Add support for our first SSSE3 instruction "pmulhrsw".
[oota-llvm.git] / lib / Target / X86 / X86.td
1 //===- X86.td - Target definition file for the Intel X86 arch ---*- C++ -*-===//
2 // 
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 //===----------------------------------------------------------------------===//
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 "../Target.td"
18
19 //===----------------------------------------------------------------------===//
20 // X86 Subtarget features.
21 //
22  
23 def Feature64Bit     : SubtargetFeature<"64bit", "HasX86_64", "true",
24                                         "Support 64-bit instructions">;
25 def FeatureMMX       : SubtargetFeature<"mmx","X86SSELevel", "MMX",
26                                         "Enable MMX instructions">;
27 def FeatureSSE1      : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
28                                         "Enable SSE instructions">;
29 def FeatureSSE2      : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
30                                         "Enable SSE2 instructions">;
31 def FeatureSSE3      : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
32                                         "Enable SSE3 instructions">;
33 def FeatureSSSE3     : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
34                                         "Enable SSSE3 instructions">;
35 def Feature3DNow     : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
36                                         "Enable 3DNow! instructions">;
37 def Feature3DNowA    : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
38                                         "Enable 3DNow! Athlon instructions">;
39
40 //===----------------------------------------------------------------------===//
41 // X86 processors supported.
42 //===----------------------------------------------------------------------===//
43
44 class Proc<string Name, list<SubtargetFeature> Features>
45  : Processor<Name, NoItineraries, Features>;
46
47 def : Proc<"generic",         []>;
48 def : Proc<"i386",            []>;
49 def : Proc<"i486",            []>;
50 def : Proc<"pentium",         []>;
51 def : Proc<"pentium-mmx",     [FeatureMMX]>;
52 def : Proc<"i686",            []>;
53 def : Proc<"pentiumpro",      []>;
54 def : Proc<"pentium2",        [FeatureMMX]>;
55 def : Proc<"pentium3",        [FeatureMMX, FeatureSSE1]>;
56 def : Proc<"pentium-m",       [FeatureMMX, FeatureSSE1, FeatureSSE2]>;
57 def : Proc<"pentium4",        [FeatureMMX, FeatureSSE1, FeatureSSE2]>;
58 def : Proc<"x86-64",          [FeatureMMX, FeatureSSE1, FeatureSSE2,
59                                Feature64Bit]>;
60 def : Proc<"yonah",           [FeatureMMX, FeatureSSE1, FeatureSSE2,
61                                FeatureSSE3]>;
62 def : Proc<"prescott",        [FeatureMMX, FeatureSSE1, FeatureSSE2,
63                                FeatureSSE3]>;
64 def : Proc<"nocona",          [FeatureMMX, FeatureSSE1, FeatureSSE2,
65                                FeatureSSE3, Feature64Bit]>;
66 def : Proc<"core2",           [FeatureMMX, FeatureSSE1, FeatureSSE2,
67                                FeatureSSE3,  Feature64Bit]>;
68
69 def : Proc<"k6",              [FeatureMMX]>;
70 def : Proc<"k6-2",            [FeatureMMX, Feature3DNow]>;
71 def : Proc<"k6-3",            [FeatureMMX, Feature3DNow]>;
72 def : Proc<"athlon",          [FeatureMMX, Feature3DNow, Feature3DNowA]>;
73 def : Proc<"athlon-tbird",    [FeatureMMX, Feature3DNow, Feature3DNowA]>;
74 def : Proc<"athlon-4",        [FeatureMMX, FeatureSSE1, Feature3DNow,
75                                Feature3DNowA]>;
76 def : Proc<"athlon-xp",       [FeatureMMX, FeatureSSE1, Feature3DNow,
77                                Feature3DNowA]>;
78 def : Proc<"athlon-mp",       [FeatureMMX, FeatureSSE1, Feature3DNow,
79                                Feature3DNowA]>;
80 def : Proc<"k8",              [FeatureMMX, FeatureSSE1, FeatureSSE2,
81                                Feature3DNow, Feature3DNowA, Feature64Bit]>;
82 def : Proc<"opteron",         [FeatureMMX, FeatureSSE1, FeatureSSE2,
83                                Feature3DNow, Feature3DNowA, Feature64Bit]>;
84 def : Proc<"athlon64",        [FeatureMMX, FeatureSSE1, FeatureSSE2,
85                                Feature3DNow, Feature3DNowA, Feature64Bit]>;
86 def : Proc<"athlon-fx",       [FeatureMMX, FeatureSSE1, FeatureSSE2,
87                                Feature3DNow, Feature3DNowA, Feature64Bit]>;
88
89 def : Proc<"winchip-c6",      [FeatureMMX]>;
90 def : Proc<"winchip2",        [FeatureMMX, Feature3DNow]>;
91 def : Proc<"c3",              [FeatureMMX, Feature3DNow]>;
92 def : Proc<"c3-2",            [FeatureMMX, FeatureSSE1]>;
93
94 //===----------------------------------------------------------------------===//
95 // Register File Description
96 //===----------------------------------------------------------------------===//
97
98 include "X86RegisterInfo.td"
99
100 //===----------------------------------------------------------------------===//
101 // Instruction Descriptions
102 //===----------------------------------------------------------------------===//
103
104 include "X86InstrInfo.td"
105
106 def X86InstrInfo : InstrInfo {
107
108   // Define how we want to layout our TargetSpecific information field... This
109   // should be kept up-to-date with the fields in the X86InstrInfo.h file.
110   let TSFlagsFields = ["FormBits",
111                        "hasOpSizePrefix",
112                        "hasAdSizePrefix",
113                        "Prefix",
114                        "hasREX_WPrefix",
115                        "ImmTypeBits",
116                        "FPFormBits",
117                        "Opcode"];
118   let TSFlagsShifts = [0,
119                        6,
120                        7,
121                        8,
122                        12,
123                        13,
124                        16,
125                        24];
126 }
127
128 //===----------------------------------------------------------------------===//
129 // Calling Conventions
130 //===----------------------------------------------------------------------===//
131
132 include "X86CallingConv.td"
133
134
135 //===----------------------------------------------------------------------===//
136 // Assembly Printers
137 //===----------------------------------------------------------------------===//
138
139 // The X86 target supports two different syntaxes for emitting machine code.
140 // This is controlled by the -x86-asm-syntax={att|intel}
141 def ATTAsmWriter : AsmWriter {
142   string AsmWriterClassName  = "ATTAsmPrinter";
143   int Variant = 0;
144 }
145 def IntelAsmWriter : AsmWriter {
146   string AsmWriterClassName  = "IntelAsmPrinter";
147   int Variant = 1;
148 }
149
150
151 def X86 : Target {
152   // Information about the instructions...
153   let InstructionSet = X86InstrInfo;
154
155   let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
156 }