1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-windows-gnu -exception-model=dwarf < %s | FileCheck %s
4 %struct.A = type { [4096 x i8] }
6 @a = common global i32 0, align 4
7 @b = common global i32 0, align 4
9 define void @fn1() nounwind uwtable {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: movl a(%rip), %eax
13 ; CHECK-NEXT: testl %eax, %eax
14 ; CHECK-NEXT: jne .LBB0_2
15 ; CHECK-NEXT: # %bb.1: # %select.true.sink
17 ; CHECK-NEXT: imulq $715827883, %rax, %rax # imm = 0x2AAAAAAB
18 ; CHECK-NEXT: movq %rax, %rcx
19 ; CHECK-NEXT: shrq $63, %rcx
20 ; CHECK-NEXT: shrq $32, %rax
21 ; CHECK-NEXT: addl %ecx, %eax
22 ; CHECK-NEXT: .LBB0_2: # %select.end
23 ; CHECK-NEXT: pushq %rax
24 ; CHECK-NEXT: movl $4128, %eax # imm = 0x1020
25 ; CHECK-NEXT: callq ___chkstk_ms
26 ; CHECK-NEXT: subq %rax, %rsp
27 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax
28 ; CHECK-NEXT: .cfi_def_cfa_offset 4144
29 ; CHECK-NEXT: movl %eax, b(%rip)
30 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
31 ; CHECK-NEXT: # kill: def $ecx killed $ecx killed $rcx
32 ; CHECK-NEXT: callq fn2
33 ; CHECK-NEXT: addq $4136, %rsp # imm = 0x1028
36 %ctx = alloca %struct.A, align 1
37 %0 = load i32, ptr @a, align 4
38 %tobool = icmp eq i32 %0, 0
40 %cond = select i1 %tobool, i32 %div, i32 %0
41 store i32 %cond, ptr @b, align 4
42 call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %ctx)
43 %1 = ptrtoint ptr %ctx to i64
44 %2 = trunc i64 %1 to i32
45 call void @fn2(i32 %2)
46 call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %ctx)
50 declare void @fn2(i32)
51 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
52 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)