Use the default lowering of ISD::DYNAMIC_STACKALLOC, delete now dead code.
[oota-llvm.git] / lib / Target / X86 / README.txt
1 //===---------------------------------------------------------------------===//
2 // Random ideas for the X86 backend.
3 //===---------------------------------------------------------------------===//
4
5 Add a MUL2U and MUL2S nodes to represent a multiply that returns both the
6 Hi and Lo parts (combination of MUL and MULH[SU] into one node).  Add this to
7 X86, & make the dag combiner produce it when needed.  This will eliminate one
8 imul from the code generated for:
9
10 long long test(long long X, long long Y) { return X*Y; }
11
12 by using the EAX result from the mul.  We should add a similar node for
13 DIVREM.
14
15 another case is:
16
17 long long test(int X, int Y) { return (long long)X*Y; }
18
19 ... which should only be one imul instruction.
20
21 //===---------------------------------------------------------------------===//
22
23 This should be one DIV/IDIV instruction, not a libcall:
24
25 unsigned test(unsigned long long X, unsigned Y) {
26         return X/Y;
27 }
28
29 This can be done trivially with a custom legalizer.  What about overflow 
30 though?  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14224
31
32 //===---------------------------------------------------------------------===//
33
34 Some targets (e.g. athlons) prefer freep to fstp ST(0):
35 http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00659.html
36
37 //===---------------------------------------------------------------------===//
38
39 This should use fiadd on chips where it is profitable:
40 double foo(double P, int *I) { return P+*I; }
41
42 //===---------------------------------------------------------------------===//
43
44 The FP stackifier needs to be global.  Also, it should handle simple permutates
45 to reduce number of shuffle instructions, e.g. turning:
46
47 fld P   ->              fld Q
48 fld Q                   fld P
49 fxch
50
51 or:
52
53 fxch    ->              fucomi
54 fucomi                  jl X
55 jg X
56
57 //===---------------------------------------------------------------------===//
58
59 Improvements to the multiply -> shift/add algorithm:
60 http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01590.html
61
62 //===---------------------------------------------------------------------===//
63
64 Improve code like this (occurs fairly frequently, e.g. in LLVM):
65 long long foo(int x) { return 1LL << x; }
66
67 http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01109.html
68 http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01128.html
69 http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01136.html
70
71 Another useful one would be  ~0ULL >> X and ~0ULL << X.
72
73 //===---------------------------------------------------------------------===//
74
75 Should support emission of the bswap instruction, probably by adding a new
76 DAG node for byte swapping.  Also useful on PPC which has byte-swapping loads.
77
78 //===---------------------------------------------------------------------===//
79
80 Compile this:
81 _Bool f(_Bool a) { return a!=1; }
82
83 into:
84         movzbl  %dil, %eax
85         xorl    $1, %eax
86         ret
87
88 //===---------------------------------------------------------------------===//
89
90 Some isel ideas:
91
92 1. Dynamic programming based approach when compile time if not an
93    issue.
94 2. Code duplication (addressing mode) during isel.
95 3. Other ideas from "Register-Sensitive Selection, Duplication, and
96    Sequencing of Instructions".
97
98 //===---------------------------------------------------------------------===//
99
100 Should we promote i16 to i32 to avoid partial register update stalls?
101
102 //===---------------------------------------------------------------------===//
103
104 Leave any_extend as pseudo instruction and hint to register
105 allocator. Delay codegen until post register allocation.
106
107 //===---------------------------------------------------------------------===//
108
109 Add a target specific hook to DAG combiner to handle SINT_TO_FP and
110 FP_TO_SINT when the source operand is already in memory.
111
112 //===---------------------------------------------------------------------===//
113
114 Check if load folding would add a cycle in the dag.
115
116 //===---------------------------------------------------------------------===//
117
118 Model X86 EFLAGS as a real register to avoid redudant cmp / test. e.g.
119
120         cmpl $1, %eax
121         setg %al
122         testb %al, %al  # unnecessary
123         jne .BB7