• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4; See https://reviews.llvm.org/D83779
5
6define <2 x float> @foo({{float, float}}* %A) {
7; CHECK-LABEL: @foo(
8; CHECK-NEXT:  entry:
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:    [[TMP3:%.*]] = extractelement <2 x float> [[TMP2]], i32 1
13; CHECK-NEXT:    [[INS1:%.*]] = insertelement <2 x float> undef, float [[TMP3]], i32 1
14; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <2 x float> [[TMP2]], i32 0
15; CHECK-NEXT:    [[INS0:%.*]] = insertelement <2 x float> [[INS1]], float [[TMP4]], i32 0
16; CHECK-NEXT:    ret <2 x float> [[INS0]]
17;
18entry:
19  %0 = bitcast {{float, float}}* %A to <2 x float>*
20  %1 = load <2 x float>, <2 x float>* %0
21  %L0 = extractelement <2 x float> %1, i32 0
22  %L1 = extractelement <2 x float> %1, i32 1
23  %Mul0 = fmul float %L0, 2.000000e+00
24  %Mul1 = fmul float %L1, 2.000000e+00
25  %Ins1 = insertelement <2 x float> undef, float %Mul1, i32 1
26  %Ins0 = insertelement <2 x float> %Ins1, float %Mul0, i32 0
27  ret <2 x float> %Ins0
28}
29
30
31%Struct1Ty = type { i16, i16 }
32%Struct2Ty = type { %Struct1Ty, %Struct1Ty}
33
34define {%Struct2Ty, %Struct2Ty} @StructOfStructOfStruct(i16 *%Ptr) {
35; CHECK-LABEL: @StructOfStructOfStruct(
36; CHECK-NEXT:    [[GEP0:%.*]] = getelementptr inbounds i16, i16* [[PTR:%.*]], i64 0
37; CHECK-NEXT:    [[GEP1:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 1
38; CHECK-NEXT:    [[GEP2:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 2
39; CHECK-NEXT:    [[GEP3:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 3
40; CHECK-NEXT:    [[GEP4:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 4
41; CHECK-NEXT:    [[GEP5:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 5
42; CHECK-NEXT:    [[GEP6:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 6
43; CHECK-NEXT:    [[GEP7:%.*]] = getelementptr inbounds i16, i16* [[PTR]], i64 7
44; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i16* [[GEP0]] to <8 x i16>*
45; CHECK-NEXT:    [[TMP2:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 2
46; CHECK-NEXT:    [[TMP3:%.*]] = add <8 x i16> [[TMP2]], <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>
47; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <8 x i16> [[TMP3]], i32 1
48; CHECK-NEXT:    [[STRUCTIN0:%.*]] = insertvalue [[STRUCT1TY:%.*]] undef, i16 [[TMP4]], 1
49; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <8 x i16> [[TMP3]], i32 0
50; CHECK-NEXT:    [[STRUCTIN1:%.*]] = insertvalue [[STRUCT1TY]] %StructIn0, i16 [[TMP5]], 0
51; CHECK-NEXT:    [[TMP6:%.*]] = extractelement <8 x i16> [[TMP3]], i32 2
52; CHECK-NEXT:    [[STRUCTIN2:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP6]], 0
53; CHECK-NEXT:    [[TMP7:%.*]] = extractelement <8 x i16> [[TMP3]], i32 3
54; CHECK-NEXT:    [[STRUCTIN3:%.*]] = insertvalue [[STRUCT1TY]] %StructIn2, i16 [[TMP7]], 1
55; CHECK-NEXT:    [[TMP8:%.*]] = extractelement <8 x i16> [[TMP3]], i32 4
56; CHECK-NEXT:    [[STRUCTIN4:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP8]], 0
57; CHECK-NEXT:    [[TMP9:%.*]] = extractelement <8 x i16> [[TMP3]], i32 5
58; CHECK-NEXT:    [[STRUCTIN5:%.*]] = insertvalue [[STRUCT1TY]] %StructIn4, i16 [[TMP9]], 1
59; CHECK-NEXT:    [[TMP10:%.*]] = extractelement <8 x i16> [[TMP3]], i32 7
60; CHECK-NEXT:    [[STRUCTIN6:%.*]] = insertvalue [[STRUCT1TY]] undef, i16 [[TMP10]], 1
61; CHECK-NEXT:    [[TMP11:%.*]] = extractelement <8 x i16> [[TMP3]], i32 6
62; CHECK-NEXT:    [[STRUCTIN7:%.*]] = insertvalue [[STRUCT1TY]] %StructIn6, i16 [[TMP11]], 0
63; CHECK-NEXT:    [[STRUCT2IN0:%.*]] = insertvalue [[STRUCT2TY:%.*]] undef, [[STRUCT1TY]] %StructIn1, 0
64; CHECK-NEXT:    [[STRUCT2IN1:%.*]] = insertvalue [[STRUCT2TY]] %Struct2In0, [[STRUCT1TY]] %StructIn3, 1
65; CHECK-NEXT:    [[STRUCT2IN2:%.*]] = insertvalue [[STRUCT2TY]] undef, [[STRUCT1TY]] %StructIn5, 0
66; CHECK-NEXT:    [[STRUCT2IN3:%.*]] = insertvalue [[STRUCT2TY]] %Struct2In2, [[STRUCT1TY]] %StructIn7, 1
67; CHECK-NEXT:    [[RET0:%.*]] = insertvalue { [[STRUCT2TY]], [[STRUCT2TY]] } undef, [[STRUCT2TY]] %Struct2In3, 1
68; CHECK-NEXT:    [[RET1:%.*]] = insertvalue { [[STRUCT2TY]], [[STRUCT2TY]] } [[RET0]], [[STRUCT2TY]] %Struct2In1, 0
69; CHECK-NEXT:    ret { [[STRUCT2TY]], [[STRUCT2TY]] } [[RET1]]
70;
71  %GEP0 = getelementptr inbounds i16, i16* %Ptr, i64 0
72  %L0 = load i16, i16 * %GEP0
73  %GEP1 = getelementptr inbounds i16, i16* %Ptr, i64 1
74  %L1 = load i16, i16 * %GEP1
75  %GEP2 = getelementptr inbounds i16, i16* %Ptr, i64 2
76  %L2 = load i16, i16 * %GEP2
77  %GEP3 = getelementptr inbounds i16, i16* %Ptr, i64 3
78  %L3 = load i16, i16 * %GEP3
79  %GEP4 = getelementptr inbounds i16, i16* %Ptr, i64 4
80  %L4 = load i16, i16 * %GEP4
81  %GEP5 = getelementptr inbounds i16, i16* %Ptr, i64 5
82  %L5 = load i16, i16 * %GEP5
83  %GEP6 = getelementptr inbounds i16, i16* %Ptr, i64 6
84  %L6 = load i16, i16 * %GEP6
85  %GEP7 = getelementptr inbounds i16, i16* %Ptr, i64 7
86  %L7 = load i16, i16 * %GEP7
87
88  %Fadd0 = add i16 %L0, 1
89  %Fadd1 = add i16 %L1, 2
90  %Fadd2 = add i16 %L2, 3
91  %Fadd3 = add i16 %L3, 4
92  %Fadd4 = add i16 %L4, 5
93  %Fadd5 = add i16 %L5, 6
94  %Fadd6 = add i16 %L6, 7
95  %Fadd7 = add i16 %L7, 8
96
97  %StructIn0 = insertvalue %Struct1Ty undef, i16 %Fadd1, 1
98  %StructIn1 = insertvalue %Struct1Ty %StructIn0, i16 %Fadd0, 0
99
100  %StructIn2 = insertvalue %Struct1Ty undef, i16 %Fadd2, 0
101  %StructIn3 = insertvalue %Struct1Ty %StructIn2, i16 %Fadd3, 1
102
103  %StructIn4 = insertvalue %Struct1Ty undef, i16 %Fadd4, 0
104  %StructIn5 = insertvalue %Struct1Ty %StructIn4, i16 %Fadd5, 1
105
106  %StructIn6 = insertvalue %Struct1Ty undef, i16 %Fadd7, 1
107  %StructIn7 = insertvalue %Struct1Ty %StructIn6, i16 %Fadd6, 0
108
109  %Struct2In0 = insertvalue %Struct2Ty undef, %Struct1Ty %StructIn1, 0
110  %Struct2In1 = insertvalue %Struct2Ty %Struct2In0, %Struct1Ty %StructIn3, 1
111
112  %Struct2In2 = insertvalue %Struct2Ty undef, %Struct1Ty %StructIn5, 0
113  %Struct2In3 = insertvalue %Struct2Ty %Struct2In2, %Struct1Ty %StructIn7, 1
114
115  %Ret0 = insertvalue {%Struct2Ty, %Struct2Ty} undef, %Struct2Ty %Struct2In3, 1
116  %Ret1 = insertvalue {%Struct2Ty, %Struct2Ty} %Ret0, %Struct2Ty %Struct2In1, 0
117  ret {%Struct2Ty, %Struct2Ty} %Ret1
118}
119