Dan Gohman | 36a0947 | 2009-09-08 23:54:48 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 |
Chris Lattner | 02b6d25 | 2008-03-09 08:49:15 +0000 | [diff] [blame] | 2 | |
| 3 | define x86_fp80 @test1() { |
| 4 | %tmp85 = call x86_fp80 asm sideeffect "fld0", "={st(0)}"() |
| 5 | ret x86_fp80 %tmp85 |
| 6 | } |
| 7 | |
| 8 | define double @test2() { |
| 9 | %tmp85 = call double asm sideeffect "fld0", "={st(0)}"() |
| 10 | ret double %tmp85 |
| 11 | } |
| 12 | |
Chris Lattner | f30e1cf | 2008-03-09 09:15:31 +0000 | [diff] [blame] | 13 | define void @test3(x86_fp80 %X) { |
| 14 | call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( x86_fp80 %X) |
| 15 | ret void |
| 16 | } |
| 17 | |
| 18 | define void @test4(double %X) { |
| 19 | call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( double %X) |
| 20 | ret void |
| 21 | } |
| 22 | |
| 23 | define void @test5(double %X) { |
Dan Gohman | ae3a0be | 2009-06-04 22:49:04 +0000 | [diff] [blame] | 24 | %Y = fadd double %X, 123.0 |
Chris Lattner | f30e1cf | 2008-03-09 09:15:31 +0000 | [diff] [blame] | 25 | call void asm sideeffect "frob ", "{st(0)},~{dirflag},~{fpsr},~{flags}"( double %Y) |
| 26 | ret void |
| 27 | } |
| 28 | |
Chris Lattner | e12ecf2 | 2008-03-11 19:50:13 +0000 | [diff] [blame] | 29 | define void @test6(double %A, double %B, double %C, |
| 30 | double %D, double %E) nounwind { |
| 31 | entry: |
| 32 | ; Uses the same value twice, should have one fstp after the asm. |
| 33 | tail call void asm sideeffect "foo $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %A, double %A ) nounwind |
| 34 | ; Uses two different values, should be in st(0)/st(1) and both be popped. |
| 35 | tail call void asm sideeffect "bar $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %B, double %C ) nounwind |
| 36 | ; Uses two different values, one of which isn't killed in this asm, it |
| 37 | ; should not be popped after the asm. |
| 38 | tail call void asm sideeffect "baz $0 $1", "f,f,~{dirflag},~{fpsr},~{flags}"( double %D, double %E ) nounwind |
| 39 | ; This is the last use of %D, so it should be popped after. |
| 40 | tail call void asm sideeffect "baz $0", "f,~{dirflag},~{fpsr},~{flags}"( double %D ) nounwind |
| 41 | ret void |
| 42 | } |
Chris Lattner | 02b6d25 | 2008-03-09 08:49:15 +0000 | [diff] [blame] | 43 | |