[PATCH] D117588: Pre-commit test case for trunc+lshr+load folds
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 24 03:24:51 PST 2022
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG12a499eb00e3: Pre-commit test case for trunc+lshr+load folds (authored by bjope).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117588/new/
https://reviews.llvm.org/D117588
Files:
llvm/test/CodeGen/X86/shift-folding.ll
Index: llvm/test/CodeGen/X86/shift-folding.ll
===================================================================
--- llvm/test/CodeGen/X86/shift-folding.ll
+++ llvm/test/CodeGen/X86/shift-folding.ll
@@ -83,3 +83,30 @@
ret i32 %xor
}
+; Should be possible to adjust the pointer and narrow the load to 16 bits.
+define i16 @srl_load_narrowing1(i32* %arg) {
+; CHECK-LABEL: srl_load_narrowing1:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
+; CHECK-NEXT: movl (%eax), %eax
+; CHECK-NEXT: shrl $8, %eax
+; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: retl
+ %tmp1 = load i32, i32* %arg, align 1
+ %tmp2 = lshr i32 %tmp1, 8
+ %tmp3 = trunc i32 %tmp2 to i16
+ ret i16 %tmp3
+}
+
+define i16 @srl_load_narrowing2(i32* %arg) {
+; CHECK-LABEL: srl_load_narrowing2:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
+; CHECK-NEXT: movzbl 3(%eax), %eax
+; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
+; CHECK-NEXT: retl
+ %tmp1 = load i32, i32* %arg, align 1
+ %tmp2 = lshr i32 %tmp1, 24
+ %tmp3 = trunc i32 %tmp2 to i16
+ ret i16 %tmp3
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117588.402448.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220124/ca994c81/attachment.bin>
More information about the llvm-commits
mailing list