blob: f47fd7472ecb4c7509876f144939a2f60817ba78 [file] [log] [blame]
Chris Lattner6bac50e2008-03-21 05:57:20 +00001; RUN: llvm-as < %s | llc -march=x86 | grep fldz
2; RUN: llvm-as < %s | llc -march=x86-64 | grep fld1
3
4; This is basically this code on x86-64:
5; _Complex long double test() { return 1.0; }
6define {x86_fp80, x86_fp80} @test() {
7 %A = fpext double 1.0 to x86_fp80
8 %B = fpext double 0.0 to x86_fp80
9 ret x86_fp80 %A, x86_fp80 %B
10}
11
Chris Lattner853e6a92008-03-21 06:01:05 +000012
13;_test2:
14; fld1
15; fld %st(0)
16; ret
17define {x86_fp80, x86_fp80} @test2() {
18 %A = fpext double 1.0 to x86_fp80
19 ret x86_fp80 %A, x86_fp80 %A
20}
21
Chris Lattner60d14d82008-03-21 06:38:26 +000022; Uses both values.
23define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) {
24 %a = call {x86_fp80,x86_fp80} @test()
25 %b = getresult {x86_fp80,x86_fp80} %a, 0
26 store x86_fp80 %b, x86_fp80* %P1
27
28 %c = getresult {x86_fp80,x86_fp80} %a, 1
29 store x86_fp80 %c, x86_fp80* %P2
30 ret void
31}
32
33; Uses both values, requires fxch
34define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
35 %a = call {x86_fp80,x86_fp80} @test()
36 %b = getresult {x86_fp80,x86_fp80} %a, 1
37 store x86_fp80 %b, x86_fp80* %P1
38
39 %c = getresult {x86_fp80,x86_fp80} %a, 0
40 store x86_fp80 %c, x86_fp80* %P2
41 ret void
42}
43
44; Uses ST(0), ST(1) is dead but must be popped.
45define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) {
46 %a = call {x86_fp80,x86_fp80} @test()
47 %b = getresult {x86_fp80,x86_fp80} %a, 0
48 store x86_fp80 %b, x86_fp80* %P1
49 ret void
50}
51
52; Uses ST(1), ST(0) is dead and must be popped.
53define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) {
54 %a = call {x86_fp80,x86_fp80} @test()
55
56 %c = getresult {x86_fp80,x86_fp80} %a, 1
57 store x86_fp80 %c, x86_fp80* %P2
58 ret void
59}
60