[llvm] ce128d8 - [InstCombine] Add i128 test for select of lshr/ashr transform (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 06:02:25 PDT 2024


Author: Nikita Popov
Date: 2024-08-16T15:02:16+02:00
New Revision: ce128d8fe8298e87799b5302e08bd0c6ea8ccce4

URL: https://github.com/llvm/llvm-project/commit/ce128d8fe8298e87799b5302e08bd0c6ea8ccce4
DIFF: https://github.com/llvm/llvm-project/commit/ce128d8fe8298e87799b5302e08bd0c6ea8ccce4.diff

LOG: [InstCombine] Add i128 test for select of lshr/ashr transform (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/ashr-lshr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/ashr-lshr.ll b/llvm/test/Transforms/InstCombine/ashr-lshr.ll
index c2a4f35412670b..4a3f836e95c3c3 100644
--- a/llvm/test/Transforms/InstCombine/ashr-lshr.ll
+++ b/llvm/test/Transforms/InstCombine/ashr-lshr.ll
@@ -61,6 +61,21 @@ define i32 @ashr_lshr2(i32 %x, i32 %y) {
   ret i32 %ret
 }
 
+define i128 @ashr_lshr2_i128(i128 %x, i128 %y) {
+; CHECK-LABEL: @ashr_lshr2_i128(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i128 [[X:%.*]], 5
+; CHECK-NEXT:    [[L:%.*]] = lshr i128 [[X]], [[Y:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = ashr exact i128 [[X]], [[Y]]
+; CHECK-NEXT:    [[RET:%.*]] = select i1 [[CMP]], i128 [[L]], i128 [[R]]
+; CHECK-NEXT:    ret i128 [[RET]]
+;
+  %cmp = icmp sgt i128 %x, 5
+  %l = lshr i128 %x, %y
+  %r = ashr exact i128 %x, %y
+  %ret = select i1 %cmp, i128 %l, i128 %r
+  ret i128 %ret
+}
+
 define <2 x i32> @ashr_lshr_splat_vec(<2 x i32> %x, <2 x i32> %y) {
 ; CHECK-LABEL: @ashr_lshr_splat_vec(
 ; CHECK-NEXT:    [[CMP12:%.*]] = ashr <2 x i32> [[X:%.*]], [[Y:%.*]]


        


More information about the llvm-commits mailing list