[AArch64][GlobalISel] Optimize G_FCMP + G_SELECT pairs when G_SELECT is fp
authorJessica Paquette <jpaquette@apple.com>
Mon, 3 Jun 2019 20:47:20 +0000 (20:47 +0000)
committerJessica Paquette <jpaquette@apple.com>
Mon, 3 Jun 2019 20:47:20 +0000 (20:47 +0000)
commit7500c97ce4bda8a0735b737231b26bde922620f5
tree8e27aa30ae3cc868f71355fec0f69ace2c93953b
parentbddab42fc763aead7aa07c3ed1974e39938d100e
[AArch64][GlobalISel] Optimize G_FCMP + G_SELECT pairs when G_SELECT is fp

Instead of emitting all of the test stuff for a compare when it's only used by
a select, instead, just emit the compare + select. The select will use the
value of NZCV correctly, so we don't need to emit all of the test instructions
etc.

For now, only support fp selects which use G_FCMP. Also only support condition
codes which will only require one select to represent.

Also add a test.

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

llvm-svn: 362446
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/fold-fp-select.mir [new file with mode: 0644]