blob: 905c704e7520b7680653d4ed2831da2e201c055e [file] [log] [blame]
Arnold Schwaighofer48abc5c2007-10-12 21:30:57 +00001//===- X86.td - Target definition file for the Intel X86 ---*- tablegen -*-===//
John Criswell856ba762003-10-21 15:17:13 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-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 Criswell856ba762003-10-21 15:17:13 +00007//
8//===----------------------------------------------------------------------===//
Chris Lattner762fb5f2003-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 Lattnerc8f45872003-08-04 04:59:56 +000015// Get the target-independent interfaces which we are implementing...
Chris Lattner762fb5f2003-08-03 15:47:49 +000016//
17include "../Target.td"
18
19//===----------------------------------------------------------------------===//
Evan Chenga26eb5e2006-10-06 09:17:41 +000020// X86 Subtarget features.
Bill Wendling4222d802007-05-04 20:38:40 +000021//===----------------------------------------------------------------------===//
Evan Chenga26eb5e2006-10-06 09:17:41 +000022
Bill Wendling4222d802007-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]>;
37def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
38 "Enable 3DNow! instructions">;
39def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendling11d8fda2007-05-06 07:56:19 +000040 "Enable 3DNow! Athlon instructions",
41 [Feature3DNow]>;
42def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
43 "Support 64-bit instructions",
Bill Wendlingcd6cea02007-05-22 05:15:37 +000044 [FeatureSSE2]>;
Evan Chenga26eb5e2006-10-06 09:17:41 +000045
46//===----------------------------------------------------------------------===//
47// X86 processors supported.
48//===----------------------------------------------------------------------===//
49
50class Proc<string Name, list<SubtargetFeature> Features>
51 : Processor<Name, NoItineraries, Features>;
52
53def : Proc<"generic", []>;
54def : Proc<"i386", []>;
55def : Proc<"i486", []>;
56def : Proc<"pentium", []>;
57def : Proc<"pentium-mmx", [FeatureMMX]>;
58def : Proc<"i686", []>;
59def : Proc<"pentiumpro", []>;
60def : Proc<"pentium2", [FeatureMMX]>;
Bill Wendlingcd6cea02007-05-22 05:15:37 +000061def : Proc<"pentium3", [FeatureSSE1]>;
62def : Proc<"pentium-m", [FeatureSSE2]>;
63def : Proc<"pentium4", [FeatureSSE2]>;
64def : Proc<"x86-64", [Feature64Bit]>;
65def : Proc<"yonah", [FeatureSSE3]>;
66def : Proc<"prescott", [FeatureSSE3]>;
67def : Proc<"nocona", [FeatureSSE3]>;
68def : Proc<"core2", [FeatureSSSE3]>;
Evan Chenga26eb5e2006-10-06 09:17:41 +000069
70def : Proc<"k6", [FeatureMMX]>;
Bill Wendlingcd6cea02007-05-22 05:15:37 +000071def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>;
72def : Proc<"k6-3", [FeatureMMX, Feature3DNow]>;
73def : Proc<"athlon", [FeatureMMX, Feature3DNowA]>;
74def : Proc<"athlon-tbird", [FeatureMMX, Feature3DNowA]>;
75def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA]>;
76def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA]>;
77def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA]>;
78def : Proc<"k8", [Feature3DNowA, Feature64Bit]>;
79def : Proc<"opteron", [Feature3DNowA, Feature64Bit]>;
80def : Proc<"athlon64", [Feature3DNowA, Feature64Bit]>;
81def : Proc<"athlon-fx", [Feature3DNowA, Feature64Bit]>;
Evan Chenga26eb5e2006-10-06 09:17:41 +000082
83def : Proc<"winchip-c6", [FeatureMMX]>;
84def : Proc<"winchip2", [FeatureMMX, Feature3DNow]>;
85def : Proc<"c3", [FeatureMMX, Feature3DNow]>;
Bill Wendlingcd6cea02007-05-22 05:15:37 +000086def : Proc<"c3-2", [FeatureSSE1]>;
Evan Chenga26eb5e2006-10-06 09:17:41 +000087
88//===----------------------------------------------------------------------===//
Chris Lattner762fb5f2003-08-03 15:47:49 +000089// Register File Description
90//===----------------------------------------------------------------------===//
91
92include "X86RegisterInfo.td"
93
Chris Lattnerb77eb782003-08-03 18:19:37 +000094//===----------------------------------------------------------------------===//
95// Instruction Descriptions
96//===----------------------------------------------------------------------===//
97
Chris Lattner1cca5e32003-08-03 21:54:21 +000098include "X86InstrInfo.td"
99
Chris Lattnerb77eb782003-08-03 18:19:37 +0000100def X86InstrInfo : InstrInfo {
Chris Lattner1cca5e32003-08-03 21:54:21 +0000101
102 // Define how we want to layout our TargetSpecific information field... This
103 // should be kept up-to-date with the fields in the X86InstrInfo.h file.
John Criswell4ffff9e2004-04-08 20:31:47 +0000104 let TSFlagsFields = ["FormBits",
105 "hasOpSizePrefix",
Evan Cheng25ab6902006-09-08 06:48:29 +0000106 "hasAdSizePrefix",
John Criswell4ffff9e2004-04-08 20:31:47 +0000107 "Prefix",
Evan Cheng25ab6902006-09-08 06:48:29 +0000108 "hasREX_WPrefix",
John Criswell4ffff9e2004-04-08 20:31:47 +0000109 "ImmTypeBits",
110 "FPFormBits",
John Criswell4ffff9e2004-04-08 20:31:47 +0000111 "Opcode"];
112 let TSFlagsShifts = [0,
John Criswell4ffff9e2004-04-08 20:31:47 +0000113 6,
Evan Cheng3c55c542006-02-01 06:13:50 +0000114 7,
Evan Cheng25ab6902006-09-08 06:48:29 +0000115 8,
116 12,
Evan Cheng3c55c542006-02-01 06:13:50 +0000117 13,
Evan Cheng25ab6902006-09-08 06:48:29 +0000118 16,
119 24];
Chris Lattnerb77eb782003-08-03 18:19:37 +0000120}
121
Chris Lattner31c8a6d2007-02-26 18:17:14 +0000122//===----------------------------------------------------------------------===//
123// Calling Conventions
124//===----------------------------------------------------------------------===//
125
126include "X86CallingConv.td"
127
128
129//===----------------------------------------------------------------------===//
130// Assembly Printers
131//===----------------------------------------------------------------------===//
132
Chris Lattner9a3e49a2004-10-03 20:36:57 +0000133// The X86 target supports two different syntaxes for emitting machine code.
134// This is controlled by the -x86-asm-syntax={att|intel}
135def ATTAsmWriter : AsmWriter {
136 string AsmWriterClassName = "ATTAsmPrinter";
137 int Variant = 0;
138}
139def IntelAsmWriter : AsmWriter {
140 string AsmWriterClassName = "IntelAsmPrinter";
141 int Variant = 1;
142}
143
144
Chris Lattnerb77eb782003-08-03 18:19:37 +0000145def X86 : Target {
Chris Lattnerb77eb782003-08-03 18:19:37 +0000146 // Information about the instructions...
Chris Lattnerc8f45872003-08-04 04:59:56 +0000147 let InstructionSet = X86InstrInfo;
Chris Lattner9a3e49a2004-10-03 20:36:57 +0000148
149 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnerb77eb782003-08-03 18:19:37 +0000150}