llvm/llvm/test/CodeGen/X86/pr34080-2.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i386-unknown-openbsd6.2 | FileCheck %s

%struct.DateTime = type { i64, i32, i32, i32, i32, i32, double, i8 }

define void @computeJD(ptr) nounwind {
; CHECK-LABEL: computeJD:
; CHECK:       # %bb.0:
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    movl %esp, %ebp
; CHECK-NEXT:    pushl %ebx
; CHECK-NEXT:    pushl %edi
; CHECK-NEXT:    pushl %esi
; CHECK-NEXT:    andl $-8, %esp
; CHECK-NEXT:    subl $40, %esp
; CHECK-NEXT:    movl 8(%ebp), %ebx
; CHECK-NEXT:    movl 8(%ebx), %esi
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    cmpl $3, 12(%ebx)
; CHECK-NEXT:    setl %al
; CHECK-NEXT:    subl %eax, %esi
; CHECK-NEXT:    movl $-1374389535, %ecx # imm = 0xAE147AE1
; CHECK-NEXT:    movl %esi, %eax
; CHECK-NEXT:    imull %ecx
; CHECK-NEXT:    movl %edx, %ecx
; CHECK-NEXT:    movl %edx, %eax
; CHECK-NEXT:    shrl $31, %eax
; CHECK-NEXT:    sarl $5, %ecx
; CHECK-NEXT:    addl %eax, %ecx
; CHECK-NEXT:    movl $1374389535, %edx # imm = 0x51EB851F
; CHECK-NEXT:    movl %esi, %eax
; CHECK-NEXT:    imull %edx
; CHECK-NEXT:    movl %edx, %edi
; CHECK-NEXT:    movl %edx, %eax
; CHECK-NEXT:    shrl $31, %eax
; CHECK-NEXT:    sarl $7, %edi
; CHECK-NEXT:    addl %eax, %edi
; CHECK-NEXT:    imull $36525, %esi, %eax # imm = 0x8EAD
; CHECK-NEXT:    addl $172251900, %eax # imm = 0xA445AFC
; CHECK-NEXT:    movl $1374389535, %edx # imm = 0x51EB851F
; CHECK-NEXT:    imull %edx
; CHECK-NEXT:    movl %edx, %eax
; CHECK-NEXT:    shrl $31, %eax
; CHECK-NEXT:    sarl $5, %edx
; CHECK-NEXT:    addl %eax, %edx
; CHECK-NEXT:    addl 16(%ebx), %ecx
; CHECK-NEXT:    addl %edi, %ecx
; CHECK-NEXT:    leal 257(%ecx,%edx), %eax
; CHECK-NEXT:    movl %eax, {{[0-9]+}}(%esp)
; CHECK-NEXT:    fildl {{[0-9]+}}(%esp)
; CHECK-NEXT:    fadds {{\.?LCPI[0-9]+_[0-9]+}}
; CHECK-NEXT:    fmuls {{\.?LCPI[0-9]+_[0-9]+}}
; CHECK-NEXT:    fnstcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT:    orl $3072, %eax # imm = 0xC00
; CHECK-NEXT:    movw %ax, {{[0-9]+}}(%esp)
; CHECK-NEXT:    fldcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    fistpll {{[0-9]+}}(%esp)
; CHECK-NEXT:    fldcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    movb $1, 36(%ebx)
; CHECK-NEXT:    imull $3600000, 20(%ebx), %ecx # imm = 0x36EE80
; CHECK-NEXT:    imull $60000, 24(%ebx), %eax # imm = 0xEA60
; CHECK-NEXT:    addl %ecx, %eax
; CHECK-NEXT:    fldl 28(%ebx)
; CHECK-NEXT:    fmuls {{\.?LCPI[0-9]+_[0-9]+}}
; CHECK-NEXT:    fnstcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    movzwl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT:    orl $3072, %ecx # imm = 0xC00
; CHECK-NEXT:    movw %cx, {{[0-9]+}}(%esp)
; CHECK-NEXT:    movl %eax, %ecx
; CHECK-NEXT:    sarl $31, %ecx
; CHECK-NEXT:    fldcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    fistpll {{[0-9]+}}(%esp)
; CHECK-NEXT:    fldcw {{[0-9]+}}(%esp)
; CHECK-NEXT:    addl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT:    adcl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT:    addl {{[0-9]+}}(%esp), %eax
; CHECK-NEXT:    adcl {{[0-9]+}}(%esp), %ecx
; CHECK-NEXT:    movl %eax, (%ebx)
; CHECK-NEXT:    movl %ecx, 4(%ebx)
; CHECK-NEXT:    leal -12(%ebp), %esp
; CHECK-NEXT:    popl %esi
; CHECK-NEXT:    popl %edi
; CHECK-NEXT:    popl %ebx
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    retl
  %2 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 7
  %3 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 1
  %4 = load i32, ptr %3, align 4
  %5 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 2
  %6 = load i32, ptr %5, align 4
  %7 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 3
  %8 = load i32, ptr %7, align 4
  %9 = icmp slt i32 %6, 3
  %10 = add i32 %6, 12
  %11 = select i1 %9, i32 %10, i32 %6
  %12 = sext i1 %9 to i32
  %13 = add i32 %4, %12
  %14 = sdiv i32 %13, -100
  %15 = sdiv i32 %13, 400
  %16 = mul i32 %13, 36525
  %17 = add i32 %16, 172251900
  %18 = sdiv i32 %17, 100
  %19 = mul i32 %11, 306001
  %20 = add i32 %19, 306001
  %21 = sdiv i32 %20, 10000
  %22 = add i32 %8, 2
  %23 = add i32 %22, %14
  %24 = add i32 %23, %15
  %25 = add i32 %24, 255
  %26 = add i32 %25, %18
  %27 = sitofp i32 %26 to double
  %28 = fadd double %27, -1.524500e+03
  %29 = fmul double %28, 8.640000e+07
  %30 = fptosi double %29 to i64
  store i8 1, ptr %2, align 4
  %31 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 4
  %32 = load i32, ptr %31, align 4
  %33 = mul i32 %32, 3600000
  %34 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 5
  %35 = load i32, ptr %34, align 4
  %36 = mul i32 %35, 60000
  %37 = add i32 %36, %33
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds %struct.DateTime, ptr %0, i32 0, i32 6
  %40 = load double, ptr %39, align 4
  %41 = fmul double %40, 1.000000e+03
  %42 = fptosi double %41 to i64
  %43 = add i64 %38, %42
  %44 = add i64 %43, %30
  store i64 %44, ptr %0, align 4
  ret void
}

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" }