1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck --check-prefix=KNL --check-prefix=CHECK %s
2 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck --check-prefix=SKX --check-prefix=CHECK %s
8 define <16 x float> @test1(<16 x float> %x, float* %br, float %y) nounwind {
10 %rrr2 = insertelement <16 x float> %x, float %rrr, i32 1
11 %rrr3 = insertelement <16 x float> %rrr2, float %y, i32 14
12 ret <16 x float> %rrr3
16 ;CHECK: vinsertf32x4 $0
17 ;CHECK: vextractf32x4 $3
18 ;CHECK: vinsertf32x4 $3
20 define <8 x double> @test2(<8 x double> %x, double* %br, double %y) nounwind {
21 %rrr = load double* %br
22 %rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
23 %rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
24 ret <8 x double> %rrr3
28 ;CHECK: vextractf32x4 $1
29 ;CHECK: vinsertf32x4 $0
31 define <16 x float> @test3(<16 x float> %x) nounwind {
32 %eee = extractelement <16 x float> %x, i32 4
33 %rrr2 = insertelement <16 x float> %x, float %eee, i32 1
34 ret <16 x float> %rrr2
38 ;CHECK: vextracti32x4 $2
39 ;CHECK: vinserti32x4 $0
41 define <8 x i64> @test4(<8 x i64> %x) nounwind {
42 %eee = extractelement <8 x i64> %x, i32 4
43 %rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
50 define i32 @test5(<4 x float> %x) nounwind {
51 %ef = extractelement <4 x float> %x, i32 3
52 %ei = bitcast float %ef to i32
57 ;CHECK: vextractps {{.*}}, (%rdi)
59 define void @test6(<4 x float> %x, float* %out) nounwind {
60 %ef = extractelement <4 x float> %x, i32 3
61 store float %ef, float* %out, align 4
69 define float @test7(<16 x float> %x, i32 %ind) nounwind {
70 %e = extractelement <16 x float> %x, i32 %ind
78 define double @test8(<8 x double> %x, i32 %ind) nounwind {
79 %e = extractelement <8 x double> %x, i32 %ind
87 define float @test9(<8 x float> %x, i32 %ind) nounwind {
88 %e = extractelement <8 x float> %x, i32 %ind
95 ;CHECK: vmovd %xmm0, %eax
97 define i32 @test10(<16 x i32> %x, i32 %ind) nounwind {
98 %e = extractelement <16 x i32> %x, i32 %ind
110 define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) {
111 %cmp_res = icmp ult <16 x i32> %a, %b
112 %ia = extractelement <16 x i1> %cmp_res, i32 4
113 br i1 %ia, label %A, label %B
117 %c = add <16 x i32>%b, %a
128 define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) {
130 %cmpvector_func.i = icmp slt <16 x i64> %a, %b
131 %extract24vector_func.i = extractelement <16 x i1> %cmpvector_func.i, i32 0
132 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
141 define i16 @test13(i32 %a, i32 %b) {
142 %cmp_res = icmp ult i32 %a, %b
143 %maskv = insertelement <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, i1 %cmp_res, i32 0
144 %res = bitcast <16 x i1> %maskv to i16
155 define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) {
157 %cmpvector_func.i = icmp slt <8 x i64> %a, %b
158 %extract24vector_func.i = extractelement <8 x i1> %cmpvector_func.i, i32 4
159 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
167 define i16 @test15(i1 *%addr) {
168 %x = load i1 * %addr, align 128
169 %x1 = insertelement <16 x i1> undef, i1 %x, i32 10
170 %x2 = bitcast <16 x i1>%x1 to i16
179 define i16 @test16(i1 *%addr, i16 %a) {
180 %x = load i1 * %addr, align 128
181 %a1 = bitcast i16 %a to <16 x i1>
182 %x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
183 %x2 = bitcast <16 x i1>%x1 to i16
193 define i8 @test17(i1 *%addr, i8 %a) {
194 %x = load i1 * %addr, align 128
195 %a1 = bitcast i8 %a to <8 x i1>
196 %x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
197 %x2 = bitcast <8 x i1>%x1 to i8