blob: 2710425628a0eaaa7b2d3536674297fe0a465b8e [file] [log] [blame]
Chris Lattner434c7cb2010-10-05 05:32:15 +00001//===- X86InstrSystem.td - System Instructions -------------*- tablegen -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the X86 instructions that are generally used in
11// privileged modes. These are not typically used by the compiler, but are
12// supported for the assembler and disassembler.
13//
14//===----------------------------------------------------------------------===//
15
16let Defs = [RAX, RDX] in
Chris Lattner87be16a2010-10-05 06:04:14 +000017 def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +000018
19let Defs = [RAX, RCX, RDX] in
Chris Lattner87be16a2010-10-05 06:04:14 +000020 def RDTSCP : I<0x01, MRM_F9, (outs), (ins), "rdtscp", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +000021
22// CPU flow control instructions
23
Kevin Enderby529b1a42010-10-27 20:46:49 +000024let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in {
Chris Lattner87be16a2010-10-05 06:04:14 +000025 def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB;
Kevin Enderby529b1a42010-10-27 20:46:49 +000026 def UD2B : I<0xB9, RawFrm, (outs), (ins), "ud2b", []>, TB;
27}
Chris Lattner434c7cb2010-10-05 05:32:15 +000028
29def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", []>;
30def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", []>, TB;
31
32// Interrupt and SysCall Instructions.
33let Uses = [EFLAGS] in
34 def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>;
35def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3",
36 [(int_x86_int (i8 3))]>;
37def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap",
38 [(int_x86_int imm:$trap)]>;
39
Chris Lattner87be16a2010-10-05 06:04:14 +000040def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", []>, TB;
41def SYSRETL : I<0x07, RawFrm, (outs), (ins), "sysretl", []>, TB;
42def SYSRETQ :RI<0x07, RawFrm, (outs), (ins), "sysretq", []>, TB,
43 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000044
Chris Lattner87be16a2010-10-05 06:04:14 +000045def SYSENTER : I<0x34, RawFrm, (outs), (ins), "sysenter", []>, TB;
46
47def SYSEXIT : I<0x35, RawFrm, (outs), (ins), "sysexit", []>, TB,
48 Requires<[In32BitMode]>;
49def SYSEXIT64 :RI<0x35, RawFrm, (outs), (ins), "sysexit", []>, TB,
50 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000051
52def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iretw", []>, OpSize;
53def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l|d}", []>;
54def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iretq", []>,
55 Requires<[In64BitMode]>;
56
57
58//===----------------------------------------------------------------------===//
59// Input/Output Instructions.
60//
61let Defs = [AL], Uses = [DX] in
62def IN8rr : I<0xEC, RawFrm, (outs), (ins),
63 "in{b}\t{%dx, %al|%AL, %DX}", []>;
64let Defs = [AX], Uses = [DX] in
65def IN16rr : I<0xED, RawFrm, (outs), (ins),
66 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
67let Defs = [EAX], Uses = [DX] in
68def IN32rr : I<0xED, RawFrm, (outs), (ins),
69 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
70
71let Defs = [AL] in
72def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i8imm:$port),
73 "in{b}\t{$port, %al|%AL, $port}", []>;
74let Defs = [AX] in
75def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
76 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
77let Defs = [EAX] in
78def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
79 "in{l}\t{$port, %eax|%EAX, $port}", []>;
80
81let Uses = [DX, AL] in
82def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
83 "out{b}\t{%al, %dx|%DX, %AL}", []>;
84let Uses = [DX, AX] in
85def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
86 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
87let Uses = [DX, EAX] in
88def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
89 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
90
91let Uses = [AL] in
92def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i8imm:$port),
93 "out{b}\t{%al, $port|$port, %AL}", []>;
94let Uses = [AX] in
95def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
96 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
97let Uses = [EAX] in
98def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
99 "out{l}\t{%eax, $port|$port, %EAX}", []>;
100
Chris Lattner87be16a2010-10-05 06:04:14 +0000101def IN8 : I<0x6C, RawFrm, (outs), (ins), "ins{b}", []>;
102def IN16 : I<0x6D, RawFrm, (outs), (ins), "ins{w}", []>, OpSize;
103def IN32 : I<0x6D, RawFrm, (outs), (ins), "ins{l}", []>;
104
105//===----------------------------------------------------------------------===//
106// Moves to and from debug registers
107
108def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src),
109 "mov{l}\t{$src, $dst|$dst, $src}", []>, TB;
110def MOV64rd : I<0x21, MRMDestReg, (outs GR64:$dst), (ins DEBUG_REG:$src),
111 "mov{q}\t{$src, $dst|$dst, $src}", []>, TB;
112
113def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src),
114 "mov{l}\t{$src, $dst|$dst, $src}", []>, TB;
115def MOV64dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR64:$src),
116 "mov{q}\t{$src, $dst|$dst, $src}", []>, TB;
117
118//===----------------------------------------------------------------------===//
119// Moves to and from control registers
120
121def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src),
122 "mov{l}\t{$src, $dst|$dst, $src}", []>, TB;
123def MOV64rc : I<0x20, MRMDestReg, (outs GR64:$dst), (ins CONTROL_REG:$src),
124 "mov{q}\t{$src, $dst|$dst, $src}", []>, TB;
125
126def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src),
127 "mov{l}\t{$src, $dst|$dst, $src}", []>, TB;
128def MOV64cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR64:$src),
129 "mov{q}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000130
131//===----------------------------------------------------------------------===//
132// Segment override instruction prefixes
133
Chris Lattner87be16a2010-10-05 06:04:14 +0000134def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>;
135def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>;
136def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>;
137def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>;
138def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>;
139def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000140
141
142//===----------------------------------------------------------------------===//
Chris Lattner87be16a2010-10-05 06:04:14 +0000143// Moves to and from segment registers.
144//
145
146def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src),
147 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
148def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src),
149 "mov{l}\t{$src, $dst|$dst, $src}", []>;
150def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src),
151 "mov{q}\t{$src, $dst|$dst, $src}", []>;
152
153def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src),
154 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
155def MOV32ms : I<0x8C, MRMDestMem, (outs i32mem:$dst), (ins SEGMENT_REG:$src),
156 "mov{l}\t{$src, $dst|$dst, $src}", []>;
157def MOV64ms : RI<0x8C, MRMDestMem, (outs i64mem:$dst), (ins SEGMENT_REG:$src),
158 "mov{q}\t{$src, $dst|$dst, $src}", []>;
159
160def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src),
161 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
162def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src),
163 "mov{l}\t{$src, $dst|$dst, $src}", []>;
164def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src),
165 "mov{q}\t{$src, $dst|$dst, $src}", []>;
166
167def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src),
168 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
169def MOV32sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i32mem:$src),
170 "mov{l}\t{$src, $dst|$dst, $src}", []>;
171def MOV64sm : RI<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i64mem:$src),
172 "mov{q}\t{$src, $dst|$dst, $src}", []>;
173
174//===----------------------------------------------------------------------===//
Chris Lattner434c7cb2010-10-05 05:32:15 +0000175// Segmentation support instructions.
176
Chris Lattner87be16a2010-10-05 06:04:14 +0000177def SWAPGS : I<0x01, MRM_F8, (outs), (ins), "swapgs", []>, TB;
178
Chris Lattner434c7cb2010-10-05 05:32:15 +0000179def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
180 "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
181def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
182 "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
183
184// i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo.
185def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
186 "lar{l}\t{$src, $dst|$dst, $src}", []>, TB;
187def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
188 "lar{l}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000189// i16mem operand in LAR64rm and GR32 operand in LAR32rr is not a typo.
190def LAR64rm : RI<0x02, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src),
191 "lar{q}\t{$src, $dst|$dst, $src}", []>, TB;
192def LAR64rr : RI<0x02, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src),
193 "lar{q}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000194
195def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
196 "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
197def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
198 "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
199def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
200 "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB;
201def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
202 "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000203def LSL64rm : RI<0x03, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
204 "lsl{q}\t{$src, $dst|$dst, $src}", []>, TB;
205def LSL64rr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
206 "lsl{q}\t{$src, $dst|$dst, $src}", []>, TB;
207
Chris Lattner434c7cb2010-10-05 05:32:15 +0000208def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr", []>, TB;
209
Eli Friedmanac39bd52011-03-04 00:10:17 +0000210def STR16r : I<0x00, MRM1r, (outs GR16:$dst), (ins),
211 "str{w}\t{$dst}", []>, TB, OpSize;
212def STR32r : I<0x00, MRM1r, (outs GR32:$dst), (ins),
213 "str{l}\t{$dst}", []>, TB;
214def STR64r : RI<0x00, MRM1r, (outs GR64:$dst), (ins),
215 "str{q}\t{$dst}", []>, TB;
216def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins),
217 "str{w}\t{$dst}", []>, TB;
218
Chris Lattner434c7cb2010-10-05 05:32:15 +0000219def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src),
220 "ltr{w}\t{$src}", []>, TB;
221def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src),
222 "ltr{w}\t{$src}", []>, TB;
223
224def PUSHCS16 : I<0x0E, RawFrm, (outs), (ins),
225 "push{w}\t%cs", []>, Requires<[In32BitMode]>, OpSize;
226def PUSHCS32 : I<0x0E, RawFrm, (outs), (ins),
227 "push{l}\t%cs", []>, Requires<[In32BitMode]>;
228def PUSHSS16 : I<0x16, RawFrm, (outs), (ins),
229 "push{w}\t%ss", []>, Requires<[In32BitMode]>, OpSize;
230def PUSHSS32 : I<0x16, RawFrm, (outs), (ins),
231 "push{l}\t%ss", []>, Requires<[In32BitMode]>;
232def PUSHDS16 : I<0x1E, RawFrm, (outs), (ins),
233 "push{w}\t%ds", []>, Requires<[In32BitMode]>, OpSize;
234def PUSHDS32 : I<0x1E, RawFrm, (outs), (ins),
235 "push{l}\t%ds", []>, Requires<[In32BitMode]>;
236def PUSHES16 : I<0x06, RawFrm, (outs), (ins),
237 "push{w}\t%es", []>, Requires<[In32BitMode]>, OpSize;
238def PUSHES32 : I<0x06, RawFrm, (outs), (ins),
239 "push{l}\t%es", []>, Requires<[In32BitMode]>;
240
241def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins),
242 "push{w}\t%fs", []>, OpSize, TB;
243def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins),
244 "push{l}\t%fs", []>, TB, Requires<[In32BitMode]>;
245def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins),
246 "push{w}\t%gs", []>, OpSize, TB;
247def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins),
248 "push{l}\t%gs", []>, TB, Requires<[In32BitMode]>;
249
250def PUSHFS64 : I<0xa0, RawFrm, (outs), (ins),
251 "push{q}\t%fs", []>, TB;
252def PUSHGS64 : I<0xa8, RawFrm, (outs), (ins),
253 "push{q}\t%gs", []>, TB;
254
255// No "pop cs" instruction.
256def POPSS16 : I<0x17, RawFrm, (outs), (ins),
257 "pop{w}\t%ss", []>, OpSize, Requires<[In32BitMode]>;
258def POPSS32 : I<0x17, RawFrm, (outs), (ins),
259 "pop{l}\t%ss", []> , Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000260
Chris Lattner434c7cb2010-10-05 05:32:15 +0000261def POPDS16 : I<0x1F, RawFrm, (outs), (ins),
262 "pop{w}\t%ds", []>, OpSize, Requires<[In32BitMode]>;
263def POPDS32 : I<0x1F, RawFrm, (outs), (ins),
264 "pop{l}\t%ds", []> , Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000265
Chris Lattner434c7cb2010-10-05 05:32:15 +0000266def POPES16 : I<0x07, RawFrm, (outs), (ins),
267 "pop{w}\t%es", []>, OpSize, Requires<[In32BitMode]>;
268def POPES32 : I<0x07, RawFrm, (outs), (ins),
269 "pop{l}\t%es", []> , Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000270
Chris Lattner434c7cb2010-10-05 05:32:15 +0000271def POPFS16 : I<0xa1, RawFrm, (outs), (ins),
272 "pop{w}\t%fs", []>, OpSize, TB;
273def POPFS32 : I<0xa1, RawFrm, (outs), (ins),
274 "pop{l}\t%fs", []>, TB , Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000275def POPFS64 : I<0xa1, RawFrm, (outs), (ins),
276 "pop{q}\t%fs", []>, TB;
277
Chris Lattner434c7cb2010-10-05 05:32:15 +0000278def POPGS16 : I<0xa9, RawFrm, (outs), (ins),
279 "pop{w}\t%gs", []>, OpSize, TB;
280def POPGS32 : I<0xa9, RawFrm, (outs), (ins),
281 "pop{l}\t%gs", []>, TB , Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000282def POPGS64 : I<0xa9, RawFrm, (outs), (ins),
283 "pop{q}\t%gs", []>, TB;
284
285
286def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
287 "lds{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
288def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
289 "lds{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000290
Chris Lattner434c7cb2010-10-05 05:32:15 +0000291def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
292 "lss{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
293def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
294 "lss{l}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000295def LSS64rm : RI<0xb2, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
296 "lss{q}\t{$src, $dst|$dst, $src}", []>, TB;
297
Chris Lattner434c7cb2010-10-05 05:32:15 +0000298def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
299 "les{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
300def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
301 "les{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000302
Chris Lattner434c7cb2010-10-05 05:32:15 +0000303def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
304 "lfs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
305def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
306 "lfs{l}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000307def LFS64rm : RI<0xb4, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
308 "lfs{q}\t{$src, $dst|$dst, $src}", []>, TB;
309
Chris Lattner434c7cb2010-10-05 05:32:15 +0000310def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
311 "lgs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
312def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
313 "lgs{l}\t{$src, $dst|$dst, $src}", []>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000314
Chris Lattner434c7cb2010-10-05 05:32:15 +0000315def LGS64rm : RI<0xb5, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
316 "lgs{q}\t{$src, $dst|$dst, $src}", []>, TB;
317
318
319def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg),
Andrew Trick0966ec02010-10-22 03:58:29 +0000320 "verr\t$seg", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000321def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg),
Andrew Trick0966ec02010-10-22 03:58:29 +0000322 "verr\t$seg", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000323def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg),
Andrew Trick0966ec02010-10-22 03:58:29 +0000324 "verw\t$seg", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000325def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg),
Andrew Trick0966ec02010-10-22 03:58:29 +0000326 "verw\t$seg", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000327
328//===----------------------------------------------------------------------===//
329// Descriptor-table support instructions
330
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000331def SGDT16m : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
332 "sgdtw\t$dst", []>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000333def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
334 "sgdt\t$dst", []>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000335def SIDT16m : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
336 "sidtw\t$dst", []>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000337def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
338 "sidt\t$dst", []>, TB;
339def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins),
340 "sldt{w}\t$dst", []>, TB, OpSize;
341def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins),
342 "sldt{w}\t$dst", []>, TB;
343def SLDT32r : I<0x00, MRM0r, (outs GR32:$dst), (ins),
344 "sldt{l}\t$dst", []>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000345
346// LLDT is not interpreted specially in 64-bit mode because there is no sign
347// extension.
348def SLDT64r : RI<0x00, MRM0r, (outs GR64:$dst), (ins),
349 "sldt{q}\t$dst", []>, TB;
350def SLDT64m : RI<0x00, MRM0m, (outs i16mem:$dst), (ins),
351 "sldt{q}\t$dst", []>, TB;
352
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000353def LGDT16m : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
354 "lgdtw\t$src", []>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000355def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
356 "lgdt\t$src", []>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000357def LIDT16m : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
358 "lidtw\t$src", []>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000359def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
360 "lidt\t$src", []>, TB;
361def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src),
362 "lldt{w}\t$src", []>, TB;
363def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src),
364 "lldt{w}\t$src", []>, TB;
365
366//===----------------------------------------------------------------------===//
367// Specialized register support
368def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB;
369def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB;
370def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", []>, TB;
371
372def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins),
373 "smsw{w}\t$dst", []>, OpSize, TB;
374def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins),
375 "smsw{l}\t$dst", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000376// no m form encodable; use SMSW16m
377def SMSW64r : RI<0x01, MRM4r, (outs GR64:$dst), (ins),
378 "smsw{q}\t$dst", []>, TB;
379
380// For memory operands, there is only a 16-bit form
381def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins),
382 "smsw{w}\t$dst", []>, TB;
383
384def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src),
385 "lmsw{w}\t$src", []>, TB;
386def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src),
387 "lmsw{w}\t$src", []>, TB;
388
389def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", []>, TB;
390
391//===----------------------------------------------------------------------===//
392// Cache instructions
393def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB;
394def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB;
395
Rafael Espindola87ca0e02011-02-22 00:35:18 +0000396let Defs = [RDX, RAX], Uses = [RCX] in
397 def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
398
399let Uses = [RDX, RAX, RCX] in
400 def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB;
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000401
402//===----------------------------------------------------------------------===//
403// VIA PadLock crypto instructions
404let Defs = [RAX, RDI], Uses = [RDX, RDI] in
405 def XSTORE : I<0xc0, RawFrm, (outs), (ins), "xstore", []>, A7;
406
407let Defs = [RSI, RDI], Uses = [RBX, RDX, RSI, RDI] in {
408 def XCRYPTECB : I<0xc8, RawFrm, (outs), (ins), "xcryptecb", []>, A7;
409 def XCRYPTCBC : I<0xd0, RawFrm, (outs), (ins), "xcryptcbc", []>, A7;
410 def XCRYPTCTR : I<0xd8, RawFrm, (outs), (ins), "xcryptctr", []>, A7;
411 def XCRYPTCFB : I<0xe0, RawFrm, (outs), (ins), "xcryptcfb", []>, A7;
412 def XCRYPTOFB : I<0xe8, RawFrm, (outs), (ins), "xcryptofb", []>, A7;
413}
414
415let Defs = [RAX, RSI, RDI], Uses = [RAX, RSI, RDI] in {
416 def XSHA1 : I<0xc8, RawFrm, (outs), (ins), "xsha1", []>, A6;
417 def XSHA256 : I<0xd0, RawFrm, (outs), (ins), "xsha256", []>, A6;
418}
419let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in
420 def MONTMUL : I<0xc0, RawFrm, (outs), (ins), "montmul", []>, A6;