1; RUN: llc < %s -march=x86 | grep fldz 2; RUN: llc < %s -march=x86-64 | grep fld1 3 4%0 = type { x86_fp80, x86_fp80 } 5 6; This is basically this code on x86-64: 7; _Complex long double test() { return 1.0; } 8define %0 @test() { 9 %A = fpext double 1.0 to x86_fp80 10 %B = fpext double 0.0 to x86_fp80 11 %mrv = insertvalue %0 undef, x86_fp80 %A, 0 12 %mrv1 = insertvalue %0 %mrv, x86_fp80 %B, 1 13 ret %0 %mrv1 14} 15 16 17;_test2: 18; fld1 19; fld %st(0) 20; ret 21define %0 @test2() { 22 %A = fpext double 1.0 to x86_fp80 23 %mrv = insertvalue %0 undef, x86_fp80 %A, 0 24 %mrv1 = insertvalue %0 %mrv, x86_fp80 %A, 1 25 ret %0 %mrv1 26} 27 28; Uses both values. 29define void @call1(x86_fp80 *%P1, x86_fp80 *%P2) { 30 %a = call %0 @test() 31 %b = extractvalue %0 %a, 0 32 store x86_fp80 %b, x86_fp80* %P1 33 34 %c = extractvalue %0 %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 %0 @test() 42 %b = extractvalue %0 %a, 1 43 store x86_fp80 %b, x86_fp80* %P1 44 45 %c = extractvalue %0 %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 %0 @test() 53 %b = extractvalue %0 %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 %0 @test() 61 62 %c = extractvalue %0 %a, 1 63 store x86_fp80 %c, x86_fp80* %P2 64 ret void 65} 66 67