blob: 779d0b4ce4c14b699093a37731f4218c36e5c929 [file] [log] [blame]
Arnold Schwaighofer373e8652007-10-12 21:30:57 +00001//===- X86.td - Target definition file for the Intel X86 ---*- tablegen -*-===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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//
17include "../Target.td"
18
19//===----------------------------------------------------------------------===//
20// X86 Subtarget features.
21//===----------------------------------------------------------------------===//
22
23def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
24 "Enable MMX instructions">;
25def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
26 "Enable SSE instructions",
27 [FeatureMMX]>;
28def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
29 "Enable SSE2 instructions",
30 [FeatureSSE1]>;
31def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
32 "Enable SSE3 instructions",
33 [FeatureSSE2]>;
34def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
35 "Enable SSSE3 instructions",
36 [FeatureSSE3]>;
Nate Begemanb2975562008-02-03 07:18:54 +000037def FeatureSSE41 : SubtargetFeature<"sse41", "X86SSELevel", "SSE41",
38 "Enable SSE 4.1 instructions",
39 [FeatureSSSE3]>;
40def FeatureSSE42 : SubtargetFeature<"sse42", "X86SSELevel", "SSE42",
41 "Enable SSE 4.2 instructions",
42 [FeatureSSE41]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000043def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
44 "Enable 3DNow! instructions">;
45def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
46 "Enable 3DNow! Athlon instructions",
47 [Feature3DNow]>;
48def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
49 "Support 64-bit instructions",
50 [FeatureSSE2]>;
51
52//===----------------------------------------------------------------------===//
53// X86 processors supported.
54//===----------------------------------------------------------------------===//
55
56class Proc<string Name, list<SubtargetFeature> Features>
57 : Processor<Name, NoItineraries, Features>;
58
59def : Proc<"generic", []>;
60def : Proc<"i386", []>;
61def : Proc<"i486", []>;
62def : Proc<"pentium", []>;
63def : Proc<"pentium-mmx", [FeatureMMX]>;
64def : Proc<"i686", []>;
65def : Proc<"pentiumpro", []>;
66def : Proc<"pentium2", [FeatureMMX]>;
67def : Proc<"pentium3", [FeatureSSE1]>;
68def : Proc<"pentium-m", [FeatureSSE2]>;
69def : Proc<"pentium4", [FeatureSSE2]>;
70def : Proc<"x86-64", [Feature64Bit]>;
71def : Proc<"yonah", [FeatureSSE3]>;
72def : Proc<"prescott", [FeatureSSE3]>;
Dale Johannesena5b0c082008-02-15 01:22:41 +000073def : Proc<"nocona", [FeatureSSE3, Feature64Bit]>;
74def : Proc<"core2", [FeatureSSSE3, Feature64Bit]>;
75def : Proc<"penryn", [FeatureSSE41, Feature64Bit]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000076
77def : Proc<"k6", [FeatureMMX]>;
78def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>;
79def : Proc<"k6-3", [FeatureMMX, Feature3DNow]>;
80def : Proc<"athlon", [FeatureMMX, Feature3DNowA]>;
81def : Proc<"athlon-tbird", [FeatureMMX, Feature3DNowA]>;
82def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA]>;
83def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA]>;
84def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA]>;
85def : Proc<"k8", [Feature3DNowA, Feature64Bit]>;
86def : Proc<"opteron", [Feature3DNowA, Feature64Bit]>;
87def : Proc<"athlon64", [Feature3DNowA, Feature64Bit]>;
88def : Proc<"athlon-fx", [Feature3DNowA, Feature64Bit]>;
89
90def : Proc<"winchip-c6", [FeatureMMX]>;
91def : Proc<"winchip2", [FeatureMMX, Feature3DNow]>;
92def : Proc<"c3", [FeatureMMX, Feature3DNow]>;
93def : Proc<"c3-2", [FeatureSSE1]>;
94
95//===----------------------------------------------------------------------===//
96// Register File Description
97//===----------------------------------------------------------------------===//
98
99include "X86RegisterInfo.td"
100
101//===----------------------------------------------------------------------===//
102// Instruction Descriptions
103//===----------------------------------------------------------------------===//
104
105include "X86InstrInfo.td"
106
107def X86InstrInfo : InstrInfo {
108
109 // Define how we want to layout our TargetSpecific information field... This
110 // should be kept up-to-date with the fields in the X86InstrInfo.h file.
111 let TSFlagsFields = ["FormBits",
112 "hasOpSizePrefix",
113 "hasAdSizePrefix",
114 "Prefix",
115 "hasREX_WPrefix",
116 "ImmTypeBits",
117 "FPFormBits",
Andrew Lenharth7a5a4b22008-03-01 13:37:02 +0000118 "hasLockPrefix",
Anton Korobeynikov975e1472008-10-11 19:09:15 +0000119 "SegOvrBits",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000120 "Opcode"];
121 let TSFlagsShifts = [0,
122 6,
123 7,
124 8,
125 12,
126 13,
127 16,
Andrew Lenharth7a5a4b22008-03-01 13:37:02 +0000128 19,
Anton Korobeynikov975e1472008-10-11 19:09:15 +0000129 20,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000130 24];
131}
132
133//===----------------------------------------------------------------------===//
134// Calling Conventions
135//===----------------------------------------------------------------------===//
136
137include "X86CallingConv.td"
138
139
140//===----------------------------------------------------------------------===//
141// Assembly Printers
142//===----------------------------------------------------------------------===//
143
144// The X86 target supports two different syntaxes for emitting machine code.
145// This is controlled by the -x86-asm-syntax={att|intel}
146def ATTAsmWriter : AsmWriter {
147 string AsmWriterClassName = "ATTAsmPrinter";
148 int Variant = 0;
149}
150def IntelAsmWriter : AsmWriter {
151 string AsmWriterClassName = "IntelAsmPrinter";
152 int Variant = 1;
153}
154
155
156def X86 : Target {
157 // Information about the instructions...
158 let InstructionSet = X86InstrInfo;
159
160 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
161}