[llvm] 8346f7e - [InstCombine] Add one more test for shl_trunc_icmp. nfc

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 00:40:46 PDT 2022


Author: Chenbing Zheng
Date: 2022-09-28T15:39:52+08:00
New Revision: 8346f7e84ba750dfea661c3a1055cce21a7e0491

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

LOG: [InstCombine] Add one more test for shl_trunc_icmp. nfc

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/icmp-trunc.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-trunc.ll b/llvm/test/Transforms/InstCombine/icmp-trunc.ll
index 7d4805df05574..883b28d152e04 100644
--- a/llvm/test/Transforms/InstCombine/icmp-trunc.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-trunc.ll
@@ -524,6 +524,25 @@ define i1 @shl2_trunc_eq8_i32(i32 %a) {
   ret i1 %r
 }
 
+define i1 @shl2_trunc_ne8_i32(i32 %a) {
+; DL64-LABEL: @shl2_trunc_ne8_i32(
+; DL64-NEXT:    [[SHL:%.*]] = shl i32 2, [[A:%.*]]
+; DL64-NEXT:    [[TMP1:%.*]] = and i32 [[SHL]], 65534
+; DL64-NEXT:    [[R:%.*]] = icmp ne i32 [[TMP1]], 8
+; DL64-NEXT:    ret i1 [[R]]
+;
+; DL8-LABEL: @shl2_trunc_ne8_i32(
+; DL8-NEXT:    [[SHL:%.*]] = shl i32 2, [[A:%.*]]
+; DL8-NEXT:    [[T:%.*]] = trunc i32 [[SHL]] to i16
+; DL8-NEXT:    [[R:%.*]] = icmp ne i16 [[T]], 8
+; DL8-NEXT:    ret i1 [[R]]
+;
+  %shl = shl i32 2, %a
+  %t = trunc i32 %shl to i16
+  %r = icmp ne i16 %t, 8
+  ret i1 %r
+}
+
 define i1 @shl1_trunc_sgt4(i32 %a) {
 ; CHECK-LABEL: @shl1_trunc_sgt4(
 ; CHECK-NEXT:    [[SHL:%.*]] = shl i32 1, [[A:%.*]]


        


More information about the llvm-commits mailing list