summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/avx512-calling-conv.ll
blob: edb6bef1a4ac0541d6577ee09c4cee23aeffd1ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s --check-prefix=SKX
; RUN: llc < %s -mtriple=i686-apple-darwin -mcpu=knl | FileCheck %s --check-prefix=KNL_X32

; KNL-LABEL: test1
; KNL: vxorps
define <16 x i1> @test1() {
  ret <16 x i1> zeroinitializer
}

; SKX-LABEL: test2
; SKX: vpmovb2m
; SKX: vpmovb2m
; SKX: kandw
; SKX: vpmovm2b
; KNL-LABEL: test2
; KNL: vpmovsxbd
; KNL: vpmovsxbd
; KNL: vpandd
; KNL: vpmovdb
define <16 x i1> @test2(<16 x i1>%a, <16 x i1>%b) {
  %c = and <16 x i1>%a, %b
  ret <16 x i1> %c
}

; SKX-LABEL: test3
; SKX: vpmovw2m
; SKX: vpmovw2m
; SKX: kandb
; SKX: vpmovm2w
define <8 x i1> @test3(<8 x i1>%a, <8 x i1>%b) {
  %c = and <8 x i1>%a, %b
  ret <8 x i1> %c
}

; SKX-LABEL: test4
; SKX: vpmovd2m
; SKX: vpmovd2m
; SKX: kandw
; SKX: vpmovm2d
define <4 x i1> @test4(<4 x i1>%a, <4 x i1>%b) {
  %c = and <4 x i1>%a, %b
  ret <4 x i1> %c
}

; SKX-LABEL: test5
; SKX: vpcmpgtd
; SKX: vpmovm2w
; SKX: call
; SKX: vpmovzxwd
declare <8 x i1> @func8xi1(<8 x i1> %a)
define <8 x i32> @test5(<8 x i32>%a, <8 x i32>%b) {
  %cmpRes = icmp sgt <8 x i32>%a, %b
  %resi = call <8 x i1> @func8xi1(<8 x i1> %cmpRes)
  %res = sext <8 x i1>%resi to <8 x i32>
  ret <8 x i32> %res
}

declare <16 x i1> @func16xi1(<16 x i1> %a)

; KNL-LABEL: test6
; KNL: vpbroadcastd
; KNL: vpmovdb
; KNL: call
; KNL: vpmovzxbd
; KNL: vpslld  $31, %zmm
; KNL: vpsrad  $31, %zmm
define <16 x i32> @test6(<16 x i32>%a, <16 x i32>%b) {
  %cmpRes = icmp sgt <16 x i32>%a, %b
  %resi = call <16 x i1> @func16xi1(<16 x i1> %cmpRes)
  %res = sext <16 x i1>%resi to <16 x i32>
  ret <16 x i32> %res
}

declare <4 x i1> @func4xi1(<4 x i1> %a)
; SKX-LABEL: test7
; SKX: vpmovm2d
; SKX: call
; SKX: vpslld  $31, %xmm
; SKX: vpsrad  $31, %xmm

define <4 x i32> @test7(<4 x i32>%a, <4 x i32>%b) {
  %cmpRes = icmp sgt <4 x i32>%a, %b
  %resi = call <4 x i1> @func4xi1(<4 x i1> %cmpRes)
  %res = sext <4 x i1>%resi to <4 x i32>
  ret <4 x i32> %res
}

; SKX-LABEL: test7a
; SKX: call
; SKX: vpmovw2m  %xmm0, %k0
; SKX: kandb
define <8 x i1> @test7a(<8 x i32>%a, <8 x i32>%b) {
  %cmpRes = icmp sgt <8 x i32>%a, %b
  %resi = call <8 x i1> @func8xi1(<8 x i1> %cmpRes)
  %res = and <8 x i1>%resi,  <i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false>
  ret <8 x i1> %res
}


; KNL_X32-LABEL: test8
; KNL_X32: testb $1, 4(%esp)
; KNL_X32:jne

; KNL-LABEL: test8
; KNL: testb   $1, %dil
; KNL:jne

define <16 x i8> @test8(<16 x i8> %a1, <16 x i8> %a2, i1 %cond) {
  %res = select i1 %cond, <16 x i8> %a1, <16 x i8> %a2
  ret <16 x i8> %res
}

; KNL-LABEL: test9
; KNL: vucomisd
; KNL: setb
define i1 @test9(double %a, double %b) {
  %c = fcmp ugt double %a, %b
  ret i1 %c
}

; KNL_X32-LABEL: test10
; KNL_X32: testb $1, 12(%esp)
; KNL_X32: cmovnel

; KNL-LABEL: test10
; KNL: testb   $1, %dl
; KNL: cmovel
define i32 @test10(i32 %a, i32 %b, i1 %cond) {
  %c = select i1 %cond, i32 %a, i32 %b
  ret i32 %c
}

; KNL-LABEL: test11
; KNL: cmp
; KNL: setg
define i1 @test11(i32 %a, i32 %b) {
  %c = icmp sgt i32 %a, %b
  ret i1 %c
}

; KNL-LABEL: test12
; KNL: callq _test11
;; return value in %al
; KNL: movzbl	%al, %ebx
; KNL: callq _test10
; KNL: testb   $1, %bl

define i32 @test12(i32 %a1, i32 %a2, i32 %b1) {
  %cond = call i1 @test11(i32 %a1, i32 %b1)
  %res = call i32 @test10(i32 %a1, i32 %a2, i1 %cond)
  %res1 = select i1 %cond, i32 %res, i32 0
  ret i32 %res1
}
OpenPOWER on IntegriCloud