1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-unknown-openbsd6.2 | FileCheck %s
4 %struct.DateTime = type { i64, i32, i32, i32, i32, i32, double, i8 }
6 define void @computeJD(ptr) nounwind {
7 ; CHECK-LABEL: computeJD:
9 ; CHECK-NEXT: pushl %ebp
10 ; CHECK-NEXT: movl %esp, %ebp
11 ; CHECK-NEXT: pushl %ebx
12 ; CHECK-NEXT: pushl %edi
13 ; CHECK-NEXT: pushl %esi
14 ; CHECK-NEXT: andl $-8, %esp
15 ; CHECK-NEXT: subl $40, %esp
16 ; CHECK-NEXT: movl 8(%ebp), %ebx
17 ; CHECK-NEXT: movl 8(%ebx), %esi
18 ; CHECK-NEXT: xorl %eax, %eax
19 ; CHECK-NEXT: cmpl $3, 12(%ebx)
20 ; CHECK-NEXT: setl %al
21 ; CHECK-NEXT: subl %eax, %esi
22 ; CHECK-NEXT: movl $-1374389535, %ecx # imm = 0xAE147AE1
23 ; CHECK-NEXT: movl %esi, %eax
24 ; CHECK-NEXT: imull %ecx
25 ; CHECK-NEXT: movl %edx, %ecx
26 ; CHECK-NEXT: movl %edx, %eax
27 ; CHECK-NEXT: shrl $31, %eax
28 ; CHECK-NEXT: sarl $5, %ecx
29 ; CHECK-NEXT: addl %eax, %ecx
30 ; CHECK-NEXT: movl $1374389535, %edx # imm = 0x51EB851F
31 ; CHECK-NEXT: movl %esi, %eax
32 ; CHECK-NEXT: imull %edx
33 ; CHECK-NEXT: movl %edx, %edi
34 ; CHECK-NEXT: movl %edx, %eax
35 ; CHECK-NEXT: shrl $31, %eax
36 ; CHECK-NEXT: sarl $7, %edi
37 ; CHECK-NEXT: addl %eax, %edi
38 ; CHECK-NEXT: imull $36525, %esi, %eax # imm = 0x8EAD
39 ; CHECK-NEXT: addl $172251900, %eax # imm = 0xA445AFC
40 ; CHECK-NEXT: movl $1374389535, %edx # imm = 0x51EB851F
41 ; CHECK-NEXT: imull %edx
42 ; CHECK-NEXT: movl %edx, %eax
43 ; CHECK-NEXT: shrl $31, %eax
44 ; CHECK-NEXT: sarl $5, %edx
45 ; CHECK-NEXT: addl %eax, %edx
46 ; CHECK-NEXT: addl 16(%ebx), %ecx
47 ; CHECK-NEXT: addl %edi, %ecx
48 ; CHECK-NEXT: leal 257(%ecx,%edx), %eax
49 ; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp)
50 ; CHECK-NEXT: fildl {{[0-9]+}}(%esp)
51 ; CHECK-NEXT: fadds {{\.?LCPI[0-9]+_[0-9]+}}
52 ; CHECK-NEXT: fmuls {{\.?LCPI[0-9]+_[0-9]+}}
53 ; CHECK-NEXT: fnstcw {{[0-9]+}}(%esp)
54 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %eax
55 ; CHECK-NEXT: orl $3072, %eax # imm = 0xC00
56 ; CHECK-NEXT: movw %ax, {{[0-9]+}}(%esp)
57 ; CHECK-NEXT: fldcw {{[0-9]+}}(%esp)
58 ; CHECK-NEXT: fistpll {{[0-9]+}}(%esp)
59 ; CHECK-NEXT: fldcw {{[0-9]+}}(%esp)
60 ; CHECK-NEXT: movb $1, 36(%ebx)
61 ; CHECK-NEXT: imull $3600000, 20(%ebx), %ecx # imm = 0x36EE80
62 ; CHECK-NEXT: imull $60000, 24(%ebx), %eax # imm = 0xEA60
63 ; CHECK-NEXT: addl %ecx, %eax
64 ; CHECK-NEXT: fldl 28(%ebx)
65 ; CHECK-NEXT: fmuls {{\.?LCPI[0-9]+_[0-9]+}}
66 ; CHECK-NEXT: fnstcw {{[0-9]+}}(%esp)
67 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
68 ; CHECK-NEXT: orl $3072, %ecx # imm = 0xC00
69 ; CHECK-NEXT: movw %cx, {{[0-9]+}}(%esp)
70 ; CHECK-NEXT: movl %eax, %ecx
71 ; CHECK-NEXT: sarl $31, %ecx
72 ; CHECK-NEXT: fldcw {{[0-9]+}}(%esp)
73 ; CHECK-NEXT: fistpll {{[0-9]+}}(%esp)
74 ; CHECK-NEXT: fldcw {{[0-9]+}}(%esp)
75 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %eax
76 ; CHECK-NEXT: adcl {{[0-9]+}}(%esp), %ecx
77 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %eax
78 ; CHECK-NEXT: adcl {{[0-9]+}}(%esp), %ecx
79 ; CHECK-NEXT: movl %eax, (%ebx)
80 ; CHECK-NEXT: movl %ecx, 4(%ebx)
81 ; CHECK-NEXT: leal -12(%ebp), %esp
82 ; CHECK-NEXT: popl %esi
83 ; CHECK-NEXT: popl %edi
84 ; CHECK-NEXT: popl %ebx
85 ; CHECK-NEXT: popl %ebp
87 %2 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 7
88 %3 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 1
89 %4 = load i32, ptr %3, align 4
90 %5 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 2
91 %6 = load i32, ptr %5, align 4
92 %7 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 3
93 %8 = load i32, ptr %7, align 4
94 %9 = icmp slt i32 %6, 3
96 %11 = select i1 %9, i32 %10, i32 %6
97 %12 = sext i1 %9 to i32
99 %14 = sdiv i32 %13, -100
100 %15 = sdiv i32 %13, 400
101 %16 = mul i32 %13, 36525
102 %17 = add i32 %16, 172251900
103 %18 = sdiv i32 %17, 100
104 %19 = mul i32 %11, 306001
105 %20 = add i32 %19, 306001
106 %21 = sdiv i32 %20, 10000
108 %23 = add i32 %22, %14
109 %24 = add i32 %23, %15
110 %25 = add i32 %24, 255
111 %26 = add i32 %25, %18
112 %27 = sitofp i32 %26 to double
113 %28 = fadd double %27, -1.524500e+03
114 %29 = fmul double %28, 8.640000e+07
115 %30 = fptosi double %29 to i64
116 store i8 1, ptr %2, align 4
117 %31 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 4
118 %32 = load i32, ptr %31, align 4
119 %33 = mul i32 %32, 3600000
120 %34 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 5
121 %35 = load i32, ptr %34, align 4
122 %36 = mul i32 %35, 60000
123 %37 = add i32 %36, %33
124 %38 = sext i32 %37 to i64
125 %39 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 6
126 %40 = load double, ptr %39, align 4
127 %41 = fmul double %40, 1.000000e+03
128 %42 = fptosi double %41 to i64
129 %43 = add i64 %38, %42
130 %44 = add i64 %43, %30
131 store i64 %44, ptr %0, align 4
135 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="i486" "target-features"="+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }