[PATCH] D135194: [AArch64][NFC] Precommit test case to show sub-optimal codegen for add(lsl(val1,small-shift), lsl(val2,large-shift)).
Mingming Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 13:59:21 PDT 2022
mingmingl created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
mingmingl requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Ideally, add operand with smaller shift should be RHS. In that way,
smaller-shift is folded into ADD.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135194
Files:
llvm/test/CodeGen/AArch64/logical_shifted_reg.ll
Index: llvm/test/CodeGen/AArch64/logical_shifted_reg.ll
===================================================================
--- llvm/test/CodeGen/AArch64/logical_shifted_reg.ll
+++ llvm/test/CodeGen/AArch64/logical_shifted_reg.ll
@@ -289,4 +289,16 @@
ret void
}
+define i64 @add_swap_rhs_lhs(i64 %0, i64 %1) {
+; CHECK-LABEL: add_swap_rhs_lhs:
+; CHECK: // %bb.0:
+; CHECK-NEXT: lsl x8, x1, #3
+; CHECK-NEXT: add x0, x8, x0, lsl #8
+; CHECK-NEXT: ret
+ %3 = shl i64 %0, 8
+ %4 = shl i64 %1, 3
+ %5 = add i64 %4, %3
+ ret i64 %5
+}
+
!1 = !{!"branch_weights", i32 1, i32 1}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135194.465148.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221004/ab70fb8e/attachment.bin>
More information about the llvm-commits
mailing list