Jakob Stoklund Olesen | c1ce95f | 2011-06-28 06:25:03 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=i686-apple-darwin8 -mcpu=yonah -march=x86 | FileCheck %s |
Chris Lattner | f4acec1 | 2007-02-25 08:23:01 +0000 | [diff] [blame] | 2 | |
| 3 | ; These testcases shouldn't require loading into an XMM register then storing |
| 4 | ; to memory, then reloading into an FPStack reg. |
| 5 | |
Jakob Stoklund Olesen | c1ce95f | 2011-06-28 06:25:03 +0000 | [diff] [blame] | 6 | ; CHECK: test1 |
| 7 | ; CHECK: fldl |
| 8 | ; CHECK-NEXT: ret |
Chris Lattner | f4acec1 | 2007-02-25 08:23:01 +0000 | [diff] [blame] | 9 | define double @test1(double *%P) { |
| 10 | %A = load double* %P |
| 11 | ret double %A |
| 12 | } |
| 13 | |
Jakob Stoklund Olesen | c1ce95f | 2011-06-28 06:25:03 +0000 | [diff] [blame] | 14 | ; fastcc should return a value |
| 15 | ; CHECK: test2 |
| 16 | ; CHECK-NOT: xmm |
| 17 | ; CHECK: ret |
Chris Lattner | 113296b | 2007-02-25 09:30:03 +0000 | [diff] [blame] | 18 | define fastcc double @test2(<2 x double> %A) { |
| 19 | %B = extractelement <2 x double> %A, i32 0 |
| 20 | ret double %B |
| 21 | } |
| 22 | |
Jakob Stoklund Olesen | c1ce95f | 2011-06-28 06:25:03 +0000 | [diff] [blame] | 23 | ; CHECK: test3 |
| 24 | ; CHECK: sub{{.*}}%esp |
| 25 | ; CHECLK-NOT: xmm |
Chris Lattner | 113296b | 2007-02-25 09:30:03 +0000 | [diff] [blame] | 26 | define fastcc double @test3(<4 x float> %A) { |
| 27 | %B = bitcast <4 x float> %A to <2 x double> |
| 28 | %C = call fastcc double @test2(<2 x double> %B) |
| 29 | ret double %C |
| 30 | } |
Jakob Stoklund Olesen | c1ce95f | 2011-06-28 06:25:03 +0000 | [diff] [blame] | 31 | |
| 32 | ; Clear the stack when not using a return value. |
| 33 | ; CHECK: test4 |
| 34 | ; CHECK: call |
| 35 | ; CHECK: fstp |
| 36 | ; CHECK: ret |
| 37 | define void @test4(double *%P) { |
| 38 | %A = call double @test1(double *%P) |
| 39 | ret void |
| 40 | } |