1 //===---------------------------------------------------------------------===//
2 // Random ideas for the X86 backend: FP stack related stuff
3 //===---------------------------------------------------------------------===//
5 //===---------------------------------------------------------------------===//
7 Some targets (e.g. athlons) prefer freep to fstp ST(0):
8 http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00659.html
10 //===---------------------------------------------------------------------===//
12 On darwin/x86, we should codegen:
14 ret double 0.000000e+00
24 //===---------------------------------------------------------------------===//
26 This should use fiadd on chips where it is profitable:
27 double foo(double P, int *I) { return P+*I; }
29 We have fiadd patterns now but the followings have the same cost and
30 complexity. We need a way to specify the later is more profitable.
32 def FpADD32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW,
33 [(set RFP:$dst, (fadd RFP:$src1,
34 (extloadf64f32 addr:$src2)))]>;
35 // ST(0) = ST(0) + [mem32]
37 def FpIADD32m : FpI<(ops RFP:$dst, RFP:$src1, i32mem:$src2), OneArgFPRW,
38 [(set RFP:$dst, (fadd RFP:$src1,
39 (X86fild addr:$src2, i32)))]>;
40 // ST(0) = ST(0) + [mem32int]
42 //===---------------------------------------------------------------------===//
44 The FP stackifier needs to be global. Also, it should handle simple permutates
45 to reduce number of shuffle instructions, e.g. turning:
58 http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02410.html
61 //===---------------------------------------------------------------------===//
63 Add a target specific hook to DAG combiner to handle SINT_TO_FP and
64 FP_TO_SINT when the source operand is already in memory.
66 //===---------------------------------------------------------------------===//
68 Open code rint,floor,ceil,trunc:
69 http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02006.html
70 http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02011.html
72 Opencode the sincos[f] libcall.
74 //===---------------------------------------------------------------------===//
76 None of the FPStack instructions are handled in
77 X86RegisterInfo::foldMemoryOperand, which prevents the spiller from
78 folding spill code into the instructions.
80 //===---------------------------------------------------------------------===//
82 Currently the x86 codegen isn't very good at mixing SSE and FPStack
85 unsigned int foo(double x) { return x; }
97 This will be solved when we go to a dynamic programming based isel.
99 //===---------------------------------------------------------------------===//