1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-darwin -mattr=+avx512f | FileCheck %s
5 define i64 @test_x86_sse2_cvtsd2si64(<2 x double> %a0) {
6 ; CHECK-LABEL: test_x86_sse2_cvtsd2si64:
8 ; CHECK-NEXT: vcvtsd2si %xmm0, %rax
10 %res = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %a0) ; <i64> [#uses=1]
13 declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone
15 define <2 x double> @test_x86_sse2_cvtsi642sd(<2 x double> %a0, i64 %a1) {
16 ; CHECK-LABEL: test_x86_sse2_cvtsi642sd:
18 ; CHECK-NEXT: vcvtsi2sd %rdi, %xmm0, %xmm0
20 %res = call <2 x double> @llvm.x86.sse2.cvtsi642sd(<2 x double> %a0, i64 %a1) ; <<2 x double>> [#uses=1]
23 declare <2 x double> @llvm.x86.sse2.cvtsi642sd(<2 x double>, i64) nounwind readnone
25 define i64 @test_x86_avx512_cvttsd2si64(<2 x double> %a0) {
26 ; CHECK-LABEL: test_x86_avx512_cvttsd2si64:
28 ; CHECK-NEXT: vcvttsd2si %xmm0, %rcx
29 ; CHECK-NEXT: vcvttsd2si {sae}, %xmm0, %rax
30 ; CHECK-NEXT: addq %rcx, %rax
32 %res0 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> %a0, i32 4) ;
33 %res1 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> %a0, i32 8) ;
34 %res2 = add i64 %res0, %res1
37 declare i64 @llvm.x86.avx512.cvttsd2si64(<2 x double>, i32) nounwind readnone
39 define i64 @test_x86_avx512_cvttsd2usi64(<2 x double> %a0) {
40 ; CHECK-LABEL: test_x86_avx512_cvttsd2usi64:
42 ; CHECK-NEXT: vcvttsd2usi %xmm0, %rcx
43 ; CHECK-NEXT: vcvttsd2usi {sae}, %xmm0, %rax
44 ; CHECK-NEXT: addq %rcx, %rax
46 %res0 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> %a0, i32 4) ;
47 %res1 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> %a0, i32 8) ;
48 %res2 = add i64 %res0, %res1
51 declare i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double>, i32) nounwind readnone
53 define i64 @test_x86_sse_cvtss2si64(<4 x float> %a0) {
54 ; CHECK-LABEL: test_x86_sse_cvtss2si64:
56 ; CHECK-NEXT: vcvtss2si %xmm0, %rax
58 %res = call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %a0) ; <i64> [#uses=1]
61 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) nounwind readnone
64 define <4 x float> @test_x86_sse_cvtsi642ss(<4 x float> %a0, i64 %a1) {
65 ; CHECK-LABEL: test_x86_sse_cvtsi642ss:
67 ; CHECK-NEXT: vcvtsi2ss %rdi, %xmm0, %xmm0
69 %res = call <4 x float> @llvm.x86.sse.cvtsi642ss(<4 x float> %a0, i64 %a1) ; <<4 x float>> [#uses=1]
72 declare <4 x float> @llvm.x86.sse.cvtsi642ss(<4 x float>, i64) nounwind readnone
75 define i64 @test_x86_avx512_cvttss2si64(<4 x float> %a0) {
76 ; CHECK-LABEL: test_x86_avx512_cvttss2si64:
78 ; CHECK-NEXT: vcvttss2si %xmm0, %rcx
79 ; CHECK-NEXT: vcvttss2si {sae}, %xmm0, %rax
80 ; CHECK-NEXT: addq %rcx, %rax
82 %res0 = call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> %a0, i32 4) ;
83 %res1 = call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> %a0, i32 8) ;
84 %res2 = add i64 %res0, %res1
87 declare i64 @llvm.x86.avx512.cvttss2si64(<4 x float>, i32) nounwind readnone
89 define i32 @test_x86_avx512_cvttss2usi(<4 x float> %a0) {
90 ; CHECK-LABEL: test_x86_avx512_cvttss2usi:
92 ; CHECK-NEXT: vcvttss2usi {sae}, %xmm0, %ecx
93 ; CHECK-NEXT: vcvttss2usi %xmm0, %eax
94 ; CHECK-NEXT: addl %ecx, %eax
96 %res0 = call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> %a0, i32 8) ;
97 %res1 = call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> %a0, i32 4) ;
98 %res2 = add i32 %res0, %res1
101 declare i32 @llvm.x86.avx512.cvttss2usi(<4 x float>, i32) nounwind readnone
103 define i64 @test_x86_avx512_cvttss2usi64(<4 x float> %a0) {
104 ; CHECK-LABEL: test_x86_avx512_cvttss2usi64:
106 ; CHECK-NEXT: vcvttss2usi %xmm0, %rcx
107 ; CHECK-NEXT: vcvttss2usi {sae}, %xmm0, %rax
108 ; CHECK-NEXT: addq %rcx, %rax
110 %res0 = call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> %a0, i32 4) ;
111 %res1 = call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> %a0, i32 8) ;
112 %res2 = add i64 %res0, %res1
115 declare i64 @llvm.x86.avx512.cvttss2usi64(<4 x float>, i32) nounwind readnone
117 define i64 @test_x86_avx512_cvtsd2usi64(<2 x double> %a0) {
118 ; CHECK-LABEL: test_x86_avx512_cvtsd2usi64:
120 ; CHECK-NEXT: vcvtsd2usi %xmm0, %rax
121 ; CHECK-NEXT: vcvtsd2usi {rz-sae}, %xmm0, %rcx
122 ; CHECK-NEXT: addq %rax, %rcx
123 ; CHECK-NEXT: vcvtsd2usi {rd-sae}, %xmm0, %rax
124 ; CHECK-NEXT: addq %rcx, %rax
127 %res = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %a0, i32 4)
128 %res1 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %a0, i32 11)
129 %res2 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %a0, i32 9)
130 %res3 = add i64 %res, %res1
131 %res4 = add i64 %res3, %res2
134 declare i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double>, i32) nounwind readnone
136 define i64 @test_x86_avx512_cvtsd2si64(<2 x double> %a0) {
137 ; CHECK-LABEL: test_x86_avx512_cvtsd2si64:
139 ; CHECK-NEXT: vcvtsd2si %xmm0, %rax
140 ; CHECK-NEXT: vcvtsd2si {rz-sae}, %xmm0, %rcx
141 ; CHECK-NEXT: addq %rax, %rcx
142 ; CHECK-NEXT: vcvtsd2si {rd-sae}, %xmm0, %rax
143 ; CHECK-NEXT: addq %rcx, %rax
146 %res = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %a0, i32 4)
147 %res1 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %a0, i32 11)
148 %res2 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %a0, i32 9)
149 %res3 = add i64 %res, %res1
150 %res4 = add i64 %res3, %res2
153 declare i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double>, i32) nounwind readnone
155 define i64 @test_x86_avx512_cvtss2usi64(<4 x float> %a0) {
156 ; CHECK-LABEL: test_x86_avx512_cvtss2usi64:
158 ; CHECK-NEXT: vcvtss2usi %xmm0, %rax
159 ; CHECK-NEXT: vcvtss2usi {rz-sae}, %xmm0, %rcx
160 ; CHECK-NEXT: addq %rax, %rcx
161 ; CHECK-NEXT: vcvtss2usi {rd-sae}, %xmm0, %rax
162 ; CHECK-NEXT: addq %rcx, %rax
165 %res = call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %a0, i32 4)
166 %res1 = call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %a0, i32 11)
167 %res2 = call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %a0, i32 9)
168 %res3 = add i64 %res, %res1
169 %res4 = add i64 %res3, %res2
172 declare i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float>, i32) nounwind readnone
174 define i64 @test_x86_avx512_cvtss2si64(<4 x float> %a0) {
175 ; CHECK-LABEL: test_x86_avx512_cvtss2si64:
177 ; CHECK-NEXT: vcvtss2si %xmm0, %rax
178 ; CHECK-NEXT: vcvtss2si {rz-sae}, %xmm0, %rcx
179 ; CHECK-NEXT: addq %rax, %rcx
180 ; CHECK-NEXT: vcvtss2si {rd-sae}, %xmm0, %rax
181 ; CHECK-NEXT: addq %rcx, %rax
184 %res = call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %a0, i32 4)
185 %res1 = call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %a0, i32 11)
186 %res2 = call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %a0, i32 9)
187 %res3 = add i64 %res, %res1
188 %res4 = add i64 %res3, %res2
191 declare i64 @llvm.x86.avx512.vcvtss2si64(<4 x float>, i32) nounwind readnone
193 define <2 x double> @test_x86_avx512_cvtsi2sd64(<2 x double> %a, i64 %b) {
194 ; CHECK-LABEL: test_x86_avx512_cvtsi2sd64:
196 ; CHECK-NEXT: vcvtsi2sd %rdi, {rz-sae}, %xmm0, %xmm0
198 %res = call <2 x double> @llvm.x86.avx512.cvtsi2sd64(<2 x double> %a, i64 %b, i32 11) ; <<<2 x double>> [#uses=1]
199 ret <2 x double> %res
201 declare <2 x double> @llvm.x86.avx512.cvtsi2sd64(<2 x double>, i64, i32) nounwind readnone
203 define <4 x float> @test_x86_avx512_cvtsi2ss64(<4 x float> %a, i64 %b) {
204 ; CHECK-LABEL: test_x86_avx512_cvtsi2ss64:
206 ; CHECK-NEXT: vcvtsi2ss %rdi, {rz-sae}, %xmm0, %xmm0
208 %res = call <4 x float> @llvm.x86.avx512.cvtsi2ss64(<4 x float> %a, i64 %b, i32 11) ; <<<4 x float>> [#uses=1]
211 declare <4 x float> @llvm.x86.avx512.cvtsi2ss64(<4 x float>, i64, i32) nounwind readnone
213 define <4 x float> @_mm_cvt_roundu64_ss (<4 x float> %a, i64 %b) {
214 ; CHECK-LABEL: _mm_cvt_roundu64_ss:
216 ; CHECK-NEXT: vcvtusi2ss %rdi, {rd-sae}, %xmm0, %xmm0
218 %res = call <4 x float> @llvm.x86.avx512.cvtusi642ss(<4 x float> %a, i64 %b, i32 9) ; <<<4 x float>> [#uses=1]
222 define <4 x float> @_mm_cvtu64_ss(<4 x float> %a, i64 %b) {
223 ; CHECK-LABEL: _mm_cvtu64_ss:
225 ; CHECK-NEXT: vcvtusi2ss %rdi, %xmm0, %xmm0
227 %res = call <4 x float> @llvm.x86.avx512.cvtusi642ss(<4 x float> %a, i64 %b, i32 4) ; <<<4 x float>> [#uses=1]
230 declare <4 x float> @llvm.x86.avx512.cvtusi642ss(<4 x float>, i64, i32) nounwind readnone
232 define <2 x double> @test_x86_avx512_mm_cvtu64_sd(<2 x double> %a, i64 %b) {
233 ; CHECK-LABEL: test_x86_avx512_mm_cvtu64_sd:
235 ; CHECK-NEXT: vcvtusi2sd %rdi, {rd-sae}, %xmm0, %xmm0
237 %res = call <2 x double> @llvm.x86.avx512.cvtusi642sd(<2 x double> %a, i64 %b, i32 9) ; <<<2 x double>> [#uses=1]
238 ret <2 x double> %res
241 define <2 x double> @test_x86_avx512__mm_cvt_roundu64_sd(<2 x double> %a, i64 %b) {
242 ; CHECK-LABEL: test_x86_avx512__mm_cvt_roundu64_sd:
244 ; CHECK-NEXT: vcvtusi2sd %rdi, %xmm0, %xmm0
246 %res = call <2 x double> @llvm.x86.avx512.cvtusi642sd(<2 x double> %a, i64 %b, i32 4) ; <<<2 x double>> [#uses=1]
247 ret <2 x double> %res
249 declare <2 x double> @llvm.x86.avx512.cvtusi642sd(<2 x double>, i64, i32) nounwind readnone