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
18 ;CHECK: vextractf32x4 $3
22 define <8 x double> @test2(<8 x double> %x, double* %br, double %y) nounwind {
23 %rrr = load double* %br
24 %rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
25 %rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
26 ret <8 x double> %rrr3
30 ;CHECK: vextractf32x4 $1
31 ;CHECK: vinsertf32x4 $0
33 define <16 x float> @test3(<16 x float> %x) nounwind {
34 %eee = extractelement <16 x float> %x, i32 4
35 %rrr2 = insertelement <16 x float> %x, float %eee, i32 1
36 ret <16 x float> %rrr2
40 ;CHECK: vextracti32x4 $2
44 define <8 x i64> @test4(<8 x i64> %x) nounwind {
45 %eee = extractelement <8 x i64> %x, i32 4
46 %rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
53 define i32 @test5(<4 x float> %x) nounwind {
54 %ef = extractelement <4 x float> %x, i32 3
55 %ei = bitcast float %ef to i32
60 ;CHECK: vextractps {{.*}}, (%rdi)
62 define void @test6(<4 x float> %x, float* %out) nounwind {
63 %ef = extractelement <4 x float> %x, i32 3
64 store float %ef, float* %out, align 4
72 define float @test7(<16 x float> %x, i32 %ind) nounwind {
73 %e = extractelement <16 x float> %x, i32 %ind
81 define double @test8(<8 x double> %x, i32 %ind) nounwind {
82 %e = extractelement <8 x double> %x, i32 %ind
90 define float @test9(<8 x float> %x, i32 %ind) nounwind {
91 %e = extractelement <8 x float> %x, i32 %ind
98 ;CHECK: vmovd %xmm0, %eax
100 define i32 @test10(<16 x i32> %x, i32 %ind) nounwind {
101 %e = extractelement <16 x i32> %x, i32 %ind
113 define <16 x i32> @test11(<16 x i32>%a, <16 x i32>%b) {
114 %cmp_res = icmp ult <16 x i32> %a, %b
115 %ia = extractelement <16 x i1> %cmp_res, i32 4
116 br i1 %ia, label %A, label %B
120 %c = add <16 x i32>%b, %a
131 define i64 @test12(<16 x i64>%a, <16 x i64>%b, i64 %a1, i64 %b1) {
133 %cmpvector_func.i = icmp slt <16 x i64> %a, %b
134 %extract24vector_func.i = extractelement <16 x i1> %cmpvector_func.i, i32 0
135 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
144 define i16 @test13(i32 %a, i32 %b) {
145 %cmp_res = icmp ult i32 %a, %b
146 %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
147 %res = bitcast <16 x i1> %maskv to i16
161 define i64 @test14(<8 x i64>%a, <8 x i64>%b, i64 %a1, i64 %b1) {
163 %cmpvector_func.i = icmp slt <8 x i64> %a, %b
164 %extract24vector_func.i = extractelement <8 x i1> %cmpvector_func.i, i32 4
165 %res = select i1 %extract24vector_func.i, i64 %a1, i64 %b1
173 define i16 @test15(i1 *%addr) {
174 %x = load i1 * %addr, align 128
175 %x1 = insertelement <16 x i1> undef, i1 %x, i32 10
176 %x2 = bitcast <16 x i1>%x1 to i16
185 define i16 @test16(i1 *%addr, i16 %a) {
186 %x = load i1 * %addr, align 128
187 %a1 = bitcast i16 %a to <16 x i1>
188 %x1 = insertelement <16 x i1> %a1, i1 %x, i32 10
189 %x2 = bitcast <16 x i1>%x1 to i16
201 define i8 @test17(i1 *%addr, i8 %a) {
202 %x = load i1 * %addr, align 128
203 %a1 = bitcast i8 %a to <8 x i1>
204 %x1 = insertelement <8 x i1> %a1, i1 %x, i32 4
205 %x2 = bitcast <8 x i1>%x1 to i8