blob: 0e2c98097ed416fb39dab64b4799a8526a777220 [file] [log] [blame]
Arnold Schwaighofer1f0da1f2007-10-12 21:30:57 +00001//===- X86.td - Target definition file for the Intel X86 ---*- tablegen -*-===//
John Criswell29265fe2003-10-21 15:17:13 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
John Criswell29265fe2003-10-21 15:17:13 +00007//
8//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +00009//
10// This is a target description file for the Intel i386 architecture, refered to
11// here as the "X86" architecture.
12//
13//===----------------------------------------------------------------------===//
14
Chris Lattner25510802003-08-04 04:59:56 +000015// Get the target-independent interfaces which we are implementing...
Chris Lattner5da8e802003-08-03 15:47:49 +000016//
Evan Cheng977e7be2008-11-24 07:34:46 +000017include "llvm/Target/Target.td"
Chris Lattner5da8e802003-08-03 15:47:49 +000018
19//===----------------------------------------------------------------------===//
Evan Chengff1beda2006-10-06 09:17:41 +000020// X86 Subtarget features.
Bill Wendlinge6182262007-05-04 20:38:40 +000021//===----------------------------------------------------------------------===//
Evan Chengff1beda2006-10-06 09:17:41 +000022
Bill Wendlinge6182262007-05-04 20:38:40 +000023def 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 Begemane14fdfa2008-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]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000043def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
44 "Enable 3DNow! instructions">;
45def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000046 "Enable 3DNow! Athlon instructions",
47 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000048// 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.
Bill Wendlingf985c492007-05-06 07:56:19 +000051def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Dan Gohman74037512009-02-03 00:04:43 +000052 "Support 64-bit instructions">;
Evan Cheng4c91aa32009-01-02 05:35:45 +000053def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
54 "Bit testing of memory is slow">;
Evan Chengff1beda2006-10-06 09:17:41 +000055
56//===----------------------------------------------------------------------===//
57// X86 processors supported.
58//===----------------------------------------------------------------------===//
59
60class Proc<string Name, list<SubtargetFeature> Features>
61 : Processor<Name, NoItineraries, Features>;
62
63def : Proc<"generic", []>;
64def : Proc<"i386", []>;
65def : Proc<"i486", []>;
Dale Johannesen28106752008-10-14 22:06:33 +000066def : Proc<"i586", []>;
Evan Chengff1beda2006-10-06 09:17:41 +000067def : Proc<"pentium", []>;
68def : Proc<"pentium-mmx", [FeatureMMX]>;
69def : Proc<"i686", []>;
70def : Proc<"pentiumpro", []>;
71def : Proc<"pentium2", [FeatureMMX]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +000072def : Proc<"pentium3", [FeatureSSE1]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000073def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +000074def : Proc<"pentium4", [FeatureSSE2]>;
Dan Gohman74037512009-02-03 00:04:43 +000075def : Proc<"x86-64", [FeatureSSE2, Feature64Bit, FeatureSlowBTMem]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000076def : Proc<"yonah", [FeatureSSE3, FeatureSlowBTMem]>;
77def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>;
78def : Proc<"nocona", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem]>;
79def : Proc<"core2", [FeatureSSSE3, Feature64Bit, FeatureSlowBTMem]>;
80def : Proc<"penryn", [FeatureSSE41, Feature64Bit, FeatureSlowBTMem]>;
Evan Cheng6e100a62009-01-03 04:24:44 +000081def : Proc<"atom", [FeatureSSE3, Feature64Bit, FeatureSlowBTMem]>;
82def : Proc<"corei7", [FeatureSSE42, Feature64Bit, FeatureSlowBTMem]>;
Evan Chengff1beda2006-10-06 09:17:41 +000083
84def : Proc<"k6", [FeatureMMX]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +000085def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>;
86def : Proc<"k6-3", [FeatureMMX, Feature3DNow]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000087def : Proc<"athlon", [FeatureMMX, Feature3DNowA, FeatureSlowBTMem]>;
88def : Proc<"athlon-tbird", [FeatureMMX, Feature3DNowA, FeatureSlowBTMem]>;
89def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem]>;
90def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem]>;
91def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem]>;
Dan Gohman74037512009-02-03 00:04:43 +000092def : Proc<"k8", [FeatureSSE2, Feature3DNowA, Feature64Bit,
93 FeatureSlowBTMem]>;
94def : Proc<"opteron", [FeatureSSE2, Feature3DNowA, Feature64Bit,
95 FeatureSlowBTMem]>;
96def : Proc<"athlon64", [FeatureSSE2, Feature3DNowA, Feature64Bit,
97 FeatureSlowBTMem]>;
98def : Proc<"athlon-fx", [FeatureSSE2, Feature3DNowA, Feature64Bit,
99 FeatureSlowBTMem]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000100
101def : Proc<"winchip-c6", [FeatureMMX]>;
102def : Proc<"winchip2", [FeatureMMX, Feature3DNow]>;
103def : Proc<"c3", [FeatureMMX, Feature3DNow]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000104def : Proc<"c3-2", [FeatureSSE1]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000105
106//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000107// Register File Description
108//===----------------------------------------------------------------------===//
109
110include "X86RegisterInfo.td"
111
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000112//===----------------------------------------------------------------------===//
113// Instruction Descriptions
114//===----------------------------------------------------------------------===//
115
Chris Lattner59a4a912003-08-03 21:54:21 +0000116include "X86InstrInfo.td"
117
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000118def X86InstrInfo : InstrInfo {
Chris Lattner59a4a912003-08-03 21:54:21 +0000119
120 // Define how we want to layout our TargetSpecific information field... This
121 // should be kept up-to-date with the fields in the X86InstrInfo.h file.
John Criswell10db0622004-04-08 20:31:47 +0000122 let TSFlagsFields = ["FormBits",
123 "hasOpSizePrefix",
Evan Cheng11b0a5d2006-09-08 06:48:29 +0000124 "hasAdSizePrefix",
John Criswell10db0622004-04-08 20:31:47 +0000125 "Prefix",
Evan Cheng11b0a5d2006-09-08 06:48:29 +0000126 "hasREX_WPrefix",
John Criswell10db0622004-04-08 20:31:47 +0000127 "ImmTypeBits",
128 "FPFormBits",
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000129 "hasLockPrefix",
Anton Korobeynikov25897772008-10-11 19:09:15 +0000130 "SegOvrBits",
John Criswell10db0622004-04-08 20:31:47 +0000131 "Opcode"];
132 let TSFlagsShifts = [0,
John Criswell10db0622004-04-08 20:31:47 +0000133 6,
Evan Cheng9e350cd2006-02-01 06:13:50 +0000134 7,
Evan Cheng11b0a5d2006-09-08 06:48:29 +0000135 8,
136 12,
Evan Cheng9e350cd2006-02-01 06:13:50 +0000137 13,
Evan Cheng11b0a5d2006-09-08 06:48:29 +0000138 16,
Andrew Lenharth0070dd12008-03-01 13:37:02 +0000139 19,
Anton Korobeynikov25897772008-10-11 19:09:15 +0000140 20,
Evan Cheng11b0a5d2006-09-08 06:48:29 +0000141 24];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000142}
143
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000144//===----------------------------------------------------------------------===//
145// Calling Conventions
146//===----------------------------------------------------------------------===//
147
148include "X86CallingConv.td"
149
150
151//===----------------------------------------------------------------------===//
152// Assembly Printers
153//===----------------------------------------------------------------------===//
154
Chris Lattner56832602004-10-03 20:36:57 +0000155// The X86 target supports two different syntaxes for emitting machine code.
156// This is controlled by the -x86-asm-syntax={att|intel}
157def ATTAsmWriter : AsmWriter {
158 string AsmWriterClassName = "ATTAsmPrinter";
159 int Variant = 0;
160}
161def IntelAsmWriter : AsmWriter {
162 string AsmWriterClassName = "IntelAsmPrinter";
163 int Variant = 1;
164}
165
166
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000167def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000168 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000169 let InstructionSet = X86InstrInfo;
Chris Lattner56832602004-10-03 20:36:57 +0000170
171 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000172}