1; RUN: not llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core-avx2 | FileCheck %s
3
4declare <4 x float> @llvm.x86.avx2.gather.d.ps(<4 x float>, i8*,
5                      <4 x i32>, <4 x float>, i8) nounwind readonly
6
7define <4 x float> @test_x86_avx2_gather_d_ps(i8* %a1,
8                     <4 x i32> %idx, <4 x float> %mask) {
9  %res = call <4 x float> @llvm.x86.avx2.gather.d.ps(<4 x float> undef,
10                            i8* %a1, <4 x i32> %idx, <4 x float> %mask, i8 2) ;
11  ret <4 x float> %res
12}
13
14; CHECK: test_x86_avx2_gather_d_ps
15; CHECK: vgatherdps
16; CHECK-NOT: [[DST]]
17; CHECK: [[DST:%xmm[0-9]+]]{{$}}
18; CHECK: vmovaps
19; CHECK: ret
20
21declare <2 x double> @llvm.x86.avx2.gather.d.pd(<2 x double>, i8*,
22                      <4 x i32>, <2 x double>, i8) nounwind readonly
23
24define <2 x double> @test_x86_avx2_gather_d_pd(i8* %a1,
25                     <4 x i32> %idx, <2 x double> %mask) {
26  %res = call <2 x double> @llvm.x86.avx2.gather.d.pd(<2 x double> undef,
27                            i8* %a1, <4 x i32> %idx, <2 x double> %mask, i8 2) ;
28  ret <2 x double> %res
29}
30
31; CHECK: test_x86_avx2_gather_d_pd
32; CHECK: vgatherdpd
33; CHECK: vmovapd
34; CHECK: ret
35
36declare <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float>, i8*,
37                      <8 x i32>, <8 x float>, i8) nounwind readonly
38
39define <8 x float> @test_x86_avx2_gather_d_ps_256(i8* %a1,
40                     <8 x i32> %idx, <8 x float> %mask) {
41  %res = call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef,
42                            i8* %a1, <8 x i32> %idx, <8 x float> %mask, i8 4) ;
43  ret <8 x float> %res
44}
45; CHECK-LABEL: @test_x86_avx2_gather_d_ps_256
46; CHECK: vgatherdps %ymm
47; CHECK: ret
48
49declare <4 x double> @llvm.x86.avx2.gather.d.pd.256(<4 x double>, i8*,
50                      <4 x i32>, <4 x double>, i8) nounwind readonly
51
52define <4 x double> @test_x86_avx2_gather_d_pd_256(i8* %a1,
53                     <4 x i32> %idx, <4 x double> %mask) {
54  %res = call <4 x double> @llvm.x86.avx2.gather.d.pd.256(<4 x double> undef,
55                            i8* %a1, <4 x i32> %idx, <4 x double> %mask, i8 8) ;
56  ret <4 x double> %res
57}
58
59; CHECK-LABEL: test_x86_avx2_gather_d_pd_256
60; CHECK: vgatherdpd %ymm
61; CHECK: ret
62