[PATCH] D140087: [X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 08:40:51 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:4004-4007
+    // If we are shifting by X+/-/^N where N == 0 mod Size, then just shift by X
+    // to avoid the ADD/SUB/XOR.
     if (Add1C && Add1C->getAPIntValue().urem(Size) == 0) {
       NewShiftAmt = Add0;
----------------
add https://alive2.llvm.org/ce/z/gFh16W
sub of constant https://alive2.llvm.org/ce/z/umLun5
xor https://alive2.llvm.org/ce/z/ewQ7Bd


================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:4009-4010
+
+    } else if ((Add0C && Add0C->getAPIntValue().urem(Size) == Size - 1) ||
+               (Add1C && Add1C->getAPIntValue().urem(Size) == Size - 1)) {
+      // If we are doing a NOT on just the lower bits with (Size*N-1) -/^ X
----------------
xor https://alive2.llvm.org/ce/z/k_3jok
sub from bias https://alive2.llvm.org/ce/z/-BBhDe
BUT NOT sub of bias: https://alive2.llvm.org/ce/z/AY9Aa7
and not add: https://alive2.llvm.org/ce/z/yUyTC7


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140087



More information about the llvm-commits mailing list