Update CPU capabilities for AMD machines
[oota-llvm.git] / lib / Target / X86 / X86.td
1 //===- X86.td - Target definition file for the Intel X86 ---*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This is a target description file for the Intel i386 architecture, refered to
11 // here as the "X86" architecture.
12 //
13 //===----------------------------------------------------------------------===//
14
15 // Get the target-independent interfaces which we are implementing...
16 //
17 include "llvm/Target/Target.td"
18
19 //===----------------------------------------------------------------------===//
20 // X86 Subtarget features.
21 //===----------------------------------------------------------------------===//
22  
23 def FeatureMMX     : SubtargetFeature<"mmx","X86SSELevel", "MMX",
24                                       "Enable MMX instructions">;
25 def FeatureSSE1    : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
26                                       "Enable SSE instructions",
27                                       [FeatureMMX]>;
28 def FeatureSSE2    : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
29                                       "Enable SSE2 instructions",
30                                       [FeatureSSE1]>;
31 def FeatureSSE3    : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
32                                       "Enable SSE3 instructions",
33                                       [FeatureSSE2]>;
34 def FeatureSSSE3   : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
35                                       "Enable SSSE3 instructions",
36                                       [FeatureSSE3]>;
37 def FeatureSSE41   : SubtargetFeature<"sse41", "X86SSELevel", "SSE41",
38                                       "Enable SSE 4.1 instructions",
39                                       [FeatureSSSE3]>;
40 def FeatureSSE42   : SubtargetFeature<"sse42", "X86SSELevel", "SSE42",
41                                       "Enable SSE 4.2 instructions",
42                                       [FeatureSSE41]>;
43 def Feature3DNow   : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
44                                       "Enable 3DNow! instructions">;
45 def Feature3DNowA  : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
46                                       "Enable 3DNow! Athlon instructions",
47                                       [Feature3DNow]>;
48 // All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
49 // feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
50 // without disabling 64-bit mode.
51 def Feature64Bit   : SubtargetFeature<"64bit", "HasX86_64", "true",
52                                       "Support 64-bit instructions">;
53 def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
54                                        "Bit testing of memory is slow">;
55 def FeatureSSE4A   : SubtargetFeature<"sse4a", "HasSSE4A", "true",
56                                       "Support SSE 4a instructions">;
57
58 //===----------------------------------------------------------------------===//
59 // X86 processors supported.
60 //===----------------------------------------------------------------------===//
61
62 class Proc<string Name, list<SubtargetFeature> Features>
63  : Processor<Name, NoItineraries, Features>;
64
65 def : Proc<"generic",         []>;
66 def : Proc<"i386",            []>;
67 def : Proc<"i486",            []>;
68 def : Proc<"i586",            []>;
69 def : Proc<"pentium",         []>;
70 def : Proc<"pentium-mmx",     [FeatureMMX]>;
71 def : Proc<"i686",            []>;
72 def : Proc<"pentiumpro",      []>;
73 def : Proc<"pentium2",        [FeatureMMX]>;
74 def : Proc<"pentium3",        [FeatureSSE1]>;
75 def : Proc<"pentium-m",       [FeatureSSE2, FeatureSlowBTMem]>;
76 def : Proc<"pentium4",        [FeatureSSE2]>;
77 def : Proc<"x86-64",          [FeatureSSE2,   Feature64Bit, FeatureSlowBTMem]>;
78 def : Proc<"yonah",           [FeatureSSE3, FeatureSlowBTMem]>;
79 def : Proc<"prescott",        [FeatureSSE3, FeatureSlowBTMem]>;
80 def : Proc<"nocona",          [FeatureSSE3,   Feature64Bit, FeatureSlowBTMem]>;
81 def : Proc<"core2",           [FeatureSSSE3,  Feature64Bit, FeatureSlowBTMem]>;
82 def : Proc<"penryn",          [FeatureSSE41,  Feature64Bit, FeatureSlowBTMem]>;
83 def : Proc<"atom",            [FeatureSSE3,   Feature64Bit, FeatureSlowBTMem]>;
84 def : Proc<"corei7",          [FeatureSSE42,  Feature64Bit, FeatureSlowBTMem]>;
85
86 def : Proc<"k6",              [FeatureMMX]>;
87 def : Proc<"k6-2",            [FeatureMMX,    Feature3DNow]>;
88 def : Proc<"k6-3",            [FeatureMMX,    Feature3DNow]>;
89 def : Proc<"athlon",          [FeatureMMX,    Feature3DNowA, FeatureSlowBTMem]>;
90 def : Proc<"athlon-tbird",    [FeatureMMX,    Feature3DNowA, FeatureSlowBTMem]>;
91 def : Proc<"athlon-4",        [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
92 def : Proc<"athlon-xp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
93 def : Proc<"athlon-mp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
94 def : Proc<"k8",              [FeatureSSE2,   Feature3DNowA, Feature64Bit,
95                                FeatureSlowBTMem]>;
96 def : Proc<"opteron",         [FeatureSSE2,   Feature3DNowA, Feature64Bit,
97                                FeatureSlowBTMem]>;
98 def : Proc<"athlon64",        [FeatureSSE2,   Feature3DNowA, Feature64Bit,
99                                FeatureSlowBTMem]>;
100 def : Proc<"athlon-fx",       [FeatureSSE2,   Feature3DNowA, Feature64Bit,
101                                FeatureSlowBTMem]>;
102 def : Proc<"k8-sse3",         [FeatureSSE3,   Feature3DNowA, Feature64Bit,
103                                FeatureSlowBTMem]>;
104 def : Proc<"opteron-sse3",    [FeatureSSE3,   Feature3DNowA, Feature64Bit,
105                                FeatureSlowBTMem]>;
106 def : Proc<"athlon64-sse3",   [FeatureSSE3,   Feature3DNowA, Feature64Bit,
107                                FeatureSlowBTMem]>;
108 def : Proc<"amdfam10",        [FeatureSSE3,   FeatureSSE4A,
109                                Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>;
110 def : Proc<"barcelona",       [FeatureSSE3,   FeatureSSE4A,
111                                Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>;
112
113 def : Proc<"winchip-c6",      [FeatureMMX]>;
114 def : Proc<"winchip2",        [FeatureMMX, Feature3DNow]>;
115 def : Proc<"c3",              [FeatureMMX, Feature3DNow]>;
116 def : Proc<"c3-2",            [FeatureSSE1]>;
117
118 //===----------------------------------------------------------------------===//
119 // Register File Description
120 //===----------------------------------------------------------------------===//
121
122 include "X86RegisterInfo.td"
123
124 //===----------------------------------------------------------------------===//
125 // Instruction Descriptions
126 //===----------------------------------------------------------------------===//
127
128 include "X86InstrInfo.td"
129
130 def X86InstrInfo : InstrInfo {
131
132   // Define how we want to layout our TargetSpecific information field... This
133   // should be kept up-to-date with the fields in the X86InstrInfo.h file.
134   let TSFlagsFields = ["FormBits",
135                        "hasOpSizePrefix",
136                        "hasAdSizePrefix",
137                        "Prefix",
138                        "hasREX_WPrefix",
139                        "ImmTypeBits",
140                        "FPFormBits",
141                        "hasLockPrefix",
142                        "SegOvrBits",
143                        "Opcode"];
144   let TSFlagsShifts = [0,
145                        6,
146                        7,
147                        8,
148                        12,
149                        13,
150                        16,
151                        19,
152                        20,
153                        24];
154 }
155
156 //===----------------------------------------------------------------------===//
157 // Calling Conventions
158 //===----------------------------------------------------------------------===//
159
160 include "X86CallingConv.td"
161
162
163 //===----------------------------------------------------------------------===//
164 // Assembly Printers
165 //===----------------------------------------------------------------------===//
166
167 // The X86 target supports two different syntaxes for emitting machine code.
168 // This is controlled by the -x86-asm-syntax={att|intel}
169 def ATTAsmWriter : AsmWriter {
170   string AsmWriterClassName  = "ATTAsmPrinter";
171   int Variant = 0;
172 }
173 def IntelAsmWriter : AsmWriter {
174   string AsmWriterClassName  = "IntelAsmPrinter";
175   int Variant = 1;
176 }
177
178
179 def X86 : Target {
180   // Information about the instructions...
181   let InstructionSet = X86InstrInfo;
182
183   let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
184 }