[llvm] 6383985 - [Test] Add one more add-reduce test w/ pointer bitcasts

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 21:14:09 PST 2022


Author: Max Kazantsev
Date: 2022-01-27T12:13:54+07:00
New Revision: 63839854baa2a9990bccb6b2a4cc3d4ec0158c96

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

LOG: [Test] Add one more add-reduce test w/ pointer bitcasts

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/reduction-and-sext-zext-i1.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/reduction-and-sext-zext-i1.ll b/llvm/test/Transforms/InstCombine/reduction-and-sext-zext-i1.ll
index e9204e2d5b46f..e167ec4488ccd 100644
--- a/llvm/test/Transforms/InstCombine/reduction-and-sext-zext-i1.ll
+++ b/llvm/test/Transforms/InstCombine/reduction-and-sext-zext-i1.ll
@@ -95,6 +95,28 @@ define i64 @reduce_and_zext_external_use(<8 x i1> %x) {
   ret i64 %res
 }
 
+define i1 @reduce_and_pointer_cast(i8* %arg, i8* %arg1) {
+; CHECK-LABEL: @reduce_and_pointer_cast(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    [[PTR1:%.*]] = bitcast i8* [[ARG1:%.*]] to <8 x i8>*
+; CHECK-NEXT:    [[PTR2:%.*]] = bitcast i8* [[ARG:%.*]] to <8 x i8>*
+; CHECK-NEXT:    [[LHS:%.*]] = load <8 x i8>, <8 x i8>* [[PTR1]], align 8
+; CHECK-NEXT:    [[RHS:%.*]] = load <8 x i8>, <8 x i8>* [[PTR2]], align 8
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <8 x i8> [[LHS]], [[RHS]]
+; CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x i1> [[CMP]] to i8
+; CHECK-NEXT:    [[TMP1:%.*]] = icmp eq i8 [[TMP0]], 0
+; CHECK-NEXT:    ret i1 [[TMP1]]
+;
+bb:
+  %ptr1 = bitcast i8* %arg1 to <8 x i8>*
+  %ptr2 = bitcast i8* %arg to <8 x i8>*
+  %lhs = load <8 x i8>, <8 x i8>* %ptr1
+  %rhs = load <8 x i8>, <8 x i8>* %ptr2
+  %cmp = icmp eq <8 x i8> %lhs, %rhs
+  %all_eq = call i1 @llvm.vector.reduce.and.v8i32(<8 x i1> %cmp)
+  ret i1 %all_eq
+}
+
 declare i1 @llvm.vector.reduce.and.v8i32(<8 x i1> %a)
 declare i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %a)
 declare i64 @llvm.vector.reduce.and.v8i64(<8 x i64> %a)


        


More information about the llvm-commits mailing list