Added INSERT and EXTRACT intructions from AVX-512 ISA.
[oota-llvm.git] / test / CodeGen / X86 / avx512-insert-extract.ll
1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s
2
3 ;CHECK: test1
4 ;CHECK: vinsertps
5 ;CHECK: vinsertf32x4
6 ;CHECK: ret
7 define <16 x float> @test1(<16 x float> %x, float* %br, float %y) nounwind {
8   %rrr = load float* %br
9   %rrr2 = insertelement <16 x float> %x, float %rrr, i32 1
10   %rrr3 = insertelement <16 x float> %rrr2, float %y, i32 14
11   ret <16 x float> %rrr3
12 }
13
14 ;CHECK: test2
15 ;CHECK: vinsertf32x4
16 ;CHECK: vextractf32x4
17 ;CHECK: vinsertf32x4
18 ;CHECK: ret
19 define <8 x double> @test2(<8 x double> %x, double* %br, double %y) nounwind {
20   %rrr = load double* %br
21   %rrr2 = insertelement <8 x double> %x, double %rrr, i32 1
22   %rrr3 = insertelement <8 x double> %rrr2, double %y, i32 6
23   ret <8 x double> %rrr3
24 }
25
26 ;CHECK: test3
27 ;CHECK: vextractf32x4
28 ;CHECK: vinsertf32x4
29 ;CHECK: ret
30 define <16 x float> @test3(<16 x float> %x) nounwind {
31   %eee = extractelement <16 x float> %x, i32 4
32   %rrr2 = insertelement <16 x float> %x, float %eee, i32 1
33   ret <16 x float> %rrr2
34 }
35
36 ;CHECK: test4
37 ;CHECK: vextracti32x4
38 ;CHECK: vinserti32x4
39 ;CHECK: ret
40 define <8 x i64> @test4(<8 x i64> %x) nounwind {
41   %eee = extractelement <8 x i64> %x, i32 4
42   %rrr2 = insertelement <8 x i64> %x, i64 %eee, i32 1
43   ret <8 x i64> %rrr2
44 }