1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: %if x86-registered-target %{ opt -S -passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s %}
3 ; RUN: %if aarch64-registered-target %{ opt -S -passes=slp-vectorizer -mtriple=aarch64-unknown-linux-gnu < %s | FileCheck %s %}
5 ; These all crashing before patch
7 define <2 x i8> @negative_index(<2 x i8> %aux_vec, ptr %in) {
8 ; CHECK-LABEL: @negative_index(
9 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
10 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
11 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
12 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 -1
13 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
14 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
15 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
17 %in0 = load i8, ptr %in, align 4
18 %g1 = getelementptr inbounds i8, ptr %in, i64 1
19 %in1 = load i8, ptr %g1, align 4
21 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 -1
22 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
24 %out = add <2 x i8> %v1, %v1
28 define <2 x i8> @exceed_index(<2 x i8> %aux_vec, ptr %in) {
29 ; CHECK-LABEL: @exceed_index(
30 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
31 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
32 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
33 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 2
34 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
35 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
36 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
38 %in0 = load i8, ptr %in, align 4
39 %g1 = getelementptr inbounds i8, ptr %in, i64 1
40 %in1 = load i8, ptr %g1, align 4
42 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 2
43 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
45 %out = add <2 x i8> %v1, %v1
49 define <2 x i8> @poison_index(<2 x i8> %aux_vec, ptr %in) {
50 ; CHECK-LABEL: @poison_index(
51 ; CHECK-NEXT: [[IN0:%.*]] = load i8, ptr [[IN:%.*]], align 4
52 ; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds i8, ptr [[IN]], i64 1
53 ; CHECK-NEXT: [[IN1:%.*]] = load i8, ptr [[G1]], align 4
54 ; CHECK-NEXT: [[V0:%.*]] = insertelement <2 x i8> [[AUX_VEC:%.*]], i8 [[IN0]], i8 poison
55 ; CHECK-NEXT: [[V1:%.*]] = insertelement <2 x i8> [[V0]], i8 [[IN1]], i64 1
56 ; CHECK-NEXT: [[OUT:%.*]] = add <2 x i8> [[V1]], [[V1]]
57 ; CHECK-NEXT: ret <2 x i8> [[OUT]]
59 %in0 = load i8, ptr %in, align 4
60 %g1 = getelementptr inbounds i8, ptr %in, i64 1
61 %in1 = load i8, ptr %g1, align 4
63 %v0 = insertelement <2 x i8> %aux_vec, i8 %in0, i8 poison
64 %v1 = insertelement <2 x i8> %v0, i8 %in1, i64 1
66 %out = add <2 x i8> %v1, %v1