1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=slp-vectorizer < %s | FileCheck %s
4 ; These all crashing before patch
6 define <2 x i8> @negative_index(<2 x i8> %aux_vec, ptr %in) {
7 ; CHECK-LABEL: @negative_index(
8 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
9 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
10 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
11 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 -1
12 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
13 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
14 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
16 %in0 = load i8, ptr %in, align 4
17 %g1 = getelementptr inbounds i8, ptr %in, i64 1
18 %in1 = load i8, ptr %g1, align 4
20 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 -1
21 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
23 %out = add <2 x i8> %v1, %v1
27 define <2 x i8> @exceed_index(<2 x i8> %aux_vec, ptr %in) {
28 ; CHECK-LABEL: @exceed_index(
29 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
30 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
31 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
32 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 2
33 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
34 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
35 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
37 %in0 = load i8, ptr %in, align 4
38 %g1 = getelementptr inbounds i8, ptr %in, i64 1
39 %in1 = load i8, ptr %g1, align 4
41 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 2
42 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
44 %out = add <2 x i8> %v1, %v1
48 define <2 x i8> @poison_index(<2 x i8> %aux_vec, ptr %in) {
49 ; CHECK-LABEL: @poison_index(
50 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
51 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
52 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
53 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 poison
54 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
55 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
56 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
58 %in0 = load i8, ptr %in, align 4
59 %g1 = getelementptr inbounds i8, ptr %in, i64 1
60 %in1 = load i8, ptr %g1, align 4
62 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 poison
63 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
65 %out = add <2 x i8> %v1, %v1