blob: 5fdcc696193a05c1e11e88014db61671ca0f02a1 [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
Chris Lattner865874c2005-12-02 00:11:20 +000015another case is:
16
17long long test(int X, int Y) { return (long long)X*Y; }
18
19... which should only be one imul instruction.
20
Chris Lattner1171ff42005-10-23 19:52:42 +000021//===---------------------------------------------------------------------===//
22
23This should be one DIV/IDIV instruction, not a libcall:
24
25unsigned test(unsigned long long X, unsigned Y) {
26 return X/Y;
27}
28
29This can be done trivially with a custom legalizer. What about overflow
30though? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14224
31
32//===---------------------------------------------------------------------===//
33
34Need to add support for rotate instructions.
35
36//===---------------------------------------------------------------------===//
37
38Some targets (e.g. athlons) prefer freep to fstp ST(0):
39http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00659.html
40
41//===---------------------------------------------------------------------===//
42
43This should use faddi on chips where it is profitable:
44double foo(double P, int *I) { return P+*I; }
45
46//===---------------------------------------------------------------------===//
47
48The FP stackifier needs to be global. Also, it should handle simple permutates
49to reduce number of shuffle instructions, e.g. turning:
50
51fld P -> fld Q
52fld Q fld P
53fxch
54
55or:
56
57fxch -> fucomi
58fucomi jl X
59jg X
60
61//===---------------------------------------------------------------------===//
62
63Improvements to the multiply -> shift/add algorithm:
64http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01590.html
65
66//===---------------------------------------------------------------------===//
67
68Improve code like this (occurs fairly frequently, e.g. in LLVM):
69long long foo(int x) { return 1LL << x; }
70
71http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01109.html
72http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01128.html
73http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01136.html
74
75Another useful one would be ~0ULL >> X and ~0ULL << X.
76
Chris Lattnerffff6172005-10-23 21:44:59 +000077//===---------------------------------------------------------------------===//
78
79Should support emission of the bswap instruction, probably by adding a new
80DAG node for byte swapping. Also useful on PPC which has byte-swapping loads.
81
Chris Lattner1e4ed932005-11-28 04:52:39 +000082//===---------------------------------------------------------------------===//
83
84Compile this:
85_Bool f(_Bool a) { return a!=1; }
86
87into:
88 movzbl %dil, %eax
89 xorl $1, %eax
90 ret
Evan Cheng8dee8cc2005-12-17 01:25:19 +000091
92//===---------------------------------------------------------------------===//
93
94Some isel ideas:
95
961. Dynamic programming based approach when compile time if not an
97 issue.
982. Code duplication (addressing mode) during isel.
993. Other ideas from "Register-Sensitive Selection, Duplication, and
100 Sequencing of Instructions".
101
102//===---------------------------------------------------------------------===//
103
104Should we promote i16 to i32 to avoid partial register update stalls?
Evan Cheng98abbfb2005-12-17 06:54:43 +0000105
106//===---------------------------------------------------------------------===//
107
108Leave any_extend as pseudo instruction and hint to register
109allocator. Delay codegen until post register allocation.