1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
4 ; See https://reviews.llvm.org/D83779
6 define <2 x float> @foo(ptr %A) {
9 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[A:%.*]], align 8
10 ; CHECK-NEXT: [[TMP2:%.*]] = fmul <2 x float> [[TMP1]], <float 2.000000e+00, float 2.000000e+00>
11 ; CHECK-NEXT: ret <2 x float> [[TMP2]]
14 %0 = load <2 x float>, ptr %A
15 %L0 = extractelement <2 x float> %0, i32 0
16 %L1 = extractelement <2 x float> %0, i32 1
17 %Mul0 = fmul float %L0, 2.000000e+00
18 %Mul1 = fmul float %L1, 2.000000e+00
19 %Ins1 = insertelement <2 x float> undef, float %Mul1, i32 1
20 %Ins0 = insertelement <2 x float> %Ins1, float %Mul0, i32 0
25 %Struct1Ty = type { i16, i16 }
26 %Struct2Ty = type { %Struct1Ty, %Struct1Ty}
28 define {%Struct2Ty, %Struct2Ty} @StructOfStructOfStruct(ptr %Ptr) {
29 ; CHECK-LABEL: @StructOfStructOfStruct(
30 ; CHECK-NEXT: [[TMP2:%.*]] = load <8 x i16>, ptr [[PTR:%.*]], align 2
31 ; CHECK-NEXT: [[TMP3:%.*]] = add <8 x i16> [[TMP2]], <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>
32 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <8 x i16> [[TMP3]], i32 1
33 ; CHECK-NEXT: [[STRUCTIN0:%.*]] = insertvalue [[STRUCT1TY:%.*]] undef, i16 [[TMP4]], 1
34 ; CHECK-NEXT: [[TMP5:%.*]] = extractelement <8 x i16> [[TMP3]], i32 0
35 ; CHECK-NEXT: [[STRUCTIN1:%.*]] = insertvalue [[STRUCT1TY]] [[STRUCTIN0]], i16 [[TMP5]], 0
36 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <8 x i16> [[TMP3]], i32 2
37 ; CHECK-NEXT: [[STRUCTIN2:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP6]], 0
38 ; CHECK-NEXT: [[TMP7:%.*]] = extractelement <8 x i16> [[TMP3]], i32 3
39 ; CHECK-NEXT: [[STRUCTIN3:%.*]] = insertvalue [[STRUCT1TY]] [[STRUCTIN2]], i16 [[TMP7]], 1
40 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <8 x i16> [[TMP3]], i32 4
41 ; CHECK-NEXT: [[STRUCTIN4:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP8]], 0
42 ; CHECK-NEXT: [[TMP9:%.*]] = extractelement <8 x i16> [[TMP3]], i32 5
43 ; CHECK-NEXT: [[STRUCTIN5:%.*]] = insertvalue [[STRUCT1TY]] [[STRUCTIN4]], i16 [[TMP9]], 1
44 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <8 x i16> [[TMP3]], i32 7
45 ; CHECK-NEXT: [[STRUCTIN6:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP10]], 1
46 ; CHECK-NEXT: [[TMP11:%.*]] = extractelement <8 x i16> [[TMP3]], i32 6
47 ; CHECK-NEXT: [[STRUCTIN7:%.*]] = insertvalue [[STRUCT1TY]] [[STRUCTIN6]], i16 [[TMP11]], 0
48 ; CHECK-NEXT: [[STRUCT2IN0:%.*]] = insertvalue [[STRUCT2TY:%.*]] undef, [[STRUCT1TY]] [[STRUCTIN1]], 0
49 ; CHECK-NEXT: [[STRUCT2IN1:%.*]] = insertvalue [[STRUCT2TY]] [[STRUCT2IN0]], [[STRUCT1TY]] [[STRUCTIN3]], 1
50 ; CHECK-NEXT: [[STRUCT2IN2:%.*]] = insertvalue [[STRUCT2TY]] undef, [[STRUCT1TY]] [[STRUCTIN5]], 0
51 ; CHECK-NEXT: [[STRUCT2IN3:%.*]] = insertvalue [[STRUCT2TY]] [[STRUCT2IN2]], [[STRUCT1TY]] [[STRUCTIN7]], 1
52 ; CHECK-NEXT: [[RET0:%.*]] = insertvalue { [[STRUCT2TY]], [[STRUCT2TY]] } undef, [[STRUCT2TY]] [[STRUCT2IN3]], 1
53 ; CHECK-NEXT: [[RET1:%.*]] = insertvalue { [[STRUCT2TY]], [[STRUCT2TY]] } [[RET0]], [[STRUCT2TY]] [[STRUCT2IN1]], 0
54 ; CHECK-NEXT: ret { [[STRUCT2TY]], [[STRUCT2TY]] } [[RET1]]
56 %L0 = load i16, ptr %Ptr
57 %GEP1 = getelementptr inbounds i16, ptr %Ptr, i64 1
58 %L1 = load i16, ptr %GEP1
59 %GEP2 = getelementptr inbounds i16, ptr %Ptr, i64 2
60 %L2 = load i16, ptr %GEP2
61 %GEP3 = getelementptr inbounds i16, ptr %Ptr, i64 3
62 %L3 = load i16, ptr %GEP3
63 %GEP4 = getelementptr inbounds i16, ptr %Ptr, i64 4
64 %L4 = load i16, ptr %GEP4
65 %GEP5 = getelementptr inbounds i16, ptr %Ptr, i64 5
66 %L5 = load i16, ptr %GEP5
67 %GEP6 = getelementptr inbounds i16, ptr %Ptr, i64 6
68 %L6 = load i16, ptr %GEP6
69 %GEP7 = getelementptr inbounds i16, ptr %Ptr, i64 7
70 %L7 = load i16, ptr %GEP7
72 %Fadd0 = add i16 %L0, 1
73 %Fadd1 = add i16 %L1, 2
74 %Fadd2 = add i16 %L2, 3
75 %Fadd3 = add i16 %L3, 4
76 %Fadd4 = add i16 %L4, 5
77 %Fadd5 = add i16 %L5, 6
78 %Fadd6 = add i16 %L6, 7
79 %Fadd7 = add i16 %L7, 8
81 %StructIn0 = insertvalue %Struct1Ty undef, i16 %Fadd1, 1
82 %StructIn1 = insertvalue %Struct1Ty %StructIn0, i16 %Fadd0, 0
84 %StructIn2 = insertvalue %Struct1Ty undef, i16 %Fadd2, 0
85 %StructIn3 = insertvalue %Struct1Ty %StructIn2, i16 %Fadd3, 1
87 %StructIn4 = insertvalue %Struct1Ty undef, i16 %Fadd4, 0
88 %StructIn5 = insertvalue %Struct1Ty %StructIn4, i16 %Fadd5, 1
90 %StructIn6 = insertvalue %Struct1Ty undef, i16 %Fadd7, 1
91 %StructIn7 = insertvalue %Struct1Ty %StructIn6, i16 %Fadd6, 0
93 %Struct2In0 = insertvalue %Struct2Ty undef, %Struct1Ty %StructIn1, 0
94 %Struct2In1 = insertvalue %Struct2Ty %Struct2In0, %Struct1Ty %StructIn3, 1
96 %Struct2In2 = insertvalue %Struct2Ty undef, %Struct1Ty %StructIn5, 0
97 %Struct2In3 = insertvalue %Struct2Ty %Struct2In2, %Struct1Ty %StructIn7, 1
99 %Ret0 = insertvalue {%Struct2Ty, %Struct2Ty} undef, %Struct2Ty %Struct2In3, 1
100 %Ret1 = insertvalue {%Struct2Ty, %Struct2Ty} %Ret0, %Struct2Ty %Struct2In1, 0
101 ret {%Struct2Ty, %Struct2Ty} %Ret1