[PATCH] D92235: [ARM] Turn pred_cast(xor(x, -1)) into xor(pred_cast(x), -1)

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 00:58:59 PST 2020


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMISelLowering.cpp:13913
+      isa<ConstantSDNode>(Op.getOperand(1)) &&
+      Op.getConstantOperandAPInt(1).isMask(32)) {
+    SDValue X =
----------------
simon_tatham wrote:
> VPT predicates are only 16 bits wide, so I think we could legally apply this to any constant XOR that has the bottom 16 bits set, not just 0xFFFFFFFF.
> 
> In case somebody wrote out `pred ^ 0xFFFF` longhand in source code, would it be better to do that?
Thanks for taking a look. Long story short, the rest of llvm will like to convert `xor i32 x, 0xffff` to `xor i32 x, -1` as it represents a not and is simpler to deal with. Because we tell it that the demanded bits of a PRED_CAST are the lower bits, it will do that transform for us and here we only need to check for a full mask.

There is a isBitwiseNot helper function though, which will do this for us. I'll change it to use that and add an extra test.


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

https://reviews.llvm.org/D92235



More information about the llvm-commits mailing list