1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-unknown -mattr=+sse2 | FileCheck -check-prefix=CHECK64 %s
3 ; RUN: llc < %s -mtriple=i686-pc-unknown -mattr=+sse2 | FileCheck -check-prefix=CHECK32 %s
7 define i32 @isint_return(double %d) nounwind {
8 ; CHECK64-LABEL: isint_return:
10 ; CHECK64-NEXT: cvttpd2dq %xmm0, %xmm1
11 ; CHECK64-NEXT: cvtdq2pd %xmm1, %xmm1
12 ; CHECK64-NEXT: cmpeqsd %xmm0, %xmm1
13 ; CHECK64-NEXT: movq %xmm1, %rax
14 ; CHECK64-NEXT: andl $1, %eax
15 ; CHECK64-NEXT: # kill: def $eax killed $eax killed $rax
18 ; CHECK32-LABEL: isint_return:
20 ; CHECK32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
21 ; CHECK32-NEXT: cvttpd2dq %xmm0, %xmm1
22 ; CHECK32-NEXT: cvtdq2pd %xmm1, %xmm1
23 ; CHECK32-NEXT: cmpeqsd %xmm0, %xmm1
24 ; CHECK32-NEXT: movd %xmm1, %eax
25 ; CHECK32-NEXT: andl $1, %eax
27 %i = fptosi double %d to i32
28 %e = sitofp i32 %i to double
29 %c = fcmp oeq double %d, %e
30 %z = zext i1 %c to i32
34 define i32 @isint_float_return(float %f) nounwind {
35 ; CHECK64-LABEL: isint_float_return:
37 ; CHECK64-NEXT: cvttps2dq %xmm0, %xmm1
38 ; CHECK64-NEXT: cvtdq2ps %xmm1, %xmm1
39 ; CHECK64-NEXT: cmpeqss %xmm0, %xmm1
40 ; CHECK64-NEXT: movd %xmm1, %eax
41 ; CHECK64-NEXT: andl $1, %eax
44 ; CHECK32-LABEL: isint_float_return:
46 ; CHECK32-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
47 ; CHECK32-NEXT: cvttps2dq %xmm0, %xmm1
48 ; CHECK32-NEXT: cvtdq2ps %xmm1, %xmm1
49 ; CHECK32-NEXT: cmpeqss %xmm0, %xmm1
50 ; CHECK32-NEXT: movd %xmm1, %eax
51 ; CHECK32-NEXT: andl $1, %eax
53 %i = fptosi float %f to i32
54 %g = sitofp i32 %i to float
55 %c = fcmp oeq float %f, %g
56 %z = zext i1 %c to i32
62 define void @isint_branch(double %d) nounwind {
63 ; CHECK64-LABEL: isint_branch:
65 ; CHECK64-NEXT: cvttpd2dq %xmm0, %xmm1
66 ; CHECK64-NEXT: cvtdq2pd %xmm1, %xmm1
67 ; CHECK64-NEXT: ucomisd %xmm1, %xmm0
68 ; CHECK64-NEXT: jne .LBB2_2
69 ; CHECK64-NEXT: jp .LBB2_2
70 ; CHECK64-NEXT: # %bb.1: # %true
71 ; CHECK64-NEXT: pushq %rax
72 ; CHECK64-NEXT: callq foo@PLT
73 ; CHECK64-NEXT: popq %rax
74 ; CHECK64-NEXT: .LBB2_2: # %false
77 ; CHECK32-LABEL: isint_branch:
79 ; CHECK32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
80 ; CHECK32-NEXT: cvttpd2dq %xmm0, %xmm1
81 ; CHECK32-NEXT: cvtdq2pd %xmm1, %xmm1
82 ; CHECK32-NEXT: ucomisd %xmm1, %xmm0
83 ; CHECK32-NEXT: jne .LBB2_2
84 ; CHECK32-NEXT: jp .LBB2_2
85 ; CHECK32-NEXT: # %bb.1: # %true
86 ; CHECK32-NEXT: calll foo@PLT
87 ; CHECK32-NEXT: .LBB2_2: # %false
89 %i = fptosi double %d to i32
90 %e = sitofp i32 %i to double
91 %c = fcmp oeq double %d, %e
92 br i1 %c, label %true, label %false