[PATCH] D28329: [PowerPC, DAGCombiner] Fold a << (b % (sizeof(a) * 8)) back to a single instruction

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 23:13:51 PST 2017


nemanjai added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.h:999
                                                  DAGCombinerInfo &DCI) const;
+
+    bool supportsModuloShift(ISD::NodeType Inst,
----------------
I don't think this is the case with every shift instruction. Please see the test case below.


================
Comment at: llvm/test/CodeGen/PowerPC/shift_mask.ll:25
 
 define i32 @test002(i32 %a, i32 %b) {
 ; CHECK-LABEL: test002:
----------------
The results before and after when `31 < b < 64` are different. I don't think this is a safe transformation in this case. The reason being that as the ISA states:

> Shift amounts from 32 to 63 give a zero result.




https://reviews.llvm.org/D28329





More information about the llvm-commits mailing list