1
; RUN: llc < %s -march=x86 | grep fldz
2
; RUN: llc < %s -march=x86-64 | grep fld1
4
; This is basically this code on x86-64:
5
; _Complex long double test() { return 1.0; }
6
define {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
17
define {x86_fp80, x86_fp80} @test2() {
18
%A = fpext double 1.0 to x86_fp80
19
ret x86_fp80 %A, x86_fp80 %A
23
define 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
28
%c = getresult {x86_fp80,x86_fp80} %a, 1
29
store x86_fp80 %c, x86_fp80* %P2
33
; Uses both values, requires fxch
34
define 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
39
%c = getresult {x86_fp80,x86_fp80} %a, 0
40
store x86_fp80 %c, x86_fp80* %P2
44
; Uses ST(0), ST(1) is dead but must be popped.
45
define 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
52
; Uses ST(1), ST(0) is dead and must be popped.
53
define void @call4(x86_fp80 *%P1, x86_fp80 *%P2) {
54
%a = call {x86_fp80,x86_fp80} @test()
56
%c = getresult {x86_fp80,x86_fp80} %a, 1
57
store x86_fp80 %c, x86_fp80* %P2