[llvm] d5c7d4b - [InstCombine] add tests for icmp-fsh

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 19:03:38 PDT 2022


Author: Chenbing Zheng
Date: 2022-05-18T10:01:44+08:00
New Revision: d5c7d4b5224b6fbdfd35b9a81bb0ca80a35189b6

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

LOG: [InstCombine] add tests for icmp-fsh

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/icmp-fsh.ll b/llvm/test/Transforms/InstCombine/icmp-fsh.ll
index 4c3bd743d5d7..a1ef8c3a6937 100644
--- a/llvm/test/Transforms/InstCombine/icmp-fsh.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-fsh.ll
@@ -66,6 +66,43 @@ define <2 x i1> @rotl_ne_n1_undef(<2 x i5> %x, <2 x i5> %y) {
   ret <2 x i1> %r
 }
 
+define <2 x i1> @rotl_eq_0_undef(<2 x i5> %x, <2 x i5> %y) {
+; CHECK-LABEL: @rotl_eq_0_undef(
+; CHECK-NEXT:    [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i5> [[ROT]], <i5 0, i5 undef>
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y)
+  %r = icmp eq <2 x i5> %rot, <i5 0, i5 undef>
+  ret <2 x i1> %r
+}
+
+; negative test - wrong constant value
+
+define <2 x i1> @rotl_eq_1_undef(<2 x i5> %x, <2 x i5> %y) {
+; CHECK-LABEL: @rotl_eq_1_undef(
+; CHECK-NEXT:    [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = icmp eq <2 x i5> [[ROT]], <i5 undef, i5 1>
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y)
+  %r = icmp eq <2 x i5> %rot, <i5 undef, i5 1>
+  ret <2 x i1> %r
+}
+
+; negative test - wrong predicate
+
+define <2 x i1> @rotl_sgt_0_undef(<2 x i5> %x, <2 x i5> %y) {
+; CHECK-LABEL: @rotl_sgt_0_undef(
+; CHECK-NEXT:    [[ROT:%.*]] = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5> [[X:%.*]], <2 x i5> [[X]], <2 x i5> [[Y:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = icmp sgt <2 x i5> [[ROT]], <i5 0, i5 undef>
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %rot = tail call <2 x i5> @llvm.fshl.v2i5(<2 x i5>%x, <2 x i5> %x, <2 x i5> %y)
+  %r = icmp sgt <2 x i5> %rot, <i5 0, i5 undef>
+  ret <2 x i1> %r
+}
+
 define i1 @rotr_eq_0(i8 %x, i8 %y) {
 ; CHECK-LABEL: @rotr_eq_0(
 ; CHECK-NEXT:    [[ROT:%.*]] = tail call i8 @llvm.fshr.i8(i8 [[X:%.*]], i8 [[X]], i8 [[Y:%.*]])


        


More information about the llvm-commits mailing list