xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/AArch64/slp-and-reduction.ll (revision 580210a0c938531ef9fd79f9ffedb93eeb2e66c2)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -S -mtriple=aarch64 -passes=slp-vectorizer | FileCheck %s
3
4%struct.buf = type { [8 x i8] }
5
6define i8 @reduce_and(ptr %a, ptr %b) {
7; CHECK-LABEL: @reduce_and(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    [[TMP1:%.*]] = load <8 x i8>, ptr [[A:%.*]], align 1
10; CHECK-NEXT:    [[TMP3:%.*]] = load <8 x i8>, ptr [[B:%.*]], align 1
11; CHECK-NEXT:    [[TMP4:%.*]] = xor <8 x i8> [[TMP3]], [[TMP1]]
12; CHECK-NEXT:    [[TMP5:%.*]] = call i8 @llvm.vector.reduce.and.v8i8(<8 x i8> [[TMP4]])
13; CHECK-NEXT:    [[OP_RDX:%.*]] = and i8 [[TMP5]], 1
14; CHECK-NEXT:    ret i8 [[OP_RDX]]
15;
16entry:
17  %0 = load i8, ptr %a, align 1
18  %1 = load i8, ptr %b, align 1
19  %xor12 = xor i8 %1, %0
20  %and13 = and i8 %xor12, 1
21  %arrayidx.1 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 1
22  %2 = load i8, ptr %arrayidx.1, align 1
23  %arrayidx3.1 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 1
24  %3 = load i8, ptr %arrayidx3.1, align 1
25  %xor12.1 = xor i8 %3, %2
26  %and13.1 = and i8 %xor12.1, %and13
27  %arrayidx.2 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 2
28  %4 = load i8, ptr %arrayidx.2, align 1
29  %arrayidx3.2 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 2
30  %5 = load i8, ptr %arrayidx3.2, align 1
31  %xor12.2 = xor i8 %5, %4
32  %and13.2 = and i8 %xor12.2, %and13.1
33  %arrayidx.3 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 3
34  %6 = load i8, ptr %arrayidx.3, align 1
35  %arrayidx3.3 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 3
36  %7 = load i8, ptr %arrayidx3.3, align 1
37  %xor12.3 = xor i8 %7, %6
38  %and13.3 = and i8 %xor12.3, %and13.2
39  %arrayidx.4 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 4
40  %8 = load i8, ptr %arrayidx.4, align 1
41  %arrayidx3.4 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 4
42  %9 = load i8, ptr %arrayidx3.4, align 1
43  %xor12.4 = xor i8 %9, %8
44  %and13.4 = and i8 %xor12.4, %and13.3
45  %arrayidx.5 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 5
46  %10 = load i8, ptr %arrayidx.5, align 1
47  %arrayidx3.5 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 5
48  %11 = load i8, ptr %arrayidx3.5, align 1
49  %xor12.5 = xor i8 %11, %10
50  %and13.5 = and i8 %xor12.5, %and13.4
51  %arrayidx.6 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 6
52  %12 = load i8, ptr %arrayidx.6, align 1
53  %arrayidx3.6 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 6
54  %13 = load i8, ptr %arrayidx3.6, align 1
55  %xor12.6 = xor i8 %13, %12
56  %and13.6 = and i8 %xor12.6, %and13.5
57  %arrayidx.7 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 7
58  %14 = load i8, ptr %arrayidx.7, align 1
59  %arrayidx3.7 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 7
60  %15 = load i8, ptr %arrayidx3.7, align 1
61  %xor12.7 = xor i8 %15, %14
62  %and13.7 = and i8 %xor12.7, %and13.6
63  ret i8 %and13.7
64}
65
66
67