Optimize 'x * c' to (ALSL x, (SLLI x, i0), i1) in which
c = (1 << i0) | (1 << i1).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
3143 | Do you mean Imm - 8 and Imm - 16 instead? |
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | ||
---|---|---|
3143 | Yes. Sorry for such a mistake. Has fixed. |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1166 | This is not optimized due to the immiedate is used twice, by mul.w and mulh.w. |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1038–1041 | Kind of interesting why this didn't get optimized into the same form as LA32, but there may be a deeper reason. I don't currently have time to look into this though. |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1038–1041 | I will take a look later, however this is still a win, since total 4 instructions are reduced to 3 ones. |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1038–1041 | Maybe we can accept current form, and I will submit another patch for this further optimization. |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1038–1041 | Fine with me, thanks! |
llvm/test/CodeGen/LoongArch/ir-instruction/mul.ll | ||
---|---|---|
1038–1041 | I have fixed that issue in https://reviews.llvm.org/D147423 . |
Do you mean Imm - 8 and Imm - 16 instead?