1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -passes=slp-vectorizer < %s -mtriple=riscv64-unknown-linux -mattr=+v | FileCheck %s
4 define i32 @sum_of_abs(ptr noalias %a, ptr noalias %b) {
5 ; CHECK-LABEL: define i32 @sum_of_abs
6 ; CHECK-SAME: (ptr noalias [[A:%.*]], ptr noalias [[B:%.*]]) #[[ATTR0:[0-9]+]] {
8 ; CHECK-NEXT: [[TMP0:%.*]] = call <8 x i8> @llvm.experimental.vp.strided.load.v8i8.p0.i64(ptr align 1 [[A]], i64 64, <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, i32 8)
9 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i8> @llvm.abs.v8i8(<8 x i8> [[TMP0]], i1 false)
10 ; CHECK-NEXT: [[TMP2:%.*]] = sext <8 x i8> [[TMP1]] to <8 x i32>
11 ; CHECK-NEXT: [[TMP3:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> [[TMP2]])
12 ; CHECK-NEXT: ret i32 [[TMP3]]
15 %0 = load i8, ptr %a, align 1
16 %spec.select.i = tail call i8 @llvm.abs.i8(i8 %0, i1 false)
17 %conv = sext i8 %spec.select.i to i32
18 %arrayidx.1 = getelementptr inbounds i8, ptr %a, i64 64
19 %1 = load i8, ptr %arrayidx.1, align 1
20 %spec.select.i.1 = tail call i8 @llvm.abs.i8(i8 %1, i1 false)
21 %conv.1 = sext i8 %spec.select.i.1 to i32
22 %add.1 = add nsw i32 %conv, %conv.1
23 %arrayidx.2 = getelementptr inbounds i8, ptr %a, i64 128
24 %2 = load i8, ptr %arrayidx.2, align 1
25 %spec.select.i.2 = tail call i8 @llvm.abs.i8(i8 %2, i1 false)
26 %conv.2 = sext i8 %spec.select.i.2 to i32
27 %add.2 = add nsw i32 %add.1, %conv.2
28 %arrayidx.3 = getelementptr inbounds i8, ptr %a, i64 192
29 %3 = load i8, ptr %arrayidx.3, align 1
30 %spec.select.i.3 = tail call i8 @llvm.abs.i8(i8 %3, i1 false)
31 %conv.3 = sext i8 %spec.select.i.3 to i32
32 %add.3 = add nsw i32 %add.2, %conv.3
33 %arrayidx.4 = getelementptr inbounds i8, ptr %a, i64 256
34 %4 = load i8, ptr %arrayidx.4, align 1
35 %spec.select.i.4 = tail call i8 @llvm.abs.i8(i8 %4, i1 false)
36 %conv.4 = sext i8 %spec.select.i.4 to i32
37 %add.4 = add nsw i32 %add.3, %conv.4
38 %arrayidx.5 = getelementptr inbounds i8, ptr %a, i64 320
39 %5 = load i8, ptr %arrayidx.5, align 1
40 %spec.select.i.5 = tail call i8 @llvm.abs.i8(i8 %5, i1 false)
41 %conv.5 = sext i8 %spec.select.i.5 to i32
42 %add.5 = add nsw i32 %add.4, %conv.5
43 %arrayidx.6 = getelementptr inbounds i8, ptr %a, i64 384
44 %6 = load i8, ptr %arrayidx.6, align 1
45 %spec.select.i.6 = tail call i8 @llvm.abs.i8(i8 %6, i1 false)
46 %conv.6 = sext i8 %spec.select.i.6 to i32
47 %add.6 = add nsw i32 %add.5, %conv.6
48 %arrayidx.7 = getelementptr inbounds i8, ptr %a, i64 448
49 %7 = load i8, ptr %arrayidx.7, align 1
50 %spec.select.i.7 = tail call i8 @llvm.abs.i8(i8 %7, i1 false)
51 %conv.7 = sext i8 %spec.select.i.7 to i32
52 %add.7 = add nsw i32 %add.6, %conv.7
56 declare i8 @llvm.abs.i8(i8, i1 immarg)