]> granicus.if.org Git - llvm/commit
[GlobalISel][AArch64] Improve register bank mappings for G_SELECT
authorJessica Paquette <jpaquette@apple.com>
Fri, 24 May 2019 19:35:25 +0000 (19:35 +0000)
committerJessica Paquette <jpaquette@apple.com>
Fri, 24 May 2019 19:35:25 +0000 (19:35 +0000)
commit161c3053150d3e7d5a91d28ccc38171eafb98efe
treec5b732a92c094a310d183c90548550366fdec6df
parent5d5f1f607e4078a6c3700d07dc64ab1136082dad
[GlobalISel][AArch64] Improve register bank mappings for G_SELECT

The fcsel and csel instructions differ in only the register banks they work on.

So, they're entirely interchangeable otherwise.

With this in mind, this does two things:

- Teach AArch64RegisterBankInfo to consider the inputs to G_SELECT as well as
  the outputs.
- Teach it to choose the best register bank mapping based off the constraints
  of the inputs and outputs.

The "best" in this case means the one that requires the smallest number of
copies to properly emit a fcsel/csel.

For example, if the inputs are all already going to be on FPRs, we should
emit a fcsel, even if the output is a GPR. This costs one copy to produce the
result, but saves us from copying the inputs into GPRs.

Also update the regbank-select.mir to check that we end up with the right
select instruction.

Differential Revision: https://reviews.llvm.org/D62267

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361665 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64RegisterBankInfo.cpp
test/CodeGen/AArch64/GlobalISel/regbank-select.mir