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 4 5; PR19059 6 7define i32 @isint_return(double %d) nounwind { 8; CHECK64-LABEL: isint_return: 9; CHECK64: # %bb.0: 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 16; CHECK64-NEXT: retq 17; 18; CHECK32-LABEL: isint_return: 19; CHECK32: # %bb.0: 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 26; CHECK32-NEXT: retl 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 31 ret i32 %z 32} 33 34define i32 @isint_float_return(float %f) nounwind { 35; CHECK64-LABEL: isint_float_return: 36; CHECK64: # %bb.0: 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 42; CHECK64-NEXT: retq 43; 44; CHECK32-LABEL: isint_float_return: 45; CHECK32: # %bb.0: 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 52; CHECK32-NEXT: retl 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 57 ret i32 %z 58} 59 60declare void @foo() 61 62define void @isint_branch(double %d) nounwind { 63; CHECK64-LABEL: isint_branch: 64; CHECK64: # %bb.0: 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 73; CHECK64-NEXT: popq %rax 74; CHECK64-NEXT: .LBB2_2: # %false 75; CHECK64-NEXT: retq 76; 77; CHECK32-LABEL: isint_branch: 78; CHECK32: # %bb.0: 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 87; CHECK32-NEXT: .LBB2_2: # %false 88; CHECK32-NEXT: retl 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 93true: 94 call void @foo() 95 ret void 96false: 97 ret void 98} 99