1 ; Verify that scalar integer conversions to FP compile successfully
2 ; (at one time long double failed with avx512f), and that reasonable
3 ; instruction sequences are selected based on subtarget features.
4 ; Due to the plethora of reasonable sequences we just check for
5 ; one key instruction, usually a cvt or fild, allowing the test
6 ; to be relatively easily updated when sequences are improved.
8 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512_32
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512_64
10 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE2_32
11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=CHECK --check-prefix=SSE2_64
12 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=-sse | FileCheck %s --check-prefix=CHECK --check-prefix=X87
14 ; CHECK-LABEL: u32_to_f
15 ; AVX512_32: vcvtusi2ssl
16 ; AVX512_64: vcvtusi2ssl
20 define float @u32_to_f(i32 %a) nounwind {
21 %r = uitofp i32 %a to float
25 ; CHECK-LABEL: s32_to_f
26 ; AVX512_32: vcvtsi2ssl
27 ; AVX512_64: vcvtsi2ssl
31 define float @s32_to_f(i32 %a) nounwind {
32 %r = sitofp i32 %a to float
36 ; CHECK-LABEL: u32_to_d
37 ; AVX512_32: vcvtusi2sdl
38 ; AVX512_64: vcvtusi2sdl
42 define double @u32_to_d(i32 %a) nounwind {
43 %r = uitofp i32 %a to double
47 ; CHECK-LABEL: s32_to_d
48 ; AVX512_32: vcvtsi2sdl
49 ; AVX512_64: vcvtsi2sdl
53 define double @s32_to_d(i32 %a) nounwind {
54 %r = sitofp i32 %a to double
58 ; CHECK-LABEL: u32_to_x
64 define x86_fp80 @u32_to_x(i32 %a) nounwind {
65 %r = uitofp i32 %a to x86_fp80
69 ; CHECK-LABEL: s32_to_x
71 define x86_fp80 @s32_to_x(i32 %a) nounwind {
72 %r = sitofp i32 %a to x86_fp80
76 ; CHECK-LABEL: u64_to_f
78 ; AVX512_64: vcvtusi2ssq
82 define float @u64_to_f(i64 %a) nounwind {
83 %r = uitofp i64 %a to float
87 ; CHECK-LABEL: s64_to_f
89 ; AVX512_64: vcvtsi2ssq
93 define float @s64_to_f(i64 %a) nounwind {
94 %r = sitofp i64 %a to float
98 ; CHECK-LABEL: u64_to_d
99 ; AVX512_32: vpunpckldq
100 ; AVX512_64: vcvtusi2sdq
104 define double @u64_to_d(i64 %a) nounwind {
105 %r = uitofp i64 %a to double
109 ; CHECK-LABEL: s64_to_d
111 ; AVX512_64: vcvtsi2sdq
115 define double @s64_to_d(i64 %a) nounwind {
116 %r = sitofp i64 %a to double
120 ; CHECK-LABEL: u64_to_x
122 define x86_fp80 @u64_to_x(i64 %a) nounwind {
123 %r = uitofp i64 %a to x86_fp80
127 ; CHECK-LABEL: s64_to_x
129 define x86_fp80 @s64_to_x(i64 %a) nounwind {
130 %r = sitofp i64 %a to x86_fp80