blob: bb86cd383394524a9ef1c442fbf76a2d589594a8 [file] [log] [blame]
Dan Gohman36a09472009-09-08 23:54:48 +00001; RUN: llc < %s -march=x86 | grep fldz
2; RUN: llc < %s -march=x86-64 | grep fld1
Chris Lattner03535262008-03-21 05:57:20 +00003
Chris Lattner437544f2011-06-17 06:49:41 +00004%0 = type { x86_fp80, x86_fp80 }
5
Chris Lattner03535262008-03-21 05:57:20 +00006; This is basically this code on x86-64:
7; _Complex long double test() { return 1.0; }
8define {x86_fp80, x86_fp80} @test() {
9 %A = fpext double 1.0 to x86_fp80
10 %B = fpext double 0.0 to x86_fp80
Chris Lattner437544f2011-06-17 06:49:41 +000011 %mrv = insertvalue %0 undef, x86_fp80 %A, 0
12 %mrv1 = insertvalue %0 %mrv, x86_fp80 %B, 1
13 ret %0 %mrv1
Chris Lattner03535262008-03-21 05:57:20 +000014}
15
Chris Lattnerae60ddc2008-03-21 06:01:05 +000016
17;_test2:
18; fld1
19; fld %st(0)
20; ret
21define {x86_fp80, x86_fp80} @test2() {
22 %A = fpext double 1.0 to x86_fp80
Chris Lattner437544f2011-06-17 06:49:41 +000023 %mrv = insertvalue %0 undef, x86_fp80 %A, 0
24 %mrv1 = insertvalue %0 %mrv, x86_fp80 %A, 1
25 ret %0 %mrv1
Chris Lattnerae60ddc2008-03-21 06:01:05 +000026}
27
Chris Lattner24e0a542008-03-21 06:38:26 +000028; Uses both values.
29define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) {
30 %a = call {x86_fp80,x86_fp80} @test()
31 %b = getresult {x86_fp80,x86_fp80} %a, 0
32 store x86_fp80 %b, x86_fp80* %P1
33
34 %c = getresult {x86_fp80,x86_fp80} %a, 1
35 store x86_fp80 %c, x86_fp80* %P2
36 ret void
37}
38
39; Uses both values, requires fxch
40define void @call2(x86_fp80 *%P1, x86_fp80 *%P2) {
41 %a = call {x86_fp80,x86_fp80} @test()
42 %b = getresult {x86_fp80,x86_fp80} %a, 1
43 store x86_fp80 %b, x86_fp80* %P1
44
45 %c = getresult {x86_fp80,x86_fp80} %a, 0
46 store x86_fp80 %c, x86_fp80* %P2
47 ret void
48}
49
50; Uses ST(0), ST(1) is dead but must be popped.
51define void @call3(x86_fp80 *%P1, x86_fp80 *%P2) {
52 %a = call {x86_fp80,x86_fp80} @test()
53 %b = getresult {x86_fp80,x86_fp80} %a, 0
54 store x86_fp80 %b, x86_fp80* %P1
55 ret void
56}
57
58; Uses ST(1), ST(0) is dead and must be popped.
59define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) {
60 %a = call {x86_fp80,x86_fp80} @test()
61
62 %c = getresult {x86_fp80,x86_fp80} %a, 1
63 store x86_fp80 %c, x86_fp80* %P2
64 ret void
65}
66