blob: c9f23d598be5be31d889b4501ec6ebc422217f82 [file] [log] [blame]
Chris Lattner1171ff42005-10-23 19:52:42 +00001//===---------------------------------------------------------------------===//
2// Random ideas for the X86 backend.
3//===---------------------------------------------------------------------===//
4
5Add a MUL2U and MUL2S nodes to represent a multiply that returns both the
6Hi and Lo parts (combination of MUL and MULH[SU] into one node). Add this to
7X86, & make the dag combiner produce it when needed. This will eliminate one
8imul from the code generated for:
9
10long long test(long long X, long long Y) { return X*Y; }
11
12by using the EAX result from the mul. We should add a similar node for
13DIVREM.
14
15//===---------------------------------------------------------------------===//
16
17This should be one DIV/IDIV instruction, not a libcall:
18
19unsigned test(unsigned long long X, unsigned Y) {
20 return X/Y;
21}
22
23This can be done trivially with a custom legalizer. What about overflow
24though? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14224
25
26//===---------------------------------------------------------------------===//
27
28Need to add support for rotate instructions.
29
30//===---------------------------------------------------------------------===//
31
32Some targets (e.g. athlons) prefer freep to fstp ST(0):
33http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00659.html
34
35//===---------------------------------------------------------------------===//
36
37This should use faddi on chips where it is profitable:
38double foo(double P, int *I) { return P+*I; }
39
40//===---------------------------------------------------------------------===//
41
42The FP stackifier needs to be global. Also, it should handle simple permutates
43to reduce number of shuffle instructions, e.g. turning:
44
45fld P -> fld Q
46fld Q fld P
47fxch
48
49or:
50
51fxch -> fucomi
52fucomi jl X
53jg X
54
55//===---------------------------------------------------------------------===//
56
57Improvements to the multiply -> shift/add algorithm:
58http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01590.html
59
60//===---------------------------------------------------------------------===//
61
62Improve code like this (occurs fairly frequently, e.g. in LLVM):
63long long foo(int x) { return 1LL << x; }
64
65http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01109.html
66http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01128.html
67http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01136.html
68
69Another useful one would be ~0ULL >> X and ~0ULL << X.
70
Chris Lattnerffff6172005-10-23 21:44:59 +000071//===---------------------------------------------------------------------===//
72
73Should support emission of the bswap instruction, probably by adding a new
74DAG node for byte swapping. Also useful on PPC which has byte-swapping loads.
75
Chris Lattner1e4ed932005-11-28 04:52:39 +000076//===---------------------------------------------------------------------===//
77
78Compile this:
79_Bool f(_Bool a) { return a!=1; }
80
81into:
82 movzbl %dil, %eax
83 xorl $1, %eax
84 ret