[PATCH] D58950: [PowerPC] Strength reduction of multiply by a constant by shift and add/sub in place

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 08:07:23 PDT 2019


jsji added a comment.

Thanks for updating! @wuzish However, I am even more confused by your new comments.



================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14591
+
+      // The cycles of related operation are showed as a table above.
+      // Only do (mul x, -(2^N + 1)) => -(add (shl x, N), x) for vector type.
----------------
These are for P9 right? I believe P8 is different no?


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:14593
+      // Only do (mul x, -(2^N + 1)) => -(add (shl x, N), x) for vector type.
+      // Because vector type mul costs more cycles than scalar type,
+      // it's worthy to do such opt.
----------------
? I am confused: the combination here is doing strength reduction from `mul` to `shl`. Why we are comparing the cycles between vector  type and scalar type? Should we compare the cycles for `mul` seq and `shl` seq for the SAME type?


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

https://reviews.llvm.org/D58950





More information about the llvm-commits mailing list