From 0d17b5d0af6f7f00f9efc7bb5f524bf9c9800d7c Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 12 Jul 2021 09:49:59 -0400 Subject: [PATCH] [SLP] add test for multiple logical reductions; NFC More coverage for: D105730 --- .../SLPVectorizer/X86/reduction-logical.ll | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll b/llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll index c911fdc..141ede2 100644 --- a/llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll @@ -211,3 +211,48 @@ define i1 @mixed_logical_icmp(<4 x i32> %x) { %s3 = select i1 %s2, i1 %c3, i1 false ret i1 %s3 } + +define i1 @logical_and_icmp_clamp(<4 x i32> %x) { +; CHECK-LABEL: @logical_and_icmp_clamp( +; CHECK-NEXT: [[X0:%.*]] = extractelement <4 x i32> [[X:%.*]], i32 0 +; CHECK-NEXT: [[X1:%.*]] = extractelement <4 x i32> [[X]], i32 1 +; CHECK-NEXT: [[X2:%.*]] = extractelement <4 x i32> [[X]], i32 2 +; CHECK-NEXT: [[X3:%.*]] = extractelement <4 x i32> [[X]], i32 3 +; CHECK-NEXT: [[C0:%.*]] = icmp slt i32 [[X0]], 42 +; CHECK-NEXT: [[C1:%.*]] = icmp slt i32 [[X1]], 42 +; CHECK-NEXT: [[C2:%.*]] = icmp slt i32 [[X2]], 42 +; CHECK-NEXT: [[C3:%.*]] = icmp slt i32 [[X3]], 42 +; CHECK-NEXT: [[D0:%.*]] = icmp sgt i32 [[X0]], 17 +; CHECK-NEXT: [[D1:%.*]] = icmp sgt i32 [[X1]], 17 +; CHECK-NEXT: [[D2:%.*]] = icmp sgt i32 [[X2]], 17 +; CHECK-NEXT: [[D3:%.*]] = icmp sgt i32 [[X3]], 17 +; CHECK-NEXT: [[S1:%.*]] = select i1 [[C0]], i1 [[C1]], i1 false +; CHECK-NEXT: [[S2:%.*]] = select i1 [[S1]], i1 [[C2]], i1 false +; CHECK-NEXT: [[S3:%.*]] = select i1 [[S2]], i1 [[C3]], i1 false +; CHECK-NEXT: [[S4:%.*]] = select i1 [[S3]], i1 [[D0]], i1 false +; CHECK-NEXT: [[S5:%.*]] = select i1 [[S4]], i1 [[D1]], i1 false +; CHECK-NEXT: [[S6:%.*]] = select i1 [[S5]], i1 [[D2]], i1 false +; CHECK-NEXT: [[S7:%.*]] = select i1 [[S6]], i1 [[D3]], i1 false +; CHECK-NEXT: ret i1 [[S7]] +; + %x0 = extractelement <4 x i32> %x, i32 0 + %x1 = extractelement <4 x i32> %x, i32 1 + %x2 = extractelement <4 x i32> %x, i32 2 + %x3 = extractelement <4 x i32> %x, i32 3 + %c0 = icmp slt i32 %x0, 42 + %c1 = icmp slt i32 %x1, 42 + %c2 = icmp slt i32 %x2, 42 + %c3 = icmp slt i32 %x3, 42 + %d0 = icmp sgt i32 %x0, 17 + %d1 = icmp sgt i32 %x1, 17 + %d2 = icmp sgt i32 %x2, 17 + %d3 = icmp sgt i32 %x3, 17 + %s1 = select i1 %c0, i1 %c1, i1 false + %s2 = select i1 %s1, i1 %c2, i1 false + %s3 = select i1 %s2, i1 %c3, i1 false + %s4 = select i1 %s3, i1 %d0, i1 false + %s5 = select i1 %s4, i1 %d1, i1 false + %s6 = select i1 %s5, i1 %d2, i1 false + %s7 = select i1 %s6, i1 %d3, i1 false + ret i1 %s7 +} -- 2.7.4