AVX-512: added calling convention for i1 vectors in 32-bit mode.
[oota-llvm.git] / test / CodeGen / X86 / avx512-calling-conv.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s --check-prefix=SKX
3 ; RUN: llc < %s -mtriple=i686-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL
4
5 ; KNL-LABEL: test1
6 ; KNL: vxorps
7 define <16 x i1> @test1() {
8   ret <16 x i1> zeroinitializer
9 }
10
11 ; SKX-LABEL: test2
12 ; SKX: vpmovb2m
13 ; SKX: vpmovb2m
14 ; SKX: kandw
15 ; SKX: vpmovm2b
16 ; KNL-LABEL: test2
17 ; KNL: vpmovsxbd
18 ; KNL: vpmovsxbd
19 ; KNL: vpandd
20 ; KNL: vpmovdb
21 define <16 x i1> @test2(<16 x i1>%a, <16 x i1>%b) {
22   %c = and <16 x i1>%a, %b
23   ret <16 x i1> %c
24 }
25
26 ; SKX-LABEL: test3
27 ; SKX: vpmovw2m
28 ; SKX: vpmovw2m
29 ; SKX: kandb
30 ; SKX: vpmovm2w
31 define <8 x i1> @test3(<8 x i1>%a, <8 x i1>%b) {
32   %c = and <8 x i1>%a, %b
33   ret <8 x i1> %c
34 }
35
36 ; SKX-LABEL: test4
37 ; SKX: vpmovd2m
38 ; SKX: vpmovd2m
39 ; SKX: kandw
40 ; SKX: vpmovm2d
41 define <4 x i1> @test4(<4 x i1>%a, <4 x i1>%b) {
42   %c = and <4 x i1>%a, %b
43   ret <4 x i1> %c
44 }
45
46 ; SKX-LABEL: test5
47 ; SKX: vpcmpgtd
48 ; SKX: vpmovm2w
49 ; SKX: call
50 ; SKX: vpmovzxwd
51 declare <8 x i1> @func8xi1(<8 x i1> %a)
52 define <8 x i32> @test5(<8 x i32>%a, <8 x i32>%b) {
53   %cmpRes = icmp sgt <8 x i32>%a, %b
54   %resi = call <8 x i1> @func8xi1(<8 x i1> %cmpRes)
55   %res = sext <8 x i1>%resi to <8 x i32>
56   ret <8 x i32> %res
57 }
58
59 declare <16 x i1> @func16xi1(<16 x i1> %a)
60
61 ; KNL-LABEL: test6
62 ; KNL: vpbroadcastd
63 ; KNL: vpmovdb
64 ; KNL: call
65 ; KNL: vpmovzxbd
66 ; KNL: vpslld  $31, %zmm
67 ; KNL: vpsrad  $31, %zmm
68 define <16 x i32> @test6(<16 x i32>%a, <16 x i32>%b) {
69   %cmpRes = icmp sgt <16 x i32>%a, %b
70   %resi = call <16 x i1> @func16xi1(<16 x i1> %cmpRes)
71   %res = sext <16 x i1>%resi to <16 x i32>
72   ret <16 x i32> %res
73 }
74
75 declare <4 x i1> @func4xi1(<4 x i1> %a)
76 ; SKX-LABEL: test7
77 ; SKX: vpmovm2d
78 ; SKX: call
79 ; SKX: vpslld  $31, %xmm
80 ; SKX: vpsrad  $31, %xmm
81
82 define <4 x i32> @test7(<4 x i32>%a, <4 x i32>%b) {
83   %cmpRes = icmp sgt <4 x i32>%a, %b
84   %resi = call <4 x i1> @func4xi1(<4 x i1> %cmpRes)
85   %res = sext <4 x i1>%resi to <4 x i32>
86   ret <4 x i32> %res
87 }