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