[llvm] 3dd2063 - [ConstProp] add tests for vector reductions with poison elements; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 07:34:47 PDT 2021


Author: Sanjay Patel
Date: 2021-05-24T10:34:40-04:00
New Revision: 3dd206367116b5519d984fe023d098ca3bbe2307

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

LOG: [ConstProp] add tests for vector reductions with poison elements; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll
index 5ace64ee78e2a..2f0289a9dd2a7 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/vecreduce.ll
@@ -79,7 +79,14 @@ define i32 @add_poison() {
   ret i32 %x
 }
 
-
+define i32 @add_poison1() {
+; CHECK-LABEL: @add_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> <i32 1, i32 1, i32 poison, i32 1, i32 1, i32 42, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> <i32 1, i32 1, i32 poison, i32 1, i32 1, i32 42, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @mul_0() {
 ; CHECK-LABEL: @mul_0(
@@ -139,6 +146,14 @@ define i32 @mul_poison() {
   ret i32 %x
 }
 
+define i32 @mul_poison1() {
+; CHECK-LABEL: @mul_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.mul.v8i32(<8 x i32> <i32 0, i32 1, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.mul.v8i32(<8 x i32> <i32 0, i32 1, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @and_0() {
 ; CHECK-LABEL: @and_0(
@@ -198,6 +213,14 @@ define i32 @and_poison() {
   ret i32 %x
 }
 
+define i32 @and_poison1() {
+; CHECK-LABEL: @and_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> <i32 -1, i32 1, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> <i32 -1, i32 1, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @or_0() {
 ; CHECK-LABEL: @or_0(
@@ -257,6 +280,14 @@ define i32 @or_poison() {
   ret i32 %x
 }
 
+define i32 @or_poison1() {
+; CHECK-LABEL: @or_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> <i32 1, i32 0, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> <i32 1, i32 0, i32 poison, i32 1, i32 1, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @xor_0() {
 ; CHECK-LABEL: @xor_0(
@@ -316,6 +347,14 @@ define i32 @xor_poison() {
   ret i32 %x
 }
 
+define i32 @xor_poison1() {
+; CHECK-LABEL: @xor_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> <i32 poison, i32 1, i32 undef, i32 1, i32 1, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> <i32 poison, i32 1, i32 undef, i32 1, i32 1, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @smin_0() {
 ; CHECK-LABEL: @smin_0(
@@ -375,6 +414,14 @@ define i32 @smin_poison() {
   ret i32 %x
 }
 
+define i32 @smin_poison1() {
+; CHECK-LABEL: @smin_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> <i32 1, i32 1, i32 undef, i32 1, i32 poison, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> <i32 1, i32 1, i32 undef, i32 1, i32 poison, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @smax_0() {
 ; CHECK-LABEL: @smax_0(
@@ -434,6 +481,14 @@ define i32 @smax_poison() {
   ret i32 %x
 }
 
+define i32 @smax_poison1() {
+; CHECK-LABEL: @smax_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.smax.v8i32(<8 x i32> <i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 1, i32 poison>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.smax.v8i32(<8 x i32> <i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 1, i32 poison>)
+  ret i32 %x
+}
 
 define i32 @umin_0() {
 ; CHECK-LABEL: @umin_0(
@@ -493,6 +548,14 @@ define i32 @umin_poison() {
   ret i32 %x
 }
 
+define i32 @umin_poison1() {
+; CHECK-LABEL: @umin_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.umin.v8i32(<8 x i32> <i32 1, i32 1, i32 -1, i32 poison, i32 1, i32 1, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.umin.v8i32(<8 x i32> <i32 1, i32 1, i32 -1, i32 poison, i32 1, i32 1, i32 1, i32 1>)
+  ret i32 %x
+}
 
 define i32 @umax_0() {
 ; CHECK-LABEL: @umax_0(
@@ -535,8 +598,8 @@ define i32 @umax_undef() {
   ret i32 %x
 }
 
-define i32 @umax_undef1d() {
-; CHECK-LABEL: @umax_undef1d(
+define i32 @umax_undef1() {
+; CHECK-LABEL: @umax_undef1(
 ; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.umax.v8i32(<8 x i32> <i32 1, i32 1, i32 undef, i32 1, i32 1, i32 1, i32 1, i32 1>)
 ; CHECK-NEXT:    ret i32 [[X]]
 ;
@@ -551,3 +614,12 @@ define i32 @umax_poison() {
   %x = call i32 @llvm.vector.reduce.umax.v8i32(<8 x i32> poison)
   ret i32 %x
 }
+
+define i32 @umax_poison1() {
+; CHECK-LABEL: @umax_poison1(
+; CHECK-NEXT:    [[X:%.*]] = call i32 @llvm.vector.reduce.umax.v8i32(<8 x i32> <i32 1, i32 1, i32 poison, i32 1, i32 1, i32 poison, i32 1, i32 1>)
+; CHECK-NEXT:    ret i32 [[X]]
+;
+  %x = call i32 @llvm.vector.reduce.umax.v8i32(<8 x i32> <i32 1, i32 1, i32 poison, i32 1, i32 1, i32 poison, i32 1, i32 1>)
+  ret i32 %x
+}


        


More information about the llvm-commits mailing list