xref: /llvm-project/llvm/test/Transforms/SLPVectorizer/AArch64/slp-xor-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_xor(ptr %a, ptr %b) {
7; CHECK-LABEL: @reduce_xor(
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:%.*]] = and <8 x i8> [[TMP3]], [[TMP1]]
12; CHECK-NEXT:    [[TMP5:%.*]] = call i8 @llvm.vector.reduce.xor.v8i8(<8 x i8> [[TMP4]])
13; CHECK-NEXT:    [[OP_RDX:%.*]] = xor 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  %and12 = and i8 %1, %0
20  %arrayidx.1 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 1
21  %2 = load i8, ptr %arrayidx.1, align 1
22  %arrayidx3.1 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 1
23  %3 = load i8, ptr %arrayidx3.1, align 1
24  %and12.1 = and i8 %3, %2
25  %4 = xor i8 %and12, %and12.1
26  %arrayidx.2 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 2
27  %5 = load i8, ptr %arrayidx.2, align 1
28  %arrayidx3.2 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 2
29  %6 = load i8, ptr %arrayidx3.2, align 1
30  %and12.2 = and i8 %6, %5
31  %7 = xor i8 %4, %and12.2
32  %arrayidx.3 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 3
33  %8 = load i8, ptr %arrayidx.3, align 1
34  %arrayidx3.3 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 3
35  %9 = load i8, ptr %arrayidx3.3, align 1
36  %and12.3 = and i8 %9, %8
37  %10 = xor i8 %7, %and12.3
38  %arrayidx.4 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 4
39  %11 = load i8, ptr %arrayidx.4, align 1
40  %arrayidx3.4 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 4
41  %12 = load i8, ptr %arrayidx3.4, align 1
42  %and12.4 = and i8 %12, %11
43  %13 = xor i8 %10, %and12.4
44  %arrayidx.5 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 5
45  %14 = load i8, ptr %arrayidx.5, align 1
46  %arrayidx3.5 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 5
47  %15 = load i8, ptr %arrayidx3.5, align 1
48  %and12.5 = and i8 %15, %14
49  %16 = xor i8 %13, %and12.5
50  %arrayidx.6 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 6
51  %17 = load i8, ptr %arrayidx.6, align 1
52  %arrayidx3.6 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 6
53  %18 = load i8, ptr %arrayidx3.6, align 1
54  %and12.6 = and i8 %18, %17
55  %19 = xor i8 %16, %and12.6
56  %arrayidx.7 = getelementptr inbounds %struct.buf, ptr %a, i64 0, i32 0, i64 7
57  %20 = load i8, ptr %arrayidx.7, align 1
58  %arrayidx3.7 = getelementptr inbounds %struct.buf, ptr %b, i64 0, i32 0, i64 7
59  %21 = load i8, ptr %arrayidx3.7, align 1
60  %and12.7 = and i8 %21, %20
61  %22 = xor i8 %19, %and12.7
62  %xor13.7 = xor i8 %22, 1
63  ret i8 %xor13.7
64}
65