1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-macosx10.15.0 -mattr=+cmov | FileCheck %s
4 @b = global i32 0, align 4
5 @a = global i64 0, align 8
7 define double @c() nounwind {
9 ; CHECK: ## %bb.0: ## %entry
10 ; CHECK-NEXT: pushl %esi
11 ; CHECK-NEXT: subl $16, %esp
12 ; CHECK-NEXT: movl _b, %eax
13 ; CHECK-NEXT: movl %eax, %ecx
14 ; CHECK-NEXT: sarl $31, %ecx
15 ; CHECK-NEXT: movl _a+4, %edx
16 ; CHECK-NEXT: movl _a, %esi
17 ; CHECK-NEXT: subl %eax, %esi
18 ; CHECK-NEXT: sbbl %ecx, %edx
19 ; CHECK-NEXT: setb %al
20 ; CHECK-NEXT: movl %esi, (%esp)
21 ; CHECK-NEXT: movl %edx, {{[0-9]+}}(%esp)
22 ; CHECK-NEXT: shrl $31, %edx
23 ; CHECK-NEXT: fildll (%esp)
24 ; CHECK-NEXT: fadds {{\.?LCPI[0-9]+_[0-9]+}}(,%edx,4)
25 ; CHECK-NEXT: fstpl {{[0-9]+}}(%esp)
26 ; CHECK-NEXT: fldl {{[0-9]+}}(%esp)
28 ; CHECK-NEXT: testb %al, %al
29 ; CHECK-NEXT: fxch %st(1)
30 ; CHECK-NEXT: fcmovne %st(1), %st
31 ; CHECK-NEXT: fstp %st(1)
32 ; CHECK-NEXT: addl $16, %esp
33 ; CHECK-NEXT: popl %esi
36 %0 = load i32, ptr @b, align 4
37 %conv = sext i32 %0 to i64
38 %1 = load i64, ptr @a, align 8
39 %cmp = icmp ult i64 %1, %conv
40 %sub = sub i64 %1, %conv
41 %conv3 = uitofp i64 %sub to double
42 %cond = select i1 %cmp, double 0.000000e+00, double %conv3