blob: 3049a861e26ec6bb42ba8b40855d6cc50894c7fd [file] [log] [blame]
Chris Lattner762fb5f2003-08-03 15:47:49 +00001//===- X86.td - Target definition file for the Intel X86 arch ---*- C++ -*-===//
John Criswell856ba762003-10-21 15:17:13 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
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.
21//
22
23def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
24 "Support 64-bit instructions">;
25def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
26 "Enable MMX instructions">;
27def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
28 "Enable SSE instructions">;
29def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
30 "Enable SSE2 instructions">;
31def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
32 "Enable SSE3 instructions">;
33def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
34 "Enable 3DNow! instructions">;
35def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
36 "Enable 3DNow! Athlon instructions">;
37
38//===----------------------------------------------------------------------===//
39// X86 processors supported.
40//===----------------------------------------------------------------------===//
41
42class Proc<string Name, list<SubtargetFeature> Features>
43 : Processor<Name, NoItineraries, Features>;
44
45def : Proc<"generic", []>;
46def : Proc<"i386", []>;
47def : Proc<"i486", []>;
48def : Proc<"pentium", []>;
49def : Proc<"pentium-mmx", [FeatureMMX]>;
50def : Proc<"i686", []>;
51def : Proc<"pentiumpro", []>;
52def : Proc<"pentium2", [FeatureMMX]>;
53def : Proc<"pentium3", [FeatureMMX, FeatureSSE1]>;
54def : Proc<"pentium-m", [FeatureMMX, FeatureSSE1, FeatureSSE2]>;
55def : Proc<"pentium4", [FeatureMMX, FeatureSSE1, FeatureSSE2]>;
56def : Proc<"x86-64", [FeatureMMX, FeatureSSE1, FeatureSSE2,
57 Feature64Bit]>;
58def : Proc<"yonah", [FeatureMMX, FeatureSSE1, FeatureSSE2,
59 FeatureSSE3]>;
60def : Proc<"prescott", [FeatureMMX, FeatureSSE1, FeatureSSE2,
61 FeatureSSE3]>;
62def : Proc<"nocona", [FeatureMMX, FeatureSSE1, FeatureSSE2,
63 FeatureSSE3, Feature64Bit]>;
64def : Proc<"core2", [FeatureMMX, FeatureSSE1, FeatureSSE2,
65 FeatureSSE3, Feature64Bit]>;
66
67def : Proc<"k6", [FeatureMMX]>;
68def : Proc<"k6-2", [FeatureMMX, Feature3DNow]>;
69def : Proc<"k6-3", [FeatureMMX, Feature3DNow]>;
70def : Proc<"athlon", [FeatureMMX, Feature3DNow, Feature3DNowA]>;
71def : Proc<"athlon-tbird", [FeatureMMX, Feature3DNow, Feature3DNowA]>;
72def : Proc<"athlon-4", [FeatureMMX, FeatureSSE1, Feature3DNow,
73 Feature3DNowA]>;
74def : Proc<"athlon-xp", [FeatureMMX, FeatureSSE1, Feature3DNow,
75 Feature3DNowA]>;
76def : Proc<"athlon-mp", [FeatureMMX, FeatureSSE1, Feature3DNow,
77 Feature3DNowA]>;
78def : Proc<"k8", [FeatureMMX, FeatureSSE1, FeatureSSE2,
79 Feature3DNow, Feature3DNowA, Feature64Bit]>;
80def : Proc<"opteron", [FeatureMMX, FeatureSSE1, FeatureSSE2,
81 Feature3DNow, Feature3DNowA, Feature64Bit]>;
82def : Proc<"athlon64", [FeatureMMX, FeatureSSE1, FeatureSSE2,
83 Feature3DNow, Feature3DNowA, Feature64Bit]>;
84def : Proc<"athlon-fx", [FeatureMMX, FeatureSSE1, FeatureSSE2,
85 Feature3DNow, Feature3DNowA, Feature64Bit]>;
86
87def : Proc<"winchip-c6", [FeatureMMX]>;
88def : Proc<"winchip2", [FeatureMMX, Feature3DNow]>;
89def : Proc<"c3", [FeatureMMX, Feature3DNow]>;
90def : Proc<"c3-2", [FeatureMMX, FeatureSSE1]>;
91
92//===----------------------------------------------------------------------===//
Chris Lattner762fb5f2003-08-03 15:47:49 +000093// Register File Description
94//===----------------------------------------------------------------------===//
95
96include "X86RegisterInfo.td"
97
Chris Lattnerb77eb782003-08-03 18:19:37 +000098//===----------------------------------------------------------------------===//
99// Instruction Descriptions
100//===----------------------------------------------------------------------===//
101
Chris Lattner1cca5e32003-08-03 21:54:21 +0000102include "X86InstrInfo.td"
103
Chris Lattnerb77eb782003-08-03 18:19:37 +0000104def X86InstrInfo : InstrInfo {
Chris Lattner1cca5e32003-08-03 21:54:21 +0000105
106 // Define how we want to layout our TargetSpecific information field... This
107 // should be kept up-to-date with the fields in the X86InstrInfo.h file.
John Criswell4ffff9e2004-04-08 20:31:47 +0000108 let TSFlagsFields = ["FormBits",
109 "hasOpSizePrefix",
Evan Cheng25ab6902006-09-08 06:48:29 +0000110 "hasAdSizePrefix",
John Criswell4ffff9e2004-04-08 20:31:47 +0000111 "Prefix",
Evan Cheng25ab6902006-09-08 06:48:29 +0000112 "hasREX_WPrefix",
John Criswell4ffff9e2004-04-08 20:31:47 +0000113 "ImmTypeBits",
114 "FPFormBits",
John Criswell4ffff9e2004-04-08 20:31:47 +0000115 "Opcode"];
116 let TSFlagsShifts = [0,
John Criswell4ffff9e2004-04-08 20:31:47 +0000117 6,
Evan Cheng3c55c542006-02-01 06:13:50 +0000118 7,
Evan Cheng25ab6902006-09-08 06:48:29 +0000119 8,
120 12,
Evan Cheng3c55c542006-02-01 06:13:50 +0000121 13,
Evan Cheng25ab6902006-09-08 06:48:29 +0000122 16,
123 24];
Chris Lattnerb77eb782003-08-03 18:19:37 +0000124}
125
Chris Lattner31c8a6d2007-02-26 18:17:14 +0000126//===----------------------------------------------------------------------===//
127// Calling Conventions
128//===----------------------------------------------------------------------===//
129
130include "X86CallingConv.td"
131
132
133//===----------------------------------------------------------------------===//
134// Assembly Printers
135//===----------------------------------------------------------------------===//
136
Chris Lattner9a3e49a2004-10-03 20:36:57 +0000137// The X86 target supports two different syntaxes for emitting machine code.
138// This is controlled by the -x86-asm-syntax={att|intel}
139def ATTAsmWriter : AsmWriter {
140 string AsmWriterClassName = "ATTAsmPrinter";
141 int Variant = 0;
142}
143def IntelAsmWriter : AsmWriter {
144 string AsmWriterClassName = "IntelAsmPrinter";
145 int Variant = 1;
146}
147
148
Chris Lattnerb77eb782003-08-03 18:19:37 +0000149def X86 : Target {
Chris Lattnerb77eb782003-08-03 18:19:37 +0000150 // Information about the instructions...
Chris Lattnerc8f45872003-08-04 04:59:56 +0000151 let InstructionSet = X86InstrInfo;
Chris Lattner9a3e49a2004-10-03 20:36:57 +0000152
153 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnerb77eb782003-08-03 18:19:37 +0000154}