[PATCH] D62539: [AArch64][GlobalISel] Select FCMPSri/FCMPDri when comparing against 0.0

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 13:49:32 PDT 2019


aemerson accepted this revision.
aemerson added a comment.
This revision is now accepted and ready to land.

LGTM. Can make a small change to make things a bit more concise but not very important.



================
Comment at: llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp:751
+  LLT CmpTy = MRI.getType(I.getOperand(2).getReg());
+  unsigned CmpOpc = 0;
+  if (CmpTy == LLT::scalar(32))
----------------
Not a big deal, but you can turn this logic into a small lookup table, like:

```
unsigned OpSize = MRI.getType(I.getOperand(2).getReg()).getSizeInBits();
unsigned CmpOpcTbl[2][2] = {{FCmpSri, FCmpDri}, {FCmpSrr, FCmpDrr}};
return CmpOpcTbl[ShouldUseImm][OpSize == 64];
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62539/new/

https://reviews.llvm.org/D62539





More information about the llvm-commits mailing list