1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i386-unknown-openbsd6.2 | FileCheck %s 3 4 %struct.DateTime = type { i64, i32, i32, i32, i32, i32, double, i8 } 5 6 define void @computeJD(%struct.DateTime*) nounwind { 7 ; CHECK-LABEL: computeJD: 8 ; CHECK: # %bb.0: 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 $32, %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.*}} 52 ; CHECK-NEXT: fmuls {{\.LCPI.*}} 53 ; CHECK-NEXT: fnstcw {{[0-9]+}}(%esp) 54 ; CHECK-NEXT: movzwl {{[0-9]+}}(%esp), %eax 55 ; CHECK-NEXT: movw $3199, {{[0-9]+}}(%esp) # imm = 0xC7F 56 ; CHECK-NEXT: fldcw {{[0-9]+}}(%esp) 57 ; CHECK-NEXT: movw %ax, {{[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), %eax # imm = 0x36EE80 62 ; CHECK-NEXT: imull $60000, 24(%ebx), %ecx # imm = 0xEA60 63 ; CHECK-NEXT: addl %eax, %ecx 64 ; CHECK-NEXT: fldl 28(%ebx) 65 ; CHECK-NEXT: fmuls {{\.LCPI.*}} 66 ; CHECK-NEXT: fnstcw (%esp) 67 ; CHECK-NEXT: movzwl (%esp), %eax 68 ; CHECK-NEXT: movw $3199, (%esp) # imm = 0xC7F 69 ; CHECK-NEXT: fldcw (%esp) 70 ; CHECK-NEXT: movw %ax, (%esp) 71 ; CHECK-NEXT: movl %ecx, %eax 72 ; CHECK-NEXT: sarl $31, %eax 73 ; CHECK-NEXT: fistpll {{[0-9]+}}(%esp) 74 ; CHECK-NEXT: fldcw (%esp) 75 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %ecx 76 ; CHECK-NEXT: adcl {{[0-9]+}}(%esp), %eax 77 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %ecx 78 ; CHECK-NEXT: adcl {{[0-9]+}}(%esp), %eax 79 ; CHECK-NEXT: movl %ecx, (%ebx) 80 ; CHECK-NEXT: movl %eax, 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 86 ; CHECK-NEXT: retl 87 %2 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 7 88 %3 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 1 89 %4 = load i32, i32* %3, align 4 90 %5 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 2 91 %6 = load i32, i32* %5, align 4 92 %7 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 3 93 %8 = load i32, i32* %7, align 4 94 %9 = icmp slt i32 %6, 3 95 %10 = add i32 %6, 12 96 %11 = select i1 %9, i32 %10, i32 %6 97 %12 = sext i1 %9 to i32 98 %13 = add i32 %4, %12 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 107 %22 = add i32 %8, 2 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 %31 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 0 117 store i8 1, i8* %2, align 4 118 %32 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 4 119 %33 = load i32, i32* %32, align 4 120 %34 = mul i32 %33, 3600000 121 %35 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 5 122 %36 = load i32, i32* %35, align 4 123 %37 = mul i32 %36, 60000 124 %38 = add i32 %37, %34 125 %39 = sext i32 %38 to i64 126 %40 = getelementptr inbounds %struct.DateTime, %struct.DateTime* %0, i32 0, i32 6 127 %41 = load double, double* %40, align 4 128 %42 = fmul double %41, 1.000000e+03 129 %43 = fptosi double %42 to i64 130 %44 = add i64 %39, %43 131 %45 = add i64 %44, %30 132 store i64 %45, i64* %31, align 4 133 ret void 134 } 135 136 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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" } 137