OSDN Git Service

[AArch64][GlobalISel] Teach tryOptSelect to handle G_ICMP
authorJessica Paquette <jpaquette@apple.com>
Tue, 2 Jul 2019 19:44:16 +0000 (19:44 +0000)
committerJessica Paquette <jpaquette@apple.com>
Tue, 2 Jul 2019 19:44:16 +0000 (19:44 +0000)
commit969224b117bd04a3523102b11a64c06736a17664
tree6de61b4811ddcd79c41024ae9e2b9014ae892005
parent7a71aab33018d1722f5665f9226ac7f9119aaa0e
[AArch64][GlobalISel] Teach tryOptSelect to handle G_ICMP

This teaches `tryOptSelect` to handle folding G_ICMP, and removes the
requirement that the G_SELECT we're dealing with is floating point.

Some refactoring to make this work nicely as well:

- Factor out the scalar case from the selection code for G_ICMP into
  `emitIntegerCompare`.
- Make `tryOptCMN` return a MachineInstr* instead of a bool.
- Make `tryOptCMN` not modify the instruction being selected.
- Factor out the CMN emission into `emitCMN` for readability.

By doing this this way, we can get all of the compare selection optimizations
in select emission.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364961 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64InstructionSelector.cpp
test/CodeGen/AArch64/GlobalISel/fold-fp-select.mir
test/CodeGen/AArch64/GlobalISel/fold-select.mir [new file with mode: 0644]
test/CodeGen/AArch64/GlobalISel/opt-fold-cmn.mir