[PATCH] D48907: [ARM] Treat cmn immediates as legal in isLegalICmpImmediate.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 10:47:47 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:3861
+    if (!isLegalICmpImmediate((int32_t)C) ||
+        (C == -1U && (CC == ISD::SETLE || CC == ISD::SETGT))) {
+      // Constant does not fit, try adjusting it by one.
----------------
samparker wrote:
> I don't understand what this is trying to do, why the special case? Surely the fix in isLegalICmpImmediate is enough?
I probably should have added a comment to this.

The special case for "-1" isn't strictly necessary; it just prefers "cmp r0, #0" over "cmn r0, #1" like the old code does, to reduce the number of regression test changes.  Maybe that doesn't matter?


Repository:
  rL LLVM

https://reviews.llvm.org/D48907





More information about the llvm-commits mailing list