1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-linux -mattr=+avx10.2-256 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+avx10.2-256 | FileCheck %s --check-prefix=X64
6 ; 32-bit float to signed integer
9 declare i32 @llvm.fptosi.sat.i32.f32 (float)
10 declare i64 @llvm.fptosi.sat.i64.f32 (float)
12 define i32 @test_signed_i32_f32(float %f) nounwind {
13 ; X86-LABEL: test_signed_i32_f32:
15 ; X86-NEXT: vcvttss2sis {{[0-9]+}}(%esp), %eax
18 ; X64-LABEL: test_signed_i32_f32:
20 ; X64-NEXT: vcvttss2sis %xmm0, %eax
22 %x = call i32 @llvm.fptosi.sat.i32.f32(float %f)
26 define i64 @test_signed_i64_f32(float %f) nounwind {
27 ; X86-LABEL: test_signed_i64_f32:
29 ; X86-NEXT: pushl %edi
30 ; X86-NEXT: pushl %esi
31 ; X86-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
32 ; X86-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
33 ; X86-NEXT: vcvttps2qq %xmm1, %xmm1
34 ; X86-NEXT: vmovd %xmm1, %esi
35 ; X86-NEXT: xorl %ecx, %ecx
36 ; X86-NEXT: vucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
37 ; X86-NEXT: cmovbl %ecx, %esi
38 ; X86-NEXT: vpextrd $1, %xmm1, %eax
39 ; X86-NEXT: movl $-2147483648, %edi # imm = 0x80000000
40 ; X86-NEXT: cmovael %eax, %edi
41 ; X86-NEXT: vucomiss {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
42 ; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF
43 ; X86-NEXT: cmovbel %edi, %edx
44 ; X86-NEXT: movl $-1, %eax
45 ; X86-NEXT: cmovbel %esi, %eax
46 ; X86-NEXT: vucomiss %xmm0, %xmm0
47 ; X86-NEXT: cmovpl %ecx, %eax
48 ; X86-NEXT: cmovpl %ecx, %edx
53 ; X64-LABEL: test_signed_i64_f32:
55 ; X64-NEXT: vcvttss2sis %xmm0, %rax
57 %x = call i64 @llvm.fptosi.sat.i64.f32(float %f)
62 ; 64-bit float to signed integer
65 declare i32 @llvm.fptosi.sat.i32.f64 (double)
66 declare i64 @llvm.fptosi.sat.i64.f64 (double)
68 define i32 @test_signed_i32_f64(double %f) nounwind {
69 ; X86-LABEL: test_signed_i32_f64:
71 ; X86-NEXT: vcvttsd2sis {{[0-9]+}}(%esp), %eax
74 ; X64-LABEL: test_signed_i32_f64:
76 ; X64-NEXT: vcvttsd2sis %xmm0, %eax
78 %x = call i32 @llvm.fptosi.sat.i32.f64(double %f)
82 define i64 @test_signed_i64_f64(double %f) nounwind {
83 ; X86-LABEL: test_signed_i64_f64:
85 ; X86-NEXT: pushl %edi
86 ; X86-NEXT: pushl %esi
87 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
88 ; X86-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
89 ; X86-NEXT: vcvttpd2qq %xmm1, %xmm1
90 ; X86-NEXT: vmovd %xmm1, %esi
91 ; X86-NEXT: xorl %ecx, %ecx
92 ; X86-NEXT: vucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
93 ; X86-NEXT: cmovbl %ecx, %esi
94 ; X86-NEXT: vpextrd $1, %xmm1, %eax
95 ; X86-NEXT: movl $-2147483648, %edi # imm = 0x80000000
96 ; X86-NEXT: cmovael %eax, %edi
97 ; X86-NEXT: vucomisd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
98 ; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF
99 ; X86-NEXT: cmovbel %edi, %edx
100 ; X86-NEXT: movl $-1, %eax
101 ; X86-NEXT: cmovbel %esi, %eax
102 ; X86-NEXT: vucomisd %xmm0, %xmm0
103 ; X86-NEXT: cmovpl %ecx, %eax
104 ; X86-NEXT: cmovpl %ecx, %edx
105 ; X86-NEXT: popl %esi
106 ; X86-NEXT: popl %edi
109 ; X64-LABEL: test_signed_i64_f64:
111 ; X64-NEXT: vcvttsd2sis %xmm0, %rax
113 %x = call i64 @llvm.fptosi.sat.i64.f64(double %f)