[PATCH] D65175: [ARM] Transform compare of masked value to shift on Thumb1.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 15:50:52 PDT 2019


efriedma marked an inline comment as done.
efriedma added a comment.

> Any reason why not to use this for thumb2 as well?

You can't save any instructions this way on Thumb2; every AND which can be transformed is a legal and/bic/bfc.  I guess a narrow lsls+cmp is still two bytes shorter than bic+cmp.



================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:4065
+  // 1. C2 fits into the immediate field of a cmp.
+  // 2. C1 is 255 or 65535, so we can use "uxtb" or "uxth".
+  if (Subtarget->isThumb1Only() && LHS->getOpcode() == ISD::AND &&
----------------
ostannard wrote:
> I don't see any code implementing this case. Instead, there is a check that `Mask > 65535`, but this looks like it should still be profitable for masks between 255 and 65535.
I'll add some tests more tests to cover this, and tweak the heuristic if it seems profitable.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65175





More information about the llvm-commits mailing list