1 ; RUN: llc -mtriple=i686-unknown-unknown < %s | FileCheck %s
2 ; RUN: llc -mtriple=i686-unknown-unknown -O0 < %s | FileCheck %s -check-prefix=CHECK0
4 %struct.interrupt_frame = type { i32, i32, i32, i32, i32 }
6 @llvm.used = appending global [4 x i8*] [i8* bitcast (void (%struct.interrupt_frame*)* @test_isr_no_ecode to i8*), i8* bitcast (void (%struct.interrupt_frame*, i32)* @test_isr_ecode to i8*), i8* bitcast (void (%struct.interrupt_frame*, i32)* @test_isr_clobbers to i8*), i8* bitcast (void (%struct.interrupt_frame*)* @test_isr_x87 to i8*)], section "llvm.metadata"
8 ; Spills eax, putting original esp at +4.
9 ; No stack adjustment if declared with no error code
10 define x86_intrcc void @test_isr_no_ecode(%struct.interrupt_frame* %frame) {
11 ; CHECK-LABEL: test_isr_no_ecode:
13 ; CHECK: movl 12(%esp), %eax
16 ; CHECK0-LABEL: test_isr_no_ecode:
18 ; CHECK0: leal 4(%esp), %eax
19 ; CHECK0: movl 8(%eax), %eax
22 %pflags = getelementptr inbounds %struct.interrupt_frame, %struct.interrupt_frame* %frame, i32 0, i32 2
23 %flags = load i32, i32* %pflags, align 4
24 call void asm sideeffect "", "r"(i32 %flags)
28 ; Spills eax and ecx, putting original esp at +8. Stack is adjusted up another 4 bytes
29 ; before return, popping the error code.
30 define x86_intrcc void @test_isr_ecode(%struct.interrupt_frame* %frame, i32 %ecode) {
31 ; CHECK-LABEL: test_isr_ecode
34 ; CHECK: movl 8(%esp), %eax
35 ; CHECK: movl 20(%esp), %ecx
38 ; CHECK: addl $4, %esp
40 ; CHECK0-LABEL: test_isr_ecode
43 ; CHECK0: movl 8(%esp), %eax
44 ; CHECK0: leal 12(%esp), %ecx
45 ; CHECK0: movl 8(%ecx), %ecx
48 ; CHECK0: addl $4, %esp
50 %pflags = getelementptr inbounds %struct.interrupt_frame, %struct.interrupt_frame* %frame, i32 0, i32 2
51 %flags = load i32, i32* %pflags, align 4
52 call x86_fastcallcc void asm sideeffect "", "r,r"(i32 %flags, i32 %ecode)
56 ; All clobbered registers must be saved
57 define x86_intrcc void @test_isr_clobbers(%struct.interrupt_frame* %frame, i32 %ecode) {
58 call void asm sideeffect "", "~{eax},~{ebx},~{ebp}"()
59 ; CHECK-LABEL: test_isr_clobbers
66 ; CHECK: addl $4, %esp
68 ; CHECK0-LABEL: test_isr_clobbers
75 ; CHECK0: addl $4, %esp
80 @f80 = common global x86_fp80 0xK00000000000000000000, align 4
82 ; Test that the presence of x87 does not crash the FP stackifier
83 define x86_intrcc void @test_isr_x87(%struct.interrupt_frame* %frame) {
84 ; CHECK-LABEL: test_isr_x87
88 ; CHECK-NEXT: fstpt f80
91 %ld = load x86_fp80, x86_fp80* @f80, align 4
92 %add = fadd x86_fp80 %ld, 0xK3FFF8000000000000000
93 store x86_fp80 %add, x86_fp80* @f80, align 4