1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -passes=slp-vectorizer -S < %s -mtriple=riscv32 -mattr=+v \
3 ; RUN: -riscv-v-slp-max-vf=0 | FileCheck %s
4 ; RUN: opt -passes=slp-vectorizer -S < %s -mtriple=riscv64 -mattr=+v \
5 ; RUN: -riscv-v-slp-max-vf=0 | FileCheck %s
7 ; These shouldn't be vectorized as the cost of materializing the constants as
8 ; vectors should outweigh the scalar cost
10 define void @f(ptr %p, i1 %c) {
11 ; CHECK-LABEL: define void @f
12 ; CHECK-SAME: (ptr [[P:%.*]], i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
13 ; CHECK-NEXT: [[P_0:%.*]] = getelementptr i8, ptr [[P]]
14 ; CHECK-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
16 ; CHECK-NEXT: br label [[D:%.*]]
18 ; CHECK-NEXT: br label [[D]]
20 ; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i8> [ <i8 1, i8 -1>, [[A]] ], [ <i8 -1, i8 1>, [[B]] ]
21 ; CHECK-NEXT: store <2 x i8> [[TMP1]], ptr [[P_0]], align 1
22 ; CHECK-NEXT: ret void
24 %p.0 = getelementptr i8, ptr %p
25 %p.1 = getelementptr i8, ptr %p, i32 1
26 br i1 %c, label %a, label %b
32 %x = phi i8 [1, %a], [-1, %b]
33 %y = phi i8 [-1, %a], [1, %b]
39 define void @g(ptr %p, i1 %c) {
40 ; CHECK-LABEL: define void @g
41 ; CHECK-SAME: (ptr [[P:%.*]], i1 [[C:%.*]]) #[[ATTR0]] {
42 ; CHECK-NEXT: [[P_0:%.*]] = getelementptr i8, ptr [[P]]
43 ; CHECK-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
45 ; CHECK-NEXT: br label [[D:%.*]]
47 ; CHECK-NEXT: br label [[D]]
49 ; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i8> [ <i8 1, i8 -1>, [[A]] ], [ <i8 -1, i8 1>, [[B]] ]
50 ; CHECK-NEXT: [[TMP2:%.*]] = add <2 x i8> [[TMP1]], <i8 1, i8 1>
51 ; CHECK-NEXT: store <2 x i8> [[TMP2]], ptr [[P_0]], align 1
52 ; CHECK-NEXT: ret void
54 %p.0 = getelementptr i8, ptr %p
55 %p.1 = getelementptr i8, ptr %p, i32 1
56 br i1 %c, label %a, label %b
62 %x = phi i8 [1, %a], [-1, %b]
63 %y = phi i8 [-1, %a], [1, %b]
66 store i8 %x.add, ptr %p.0
67 store i8 %y.add, ptr %p.1