blob: 1307f70ead17daf96befade644ab10e52d6fcf92 [file] [log] [blame]
Jakob Stoklund Olesenc1ce95f2011-06-28 06:25:03 +00001; RUN: llc < %s -mtriple=i686-apple-darwin8 -mcpu=yonah -march=x86 | FileCheck %s
Chris Lattnerf4acec12007-02-25 08:23:01 +00002
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 Olesenc1ce95f2011-06-28 06:25:03 +00006; CHECK: test1
7; CHECK: fldl
8; CHECK-NEXT: ret
Chris Lattnerf4acec12007-02-25 08:23:01 +00009define double @test1(double *%P) {
10 %A = load double* %P
11 ret double %A
12}
13
Jakob Stoklund Olesenc1ce95f2011-06-28 06:25:03 +000014; fastcc should return a value
15; CHECK: test2
16; CHECK-NOT: xmm
17; CHECK: ret
Chris Lattner113296b2007-02-25 09:30:03 +000018define fastcc double @test2(<2 x double> %A) {
19 %B = extractelement <2 x double> %A, i32 0
20 ret double %B
21}
22
Jakob Stoklund Olesenc1ce95f2011-06-28 06:25:03 +000023; CHECK: test3
24; CHECK: sub{{.*}}%esp
25; CHECLK-NOT: xmm
Chris Lattner113296b2007-02-25 09:30:03 +000026define 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 Olesenc1ce95f2011-06-28 06:25:03 +000031
32; Clear the stack when not using a return value.
33; CHECK: test4
34; CHECK: call
35; CHECK: fstp
36; CHECK: ret
37define void @test4(double *%P) {
38 %A = call double @test1(double *%P)
39 ret void
40}