[PATCH] D36061: [MSP430] Implement multiplication by a constant

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 14:46:58 PDT 2017


efriedma added a comment.

I'm not really the best person to review this (since I'm not really that familiar with either MIPS or MSP430), but I can provide some more comments.



================
Comment at: lib/Target/MSP430/MSP430ISelLowering.cpp:1337
+    NumberOfOps += 1;
+    MulAmt >>= 1;
+  }
----------------
I'm not sure this algorithm is right?  In any case, it's a lot different from what getMulByConstant is actually doing, so needs a lot of comments.


================
Comment at: test/CodeGen/MSP430/mul-by-constant.ll:10
+  %2 = mul i16 %0, 3
+  ret i16 %2
+}
----------------
A testcase for some negative numbers would make sense.  (e.g. `x*-3` should lower to something like `x - (x << 2)`).


https://reviews.llvm.org/D36061





More information about the llvm-commits mailing list