1 ; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s
3 ; There should be no stack manipulations between the inline asm and ret.
7 define x86_fp80 @test1() {
8 %tmp85 = call x86_fp80 asm sideeffect "fld0", "={st(0)}"()
13 ; CHECK: InlineAsm End
15 define double @test2() {
16 %tmp85 = call double asm sideeffect "fld0", "={st(0)}"()
20 ; Setting up argument in st(0) should be a single fld.
23 ; CHECK-NEXT: InlineAsm Start
24 ; Asm consumes stack, nothing should be popped.
25 ; CHECK: InlineAsm End
28 define void @test3(x86_fp80 %X) {
29 call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( x86_fp80 %X)
35 ; CHECK-NEXT: InlineAsm Start
36 ; CHECK: InlineAsm End
39 define void @test4(double %X) {
40 call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( double %X)
44 ; Same as test3/4, but using value from fadd.
45 ; The fadd can be done in xmm or x87 regs - we don't test that.
47 ; CHECK: InlineAsm End
50 define void @test5(double %X) {
51 %Y = fadd double %X, 123.0
52 call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( double %Y)
57 define void @test6(double %A, double %B, double %C,
58 double %D, double %E) nounwind {
60 ; Uses the same value twice, should have one fstp after the asm.
62 ; CHECK: InlineAsm End
65 tail call void asm sideeffect "foo $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %A, double %A ) nounwind
66 ; Uses two different values, should be in st(0)/st(1) and both be popped.
68 ; CHECK: InlineAsm End
71 tail call void asm sideeffect "bar $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %B, double %C ) nounwind
72 ; Uses two different values, one of which isn't killed in this asm, it
73 ; should not be popped after the asm.
75 ; CHECK: InlineAsm End
78 tail call void asm sideeffect "baz $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %D, double %E ) nounwind
79 ; This is the last use of %D, so it should be popped after.
81 ; CHECK: InlineAsm End
85 tail call void asm sideeffect "baz $0", "f,~{dirflag},~{fpsr},~{flags}"( double %D ) nounwind