blob: 1807c0d1bd06b64fe4a751d6a9be7b9d46b498ab [file] [log] [blame]
Arnold Schwaighofer373e8652007-10-12 21:30:57 +00001//===- X86InstrInfo.td - Describe the X86 Instruction Set --*- tablegen -*-===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the X86 instruction set, defining the instructions, and
11// properties of the instructions which are needed for code generation, machine
12// code emission, and analysis.
13//
14//===----------------------------------------------------------------------===//
15
16//===----------------------------------------------------------------------===//
17// X86 specific DAG Nodes.
18//
19
20def SDTIntShiftDOp: SDTypeProfile<1, 3,
21 [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
22 SDTCisInt<0>, SDTCisInt<3>]>;
23
24def SDTX86CmpTest : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
25
Evan Cheng621216e2007-09-29 00:00:36 +000026def SDTX86Cmov : SDTypeProfile<1, 4,
Evan Cheng950aac02007-09-25 01:57:46 +000027 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
28 SDTCisVT<3, i8>, SDTCisVT<4, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029
Evan Cheng621216e2007-09-29 00:00:36 +000030def SDTX86BrCond : SDTypeProfile<0, 3,
Evan Cheng950aac02007-09-25 01:57:46 +000031 [SDTCisVT<0, OtherVT>,
32 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033
Evan Cheng621216e2007-09-29 00:00:36 +000034def SDTX86SetCC : SDTypeProfile<1, 2,
Evan Cheng950aac02007-09-25 01:57:46 +000035 [SDTCisVT<0, i8>,
36 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037
38def SDTX86Ret : SDTypeProfile<0, 1, [SDTCisVT<0, i16>]>;
39
Bill Wendling7173da52007-11-13 09:19:02 +000040def SDT_X86CallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
41def SDT_X86CallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>,
42 SDTCisVT<1, i32> ]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000043
44def SDT_X86Call : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>;
45
46def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
47
48def SDTX86RdTsc : SDTypeProfile<0, 0, []>;
49
50def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
51
52def SDT_X86TLSADDR : SDTypeProfile<1, 1, [SDTCisPtrTy<0>, SDTCisInt<1>]>;
53
54def SDT_X86TLSTP : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
55
56def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
57
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000058def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
59
Evan Cheng48679f42007-12-14 02:13:44 +000060def X86bsf : SDNode<"X86ISD::BSF", SDTIntUnaryOp>;
61def X86bsr : SDNode<"X86ISD::BSR", SDTIntUnaryOp>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
63def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
64
Evan Cheng621216e2007-09-29 00:00:36 +000065def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000066
Evan Cheng621216e2007-09-29 00:00:36 +000067def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000068def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
Evan Cheng950aac02007-09-25 01:57:46 +000069 [SDNPHasChain]>;
Evan Cheng621216e2007-09-29 00:00:36 +000070def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000071
72def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
73 [SDNPHasChain, SDNPOptInFlag]>;
74
75def X86callseq_start :
76 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
77 [SDNPHasChain, SDNPOutFlag]>;
78def X86callseq_end :
79 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +000080 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000081
82def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
83 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
84
85def X86tailcall: SDNode<"X86ISD::TAILCALL", SDT_X86Call,
86 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
87
88def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
Chris Lattnerca4e0fe2008-01-10 05:12:37 +000089 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000090def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
Chris Lattnerca4e0fe2008-01-10 05:12:37 +000091 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
92 SDNPMayLoad]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000093
94def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc,
Chris Lattnerc90ee9c2008-01-10 07:59:24 +000095 [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000096
97def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
98def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>;
99
100def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
101 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
102def X86TLStp : SDNode<"X86ISD::THREAD_POINTER", SDT_X86TLSTP, []>;
103
104def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
105 [SDNPHasChain]>;
106
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +0000107def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET,
108 [SDNPHasChain, SDNPOptInFlag]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000109
110//===----------------------------------------------------------------------===//
111// X86 Operand Definitions.
112//
113
114// *mem - Operand definitions for the funky X86 addressing mode operands.
115//
116class X86MemOperand<string printMethod> : Operand<iPTR> {
117 let PrintMethod = printMethod;
118 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc, i32imm);
119}
120
121def i8mem : X86MemOperand<"printi8mem">;
122def i16mem : X86MemOperand<"printi16mem">;
123def i32mem : X86MemOperand<"printi32mem">;
124def i64mem : X86MemOperand<"printi64mem">;
125def i128mem : X86MemOperand<"printi128mem">;
126def f32mem : X86MemOperand<"printf32mem">;
127def f64mem : X86MemOperand<"printf64mem">;
Dale Johannesen4ab00bd2007-08-05 18:49:15 +0000128def f80mem : X86MemOperand<"printf80mem">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000129def f128mem : X86MemOperand<"printf128mem">;
130
131def lea32mem : Operand<i32> {
132 let PrintMethod = "printi32mem";
133 let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
134}
135
136def SSECC : Operand<i8> {
137 let PrintMethod = "printSSECC";
138}
139
140def piclabel: Operand<i32> {
141 let PrintMethod = "printPICLabel";
142}
143
144// A couple of more descriptive operand definitions.
145// 16-bits but only 8 bits are significant.
146def i16i8imm : Operand<i16>;
147// 32-bits but only 8 bits are significant.
148def i32i8imm : Operand<i32>;
149
150// Branch targets have OtherVT type.
151def brtarget : Operand<OtherVT>;
152
153//===----------------------------------------------------------------------===//
154// X86 Complex Pattern Definitions.
155//
156
157// Define X86 specific addressing mode.
158def addr : ComplexPattern<iPTR, 4, "SelectAddr", [], []>;
159def lea32addr : ComplexPattern<i32, 4, "SelectLEAAddr",
160 [add, mul, shl, or, frameindex], []>;
161
162//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000163// X86 Instruction Predicate Definitions.
164def HasMMX : Predicate<"Subtarget->hasMMX()">;
165def HasSSE1 : Predicate<"Subtarget->hasSSE1()">;
166def HasSSE2 : Predicate<"Subtarget->hasSSE2()">;
167def HasSSE3 : Predicate<"Subtarget->hasSSE3()">;
168def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">;
Dale Johannesene0e0fd02007-09-23 14:52:20 +0000169def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">;
170def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000171def In32BitMode : Predicate<"!Subtarget->is64Bit()">;
172def In64BitMode : Predicate<"Subtarget->is64Bit()">;
Evan Cheng09e13792007-08-01 23:45:51 +0000173def HasLow4G : Predicate<"Subtarget->hasLow4GUserSpaceAddress()">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000174def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">;
175def NotSmallCode : Predicate<"TM.getCodeModel() != CodeModel::Small">;
176def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">;
177
178//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +0000179// X86 Instruction Format Definitions.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000180//
181
Evan Cheng86ab7d32007-07-31 08:04:03 +0000182include "X86InstrFormats.td"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000183
184//===----------------------------------------------------------------------===//
185// Pattern fragments...
186//
187
188// X86 specific condition code. These correspond to CondCode in
189// X86InstrInfo.h. They must be kept in synch.
190def X86_COND_A : PatLeaf<(i8 0)>;
191def X86_COND_AE : PatLeaf<(i8 1)>;
192def X86_COND_B : PatLeaf<(i8 2)>;
193def X86_COND_BE : PatLeaf<(i8 3)>;
194def X86_COND_E : PatLeaf<(i8 4)>;
195def X86_COND_G : PatLeaf<(i8 5)>;
196def X86_COND_GE : PatLeaf<(i8 6)>;
197def X86_COND_L : PatLeaf<(i8 7)>;
198def X86_COND_LE : PatLeaf<(i8 8)>;
199def X86_COND_NE : PatLeaf<(i8 9)>;
200def X86_COND_NO : PatLeaf<(i8 10)>;
201def X86_COND_NP : PatLeaf<(i8 11)>;
202def X86_COND_NS : PatLeaf<(i8 12)>;
203def X86_COND_O : PatLeaf<(i8 13)>;
204def X86_COND_P : PatLeaf<(i8 14)>;
205def X86_COND_S : PatLeaf<(i8 15)>;
206
207def i16immSExt8 : PatLeaf<(i16 imm), [{
208 // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
209 // sign extended field.
210 return (int16_t)N->getValue() == (int8_t)N->getValue();
211}]>;
212
213def i32immSExt8 : PatLeaf<(i32 imm), [{
214 // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
215 // sign extended field.
216 return (int32_t)N->getValue() == (int8_t)N->getValue();
217}]>;
218
219// Helper fragments for loads.
220def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>;
221def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>;
222def loadi32 : PatFrag<(ops node:$ptr), (i32 (load node:$ptr))>;
223def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>;
224
225def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>;
226def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>;
Dale Johannesen4ab00bd2007-08-05 18:49:15 +0000227def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr))>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000228
229def sextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (sextloadi1 node:$ptr))>;
230def sextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (sextloadi1 node:$ptr))>;
231def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
232def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
233def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>;
234
235def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>;
236def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>;
237def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>;
238def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
239def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>;
240def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>;
241
242def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>;
243def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>;
244def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>;
245def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>;
246def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>;
247def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
248
249//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000250// Instruction list...
251//
252
253// ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into
254// a stack adjustment and the codegen must know that they may modify the stack
255// pointer before prolog-epilog rewriting occurs.
Evan Chenge4f1f572007-09-28 01:35:02 +0000256// Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become sub / add
Evan Cheng037364a2007-09-28 01:19:48 +0000257// which can clobber EFLAGS.
258let Defs = [ESP, EFLAGS], Uses = [ESP] in {
Bill Wendling22f8deb2007-11-13 00:44:25 +0000259def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt),
260 "#ADJCALLSTACKDOWN",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000261 [(X86callseq_start imm:$amt)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000262def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000263 "#ADJCALLSTACKUP",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000264 [(X86callseq_end imm:$amt1, imm:$amt2)]>;
265}
Evan Chenge399fbb2007-12-12 23:12:09 +0000266let isImplicitDef = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000267def IMPLICIT_DEF_GR8 : I<0, Pseudo, (outs GR8:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000268 "#IMPLICIT_DEF $dst",
269 [(set GR8:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000270def IMPLICIT_DEF_GR16 : I<0, Pseudo, (outs GR16:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000271 "#IMPLICIT_DEF $dst",
272 [(set GR16:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000273def IMPLICIT_DEF_GR32 : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000274 "#IMPLICIT_DEF $dst",
275 [(set GR32:$dst, (undef))]>;
Evan Chenge399fbb2007-12-12 23:12:09 +0000276}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000277
278// Nop
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000279let neverHasSideEffects = 1 in
280 def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000281
Evan Cheng0729ccf2008-01-05 00:41:47 +0000282// PIC base
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000283let neverHasSideEffects = 1, isNotDuplicable = 1 in
284 def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel:$label),
285 "call\t$label\n\tpop{l}\t$reg", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000286
287//===----------------------------------------------------------------------===//
288// Control Flow Instructions...
289//
290
291// Return instructions.
292let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +0000293 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000294 def RET : I<0xC3, RawFrm, (outs), (ins), "ret", [(X86retflag 0)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000295 def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt), "ret\t$amt",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000296 [(X86retflag imm:$amt)]>;
297}
298
299// All branches are RawFrm, Void, Branch, and Terminators
Evan Cheng37e7c752007-07-21 00:34:19 +0000300let isBranch = 1, isTerminator = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000301 class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> :
302 I<opcode, RawFrm, (outs), ins, asm, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000303
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000304let isBranch = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000305 def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000306
Owen Andersonf8053082007-11-12 07:39:39 +0000307// Indirect branches
308let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
Dan Gohman91888f02007-07-31 20:11:57 +0000309 def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000310 [(brind GR32:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000311 def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000312 [(brind (loadi32 addr:$dst))]>;
313}
314
315// Conditional branches
Evan Cheng950aac02007-09-25 01:57:46 +0000316let Uses = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +0000317def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000318 [(X86brcond bb:$dst, X86_COND_E, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000319def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000320 [(X86brcond bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000321def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000322 [(X86brcond bb:$dst, X86_COND_L, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000323def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000324 [(X86brcond bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000325def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000326 [(X86brcond bb:$dst, X86_COND_G, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000327def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000328 [(X86brcond bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000329
Dan Gohman91888f02007-07-31 20:11:57 +0000330def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000331 [(X86brcond bb:$dst, X86_COND_B, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000332def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000333 [(X86brcond bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000334def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000335 [(X86brcond bb:$dst, X86_COND_A, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000336def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000337 [(X86brcond bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000338
Dan Gohman91888f02007-07-31 20:11:57 +0000339def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000340 [(X86brcond bb:$dst, X86_COND_S, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000341def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000342 [(X86brcond bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000343def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000344 [(X86brcond bb:$dst, X86_COND_P, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000345def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000346 [(X86brcond bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000347def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000348 [(X86brcond bb:$dst, X86_COND_O, EFLAGS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000349def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +0000350 [(X86brcond bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
Evan Cheng950aac02007-09-25 01:57:46 +0000351} // Uses = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000352
353//===----------------------------------------------------------------------===//
354// Call Instructions...
355//
Evan Cheng37e7c752007-07-21 00:34:19 +0000356let isCall = 1 in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000357 // All calls clobber the non-callee saved registers...
358 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
359 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
Evan Cheng950aac02007-09-25 01:57:46 +0000360 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in {
Evan Cheng34f93712007-12-22 02:26:46 +0000361 def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops),
362 "call\t${dst:call}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000363 def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000364 "call\t{*}$dst", [(X86call GR32:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000365 def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000366 "call\t{*}$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000367 }
368
369// Tail call stuff.
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +0000370
371def TAILCALL : I<0, Pseudo, (outs), (ins ),
372 "#TAILCALL",
373 []>;
374
Evan Cheng37e7c752007-07-21 00:34:19 +0000375let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +0000376def TCRETURNdi : I<0, Pseudo, (outs), (ins i32imm:$dst, i32imm:$offset),
377 "#TC_RETURN $dst $offset",
378 []>;
379
380let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
381def TCRETURNri : I<0, Pseudo, (outs), (ins GR32:$dst, i32imm:$offset),
382 "#TC_RETURN $dst $offset",
383 []>;
384
385let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
386 def TAILJMPd : IBr<0xE9, (ins i32imm:$dst), "jmp\t${dst:call} # TAILCALL",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000387 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000388let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +0000389 def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst # TAILCALL",
390 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000391let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000392 def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +0000393 "jmp\t{*}$dst # TAILCALL", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000394
395//===----------------------------------------------------------------------===//
396// Miscellaneous Instructions...
397//
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000398let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000399def LEAVE : I<0xC9, RawFrm,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000400 (outs), (ins), "leave", []>;
401
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000402let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in {
403let mayLoad = 1 in
Evan Chengd8434332007-09-26 01:29:06 +0000404def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000405
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000406let mayStore = 1 in
Evan Chengd8434332007-09-26 01:29:06 +0000407def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000408}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000409
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000410let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in
Evan Chengf1341312007-09-26 21:28:00 +0000411def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000412let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in
Evan Chengf1341312007-09-26 21:28:00 +0000413def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
Evan Chengd8434332007-09-26 01:29:06 +0000414
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000415let isTwoAddress = 1 in // GR32 = bswap GR32
416 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Chengb783fa32007-07-19 01:14:50 +0000417 (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000418 "bswap{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000419 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
420
Evan Chengb783fa32007-07-19 01:14:50 +0000421// FIXME: Model xchg* as two address instructions?
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000422def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
Evan Chengb783fa32007-07-19 01:14:50 +0000423 (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000424 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000425def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000426 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000427 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000428def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000429 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000430 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000431
432def XCHG8mr : I<0x86, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000433 (outs), (ins i8mem:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000434 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000435def XCHG16mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000436 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000437 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000438def XCHG32mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000439 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000440 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000441def XCHG8rm : I<0x86, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000442 (outs), (ins GR8:$src1, i8mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000443 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000444def XCHG16rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000445 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000446 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000447def XCHG32rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000448 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000449 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000450
Evan Cheng48679f42007-12-14 02:13:44 +0000451// Bit scan instructions.
452let Defs = [EFLAGS] in {
Evan Cheng4e33de92007-12-14 18:49:43 +0000453def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000454 "bsf{w}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000455 [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000456def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000457 "bsf{w}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000458 [(set GR16:$dst, (X86bsf (loadi16 addr:$src))),
459 (implicit EFLAGS)]>, TB;
Evan Cheng4e33de92007-12-14 18:49:43 +0000460def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000461 "bsf{l}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000462 [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000463def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000464 "bsf{l}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000465 [(set GR32:$dst, (X86bsf (loadi32 addr:$src))),
466 (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000467
Evan Cheng4e33de92007-12-14 18:49:43 +0000468def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000469 "bsr{w}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000470 [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000471def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000472 "bsr{w}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000473 [(set GR16:$dst, (X86bsr (loadi16 addr:$src))),
474 (implicit EFLAGS)]>, TB;
Evan Cheng4e33de92007-12-14 18:49:43 +0000475def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000476 "bsr{l}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000477 [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000478def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohmancdb54c62007-12-14 15:10:00 +0000479 "bsr{l}\t{$src, $dst|$dst, $src}",
Evan Cheng7cfbfe32007-12-14 08:30:15 +0000480 [(set GR32:$dst, (X86bsr (loadi32 addr:$src))),
481 (implicit EFLAGS)]>, TB;
Evan Cheng48679f42007-12-14 02:13:44 +0000482} // Defs = [EFLAGS]
483
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000484let neverHasSideEffects = 1 in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000485def LEA16r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000486 (outs GR16:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000487 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000488def LEA32r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000489 (outs GR32:$dst), (ins lea32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000490 "lea{l}\t{$src|$dst}, {$dst|$src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000491 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
492
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000493let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000494def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000495 [(X86rep_movs i8)]>, REP;
Evan Chengb783fa32007-07-19 01:14:50 +0000496def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000497 [(X86rep_movs i16)]>, REP, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000498def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000499 [(X86rep_movs i32)]>, REP;
500}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000501
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000502let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000503def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000504 [(X86rep_stos i8)]>, REP;
505let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000506def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000507 [(X86rep_stos i16)]>, REP, OpSize;
508let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000509def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000510 [(X86rep_stos i32)]>, REP;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000511
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000512let Defs = [RAX, RDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000513def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000514 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000515
516//===----------------------------------------------------------------------===//
517// Input/Output Instructions...
518//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000519let Defs = [AL], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000520def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000521 "in{b}\t{%dx, %al|%AL, %DX}", []>;
522let Defs = [AX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000523def IN16rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000524 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
525let Defs = [EAX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000526def IN32rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000527 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000528
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000529let Defs = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000530def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000531 "in{b}\t{$port, %al|%AL, $port}", []>;
532let Defs = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000533def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000534 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
535let Defs = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000536def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000537 "in{l}\t{$port, %eax|%EAX, $port}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000538
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000539let Uses = [DX, AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000540def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000541 "out{b}\t{%al, %dx|%DX, %AL}", []>;
542let Uses = [DX, AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000543def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000544 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
545let Uses = [DX, EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000546def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000547 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000548
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000549let Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000550def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000551 "out{b}\t{%al, $port|$port, %AL}", []>;
552let Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000553def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000554 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
555let Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000556def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000557 "out{l}\t{%eax, $port|$port, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000558
559//===----------------------------------------------------------------------===//
560// Move Instructions...
561//
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000562let neverHasSideEffects = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000563def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000564 "mov{b}\t{$src, $dst|$dst, $src}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000565def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000566 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000567def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000568 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000569}
Chris Lattner17dab4a2008-01-10 05:45:39 +0000570let isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000571def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000572 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000573 [(set GR8:$dst, imm:$src)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000574def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000575 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000576 [(set GR16:$dst, imm:$src)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000577def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000578 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000579 [(set GR32:$dst, imm:$src)]>;
580}
Evan Chengb783fa32007-07-19 01:14:50 +0000581def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000582 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000583 [(store (i8 imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000584def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000585 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000586 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000587def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000588 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000589 [(store (i32 imm:$src), addr:$dst)]>;
590
Chris Lattner1a1932c2008-01-06 23:38:27 +0000591let isSimpleLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000592def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000593 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000594 [(set GR8:$dst, (load addr:$src))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000595def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000596 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000597 [(set GR16:$dst, (load addr:$src))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000598def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000599 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000600 [(set GR32:$dst, (load addr:$src))]>;
Evan Cheng4e84e452007-08-30 05:49:43 +0000601}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000602
Evan Chengb783fa32007-07-19 01:14:50 +0000603def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000604 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000605 [(store GR8:$src, addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000606def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000607 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000608 [(store GR16:$src, addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000609def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000610 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000611 [(store GR32:$src, addr:$dst)]>;
612
613//===----------------------------------------------------------------------===//
614// Fixed-Register Multiplication and Division Instructions...
615//
616
617// Extra precision multiplication
Evan Cheng55687072007-09-14 21:48:26 +0000618let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Dan Gohman91888f02007-07-31 20:11:57 +0000619def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000620 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
621 // This probably ought to be moved to a def : Pat<> if the
622 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000623 [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000624let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000625def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000626 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000627let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000628def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>;
629 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000630let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000631def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000632 "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000633 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
634 // This probably ought to be moved to a def : Pat<> if the
635 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000636 [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8]
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000637let mayLoad = 1, neverHasSideEffects = 1 in {
Evan Cheng55687072007-09-14 21:48:26 +0000638let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000639def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000640 "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
Evan Cheng55687072007-09-14 21:48:26 +0000641let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000642def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000643 "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000644}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000645
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000646let neverHasSideEffects = 1 in {
Evan Cheng55687072007-09-14 21:48:26 +0000647let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000648def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
649 // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000650let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000651def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000652 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000653let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000654def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
655 // EAX,EDX = EAX*GR32
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000656let mayLoad = 1 in {
Evan Cheng55687072007-09-14 21:48:26 +0000657let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000658def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000659 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000660let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000661def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000662 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
663let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000664def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000665 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000666}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000667
668// unsigned division/remainder
Evan Cheng55687072007-09-14 21:48:26 +0000669let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000670def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000671 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000672let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000673def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000674 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000675let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000676def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000677 "div{l}\t$src", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000678let mayLoad = 1 in {
Evan Cheng55687072007-09-14 21:48:26 +0000679let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000680def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000681 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000682let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000683def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000684 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000685let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000686def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000687 "div{l}\t$src", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000688}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000689
690// Signed division/remainder.
Evan Cheng55687072007-09-14 21:48:26 +0000691let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000692def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000693 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000694let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000695def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000696 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000697let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000698def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000699 "idiv{l}\t$src", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000700let mayLoad = 1, mayLoad = 1 in {
Evan Cheng55687072007-09-14 21:48:26 +0000701let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000702def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000703 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000704let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000705def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000706 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000707let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000708def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000709 "idiv{l}\t$src", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000710}
711} // neverHasSideEffects
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000712
713//===----------------------------------------------------------------------===//
Chris Lattnerc90ee9c2008-01-10 07:59:24 +0000714// Two address Instructions.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000715//
716let isTwoAddress = 1 in {
717
718// Conditional moves
Evan Cheng950aac02007-09-25 01:57:46 +0000719let Uses = [EFLAGS] in {
Evan Cheng926658c2007-10-05 23:13:21 +0000720let isCommutable = 1 in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000721def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000722 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000723 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000724 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000725 X86_COND_B, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000726 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000727def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000728 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000729 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000730 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000731 X86_COND_B, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000732 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000733
734def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000735 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000736 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000737 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000738 X86_COND_AE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000739 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000740def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000741 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000742 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000743 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000744 X86_COND_AE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000745 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000746def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000747 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000748 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000749 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000750 X86_COND_E, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000751 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000752def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000753 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000754 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000755 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000756 X86_COND_E, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000757 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000758def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000759 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000760 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000761 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000762 X86_COND_NE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000763 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000764def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000765 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000766 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000767 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000768 X86_COND_NE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000769 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000770def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000771 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000772 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000773 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000774 X86_COND_BE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000775 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000776def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000777 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000778 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000779 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000780 X86_COND_BE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000781 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000782def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000783 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000784 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000785 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000786 X86_COND_A, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000787 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000788def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000789 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000790 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000791 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000792 X86_COND_A, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000793 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000794def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000795 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000796 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000797 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000798 X86_COND_L, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000799 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000800def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000801 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000802 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000803 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000804 X86_COND_L, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000805 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000806def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000807 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000808 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000809 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000810 X86_COND_GE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000811 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000812def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000813 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000814 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000815 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000816 X86_COND_GE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000817 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000818def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000819 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000820 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000821 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000822 X86_COND_LE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000823 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000824def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000825 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000826 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000827 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000828 X86_COND_LE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000829 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000830def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000831 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000832 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000833 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000834 X86_COND_G, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000835 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000836def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000837 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000838 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000839 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000840 X86_COND_G, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000841 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000842def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000843 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000844 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000845 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000846 X86_COND_S, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000847 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000848def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000849 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000850 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000851 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000852 X86_COND_S, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000853 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000854def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000855 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000856 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000857 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000858 X86_COND_NS, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000859 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000860def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000861 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000862 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000863 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000864 X86_COND_NS, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000865 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000866def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000867 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000868 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000869 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000870 X86_COND_P, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000871 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000872def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000873 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000874 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000875 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000876 X86_COND_P, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000877 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000878def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000879 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000880 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000881 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000882 X86_COND_NP, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000883 TB, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000884def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000885 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000886 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000887 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng621216e2007-09-29 00:00:36 +0000888 X86_COND_NP, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000889 TB;
Evan Cheng926658c2007-10-05 23:13:21 +0000890} // isCommutable = 1
891
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000892def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000893 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000894 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000895 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng950aac02007-09-25 01:57:46 +0000896 X86_COND_NP, EFLAGS))]>,
897 TB;
Evan Cheng926658c2007-10-05 23:13:21 +0000898
899def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
900 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
901 "cmovb\t{$src2, $dst|$dst, $src2}",
902 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
903 X86_COND_B, EFLAGS))]>,
904 TB, OpSize;
905def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
906 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
907 "cmovb\t{$src2, $dst|$dst, $src2}",
908 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
909 X86_COND_B, EFLAGS))]>,
910 TB;
911def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
912 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
913 "cmovae\t{$src2, $dst|$dst, $src2}",
914 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
915 X86_COND_AE, EFLAGS))]>,
916 TB, OpSize;
917def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
918 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
919 "cmovae\t{$src2, $dst|$dst, $src2}",
920 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
921 X86_COND_AE, EFLAGS))]>,
922 TB;
923def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
924 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
925 "cmove\t{$src2, $dst|$dst, $src2}",
926 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
927 X86_COND_E, EFLAGS))]>,
928 TB, OpSize;
929def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
930 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
931 "cmove\t{$src2, $dst|$dst, $src2}",
932 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
933 X86_COND_E, EFLAGS))]>,
934 TB;
935def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
936 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
937 "cmovne\t{$src2, $dst|$dst, $src2}",
938 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
939 X86_COND_NE, EFLAGS))]>,
940 TB, OpSize;
941def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
942 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
943 "cmovne\t{$src2, $dst|$dst, $src2}",
944 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
945 X86_COND_NE, EFLAGS))]>,
946 TB;
947def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
948 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
949 "cmovbe\t{$src2, $dst|$dst, $src2}",
950 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
951 X86_COND_BE, EFLAGS))]>,
952 TB, OpSize;
953def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
954 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
955 "cmovbe\t{$src2, $dst|$dst, $src2}",
956 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
957 X86_COND_BE, EFLAGS))]>,
958 TB;
959def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
960 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
961 "cmova\t{$src2, $dst|$dst, $src2}",
962 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
963 X86_COND_A, EFLAGS))]>,
964 TB, OpSize;
965def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
966 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
967 "cmova\t{$src2, $dst|$dst, $src2}",
968 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
969 X86_COND_A, EFLAGS))]>,
970 TB;
971def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
972 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
973 "cmovl\t{$src2, $dst|$dst, $src2}",
974 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
975 X86_COND_L, EFLAGS))]>,
976 TB, OpSize;
977def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
978 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
979 "cmovl\t{$src2, $dst|$dst, $src2}",
980 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
981 X86_COND_L, EFLAGS))]>,
982 TB;
983def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
984 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
985 "cmovge\t{$src2, $dst|$dst, $src2}",
986 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
987 X86_COND_GE, EFLAGS))]>,
988 TB, OpSize;
989def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
990 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
991 "cmovge\t{$src2, $dst|$dst, $src2}",
992 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
993 X86_COND_GE, EFLAGS))]>,
994 TB;
995def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
996 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
997 "cmovle\t{$src2, $dst|$dst, $src2}",
998 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
999 X86_COND_LE, EFLAGS))]>,
1000 TB, OpSize;
1001def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1002 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1003 "cmovle\t{$src2, $dst|$dst, $src2}",
1004 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1005 X86_COND_LE, EFLAGS))]>,
1006 TB;
1007def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1008 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1009 "cmovg\t{$src2, $dst|$dst, $src2}",
1010 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1011 X86_COND_G, EFLAGS))]>,
1012 TB, OpSize;
1013def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1014 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1015 "cmovg\t{$src2, $dst|$dst, $src2}",
1016 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1017 X86_COND_G, EFLAGS))]>,
1018 TB;
1019def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1020 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1021 "cmovs\t{$src2, $dst|$dst, $src2}",
1022 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1023 X86_COND_S, EFLAGS))]>,
1024 TB, OpSize;
1025def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1026 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1027 "cmovs\t{$src2, $dst|$dst, $src2}",
1028 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1029 X86_COND_S, EFLAGS))]>,
1030 TB;
1031def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1032 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1033 "cmovns\t{$src2, $dst|$dst, $src2}",
1034 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1035 X86_COND_NS, EFLAGS))]>,
1036 TB, OpSize;
1037def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1038 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1039 "cmovns\t{$src2, $dst|$dst, $src2}",
1040 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1041 X86_COND_NS, EFLAGS))]>,
1042 TB;
1043def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1044 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1045 "cmovp\t{$src2, $dst|$dst, $src2}",
1046 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1047 X86_COND_P, EFLAGS))]>,
1048 TB, OpSize;
1049def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1050 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1051 "cmovp\t{$src2, $dst|$dst, $src2}",
1052 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1053 X86_COND_P, EFLAGS))]>,
1054 TB;
1055def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1056 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1057 "cmovnp\t{$src2, $dst|$dst, $src2}",
1058 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1059 X86_COND_NP, EFLAGS))]>,
1060 TB, OpSize;
Evan Cheng950aac02007-09-25 01:57:46 +00001061} // Uses = [EFLAGS]
1062
1063
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001064// unary instructions
1065let CodeSize = 2 in {
Evan Cheng55687072007-09-14 21:48:26 +00001066let Defs = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +00001067def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001068 [(set GR8:$dst, (ineg GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001069def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001070 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001071def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001072 [(set GR32:$dst, (ineg GR32:$src))]>;
1073let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001074 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001075 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001076 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001077 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001078 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001079 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1080
1081}
Evan Cheng55687072007-09-14 21:48:26 +00001082} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001083
Dan Gohman91888f02007-07-31 20:11:57 +00001084def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001085 [(set GR8:$dst, (not GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001086def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001087 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001088def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001089 [(set GR32:$dst, (not GR32:$src))]>;
1090let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001091 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001092 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001093 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001094 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001095 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001096 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1097}
1098} // CodeSize
1099
1100// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng55687072007-09-14 21:48:26 +00001101let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001102let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001103def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001104 [(set GR8:$dst, (add GR8:$src, 1))]>;
1105let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001106def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001107 [(set GR16:$dst, (add GR16:$src, 1))]>,
1108 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001109def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001110 [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>;
1111}
1112let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001113 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001114 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001115 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
Evan Cheng4a7e72f2007-10-19 21:23:22 +00001116 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>,
1117 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001118 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
Evan Cheng4a7e72f2007-10-19 21:23:22 +00001119 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>,
1120 Requires<[In32BitMode]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001121}
1122
1123let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001124def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001125 [(set GR8:$dst, (add GR8:$src, -1))]>;
1126let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001127def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001128 [(set GR16:$dst, (add GR16:$src, -1))]>,
1129 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001130def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001131 [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>;
1132}
1133
1134let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001135 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001136 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001137 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
Evan Cheng4a7e72f2007-10-19 21:23:22 +00001138 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>,
1139 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001140 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
Evan Cheng4a7e72f2007-10-19 21:23:22 +00001141 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>,
1142 Requires<[In32BitMode]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001143}
Evan Cheng55687072007-09-14 21:48:26 +00001144} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001145
1146// Logical operators...
Evan Cheng55687072007-09-14 21:48:26 +00001147let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001148let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1149def AND8rr : I<0x20, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001150 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001151 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001152 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
1153def AND16rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001154 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001155 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001156 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
1157def AND32rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001158 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001159 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001160 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
1161}
1162
1163def AND8rm : I<0x22, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001164 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001165 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001166 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
1167def AND16rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001168 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001169 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001170 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
1171def AND32rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001172 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001173 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001174 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
1175
1176def AND8ri : Ii8<0x80, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001177 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001178 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001179 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
1180def AND16ri : Ii16<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001181 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001182 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001183 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
1184def AND32ri : Ii32<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001185 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001186 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001187 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
1188def AND16ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001189 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001190 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001191 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
1192 OpSize;
1193def AND32ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001194 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001195 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001196 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
1197
1198let isTwoAddress = 0 in {
1199 def AND8mr : I<0x20, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001200 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001201 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001202 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
1203 def AND16mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001204 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001205 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001206 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
1207 OpSize;
1208 def AND32mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001209 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001210 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001211 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
1212 def AND8mi : Ii8<0x80, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001213 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001214 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001215 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1216 def AND16mi : Ii16<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001217 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001218 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001219 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1220 OpSize;
1221 def AND32mi : Ii32<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001222 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001223 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001224 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1225 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001226 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001227 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001228 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1229 OpSize;
1230 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001231 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001232 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001233 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1234}
1235
1236
1237let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00001238def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001239 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001240 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001241def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001242 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001243 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001244def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001245 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001246 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
1247}
Evan Chengb783fa32007-07-19 01:14:50 +00001248def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001249 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001250 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001251def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001252 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001253 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001254def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001255 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001256 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
1257
Evan Chengb783fa32007-07-19 01:14:50 +00001258def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001259 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001260 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001261def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001262 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001263 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001264def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001265 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001266 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
1267
Evan Chengb783fa32007-07-19 01:14:50 +00001268def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001269 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001270 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001271def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001272 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001273 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
1274let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001275 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001276 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001277 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001278 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001279 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001280 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001281 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001282 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001283 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001284 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001285 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001286 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001287 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001288 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001289 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1290 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001291 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001292 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001293 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001294 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001295 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001296 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1297 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001298 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001299 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001300 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1301}
1302
1303
1304let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1305def XOR8rr : I<0x30, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001306 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001307 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001308 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
1309def XOR16rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001310 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001311 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001312 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
1313def XOR32rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001314 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001315 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001316 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
1317}
1318
1319def XOR8rm : I<0x32, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001320 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001321 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001322 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
1323def XOR16rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001324 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001325 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001326 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
1327def XOR32rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001328 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001329 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001330 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
1331
1332def XOR8ri : Ii8<0x80, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001333 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001334 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001335 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
1336def XOR16ri : Ii16<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001337 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001338 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001339 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
1340def XOR32ri : Ii32<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001341 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001342 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001343 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
1344def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001345 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001346 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001347 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
1348 OpSize;
1349def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001350 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001351 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001352 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
1353let isTwoAddress = 0 in {
1354 def XOR8mr : I<0x30, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001355 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001356 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001357 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
1358 def XOR16mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001359 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001360 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001361 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
1362 OpSize;
1363 def XOR32mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001364 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001365 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001366 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
1367 def XOR8mi : Ii8<0x80, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001368 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001369 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001370 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1371 def XOR16mi : Ii16<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001372 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001373 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001374 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1375 OpSize;
1376 def XOR32mi : Ii32<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001377 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001378 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001379 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1380 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001381 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001382 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001383 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1384 OpSize;
1385 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001386 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001387 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001388 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1389}
Evan Cheng55687072007-09-14 21:48:26 +00001390} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001391
1392// Shift instructions
Evan Cheng55687072007-09-14 21:48:26 +00001393let Defs = [EFLAGS] in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001394let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001395def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001396 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001397 [(set GR8:$dst, (shl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001398def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001399 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001400 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001401def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001402 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001403 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1404}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405
Evan Chengb783fa32007-07-19 01:14:50 +00001406def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001407 "shl{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001408 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1409let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Chengb783fa32007-07-19 01:14:50 +00001410def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001411 "shl{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001412 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001413def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001414 "shl{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001415 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1416}
1417
1418// Shift left by one. Not used because (add x, x) is slightly cheaper.
Evan Chengb783fa32007-07-19 01:14:50 +00001419def SHL8r1 : I<0xD0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001420 "shl{b}\t$dst", []>;
Evan Chengb783fa32007-07-19 01:14:50 +00001421def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001422 "shl{w}\t$dst", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001423def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001424 "shl{l}\t$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001425
1426let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001427 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001428 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001429 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001430 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001431 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001432 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001433 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001434 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001435 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001436 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1437 }
Evan Chengb783fa32007-07-19 01:14:50 +00001438 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001439 "shl{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001440 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001441 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001442 "shl{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001443 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1444 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001445 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001446 "shl{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001447 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1448
1449 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001450 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001451 "shl{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001452 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001453 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001454 "shl{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001455 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1456 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001457 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001458 "shl{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001459 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1460}
1461
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001462let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001463def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001464 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001465 [(set GR8:$dst, (srl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001466def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001467 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001468 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001469def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001470 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001471 [(set GR32:$dst, (srl GR32:$src, CL))]>;
1472}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001473
Evan Chengb783fa32007-07-19 01:14:50 +00001474def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001475 "shr{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001476 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001477def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001478 "shr{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001479 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001480def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001481 "shr{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001482 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
1483
1484// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001485def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001486 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001487 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001488def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001489 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001490 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001491def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001492 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001493 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1494
1495let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001496 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001497 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001498 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001499 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001500 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001501 "shr{w}\t{%cl, $dst|$dst, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001502 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001503 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001504 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001505 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001506 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1507 }
Evan Chengb783fa32007-07-19 01:14:50 +00001508 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001509 "shr{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001510 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001511 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001512 "shr{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001513 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1514 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001515 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001516 "shr{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001517 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1518
1519 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001520 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001521 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001522 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001523 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001524 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001525 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001526 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001527 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001528 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1529}
1530
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001531let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001532def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001533 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001534 [(set GR8:$dst, (sra GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001535def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001536 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001537 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001538def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001539 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001540 [(set GR32:$dst, (sra GR32:$src, CL))]>;
1541}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001542
Evan Chengb783fa32007-07-19 01:14:50 +00001543def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001544 "sar{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001545 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001546def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001547 "sar{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001548 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
1549 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001550def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001551 "sar{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001552 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
1553
1554// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001555def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001556 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001557 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001558def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001559 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001560 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001561def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001562 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001563 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1564
1565let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001566 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001567 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001568 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001569 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001570 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001571 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001572 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001573 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001574 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001575 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1576 }
Evan Chengb783fa32007-07-19 01:14:50 +00001577 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001578 "sar{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001579 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001580 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001581 "sar{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001582 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1583 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001584 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001585 "sar{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001586 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1587
1588 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001589 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001590 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001591 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001592 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001593 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001594 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1595 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001596 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001597 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001598 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1599}
1600
1601// Rotate instructions
1602// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001603let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001604def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001605 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001606 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001607def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001608 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001609 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001610def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001611 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001612 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
1613}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001614
Evan Chengb783fa32007-07-19 01:14:50 +00001615def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001616 "rol{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001617 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001618def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001619 "rol{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001620 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001621def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001622 "rol{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001623 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
1624
1625// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001626def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001627 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001628 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001629def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001630 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001631 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001632def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001633 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001634 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1635
1636let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001637 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001638 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001639 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001640 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001641 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001642 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001643 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001644 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001645 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001646 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1647 }
Evan Chengb783fa32007-07-19 01:14:50 +00001648 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001649 "rol{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001650 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001651 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001652 "rol{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001653 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1654 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001655 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001656 "rol{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001657 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1658
1659 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001660 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001661 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001662 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001663 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001664 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001665 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1666 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001667 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001668 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001669 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1670}
1671
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001672let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001673def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001674 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001675 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001676def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001677 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001678 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001679def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001680 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001681 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
1682}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001683
Evan Chengb783fa32007-07-19 01:14:50 +00001684def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001685 "ror{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001686 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001687def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001688 "ror{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001689 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001690def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001691 "ror{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001692 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
1693
1694// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001695def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001696 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001697 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001698def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001699 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001700 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001701def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001702 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001703 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
1704
1705let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001706 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001707 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001708 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001709 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001710 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001711 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001712 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001713 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001714 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001715 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
1716 }
Evan Chengb783fa32007-07-19 01:14:50 +00001717 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001718 "ror{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001719 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001720 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001721 "ror{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001722 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1723 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001724 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001725 "ror{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001726 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1727
1728 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001729 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001730 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001731 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001732 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001733 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001734 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1735 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001736 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001737 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001738 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1739}
1740
1741
1742
1743// Double shift instructions (generalizations of rotate)
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001744let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001745def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001746 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001747 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00001748def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001749 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001750 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00001751def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001752 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001753 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001754 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001755def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001756 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001757 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001758 TB, OpSize;
1759}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001760
1761let isCommutable = 1 in { // These instructions commute to each other.
1762def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001763 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001764 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001765 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
1766 (i8 imm:$src3)))]>,
1767 TB;
1768def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001769 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001770 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001771 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
1772 (i8 imm:$src3)))]>,
1773 TB;
1774def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001775 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001776 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001777 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
1778 (i8 imm:$src3)))]>,
1779 TB, OpSize;
1780def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001781 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001782 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001783 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
1784 (i8 imm:$src3)))]>,
1785 TB, OpSize;
1786}
1787
1788let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001789 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001790 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001791 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001792 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001793 addr:$dst)]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00001794 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001795 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001796 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001797 addr:$dst)]>, TB;
1798 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001799 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001800 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001801 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001802 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
1803 (i8 imm:$src3)), addr:$dst)]>,
1804 TB;
1805 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001806 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001807 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001808 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
1809 (i8 imm:$src3)), addr:$dst)]>,
1810 TB;
1811
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001812 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001813 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001814 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001815 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001816 addr:$dst)]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001817 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001818 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001819 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001820 addr:$dst)]>, TB, OpSize;
1821 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001822 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001823 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001824 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001825 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
1826 (i8 imm:$src3)), addr:$dst)]>,
1827 TB, OpSize;
1828 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001829 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00001830 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001831 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
1832 (i8 imm:$src3)), addr:$dst)]>,
1833 TB, OpSize;
1834}
Evan Cheng55687072007-09-14 21:48:26 +00001835} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001836
1837
1838// Arithmetic.
Evan Cheng55687072007-09-14 21:48:26 +00001839let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001840let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001841def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
1842 (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001843 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001844 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
1845let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001846def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
1847 (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001848 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001849 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001850def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
1851 (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001852 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001853 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
1854} // end isConvertibleToThreeAddress
1855} // end isCommutable
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001856def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
1857 (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001858 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001859 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001860def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
1861 (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001862 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001863 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize;
1864def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
1865 (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001866 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001867 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
1868
Evan Chengb783fa32007-07-19 01:14:50 +00001869def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001870 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001871 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
1872
1873let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001874def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
1875 (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001876 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001877 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001878def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
1879 (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001880 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001881 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001882def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
1883 (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001884 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001885 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize;
1886def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
1887 (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001888 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001889 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001890}
1891
1892let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001893 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001894 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001895 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001896 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001897 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001898 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00001899 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001900 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001901 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001902 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001903 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001904 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001905 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001906 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001907 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001908 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00001909 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001910 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001911 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001912 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001913 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001914 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001915 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00001916 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001917 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001918 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001919 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
1920}
1921
Evan Cheng259471d2007-10-05 17:59:57 +00001922let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001923let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00001924def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001925 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001926 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
1927}
Evan Chengb783fa32007-07-19 01:14:50 +00001928def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001929 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001930 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001931def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001932 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001933 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001934def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001935 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001936 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
1937
1938let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001939 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001940 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001941 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001942 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001943 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001944 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001945 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001946 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001947 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
1948}
Evan Cheng259471d2007-10-05 17:59:57 +00001949} // Uses = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001950
Evan Chengb783fa32007-07-19 01:14:50 +00001951def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001952 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001953 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001954def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001955 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001956 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001957def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001958 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001959 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001960def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001961 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001962 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001963def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001964 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001965 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001966def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001967 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001968 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
1969
Evan Chengb783fa32007-07-19 01:14:50 +00001970def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001971 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001972 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001973def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001974 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001975 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001976def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001977 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001978 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001979def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001980 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001981 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng55687072007-09-14 21:48:26 +00001982 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001983def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001984 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001985 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
1986let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001987 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001988 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001989 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001990 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001991 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001992 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00001993 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001994 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001995 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001996 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001997 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001998 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001999 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002000 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002001 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002002 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002003 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002004 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002005 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002006 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002007 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002008 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002009 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002010 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002011 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002012 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002013 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2014}
2015
Evan Cheng259471d2007-10-05 17:59:57 +00002016let Uses = [EFLAGS] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002017def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002018 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002019 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002020
2021let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002022 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002023 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002024 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002025 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002026 "sbb{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002027 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002028 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002029 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002030 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002031 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002032 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002033 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002034}
Evan Chengb783fa32007-07-19 01:14:50 +00002035def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002036 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002037 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002038def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002039 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002040 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002041def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002042 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002043 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng259471d2007-10-05 17:59:57 +00002044} // Uses = [EFLAGS]
Evan Cheng55687072007-09-14 21:48:26 +00002045} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002046
Evan Cheng55687072007-09-14 21:48:26 +00002047let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002048let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002049def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002050 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002051 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002052def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002053 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002054 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
2055}
Evan Chengb783fa32007-07-19 01:14:50 +00002056def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002057 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002058 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
2059 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002060def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002061 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002062 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Evan Cheng55687072007-09-14 21:48:26 +00002063} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002064} // end Two Address instructions
2065
2066// Suprisingly enough, these are not two address instructions!
Evan Cheng55687072007-09-14 21:48:26 +00002067let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002068def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002069 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002070 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002071 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
2072def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002073 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002074 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002075 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
2076def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002077 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002078 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002079 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
2080 OpSize;
2081def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002082 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002083 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002084 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
2085
2086def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002087 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002088 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002089 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
2090 OpSize;
2091def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002092 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002093 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002094 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
2095def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002096 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002097 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002098 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
2099 OpSize;
2100def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002101 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002102 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002103 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002104} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002105
2106//===----------------------------------------------------------------------===//
2107// Test instructions are just like AND, except they don't generate a result.
2108//
Evan Cheng950aac02007-09-25 01:57:46 +00002109let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002110let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Chengb783fa32007-07-19 01:14:50 +00002111def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002112 "test{b}\t{$src2, $src1|$src1, $src2}",
2113 [(X86cmp (and GR8:$src1, GR8:$src2), 0),
2114 (implicit EFLAGS)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002115def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002116 "test{w}\t{$src2, $src1|$src1, $src2}",
2117 [(X86cmp (and GR16:$src1, GR16:$src2), 0),
2118 (implicit EFLAGS)]>,
2119 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002120def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002121 "test{l}\t{$src2, $src1|$src1, $src2}",
2122 [(X86cmp (and GR32:$src1, GR32:$src2), 0),
2123 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002124}
2125
Evan Chengb783fa32007-07-19 01:14:50 +00002126def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002127 "test{b}\t{$src2, $src1|$src1, $src2}",
2128 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0),
2129 (implicit EFLAGS)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002130def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002131 "test{w}\t{$src2, $src1|$src1, $src2}",
2132 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0),
2133 (implicit EFLAGS)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002134def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
Evan Cheng621216e2007-09-29 00:00:36 +00002135 "test{l}\t{$src2, $src1|$src1, $src2}",
2136 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0),
2137 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002138
2139def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002140 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002141 "test{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002142 [(X86cmp (and GR8:$src1, imm:$src2), 0),
2143 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002144def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002145 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002146 "test{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002147 [(X86cmp (and GR16:$src1, imm:$src2), 0),
2148 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002149def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002150 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002151 "test{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002152 [(X86cmp (and GR32:$src1, imm:$src2), 0),
2153 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002154
Evan Cheng621216e2007-09-29 00:00:36 +00002155def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002156 (outs), (ins i8mem:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002157 "test{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002158 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0),
2159 (implicit EFLAGS)]>;
2160def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002161 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002162 "test{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002163 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0),
2164 (implicit EFLAGS)]>, OpSize;
2165def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002166 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002167 "test{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002168 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0),
Evan Cheng950aac02007-09-25 01:57:46 +00002169 (implicit EFLAGS)]>;
2170} // Defs = [EFLAGS]
2171
2172
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002173// Condition code ops, incl. set if equal/not equal/...
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002174let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002175def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002176let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002177def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002178
Evan Cheng950aac02007-09-25 01:57:46 +00002179let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002180def SETEr : I<0x94, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002181 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002182 "sete\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002183 [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002184 TB; // GR8 = ==
2185def SETEm : I<0x94, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002186 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002187 "sete\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002188 [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002189 TB; // [mem8] = ==
2190def SETNEr : I<0x95, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002191 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002192 "setne\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002193 [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002194 TB; // GR8 = !=
2195def SETNEm : I<0x95, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002196 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002197 "setne\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002198 [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002199 TB; // [mem8] = !=
2200def SETLr : I<0x9C, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002201 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002202 "setl\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002203 [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002204 TB; // GR8 = < signed
2205def SETLm : I<0x9C, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002206 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002207 "setl\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002208 [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002209 TB; // [mem8] = < signed
2210def SETGEr : I<0x9D, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002211 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002212 "setge\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002213 [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002214 TB; // GR8 = >= signed
2215def SETGEm : I<0x9D, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002216 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002217 "setge\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002218 [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002219 TB; // [mem8] = >= signed
2220def SETLEr : I<0x9E, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002221 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002222 "setle\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002223 [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002224 TB; // GR8 = <= signed
2225def SETLEm : I<0x9E, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002226 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002227 "setle\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002228 [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002229 TB; // [mem8] = <= signed
2230def SETGr : I<0x9F, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002231 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002232 "setg\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002233 [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002234 TB; // GR8 = > signed
2235def SETGm : I<0x9F, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002236 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002237 "setg\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002238 [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002239 TB; // [mem8] = > signed
2240
2241def SETBr : I<0x92, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002242 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002243 "setb\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002244 [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002245 TB; // GR8 = < unsign
2246def SETBm : I<0x92, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002247 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002248 "setb\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002249 [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002250 TB; // [mem8] = < unsign
2251def SETAEr : I<0x93, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002252 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002253 "setae\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002254 [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002255 TB; // GR8 = >= unsign
2256def SETAEm : I<0x93, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002257 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002258 "setae\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002259 [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002260 TB; // [mem8] = >= unsign
2261def SETBEr : I<0x96, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002262 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002263 "setbe\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002264 [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002265 TB; // GR8 = <= unsign
2266def SETBEm : I<0x96, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002267 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002268 "setbe\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002269 [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002270 TB; // [mem8] = <= unsign
2271def SETAr : I<0x97, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002272 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002273 "seta\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002274 [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002275 TB; // GR8 = > signed
2276def SETAm : I<0x97, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002277 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002278 "seta\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002279 [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002280 TB; // [mem8] = > signed
2281
2282def SETSr : I<0x98, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002283 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002284 "sets\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002285 [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002286 TB; // GR8 = <sign bit>
2287def SETSm : I<0x98, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002288 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002289 "sets\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002290 [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002291 TB; // [mem8] = <sign bit>
2292def SETNSr : I<0x99, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002293 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002294 "setns\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002295 [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002296 TB; // GR8 = !<sign bit>
2297def SETNSm : I<0x99, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002298 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002299 "setns\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002300 [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002301 TB; // [mem8] = !<sign bit>
2302def SETPr : I<0x9A, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002303 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002304 "setp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002305 [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002306 TB; // GR8 = parity
2307def SETPm : I<0x9A, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002308 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002309 "setp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002310 [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002311 TB; // [mem8] = parity
2312def SETNPr : I<0x9B, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002313 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002314 "setnp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002315 [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002316 TB; // GR8 = not parity
2317def SETNPm : I<0x9B, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002318 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002319 "setnp\t$dst",
Evan Cheng621216e2007-09-29 00:00:36 +00002320 [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002321 TB; // [mem8] = not parity
Evan Cheng950aac02007-09-25 01:57:46 +00002322} // Uses = [EFLAGS]
2323
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002324
2325// Integer comparisons
Evan Cheng55687072007-09-14 21:48:26 +00002326let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002327def CMP8rr : I<0x38, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002328 (outs), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002329 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002330 [(X86cmp GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002331def CMP16rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002332 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002333 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002334 [(X86cmp GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002335def CMP32rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002336 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002337 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002338 [(X86cmp GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002339def CMP8mr : I<0x38, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002340 (outs), (ins i8mem :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002341 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002342 [(X86cmp (loadi8 addr:$src1), GR8:$src2),
2343 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002344def CMP16mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002345 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002346 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002347 [(X86cmp (loadi16 addr:$src1), GR16:$src2),
2348 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002349def CMP32mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002350 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002351 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002352 [(X86cmp (loadi32 addr:$src1), GR32:$src2),
2353 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002354def CMP8rm : I<0x3A, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002355 (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002356 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002357 [(X86cmp GR8:$src1, (loadi8 addr:$src2)),
2358 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002359def CMP16rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002360 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002361 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002362 [(X86cmp GR16:$src1, (loadi16 addr:$src2)),
2363 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002364def CMP32rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002365 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002366 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002367 [(X86cmp GR32:$src1, (loadi32 addr:$src2)),
2368 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002369def CMP8ri : Ii8<0x80, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002370 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002371 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002372 [(X86cmp GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002373def CMP16ri : Ii16<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002374 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002375 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002376 [(X86cmp GR16:$src1, imm:$src2),
2377 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002378def CMP32ri : Ii32<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002379 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002380 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002381 [(X86cmp GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002382def CMP8mi : Ii8 <0x80, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002383 (outs), (ins i8mem :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002384 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002385 [(X86cmp (loadi8 addr:$src1), imm:$src2),
2386 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002387def CMP16mi : Ii16<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002388 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002389 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002390 [(X86cmp (loadi16 addr:$src1), imm:$src2),
2391 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002392def CMP32mi : Ii32<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002393 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002394 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002395 [(X86cmp (loadi32 addr:$src1), imm:$src2),
2396 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002397def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002398 (outs), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002399 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002400 [(X86cmp GR16:$src1, i16immSExt8:$src2),
2401 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002402def CMP16mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002403 (outs), (ins i16mem:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002404 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002405 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2),
2406 (implicit EFLAGS)]>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002407def CMP32mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002408 (outs), (ins i32mem:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002409 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002410 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2),
2411 (implicit EFLAGS)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002412def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002413 (outs), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002414 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Cheng621216e2007-09-29 00:00:36 +00002415 [(X86cmp GR32:$src1, i32immSExt8:$src2),
Evan Cheng950aac02007-09-25 01:57:46 +00002416 (implicit EFLAGS)]>;
2417} // Defs = [EFLAGS]
2418
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002419// Sign/Zero extenders
Evan Chengb783fa32007-07-19 01:14:50 +00002420def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002421 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002422 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002423def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002424 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002425 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002426def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002427 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002428 [(set GR32:$dst, (sext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002429def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002430 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002431 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002432def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002433 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002434 [(set GR32:$dst, (sext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002435def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002436 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002437 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
2438
Evan Chengb783fa32007-07-19 01:14:50 +00002439def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002440 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002441 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002442def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002443 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002444 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002445def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002446 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002447 [(set GR32:$dst, (zext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002448def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002449 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002450 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002451def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002452 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002453 [(set GR32:$dst, (zext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002454def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002455 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002456 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
2457
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002458let neverHasSideEffects = 1 in {
2459 let Defs = [AX], Uses = [AL] in
2460 def CBW : I<0x98, RawFrm, (outs), (ins),
2461 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
2462 let Defs = [EAX], Uses = [AX] in
2463 def CWDE : I<0x98, RawFrm, (outs), (ins),
2464 "{cwtl|cwde}", []>; // EAX = signext(AX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002465
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002466 let Defs = [AX,DX], Uses = [AX] in
2467 def CWD : I<0x99, RawFrm, (outs), (ins),
2468 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
2469 let Defs = [EAX,EDX], Uses = [EAX] in
2470 def CDQ : I<0x99, RawFrm, (outs), (ins),
2471 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
2472}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002473
2474//===----------------------------------------------------------------------===//
2475// Alias Instructions
2476//===----------------------------------------------------------------------===//
2477
2478// Alias instructions that map movr0 to xor.
2479// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Chris Lattner17dab4a2008-01-10 05:45:39 +00002480let Defs = [EFLAGS], isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002481def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002482 "xor{b}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002483 [(set GR8:$dst, 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002484def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002485 "xor{w}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002486 [(set GR16:$dst, 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002487def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002488 "xor{l}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002489 [(set GR32:$dst, 0)]>;
Dan Gohman8aef09b2007-09-07 21:32:51 +00002490}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002491
2492// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
2493// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002494let neverHasSideEffects = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002495def MOV16to16_ : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002496 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002497def MOV32to32_ : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002498 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002499
Evan Chengb783fa32007-07-19 01:14:50 +00002500def MOV16_rr : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002501 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002502def MOV32_rr : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002503 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002504} // neverHasSideEffects
2505
2506let isSimpleLoad = 1, mayLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002507def MOV16_rm : I<0x8B, MRMSrcMem, (outs GR16_:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002508 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002509def MOV32_rm : I<0x8B, MRMSrcMem, (outs GR32_:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002510 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00002511}
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002512let mayStore = 1, neverHasSideEffects = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002513def MOV16_mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002514 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002515def MOV32_mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002516 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerc90ee9c2008-01-10 07:59:24 +00002517}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002518
2519//===----------------------------------------------------------------------===//
2520// Thread Local Storage Instructions
2521//
2522
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002523let Uses = [EBX] in
Evan Chengb783fa32007-07-19 01:14:50 +00002524def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym),
Dan Gohman91888f02007-07-31 20:11:57 +00002525 "leal\t${sym:mem}(,%ebx,1), $dst",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002526 [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002527
2528let AddedComplexity = 10 in
Evan Chengb783fa32007-07-19 01:14:50 +00002529def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002530 "movl\t%gs:($src), $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002531 [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
2532
2533let AddedComplexity = 15 in
Evan Chengb783fa32007-07-19 01:14:50 +00002534def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002535 "movl\t%gs:${src:mem}, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002536 [(set GR32:$dst,
2537 (load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
2538
Evan Chengb783fa32007-07-19 01:14:50 +00002539def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002540 "movl\t%gs:0, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002541 [(set GR32:$dst, X86TLStp)]>;
2542
2543//===----------------------------------------------------------------------===//
2544// DWARF Pseudo Instructions
2545//
2546
Evan Chengb783fa32007-07-19 01:14:50 +00002547def DWARF_LOC : I<0, Pseudo, (outs),
2548 (ins i32imm:$line, i32imm:$col, i32imm:$file),
Dan Gohman77af4a82007-09-24 19:25:06 +00002549 ".loc\t${file:debug} ${line:debug} ${col:debug}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002550 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
2551 (i32 imm:$file))]>;
2552
2553//===----------------------------------------------------------------------===//
2554// EH Pseudo Instructions
2555//
2556let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +00002557 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002558def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
Dan Gohman91888f02007-07-31 20:11:57 +00002559 "ret\t#eh_return, addr: $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002560 [(X86ehret GR32:$addr)]>;
2561
2562}
2563
2564//===----------------------------------------------------------------------===//
2565// Non-Instruction Patterns
2566//===----------------------------------------------------------------------===//
2567
2568// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
2569def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
2570def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
2571def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)), (MOV32ri tglobaltlsaddr:$dst)>;
2572def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
2573def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
2574
2575def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
2576 (ADD32ri GR32:$src1, tconstpool:$src2)>;
2577def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
2578 (ADD32ri GR32:$src1, tjumptable:$src2)>;
2579def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
2580 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
2581def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
2582 (ADD32ri GR32:$src1, texternalsym:$src2)>;
2583
2584def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
2585 (MOV32mi addr:$dst, tglobaladdr:$src)>;
2586def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
2587 (MOV32mi addr:$dst, texternalsym:$src)>;
2588
2589// Calls
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +00002590// tailcall stuff
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002591def : Pat<(X86tailcall GR32:$dst),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +00002592 (TAILCALL)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002593
2594def : Pat<(X86tailcall (i32 tglobaladdr:$dst)),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +00002595 (TAILCALL)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002596def : Pat<(X86tailcall (i32 texternalsym:$dst)),
Arnold Schwaighofere2d6bbb2007-10-11 19:40:01 +00002597 (TAILCALL)>;
2598
2599def : Pat<(X86tcret GR32:$dst, imm:$off),
2600 (TCRETURNri GR32:$dst, imm:$off)>;
2601
2602def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off),
2603 (TCRETURNdi texternalsym:$dst, imm:$off)>;
2604
2605def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off),
2606 (TCRETURNdi texternalsym:$dst, imm:$off)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002607
2608def : Pat<(X86call (i32 tglobaladdr:$dst)),
2609 (CALLpcrel32 tglobaladdr:$dst)>;
2610def : Pat<(X86call (i32 texternalsym:$dst)),
2611 (CALLpcrel32 texternalsym:$dst)>;
2612
2613// X86 specific add which produces a flag.
2614def : Pat<(addc GR32:$src1, GR32:$src2),
2615 (ADD32rr GR32:$src1, GR32:$src2)>;
2616def : Pat<(addc GR32:$src1, (load addr:$src2)),
2617 (ADD32rm GR32:$src1, addr:$src2)>;
2618def : Pat<(addc GR32:$src1, imm:$src2),
2619 (ADD32ri GR32:$src1, imm:$src2)>;
2620def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
2621 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
2622
2623def : Pat<(subc GR32:$src1, GR32:$src2),
2624 (SUB32rr GR32:$src1, GR32:$src2)>;
2625def : Pat<(subc GR32:$src1, (load addr:$src2)),
2626 (SUB32rm GR32:$src1, addr:$src2)>;
2627def : Pat<(subc GR32:$src1, imm:$src2),
2628 (SUB32ri GR32:$src1, imm:$src2)>;
2629def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
2630 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
2631
2632def : Pat<(truncstorei1 (i8 imm:$src), addr:$dst),
2633 (MOV8mi addr:$dst, imm:$src)>;
2634def : Pat<(truncstorei1 GR8:$src, addr:$dst),
2635 (MOV8mr addr:$dst, GR8:$src)>;
2636
2637// Comparisons.
2638
2639// TEST R,R is smaller than CMP R,0
Evan Cheng621216e2007-09-29 00:00:36 +00002640def : Pat<(parallel (X86cmp GR8:$src1, 0), (implicit EFLAGS)),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002641 (TEST8rr GR8:$src1, GR8:$src1)>;
Evan Cheng621216e2007-09-29 00:00:36 +00002642def : Pat<(parallel (X86cmp GR16:$src1, 0), (implicit EFLAGS)),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002643 (TEST16rr GR16:$src1, GR16:$src1)>;
Evan Cheng621216e2007-09-29 00:00:36 +00002644def : Pat<(parallel (X86cmp GR32:$src1, 0), (implicit EFLAGS)),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002645 (TEST32rr GR32:$src1, GR32:$src1)>;
2646
2647// {s|z}extload bool -> {s|z}extload byte
2648def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
2649def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
2650def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
2651def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2652def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2653
2654// extload bool -> extload byte
2655def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
2656def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2657def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2658def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
2659def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
2660def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
2661
2662// anyext -> zext
2663def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
2664def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
2665def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
2666def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
2667def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
2668def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
2669
Evan Chengf2abee72007-12-13 00:43:27 +00002670// (and (i32 load), 255) -> (zextload i8)
2671def : Pat<(i32 (and (loadi32 addr:$src), (i32 255))), (MOVZX32rm8 addr:$src)>;
2672def : Pat<(i32 (and (loadi32 addr:$src), (i32 65535))),(MOVZX32rm16 addr:$src)>;
2673
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002674//===----------------------------------------------------------------------===//
2675// Some peepholes
2676//===----------------------------------------------------------------------===//
2677
2678// (shl x, 1) ==> (add x, x)
2679def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
2680def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
2681def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
2682
2683// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
2684def : Pat<(or (srl GR32:$src1, CL:$amt),
2685 (shl GR32:$src2, (sub 32, CL:$amt))),
2686 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
2687
2688def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
2689 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2690 (SHRD32mrCL addr:$dst, GR32:$src2)>;
2691
2692// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
2693def : Pat<(or (shl GR32:$src1, CL:$amt),
2694 (srl GR32:$src2, (sub 32, CL:$amt))),
2695 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
2696
2697def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
2698 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2699 (SHLD32mrCL addr:$dst, GR32:$src2)>;
2700
2701// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
2702def : Pat<(or (srl GR16:$src1, CL:$amt),
2703 (shl GR16:$src2, (sub 16, CL:$amt))),
2704 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
2705
2706def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
2707 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2708 (SHRD16mrCL addr:$dst, GR16:$src2)>;
2709
2710// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
2711def : Pat<(or (shl GR16:$src1, CL:$amt),
2712 (srl GR16:$src2, (sub 16, CL:$amt))),
2713 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
2714
2715def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
2716 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2717 (SHLD16mrCL addr:$dst, GR16:$src2)>;
2718
2719
2720//===----------------------------------------------------------------------===//
2721// Floating Point Stack Support
2722//===----------------------------------------------------------------------===//
2723
2724include "X86InstrFPStack.td"
2725
2726//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +00002727// X86-64 Support
2728//===----------------------------------------------------------------------===//
2729
Chris Lattner2de8d2b2008-01-10 05:50:42 +00002730include "X86Instr64bit.td"
Evan Cheng86ab7d32007-07-31 08:04:03 +00002731
2732//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002733// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
2734//===----------------------------------------------------------------------===//
2735
2736include "X86InstrMMX.td"
2737
2738//===----------------------------------------------------------------------===//
2739// XMM Floating point support (requires SSE / SSE2)
2740//===----------------------------------------------------------------------===//
2741
2742include "X86InstrSSE.td"