[PATCH] D134706: [AArch64] Lower multiplication by a constant int to shl+sub+shl

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 14:28:18 PDT 2022


efriedma added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:14849
+      AddSubOpc = ISD::SUB;
+      Sub2Shift = true;
     } else
----------------
The use of all these booleans makes the actual code generation difficult to understand.

Maybe we can simplify with a few lambdas?  Name them Shl, Add, Sub, Negate.  Then for each case, write out the operations explicitly.  For example, in this case, instead of setting AddSubOpc  and Sub2Shift, you can write `return Sub(Shl(N0, ShiftAmt), Shl(N0, TrailingZeroes))`.


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

https://reviews.llvm.org/D134706



More information about the llvm-commits mailing list