blob: 86e102e1d1a1efe3eedc571b3dfc94ad175a221b [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- X86InstrInfo.td - Describe the X86 Instruction Set -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This 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
26def SDTX86Cmov : SDTypeProfile<1, 3,
27 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
28 SDTCisVT<3, i8>]>;
Evan Cheng950aac02007-09-25 01:57:46 +000029def SDTX86Cmov_NEW : SDTypeProfile<1, 4,
30 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
31 SDTCisVT<3, i8>, SDTCisVT<4, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032
33def SDTX86BrCond : SDTypeProfile<0, 2,
34 [SDTCisVT<0, OtherVT>, SDTCisVT<1, i8>]>;
Evan Cheng950aac02007-09-25 01:57:46 +000035def SDTX86BrCond_NEW : SDTypeProfile<0, 3,
36 [SDTCisVT<0, OtherVT>,
37 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000038
39def SDTX86SetCC : SDTypeProfile<1, 1,
40 [SDTCisVT<0, i8>, SDTCisVT<1, i8>]>;
Evan Cheng950aac02007-09-25 01:57:46 +000041def SDTX86SetCC_NEW : SDTypeProfile<1, 2,
42 [SDTCisVT<0, i8>,
43 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000044
45def SDTX86Ret : SDTypeProfile<0, 1, [SDTCisVT<0, i16>]>;
46
47def SDT_X86CallSeqStart : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
48def SDT_X86CallSeqEnd : SDTypeProfile<0, 2, [ SDTCisVT<0, i32>,
49 SDTCisVT<1, i32> ]>;
50
51def SDT_X86Call : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>;
52
53def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
54
55def SDTX86RdTsc : SDTypeProfile<0, 0, []>;
56
57def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
58
59def SDT_X86TLSADDR : SDTypeProfile<1, 1, [SDTCisPtrTy<0>, SDTCisInt<1>]>;
60
61def SDT_X86TLSTP : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
62
63def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
64
65def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
66def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
67
68def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest,
69 [SDNPHasChain, SDNPOutFlag]>;
Evan Cheng950aac02007-09-25 01:57:46 +000070def X86cmp_new : SDNode<"X86ISD::CMP_NEW" , SDTX86CmpTest>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000071
Evan Cheng950aac02007-09-25 01:57:46 +000072def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov,
Dan Gohmanf17a25c2007-07-18 16:29:46 +000073 [SDNPInFlag, SDNPOutFlag]>;
Evan Cheng950aac02007-09-25 01:57:46 +000074def X86cmov_new: SDNode<"X86ISD::CMOV_NEW", SDTX86Cmov_NEW>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000075def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
76 [SDNPHasChain, SDNPInFlag]>;
Evan Cheng950aac02007-09-25 01:57:46 +000077def X86brcond_new : SDNode<"X86ISD::BRCOND_NEW", SDTX86BrCond_NEW,
78 [SDNPHasChain]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000079def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC,
80 [SDNPInFlag, SDNPOutFlag]>;
Evan Cheng950aac02007-09-25 01:57:46 +000081def X86setcc_new : SDNode<"X86ISD::SETCC_NEW", SDTX86SetCC_NEW>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000082
83def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
84 [SDNPHasChain, SDNPOptInFlag]>;
85
86def X86callseq_start :
87 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
88 [SDNPHasChain, SDNPOutFlag]>;
89def X86callseq_end :
90 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
91 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
92
93def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
94 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
95
96def X86tailcall: SDNode<"X86ISD::TAILCALL", SDT_X86Call,
97 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
98
99def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
100 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
101def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
102 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
103
104def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc,
105 [SDNPHasChain, SDNPOutFlag]>;
106
107def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
108def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>;
109
110def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
111 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
112def X86TLStp : SDNode<"X86ISD::THREAD_POINTER", SDT_X86TLSTP, []>;
113
114def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
115 [SDNPHasChain]>;
116
117
118//===----------------------------------------------------------------------===//
119// X86 Operand Definitions.
120//
121
122// *mem - Operand definitions for the funky X86 addressing mode operands.
123//
124class X86MemOperand<string printMethod> : Operand<iPTR> {
125 let PrintMethod = printMethod;
126 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc, i32imm);
127}
128
129def i8mem : X86MemOperand<"printi8mem">;
130def i16mem : X86MemOperand<"printi16mem">;
131def i32mem : X86MemOperand<"printi32mem">;
132def i64mem : X86MemOperand<"printi64mem">;
133def i128mem : X86MemOperand<"printi128mem">;
134def f32mem : X86MemOperand<"printf32mem">;
135def f64mem : X86MemOperand<"printf64mem">;
Dale Johannesen4ab00bd2007-08-05 18:49:15 +0000136def f80mem : X86MemOperand<"printf80mem">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000137def f128mem : X86MemOperand<"printf128mem">;
138
139def lea32mem : Operand<i32> {
140 let PrintMethod = "printi32mem";
141 let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
142}
143
144def SSECC : Operand<i8> {
145 let PrintMethod = "printSSECC";
146}
147
148def piclabel: Operand<i32> {
149 let PrintMethod = "printPICLabel";
150}
151
152// A couple of more descriptive operand definitions.
153// 16-bits but only 8 bits are significant.
154def i16i8imm : Operand<i16>;
155// 32-bits but only 8 bits are significant.
156def i32i8imm : Operand<i32>;
157
158// Branch targets have OtherVT type.
159def brtarget : Operand<OtherVT>;
160
161//===----------------------------------------------------------------------===//
162// X86 Complex Pattern Definitions.
163//
164
165// Define X86 specific addressing mode.
166def addr : ComplexPattern<iPTR, 4, "SelectAddr", [], []>;
167def lea32addr : ComplexPattern<i32, 4, "SelectLEAAddr",
168 [add, mul, shl, or, frameindex], []>;
169
170//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000171// X86 Instruction Predicate Definitions.
172def HasMMX : Predicate<"Subtarget->hasMMX()">;
173def HasSSE1 : Predicate<"Subtarget->hasSSE1()">;
174def HasSSE2 : Predicate<"Subtarget->hasSSE2()">;
175def HasSSE3 : Predicate<"Subtarget->hasSSE3()">;
176def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">;
Dale Johannesene0e0fd02007-09-23 14:52:20 +0000177def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">;
178def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000179def In32BitMode : Predicate<"!Subtarget->is64Bit()">;
180def In64BitMode : Predicate<"Subtarget->is64Bit()">;
Evan Cheng09e13792007-08-01 23:45:51 +0000181def HasLow4G : Predicate<"Subtarget->hasLow4GUserSpaceAddress()">;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000182def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">;
183def NotSmallCode : Predicate<"TM.getCodeModel() != CodeModel::Small">;
184def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">;
185
186//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +0000187// X86 Instruction Format Definitions.
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000188//
189
Evan Cheng86ab7d32007-07-31 08:04:03 +0000190include "X86InstrFormats.td"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000191
192//===----------------------------------------------------------------------===//
193// Pattern fragments...
194//
195
196// X86 specific condition code. These correspond to CondCode in
197// X86InstrInfo.h. They must be kept in synch.
198def X86_COND_A : PatLeaf<(i8 0)>;
199def X86_COND_AE : PatLeaf<(i8 1)>;
200def X86_COND_B : PatLeaf<(i8 2)>;
201def X86_COND_BE : PatLeaf<(i8 3)>;
202def X86_COND_E : PatLeaf<(i8 4)>;
203def X86_COND_G : PatLeaf<(i8 5)>;
204def X86_COND_GE : PatLeaf<(i8 6)>;
205def X86_COND_L : PatLeaf<(i8 7)>;
206def X86_COND_LE : PatLeaf<(i8 8)>;
207def X86_COND_NE : PatLeaf<(i8 9)>;
208def X86_COND_NO : PatLeaf<(i8 10)>;
209def X86_COND_NP : PatLeaf<(i8 11)>;
210def X86_COND_NS : PatLeaf<(i8 12)>;
211def X86_COND_O : PatLeaf<(i8 13)>;
212def X86_COND_P : PatLeaf<(i8 14)>;
213def X86_COND_S : PatLeaf<(i8 15)>;
214
215def i16immSExt8 : PatLeaf<(i16 imm), [{
216 // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
217 // sign extended field.
218 return (int16_t)N->getValue() == (int8_t)N->getValue();
219}]>;
220
221def i32immSExt8 : PatLeaf<(i32 imm), [{
222 // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
223 // sign extended field.
224 return (int32_t)N->getValue() == (int8_t)N->getValue();
225}]>;
226
227// Helper fragments for loads.
228def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>;
229def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>;
230def loadi32 : PatFrag<(ops node:$ptr), (i32 (load node:$ptr))>;
231def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>;
232
233def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>;
234def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>;
Dale Johannesen4ab00bd2007-08-05 18:49:15 +0000235def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr))>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000236
237def sextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (sextloadi1 node:$ptr))>;
238def sextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (sextloadi1 node:$ptr))>;
239def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
240def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
241def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>;
242
243def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>;
244def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>;
245def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>;
246def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
247def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>;
248def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>;
249
250def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>;
251def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>;
252def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>;
253def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>;
254def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>;
255def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
256
257//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000258// Instruction list...
259//
260
261// ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into
262// a stack adjustment and the codegen must know that they may modify the stack
263// pointer before prolog-epilog rewriting occurs.
Evan Chenge4f1f572007-09-28 01:35:02 +0000264// Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become sub / add
Evan Cheng037364a2007-09-28 01:19:48 +0000265// which can clobber EFLAGS.
266let Defs = [ESP, EFLAGS], Uses = [ESP] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000267def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt), "#ADJCALLSTACKDOWN",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000268 [(X86callseq_start imm:$amt)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000269def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000270 "#ADJCALLSTACKUP",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000271 [(X86callseq_end imm:$amt1, imm:$amt2)]>;
272}
Evan Chengb783fa32007-07-19 01:14:50 +0000273def IMPLICIT_USE : I<0, Pseudo, (outs), (ins variable_ops),
274 "#IMPLICIT_USE", []>;
275def IMPLICIT_DEF : I<0, Pseudo, (outs variable_ops), (ins),
276 "#IMPLICIT_DEF", []>;
277def IMPLICIT_DEF_GR8 : I<0, Pseudo, (outs GR8:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000278 "#IMPLICIT_DEF $dst",
279 [(set GR8:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000280def IMPLICIT_DEF_GR16 : I<0, Pseudo, (outs GR16:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000281 "#IMPLICIT_DEF $dst",
282 [(set GR16:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000283def IMPLICIT_DEF_GR32 : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000284 "#IMPLICIT_DEF $dst",
285 [(set GR32:$dst, (undef))]>;
286
287// Nop
Evan Chengb783fa32007-07-19 01:14:50 +0000288def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000289
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000290
291//===----------------------------------------------------------------------===//
292// Control Flow Instructions...
293//
294
295// Return instructions.
296let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +0000297 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000298 def RET : I<0xC3, RawFrm, (outs), (ins), "ret", [(X86retflag 0)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000299 def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt), "ret\t$amt",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000300 [(X86retflag imm:$amt)]>;
301}
302
303// All branches are RawFrm, Void, Branch, and Terminators
Evan Cheng37e7c752007-07-21 00:34:19 +0000304let isBranch = 1, isTerminator = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000305 class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> :
306 I<opcode, RawFrm, (outs), ins, asm, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000307
308// Indirect branches
309let isBranch = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000310 def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000311
Evan Cheng37e7c752007-07-21 00:34:19 +0000312let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
Dan Gohman91888f02007-07-31 20:11:57 +0000313 def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000314 [(brind GR32:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000315 def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000316 [(brind (loadi32 addr:$dst))]>;
317}
318
319// Conditional branches
Evan Cheng950aac02007-09-25 01:57:46 +0000320let Uses = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +0000321def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000322 [(X86brcond bb:$dst, X86_COND_E)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000323def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000324 [(X86brcond bb:$dst, X86_COND_NE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000325def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000326 [(X86brcond bb:$dst, X86_COND_L)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000327def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000328 [(X86brcond bb:$dst, X86_COND_LE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000329def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000330 [(X86brcond bb:$dst, X86_COND_G)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000331def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000332 [(X86brcond bb:$dst, X86_COND_GE)]>, TB;
333
Dan Gohman91888f02007-07-31 20:11:57 +0000334def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000335 [(X86brcond bb:$dst, X86_COND_B)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000336def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000337 [(X86brcond bb:$dst, X86_COND_BE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000338def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000339 [(X86brcond bb:$dst, X86_COND_A)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000340def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000341 [(X86brcond bb:$dst, X86_COND_AE)]>, TB;
342
Dan Gohman91888f02007-07-31 20:11:57 +0000343def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000344 [(X86brcond bb:$dst, X86_COND_S)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000345def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000346 [(X86brcond bb:$dst, X86_COND_NS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000347def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000348 [(X86brcond bb:$dst, X86_COND_P)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000349def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000350 [(X86brcond bb:$dst, X86_COND_NP)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000351def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000352 [(X86brcond bb:$dst, X86_COND_O)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000353def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000354 [(X86brcond bb:$dst, X86_COND_NO)]>, TB;
Evan Cheng950aac02007-09-25 01:57:46 +0000355} // Uses = [EFLAGS]
356
357let Uses = [EFLAGS] in {
358def NEW_JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
359 [(X86brcond_new bb:$dst, X86_COND_E, EFLAGS)]>, TB;
360def NEW_JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
361 [(X86brcond_new bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
362def NEW_JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
363 [(X86brcond_new bb:$dst, X86_COND_L, EFLAGS)]>, TB;
364def NEW_JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
365 [(X86brcond_new bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
366def NEW_JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
367 [(X86brcond_new bb:$dst, X86_COND_G, EFLAGS)]>, TB;
368def NEW_JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
369 [(X86brcond_new bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
370
371def NEW_JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
372 [(X86brcond_new bb:$dst, X86_COND_B, EFLAGS)]>, TB;
373def NEW_JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
374 [(X86brcond_new bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
375def NEW_JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
376 [(X86brcond_new bb:$dst, X86_COND_A, EFLAGS)]>, TB;
377def NEW_JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
378 [(X86brcond_new bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
379
380def NEW_JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
381 [(X86brcond_new bb:$dst, X86_COND_S, EFLAGS)]>, TB;
382def NEW_JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
383 [(X86brcond_new bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
384def NEW_JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
385 [(X86brcond_new bb:$dst, X86_COND_P, EFLAGS)]>, TB;
386def NEW_JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
387 [(X86brcond_new bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
388def NEW_JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
389 [(X86brcond_new bb:$dst, X86_COND_O, EFLAGS)]>, TB;
390def NEW_JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
391 [(X86brcond_new bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
392} // Uses = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000393
394//===----------------------------------------------------------------------===//
395// Call Instructions...
396//
Evan Cheng37e7c752007-07-21 00:34:19 +0000397let isCall = 1 in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000398 // All calls clobber the non-callee saved registers...
399 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
400 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
Evan Cheng950aac02007-09-25 01:57:46 +0000401 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000402 def CALLpcrel32 : I<0xE8, RawFrm, (outs), (ins i32imm:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000403 "call\t${dst:call}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000404 def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000405 "call\t{*}$dst", [(X86call GR32:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000406 def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000407 "call\t{*}$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000408 }
409
410// Tail call stuff.
Evan Cheng37e7c752007-07-21 00:34:19 +0000411let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000412 def TAILJMPd : IBr<0xE9, (ins i32imm:$dst), "jmp\t${dst:call} # TAIL CALL",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000413 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000414let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000415 def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp\t{*}$dst # TAIL CALL",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000416 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000417let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000418 def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +0000419 "jmp\t{*}$dst # TAIL CALL", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000420
421//===----------------------------------------------------------------------===//
422// Miscellaneous Instructions...
423//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000424let Defs = [EBP, ESP], Uses = [EBP, ESP] in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000425def LEAVE : I<0xC9, RawFrm,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000426 (outs), (ins), "leave", []>;
427
428let Defs = [ESP], Uses = [ESP] in {
Evan Chengd8434332007-09-26 01:29:06 +0000429def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000430
Evan Chengd8434332007-09-26 01:29:06 +0000431def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000432}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000433
Evan Chengd8434332007-09-26 01:29:06 +0000434let Defs = [ESP, EFLAGS], Uses = [ESP] in
Evan Chengf1341312007-09-26 21:28:00 +0000435def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
Evan Chengd8434332007-09-26 01:29:06 +0000436let Defs = [ESP], Uses = [ESP, EFLAGS] in
Evan Chengf1341312007-09-26 21:28:00 +0000437def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
Evan Chengd8434332007-09-26 01:29:06 +0000438
Evan Chengb783fa32007-07-19 01:14:50 +0000439def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label),
Dan Gohman91888f02007-07-31 20:11:57 +0000440 "call\t$label", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000441
442let isTwoAddress = 1 in // GR32 = bswap GR32
443 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Chengb783fa32007-07-19 01:14:50 +0000444 (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000445 "bswap{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000446 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
447
Evan Chengb783fa32007-07-19 01:14:50 +0000448// FIXME: Model xchg* as two address instructions?
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000449def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
Evan Chengb783fa32007-07-19 01:14:50 +0000450 (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000451 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000452def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000453 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000454 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000455def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000456 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000457 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000458
459def XCHG8mr : I<0x86, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000460 (outs), (ins i8mem:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000461 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000462def XCHG16mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000463 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000464 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000465def XCHG32mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000466 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000467 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000468def XCHG8rm : I<0x86, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000469 (outs), (ins GR8:$src1, i8mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000470 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000471def XCHG16rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000472 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000473 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000474def XCHG32rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000475 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000476 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000477
478def LEA16r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000479 (outs GR16:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000480 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000481def LEA32r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000482 (outs GR32:$dst), (ins lea32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000483 "lea{l}\t{$src|$dst}, {$dst|$src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000484 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
485
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000486let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000487def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000488 [(X86rep_movs i8)]>, REP;
Evan Chengb783fa32007-07-19 01:14:50 +0000489def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000490 [(X86rep_movs i16)]>, REP, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000491def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000492 [(X86rep_movs i32)]>, REP;
493}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000494
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000495let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000496def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000497 [(X86rep_stos i8)]>, REP;
498let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000499def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000500 [(X86rep_stos i16)]>, REP, OpSize;
501let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000502def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000503 [(X86rep_stos i32)]>, REP;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000504
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000505let Defs = [RAX, RDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000506def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000507 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000508
509//===----------------------------------------------------------------------===//
510// Input/Output Instructions...
511//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000512let Defs = [AL], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000513def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000514 "in{b}\t{%dx, %al|%AL, %DX}", []>;
515let Defs = [AX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000516def IN16rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000517 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
518let Defs = [EAX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000519def IN32rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000520 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000521
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000522let Defs = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000523def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000524 "in{b}\t{$port, %al|%AL, $port}", []>;
525let Defs = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000526def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000527 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
528let Defs = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000529def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000530 "in{l}\t{$port, %eax|%EAX, $port}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000531
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000532let Uses = [DX, AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000533def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000534 "out{b}\t{%al, %dx|%DX, %AL}", []>;
535let Uses = [DX, AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000536def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000537 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
538let Uses = [DX, EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000539def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000540 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000541
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000542let Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000543def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000544 "out{b}\t{%al, $port|$port, %AL}", []>;
545let Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000546def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000547 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
548let Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000549def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000550 "out{l}\t{%eax, $port|$port, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000551
552//===----------------------------------------------------------------------===//
553// Move Instructions...
554//
Evan Chengb783fa32007-07-19 01:14:50 +0000555def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000556 "mov{b}\t{$src, $dst|$dst, $src}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000557def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000558 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000559def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000560 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000561let isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000562def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000563 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000564 [(set GR8:$dst, imm:$src)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000565def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000566 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000567 [(set GR16:$dst, imm:$src)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000568def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000569 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000570 [(set GR32:$dst, imm:$src)]>;
571}
Evan Chengb783fa32007-07-19 01:14:50 +0000572def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000573 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000574 [(store (i8 imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000575def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000576 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000577 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000578def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000579 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000580 [(store (i32 imm:$src), addr:$dst)]>;
581
Evan Cheng4e84e452007-08-30 05:49:43 +0000582let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000583def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000584 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000585 [(set GR8:$dst, (load addr:$src))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000586def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000587 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000588 [(set GR16:$dst, (load addr:$src))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000589def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000590 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000591 [(set GR32:$dst, (load addr:$src))]>;
Evan Cheng4e84e452007-08-30 05:49:43 +0000592}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000593
Evan Chengb783fa32007-07-19 01:14:50 +0000594def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000595 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000596 [(store GR8:$src, addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000597def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000598 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000599 [(store GR16:$src, addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000600def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000601 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000602 [(store GR32:$src, addr:$dst)]>;
603
604//===----------------------------------------------------------------------===//
605// Fixed-Register Multiplication and Division Instructions...
606//
607
608// Extra precision multiplication
Evan Cheng55687072007-09-14 21:48:26 +0000609let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Dan Gohman91888f02007-07-31 20:11:57 +0000610def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000611 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
612 // This probably ought to be moved to a def : Pat<> if the
613 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000614 [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000615let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000616def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000617 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000618let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000619def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>;
620 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000621let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000622def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000623 "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000624 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
625 // This probably ought to be moved to a def : Pat<> if the
626 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000627 [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000628let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000629def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000630 "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
Evan Cheng55687072007-09-14 21:48:26 +0000631let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000632def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000633 "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000634
Evan Cheng55687072007-09-14 21:48:26 +0000635let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000636def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
637 // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000638let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000639def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000640 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000641let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000642def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
643 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000644let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000645def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000646 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000647let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000648def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000649 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
650let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000651def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000652 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000653
654// unsigned division/remainder
Evan Cheng55687072007-09-14 21:48:26 +0000655let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000656def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000657 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000658let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000659def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000660 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000661let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000662def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000663 "div{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000664let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000665def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000666 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000667let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000668def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000669 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000670let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000671def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000672 "div{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000673
674// Signed division/remainder.
Evan Cheng55687072007-09-14 21:48:26 +0000675let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000676def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000677 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000678let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000679def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000680 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000681let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000682def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000683 "idiv{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000684let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000685def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000686 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000687let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000688def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000689 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000690let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000691def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000692 "idiv{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000693
694
695//===----------------------------------------------------------------------===//
696// Two address Instructions...
697//
698let isTwoAddress = 1 in {
699
700// Conditional moves
Evan Cheng950aac02007-09-25 01:57:46 +0000701let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000702def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000703 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000704 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000705 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
706 X86_COND_B))]>,
707 TB, OpSize;
708def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000709 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000710 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000711 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
712 X86_COND_B))]>,
713 TB, OpSize;
714def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000715 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000716 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000717 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
718 X86_COND_B))]>,
719 TB;
720def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000721 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000722 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000723 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
724 X86_COND_B))]>,
725 TB;
726
727def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000728 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000729 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000730 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
731 X86_COND_AE))]>,
732 TB, OpSize;
733def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000734 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000735 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000736 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
737 X86_COND_AE))]>,
738 TB, OpSize;
739def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000740 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000741 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000742 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
743 X86_COND_AE))]>,
744 TB;
745def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000746 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000747 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000748 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
749 X86_COND_AE))]>,
750 TB;
751
752def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000753 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000754 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000755 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
756 X86_COND_E))]>,
757 TB, OpSize;
758def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000759 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000760 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000761 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
762 X86_COND_E))]>,
763 TB, OpSize;
764def CMOVE32rr : I<0x44, 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 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000767 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
768 X86_COND_E))]>,
769 TB;
770def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000771 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000772 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000773 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
774 X86_COND_E))]>,
775 TB;
776
777def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000778 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000779 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000780 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
781 X86_COND_NE))]>,
782 TB, OpSize;
783def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000784 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000785 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000786 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
787 X86_COND_NE))]>,
788 TB, OpSize;
789def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000790 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000791 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000792 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
793 X86_COND_NE))]>,
794 TB;
795def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000796 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000797 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000798 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
799 X86_COND_NE))]>,
800 TB;
801
802def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000803 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000804 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000805 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
806 X86_COND_BE))]>,
807 TB, OpSize;
808def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000809 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000810 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000811 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
812 X86_COND_BE))]>,
813 TB, OpSize;
814def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000815 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000816 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000817 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
818 X86_COND_BE))]>,
819 TB;
820def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000821 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000822 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000823 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
824 X86_COND_BE))]>,
825 TB;
826
827def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000828 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000829 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000830 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
831 X86_COND_A))]>,
832 TB, OpSize;
833def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000834 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000835 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000836 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
837 X86_COND_A))]>,
838 TB, OpSize;
839def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000840 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000841 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000842 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
843 X86_COND_A))]>,
844 TB;
845def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000846 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000847 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000848 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
849 X86_COND_A))]>,
850 TB;
851
852def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000853 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000854 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000855 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
856 X86_COND_L))]>,
857 TB, OpSize;
858def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000859 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000860 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000861 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
862 X86_COND_L))]>,
863 TB, OpSize;
864def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000865 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000866 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000867 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
868 X86_COND_L))]>,
869 TB;
870def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000871 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000872 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000873 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
874 X86_COND_L))]>,
875 TB;
876
877def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000878 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000879 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000880 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
881 X86_COND_GE))]>,
882 TB, OpSize;
883def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000884 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000885 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000886 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
887 X86_COND_GE))]>,
888 TB, OpSize;
889def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000890 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000891 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000892 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
893 X86_COND_GE))]>,
894 TB;
895def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000896 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000897 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000898 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
899 X86_COND_GE))]>,
900 TB;
901
902def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000903 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000904 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000905 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
906 X86_COND_LE))]>,
907 TB, OpSize;
908def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000909 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000910 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000911 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
912 X86_COND_LE))]>,
913 TB, OpSize;
914def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000915 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000916 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000917 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
918 X86_COND_LE))]>,
919 TB;
920def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000921 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000922 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000923 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
924 X86_COND_LE))]>,
925 TB;
926
927def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000928 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000929 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000930 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
931 X86_COND_G))]>,
932 TB, OpSize;
933def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000934 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000935 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000936 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
937 X86_COND_G))]>,
938 TB, OpSize;
939def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000940 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000941 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000942 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
943 X86_COND_G))]>,
944 TB;
945def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000946 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000947 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000948 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
949 X86_COND_G))]>,
950 TB;
951
952def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000953 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000954 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000955 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
956 X86_COND_S))]>,
957 TB, OpSize;
958def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000959 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000960 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000961 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
962 X86_COND_S))]>,
963 TB, OpSize;
964def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000965 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000966 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000967 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
968 X86_COND_S))]>,
969 TB;
970def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000971 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000972 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000973 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
974 X86_COND_S))]>,
975 TB;
976
977def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000978 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000979 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000980 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
981 X86_COND_NS))]>,
982 TB, OpSize;
983def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000984 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000985 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000986 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
987 X86_COND_NS))]>,
988 TB, OpSize;
989def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000990 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000991 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000992 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
993 X86_COND_NS))]>,
994 TB;
995def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000996 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000997 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000998 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
999 X86_COND_NS))]>,
1000 TB;
1001
1002def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +00001003 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001004 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001005 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1006 X86_COND_P))]>,
1007 TB, OpSize;
1008def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001009 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001010 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001011 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1012 X86_COND_P))]>,
1013 TB, OpSize;
1014def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001015 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001016 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001017 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1018 X86_COND_P))]>,
1019 TB;
1020def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001021 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001022 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001023 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1024 X86_COND_P))]>,
1025 TB;
1026
1027def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +00001028 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001029 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001030 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1031 X86_COND_NP))]>,
1032 TB, OpSize;
1033def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001034 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001035 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001036 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1037 X86_COND_NP))]>,
1038 TB, OpSize;
1039def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001040 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001041 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001042 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1043 X86_COND_NP))]>,
1044 TB;
1045def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001046 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001047 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001048 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1049 X86_COND_NP))]>,
1050 TB;
1051
1052
Evan Cheng950aac02007-09-25 01:57:46 +00001053def NEW_CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
1054 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1055 "cmovb\t{$src2, $dst|$dst, $src2}",
1056 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1057 X86_COND_B, EFLAGS))]>,
1058 TB, OpSize;
1059def NEW_CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
1060 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1061 "cmovb\t{$src2, $dst|$dst, $src2}",
1062 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1063 X86_COND_B, EFLAGS))]>,
1064 TB, OpSize;
1065def NEW_CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
1066 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1067 "cmovb\t{$src2, $dst|$dst, $src2}",
1068 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1069 X86_COND_B, EFLAGS))]>,
1070 TB;
1071def NEW_CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
1072 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1073 "cmovb\t{$src2, $dst|$dst, $src2}",
1074 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1075 X86_COND_B, EFLAGS))]>,
1076 TB;
1077
1078def NEW_CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
1079 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1080 "cmovae\t{$src2, $dst|$dst, $src2}",
1081 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1082 X86_COND_AE, EFLAGS))]>,
1083 TB, OpSize;
1084def NEW_CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
1085 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1086 "cmovae\t{$src2, $dst|$dst, $src2}",
1087 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1088 X86_COND_AE, EFLAGS))]>,
1089 TB, OpSize;
1090def NEW_CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
1091 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1092 "cmovae\t{$src2, $dst|$dst, $src2}",
1093 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1094 X86_COND_AE, EFLAGS))]>,
1095 TB;
1096def NEW_CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
1097 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1098 "cmovae\t{$src2, $dst|$dst, $src2}",
1099 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1100 X86_COND_AE, EFLAGS))]>,
1101 TB;
1102
1103def NEW_CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
1104 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1105 "cmove\t{$src2, $dst|$dst, $src2}",
1106 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1107 X86_COND_E, EFLAGS))]>,
1108 TB, OpSize;
1109def NEW_CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
1110 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1111 "cmove\t{$src2, $dst|$dst, $src2}",
1112 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1113 X86_COND_E, EFLAGS))]>,
1114 TB, OpSize;
1115def NEW_CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
1116 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1117 "cmove\t{$src2, $dst|$dst, $src2}",
1118 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1119 X86_COND_E, EFLAGS))]>,
1120 TB;
1121def NEW_CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
1122 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1123 "cmove\t{$src2, $dst|$dst, $src2}",
1124 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1125 X86_COND_E, EFLAGS))]>,
1126 TB;
1127
1128def NEW_CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
1129 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1130 "cmovne\t{$src2, $dst|$dst, $src2}",
1131 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1132 X86_COND_NE, EFLAGS))]>,
1133 TB, OpSize;
1134def NEW_CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
1135 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1136 "cmovne\t{$src2, $dst|$dst, $src2}",
1137 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1138 X86_COND_NE, EFLAGS))]>,
1139 TB, OpSize;
1140def NEW_CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
1141 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1142 "cmovne\t{$src2, $dst|$dst, $src2}",
1143 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1144 X86_COND_NE, EFLAGS))]>,
1145 TB;
1146def NEW_CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
1147 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1148 "cmovne\t{$src2, $dst|$dst, $src2}",
1149 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1150 X86_COND_NE, EFLAGS))]>,
1151 TB;
1152
1153def NEW_CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
1154 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1155 "cmovbe\t{$src2, $dst|$dst, $src2}",
1156 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1157 X86_COND_BE, EFLAGS))]>,
1158 TB, OpSize;
1159def NEW_CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
1160 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1161 "cmovbe\t{$src2, $dst|$dst, $src2}",
1162 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1163 X86_COND_BE, EFLAGS))]>,
1164 TB, OpSize;
1165def NEW_CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
1166 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1167 "cmovbe\t{$src2, $dst|$dst, $src2}",
1168 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1169 X86_COND_BE, EFLAGS))]>,
1170 TB;
1171def NEW_CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
1172 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1173 "cmovbe\t{$src2, $dst|$dst, $src2}",
1174 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1175 X86_COND_BE, EFLAGS))]>,
1176 TB;
1177
1178def NEW_CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
1179 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1180 "cmova\t{$src2, $dst|$dst, $src2}",
1181 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1182 X86_COND_A, EFLAGS))]>,
1183 TB, OpSize;
1184def NEW_CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
1185 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1186 "cmova\t{$src2, $dst|$dst, $src2}",
1187 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1188 X86_COND_A, EFLAGS))]>,
1189 TB, OpSize;
1190def NEW_CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
1191 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1192 "cmova\t{$src2, $dst|$dst, $src2}",
1193 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1194 X86_COND_A, EFLAGS))]>,
1195 TB;
1196def NEW_CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
1197 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1198 "cmova\t{$src2, $dst|$dst, $src2}",
1199 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1200 X86_COND_A, EFLAGS))]>,
1201 TB;
1202
1203def NEW_CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
1204 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1205 "cmovl\t{$src2, $dst|$dst, $src2}",
1206 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1207 X86_COND_L, EFLAGS))]>,
1208 TB, OpSize;
1209def NEW_CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
1210 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1211 "cmovl\t{$src2, $dst|$dst, $src2}",
1212 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1213 X86_COND_L, EFLAGS))]>,
1214 TB, OpSize;
1215def NEW_CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
1216 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1217 "cmovl\t{$src2, $dst|$dst, $src2}",
1218 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1219 X86_COND_L, EFLAGS))]>,
1220 TB;
1221def NEW_CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
1222 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1223 "cmovl\t{$src2, $dst|$dst, $src2}",
1224 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1225 X86_COND_L, EFLAGS))]>,
1226 TB;
1227
1228def NEW_CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
1229 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1230 "cmovge\t{$src2, $dst|$dst, $src2}",
1231 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1232 X86_COND_GE, EFLAGS))]>,
1233 TB, OpSize;
1234def NEW_CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
1235 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1236 "cmovge\t{$src2, $dst|$dst, $src2}",
1237 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1238 X86_COND_GE, EFLAGS))]>,
1239 TB, OpSize;
1240def NEW_CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
1241 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1242 "cmovge\t{$src2, $dst|$dst, $src2}",
1243 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1244 X86_COND_GE, EFLAGS))]>,
1245 TB;
1246def NEW_CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
1247 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1248 "cmovge\t{$src2, $dst|$dst, $src2}",
1249 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1250 X86_COND_GE, EFLAGS))]>,
1251 TB;
1252
1253def NEW_CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
1254 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1255 "cmovle\t{$src2, $dst|$dst, $src2}",
1256 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1257 X86_COND_LE, EFLAGS))]>,
1258 TB, OpSize;
1259def NEW_CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
1260 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1261 "cmovle\t{$src2, $dst|$dst, $src2}",
1262 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1263 X86_COND_LE, EFLAGS))]>,
1264 TB, OpSize;
1265def NEW_CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
1266 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1267 "cmovle\t{$src2, $dst|$dst, $src2}",
1268 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1269 X86_COND_LE, EFLAGS))]>,
1270 TB;
1271def NEW_CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1272 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1273 "cmovle\t{$src2, $dst|$dst, $src2}",
1274 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1275 X86_COND_LE, EFLAGS))]>,
1276 TB;
1277
1278def NEW_CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
1279 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1280 "cmovg\t{$src2, $dst|$dst, $src2}",
1281 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1282 X86_COND_G, EFLAGS))]>,
1283 TB, OpSize;
1284def NEW_CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1285 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1286 "cmovg\t{$src2, $dst|$dst, $src2}",
1287 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1288 X86_COND_G, EFLAGS))]>,
1289 TB, OpSize;
1290def NEW_CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
1291 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1292 "cmovg\t{$src2, $dst|$dst, $src2}",
1293 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1294 X86_COND_G, EFLAGS))]>,
1295 TB;
1296def NEW_CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1297 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1298 "cmovg\t{$src2, $dst|$dst, $src2}",
1299 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1300 X86_COND_G, EFLAGS))]>,
1301 TB;
1302
1303def NEW_CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
1304 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1305 "cmovs\t{$src2, $dst|$dst, $src2}",
1306 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1307 X86_COND_S, EFLAGS))]>,
1308 TB, OpSize;
1309def NEW_CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1310 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1311 "cmovs\t{$src2, $dst|$dst, $src2}",
1312 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1313 X86_COND_S, EFLAGS))]>,
1314 TB, OpSize;
1315def NEW_CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
1316 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1317 "cmovs\t{$src2, $dst|$dst, $src2}",
1318 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1319 X86_COND_S, EFLAGS))]>,
1320 TB;
1321def NEW_CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1322 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1323 "cmovs\t{$src2, $dst|$dst, $src2}",
1324 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1325 X86_COND_S, EFLAGS))]>,
1326 TB;
1327
1328def NEW_CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
1329 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1330 "cmovns\t{$src2, $dst|$dst, $src2}",
1331 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1332 X86_COND_NS, EFLAGS))]>,
1333 TB, OpSize;
1334def NEW_CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1335 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1336 "cmovns\t{$src2, $dst|$dst, $src2}",
1337 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1338 X86_COND_NS, EFLAGS))]>,
1339 TB, OpSize;
1340def NEW_CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1341 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1342 "cmovns\t{$src2, $dst|$dst, $src2}",
1343 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1344 X86_COND_NS, EFLAGS))]>,
1345 TB;
1346def NEW_CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1347 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1348 "cmovns\t{$src2, $dst|$dst, $src2}",
1349 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1350 X86_COND_NS, EFLAGS))]>,
1351 TB;
1352
1353def NEW_CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1354 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1355 "cmovp\t{$src2, $dst|$dst, $src2}",
1356 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1357 X86_COND_P, EFLAGS))]>,
1358 TB, OpSize;
1359def NEW_CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1360 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1361 "cmovp\t{$src2, $dst|$dst, $src2}",
1362 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1363 X86_COND_P, EFLAGS))]>,
1364 TB, OpSize;
1365def NEW_CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1366 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1367 "cmovp\t{$src2, $dst|$dst, $src2}",
1368 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1369 X86_COND_P, EFLAGS))]>,
1370 TB;
1371def NEW_CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1372 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1373 "cmovp\t{$src2, $dst|$dst, $src2}",
1374 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1375 X86_COND_P, EFLAGS))]>,
1376 TB;
1377
1378def NEW_CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1379 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1380 "cmovnp\t{$src2, $dst|$dst, $src2}",
1381 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1382 X86_COND_NP, EFLAGS))]>,
1383 TB, OpSize;
1384def NEW_CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1385 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1386 "cmovnp\t{$src2, $dst|$dst, $src2}",
1387 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1388 X86_COND_NP, EFLAGS))]>,
1389 TB, OpSize;
1390def NEW_CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1391 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1392 "cmovnp\t{$src2, $dst|$dst, $src2}",
1393 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1394 X86_COND_NP, EFLAGS))]>,
1395 TB;
1396def NEW_CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1397 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1398 "cmovnp\t{$src2, $dst|$dst, $src2}",
1399 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1400 X86_COND_NP, EFLAGS))]>,
1401 TB;
1402} // Uses = [EFLAGS]
1403
1404
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405// unary instructions
1406let CodeSize = 2 in {
Evan Cheng55687072007-09-14 21:48:26 +00001407let Defs = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +00001408def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409 [(set GR8:$dst, (ineg GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001410def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001412def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001413 [(set GR32:$dst, (ineg GR32:$src))]>;
1414let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001415 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001416 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001417 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001418 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001419 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001420 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1421
1422}
Evan Cheng55687072007-09-14 21:48:26 +00001423} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001424
Dan Gohman91888f02007-07-31 20:11:57 +00001425def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001426 [(set GR8:$dst, (not GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001427def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001428 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001429def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001430 [(set GR32:$dst, (not GR32:$src))]>;
1431let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001432 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001433 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001434 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001435 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001436 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001437 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1438}
1439} // CodeSize
1440
1441// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng55687072007-09-14 21:48:26 +00001442let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001443let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001444def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001445 [(set GR8:$dst, (add GR8:$src, 1))]>;
1446let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001447def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001448 [(set GR16:$dst, (add GR16:$src, 1))]>,
1449 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001450def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001451 [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>;
1452}
1453let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001454 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001455 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001456 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001457 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001458 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001459 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>;
1460}
1461
1462let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001463def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001464 [(set GR8:$dst, (add GR8:$src, -1))]>;
1465let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001466def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001467 [(set GR16:$dst, (add GR16:$src, -1))]>,
1468 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001469def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001470 [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>;
1471}
1472
1473let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001474 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001475 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001476 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001477 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001478 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001479 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>;
1480}
Evan Cheng55687072007-09-14 21:48:26 +00001481} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001482
1483// Logical operators...
Evan Cheng55687072007-09-14 21:48:26 +00001484let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001485let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1486def AND8rr : I<0x20, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001487 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001488 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001489 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
1490def AND16rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001491 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001492 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001493 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
1494def AND32rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001495 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001496 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001497 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
1498}
1499
1500def AND8rm : I<0x22, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001501 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001502 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001503 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
1504def AND16rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001505 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001506 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001507 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
1508def AND32rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001509 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001510 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001511 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
1512
1513def AND8ri : Ii8<0x80, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001514 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001515 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001516 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
1517def AND16ri : Ii16<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001518 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001519 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001520 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
1521def AND32ri : Ii32<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001522 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001523 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001524 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
1525def AND16ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001526 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001527 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001528 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
1529 OpSize;
1530def AND32ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001531 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001532 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001533 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
1534
1535let isTwoAddress = 0 in {
1536 def AND8mr : I<0x20, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001537 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001538 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001539 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
1540 def AND16mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001541 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001542 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001543 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
1544 OpSize;
1545 def AND32mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001546 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001547 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001548 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
1549 def AND8mi : Ii8<0x80, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001550 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001551 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001552 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1553 def AND16mi : Ii16<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001554 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001555 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001556 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1557 OpSize;
1558 def AND32mi : Ii32<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001559 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001560 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001561 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1562 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001563 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001564 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001565 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1566 OpSize;
1567 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001568 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001569 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001570 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1571}
1572
1573
1574let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00001575def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001576 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001577 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001578def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001579 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001580 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001581def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001582 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001583 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
1584}
Evan Chengb783fa32007-07-19 01:14:50 +00001585def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001586 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001587 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001588def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001589 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001590 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001591def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001592 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001593 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
1594
Evan Chengb783fa32007-07-19 01:14:50 +00001595def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001596 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001597 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001598def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001599 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001600 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001601def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001602 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001603 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
1604
Evan Chengb783fa32007-07-19 01:14:50 +00001605def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001606 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001607 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001608def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001609 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001610 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
1611let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001612 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001613 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001614 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001615 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001616 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001617 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001618 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001619 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001620 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001621 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001622 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001623 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001624 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001625 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001626 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1627 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001628 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001629 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001630 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001631 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001632 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001633 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1634 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001635 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001636 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001637 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1638}
1639
1640
1641let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1642def XOR8rr : I<0x30, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001643 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001644 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001645 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
1646def XOR16rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001647 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001648 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001649 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
1650def XOR32rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001651 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001652 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001653 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
1654}
1655
1656def XOR8rm : I<0x32, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001657 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001658 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001659 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
1660def XOR16rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001661 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001662 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001663 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
1664def XOR32rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001665 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001666 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001667 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
1668
1669def XOR8ri : Ii8<0x80, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001670 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001671 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001672 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
1673def XOR16ri : Ii16<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001674 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001675 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001676 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
1677def XOR32ri : Ii32<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001678 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001679 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001680 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
1681def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001682 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001683 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001684 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
1685 OpSize;
1686def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001687 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001688 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001689 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
1690let isTwoAddress = 0 in {
1691 def XOR8mr : I<0x30, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001692 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001693 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001694 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
1695 def XOR16mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001696 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001697 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001698 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
1699 OpSize;
1700 def XOR32mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001701 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001702 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001703 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
1704 def XOR8mi : Ii8<0x80, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001705 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001706 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001707 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1708 def XOR16mi : Ii16<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001709 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001710 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001711 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1712 OpSize;
1713 def XOR32mi : Ii32<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001714 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001715 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001716 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1717 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001718 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001719 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001720 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1721 OpSize;
1722 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001723 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001724 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001725 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1726}
Evan Cheng55687072007-09-14 21:48:26 +00001727} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001728
1729// Shift instructions
Evan Cheng55687072007-09-14 21:48:26 +00001730let Defs = [EFLAGS] in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001731let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001732def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001733 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001734 [(set GR8:$dst, (shl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001735def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001736 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001737 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001738def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001739 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001740 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1741}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001742
Evan Chengb783fa32007-07-19 01:14:50 +00001743def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001744 "shl{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001745 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1746let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Chengb783fa32007-07-19 01:14:50 +00001747def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001748 "shl{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001749 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001750def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001751 "shl{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001752 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1753}
1754
1755// Shift left by one. Not used because (add x, x) is slightly cheaper.
Evan Chengb783fa32007-07-19 01:14:50 +00001756def SHL8r1 : I<0xD0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001757 "shl{b}\t$dst", []>;
Evan Chengb783fa32007-07-19 01:14:50 +00001758def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001759 "shl{w}\t$dst", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001760def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001761 "shl{l}\t$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001762
1763let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001764 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001765 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001766 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001767 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001768 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001769 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001770 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001771 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001772 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001773 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1774 }
Evan Chengb783fa32007-07-19 01:14:50 +00001775 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001776 "shl{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001777 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001778 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001779 "shl{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001780 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1781 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001782 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001783 "shl{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001784 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1785
1786 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001787 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001788 "shl{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001789 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001790 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001791 "shl{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001792 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1793 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001794 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001795 "shl{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001796 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1797}
1798
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001799let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001800def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001801 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001802 [(set GR8:$dst, (srl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001803def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001804 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001805 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001806def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001807 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001808 [(set GR32:$dst, (srl GR32:$src, CL))]>;
1809}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001810
Evan Chengb783fa32007-07-19 01:14:50 +00001811def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001812 "shr{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001813 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001814def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001815 "shr{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001816 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001817def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001818 "shr{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001819 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
1820
1821// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001822def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001823 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001824 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001825def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001826 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001827 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001828def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001829 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001830 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1831
1832let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001833 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001834 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001835 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001836 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001837 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001838 "shr{w}\t{%cl, $dst|$dst, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001839 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001840 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001841 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001842 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001843 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1844 }
Evan Chengb783fa32007-07-19 01:14:50 +00001845 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001846 "shr{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001847 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001848 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001849 "shr{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001850 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1851 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001852 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001853 "shr{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001854 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1855
1856 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001857 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001858 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001859 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001860 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001861 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001862 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001863 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001864 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001865 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1866}
1867
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001868let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001869def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001870 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001871 [(set GR8:$dst, (sra GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001872def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001873 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001874 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001875def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001876 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001877 [(set GR32:$dst, (sra GR32:$src, CL))]>;
1878}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001879
Evan Chengb783fa32007-07-19 01:14:50 +00001880def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001881 "sar{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001882 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001883def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001884 "sar{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001885 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
1886 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001887def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001888 "sar{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001889 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
1890
1891// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001892def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001893 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001894 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001895def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001896 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001897 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001898def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001899 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001900 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1901
1902let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001903 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001904 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001905 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001906 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001907 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001908 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001909 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001910 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001911 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001912 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1913 }
Evan Chengb783fa32007-07-19 01:14:50 +00001914 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001915 "sar{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001916 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001917 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001918 "sar{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001919 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1920 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001921 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001922 "sar{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001923 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1924
1925 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001926 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001927 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001928 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001929 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001930 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001931 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1932 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001933 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001934 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001935 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1936}
1937
1938// Rotate instructions
1939// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001940let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001941def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001942 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001943 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001944def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001945 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001946 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001947def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001948 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001949 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
1950}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001951
Evan Chengb783fa32007-07-19 01:14:50 +00001952def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001953 "rol{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001954 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001955def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001956 "rol{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001957 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001958def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001959 "rol{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001960 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
1961
1962// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001963def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001964 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001965 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001966def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001967 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001968 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001969def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001970 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001971 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1972
1973let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001974 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001975 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001976 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001977 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001978 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001979 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001980 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001981 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001982 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001983 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1984 }
Evan Chengb783fa32007-07-19 01:14:50 +00001985 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001986 "rol{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001987 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001988 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001989 "rol{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001990 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1991 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001992 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001993 "rol{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001994 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1995
1996 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001997 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001998 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001999 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002000 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002001 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002002 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2003 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002004 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002005 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002006 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2007}
2008
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002009let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002010def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002011 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002012 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002013def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002014 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002015 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002016def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002017 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002018 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
2019}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002020
Evan Chengb783fa32007-07-19 01:14:50 +00002021def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002022 "ror{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002023 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002024def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002025 "ror{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002026 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002027def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002028 "ror{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002029 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
2030
2031// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002032def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002033 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002034 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002035def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002036 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002037 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002038def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002039 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002040 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
2041
2042let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002043 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002044 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002045 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002046 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002047 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002048 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002049 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002050 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002051 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002052 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
2053 }
Evan Chengb783fa32007-07-19 01:14:50 +00002054 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002055 "ror{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002056 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002057 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002058 "ror{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002059 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2060 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002061 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002062 "ror{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002063 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2064
2065 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002066 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002067 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002068 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002069 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002070 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002071 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2072 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002073 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002074 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002075 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2076}
2077
2078
2079
2080// Double shift instructions (generalizations of rotate)
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002081let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002082def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002083 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002084 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002085def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002086 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002087 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002088def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002089 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002090 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002091 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002092def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002093 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002094 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002095 TB, OpSize;
2096}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002097
2098let isCommutable = 1 in { // These instructions commute to each other.
2099def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002100 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002101 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002102 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
2103 (i8 imm:$src3)))]>,
2104 TB;
2105def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002106 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002107 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002108 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
2109 (i8 imm:$src3)))]>,
2110 TB;
2111def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002112 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002113 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002114 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
2115 (i8 imm:$src3)))]>,
2116 TB, OpSize;
2117def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002118 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002119 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002120 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
2121 (i8 imm:$src3)))]>,
2122 TB, OpSize;
2123}
2124
2125let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002126 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002127 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002128 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002129 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002130 addr:$dst)]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002131 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002132 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002133 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002134 addr:$dst)]>, TB;
2135 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002136 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002137 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002138 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002139 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
2140 (i8 imm:$src3)), addr:$dst)]>,
2141 TB;
2142 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002143 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002144 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002145 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
2146 (i8 imm:$src3)), addr:$dst)]>,
2147 TB;
2148
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002149 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002150 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002151 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002152 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002153 addr:$dst)]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002154 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002155 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002156 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002157 addr:$dst)]>, TB, OpSize;
2158 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002159 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002160 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002161 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002162 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
2163 (i8 imm:$src3)), addr:$dst)]>,
2164 TB, OpSize;
2165 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002166 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002167 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002168 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
2169 (i8 imm:$src3)), addr:$dst)]>,
2170 TB, OpSize;
2171}
Evan Cheng55687072007-09-14 21:48:26 +00002172} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002173
2174
2175// Arithmetic.
Evan Cheng55687072007-09-14 21:48:26 +00002176let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002177let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002178def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
2179 (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002180 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002181 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
2182let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002183def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
2184 (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002185 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002186 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002187def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
2188 (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002189 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002190 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
2191} // end isConvertibleToThreeAddress
2192} // end isCommutable
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002193def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
2194 (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002195 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002196 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002197def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
2198 (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002199 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002200 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize;
2201def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
2202 (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002203 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002204 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
2205
Evan Chengb783fa32007-07-19 01:14:50 +00002206def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002207 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002208 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
2209
2210let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002211def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
2212 (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002213 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002214 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002215def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
2216 (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002217 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002218 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002219def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
2220 (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002221 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002222 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize;
2223def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
2224 (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002225 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002226 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002227}
2228
2229let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002230 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002231 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002232 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002233 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002234 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002235 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002236 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002237 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002238 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002239 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002240 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002241 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002242 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002243 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002244 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002245 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002246 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002247 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002248 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002249 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002250 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002251 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002252 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002253 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002254 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002255 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002256 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2257}
2258
2259let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002260def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002261 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002262 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
2263}
Evan Chengb783fa32007-07-19 01:14:50 +00002264def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002265 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002266 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002267def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002268 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002269 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002270def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002271 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002272 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
2273
2274let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002275 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002276 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002277 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002278 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002279 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002280 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002281 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002282 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002283 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2284}
2285
Evan Chengb783fa32007-07-19 01:14:50 +00002286def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002287 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002288 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002289def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002290 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002291 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002292def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002293 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002294 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002295def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002296 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002297 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002298def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002299 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002300 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002301def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002302 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002303 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
2304
Evan Chengb783fa32007-07-19 01:14:50 +00002305def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002306 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002307 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002308def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002309 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002310 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002311def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002312 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002313 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002314def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002315 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002316 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng55687072007-09-14 21:48:26 +00002317 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002318def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002319 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002320 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
2321let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002322 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002323 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002324 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002325 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002326 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002327 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002328 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002329 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002330 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002331 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002332 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002333 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002334 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002335 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002336 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002337 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002338 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002339 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002340 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002341 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002342 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002343 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002344 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002345 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002346 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002347 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002348 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2349}
2350
Evan Chengb783fa32007-07-19 01:14:50 +00002351def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002352 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002353 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002354
2355let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002356 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002357 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002358 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002359 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002360 "sbb{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002361 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002362 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002363 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002364 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002365 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002366 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002367 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002368}
Evan Chengb783fa32007-07-19 01:14:50 +00002369def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002370 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002371 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002372def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002373 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002374 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002375def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002376 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002377 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002378} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002379
Evan Cheng55687072007-09-14 21:48:26 +00002380let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002381let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002382def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002383 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002384 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002385def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002386 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002387 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
2388}
Evan Chengb783fa32007-07-19 01:14:50 +00002389def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002390 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002391 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
2392 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002393def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002394 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002395 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Evan Cheng55687072007-09-14 21:48:26 +00002396} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002397} // end Two Address instructions
2398
2399// Suprisingly enough, these are not two address instructions!
Evan Cheng55687072007-09-14 21:48:26 +00002400let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002401def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002402 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002403 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002404 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
2405def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002406 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002407 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002408 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
2409def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002410 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002411 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002412 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
2413 OpSize;
2414def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002415 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002416 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002417 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
2418
2419def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002420 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002421 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002422 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
2423 OpSize;
2424def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002425 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002426 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002427 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
2428def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002429 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002430 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002431 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
2432 OpSize;
2433def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002434 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002435 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002436 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002437} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002438
2439//===----------------------------------------------------------------------===//
2440// Test instructions are just like AND, except they don't generate a result.
2441//
Evan Cheng950aac02007-09-25 01:57:46 +00002442let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002443let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Chengb783fa32007-07-19 01:14:50 +00002444def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002445 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002446 [(X86cmp (and GR8:$src1, GR8:$src2), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002447def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002448 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002449 [(X86cmp (and GR16:$src1, GR16:$src2), 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002450def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002451 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002452 [(X86cmp (and GR32:$src1, GR32:$src2), 0)]>;
2453}
2454
Evan Chengb783fa32007-07-19 01:14:50 +00002455def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002456 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002457 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002458def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002459 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002460 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0)]>,
2461 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002462def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002463 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002464 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0)]>;
2465
2466def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002467 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002468 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002469 [(X86cmp (and GR8:$src1, imm:$src2), 0)]>;
2470def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002471 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002472 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002473 [(X86cmp (and GR16:$src1, imm:$src2), 0)]>, OpSize;
2474def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002475 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002476 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002477 [(X86cmp (and GR32:$src1, imm:$src2), 0)]>;
2478
2479def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002480 (outs), (ins i8mem:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002481 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002482 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0)]>;
2483def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002484 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002485 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002486 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0)]>,
2487 OpSize;
2488def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002489 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002490 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002491 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002492} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002493
2494
Evan Cheng950aac02007-09-25 01:57:46 +00002495let Defs = [EFLAGS] in {
2496let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
2497def NEW_TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
2498 "test{b}\t{$src2, $src1|$src1, $src2}",
2499 [(X86cmp_new (and GR8:$src1, GR8:$src2), 0),
2500 (implicit EFLAGS)]>;
2501def NEW_TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2502 "test{w}\t{$src2, $src1|$src1, $src2}",
2503 [(X86cmp_new (and GR16:$src1, GR16:$src2), 0),
2504 (implicit EFLAGS)]>,
2505 OpSize;
2506def NEW_TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2507 "test{l}\t{$src2, $src1|$src1, $src2}",
2508 [(X86cmp_new (and GR32:$src1, GR32:$src2), 0),
2509 (implicit EFLAGS)]>;
2510}
2511
2512def NEW_TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
2513 "test{b}\t{$src2, $src1|$src1, $src2}",
2514 [(X86cmp_new (and GR8:$src1, (loadi8 addr:$src2)), 0),
2515 (implicit EFLAGS)]>;
2516def NEW_TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
2517 "test{w}\t{$src2, $src1|$src1, $src2}",
2518 [(X86cmp_new (and GR16:$src1, (loadi16 addr:$src2)), 0),
2519 (implicit EFLAGS)]>, OpSize;
2520def NEW_TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
2521 "test{l}\t{$src2, $src1|$src1, $src2}",
2522 [(X86cmp_new (and GR32:$src1, (loadi32 addr:$src2)), 0),
2523 (implicit EFLAGS)]>;
2524
2525def NEW_TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
2526 (outs), (ins GR8:$src1, i8imm:$src2),
2527 "test{b}\t{$src2, $src1|$src1, $src2}",
2528 [(X86cmp_new (and GR8:$src1, imm:$src2), 0),
2529 (implicit EFLAGS)]>;
2530def NEW_TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2531 (outs), (ins GR16:$src1, i16imm:$src2),
2532 "test{w}\t{$src2, $src1|$src1, $src2}",
2533 [(X86cmp_new (and GR16:$src1, imm:$src2), 0),
2534 (implicit EFLAGS)]>, OpSize;
2535def NEW_TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2536 (outs), (ins GR32:$src1, i32imm:$src2),
2537 "test{l}\t{$src2, $src1|$src1, $src2}",
2538 [(X86cmp_new (and GR32:$src1, imm:$src2), 0),
2539 (implicit EFLAGS)]>;
2540
2541def NEW_TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
2542 (outs), (ins i8mem:$src1, i8imm:$src2),
2543 "test{b}\t{$src2, $src1|$src1, $src2}",
2544 [(X86cmp_new (and (loadi8 addr:$src1), imm:$src2), 0),
2545 (implicit EFLAGS)]>;
2546def NEW_TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2547 (outs), (ins i16mem:$src1, i16imm:$src2),
2548 "test{w}\t{$src2, $src1|$src1, $src2}",
2549 [(X86cmp_new (and (loadi16 addr:$src1), imm:$src2), 0),
2550 (implicit EFLAGS)]>, OpSize;
2551def NEW_TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2552 (outs), (ins i32mem:$src1, i32imm:$src2),
2553 "test{l}\t{$src2, $src1|$src1, $src2}",
2554 [(X86cmp_new (and (loadi32 addr:$src1), imm:$src2), 0),
2555 (implicit EFLAGS)]>;
2556} // Defs = [EFLAGS]
2557
2558
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002559// Condition code ops, incl. set if equal/not equal/...
Evan Cheng55687072007-09-14 21:48:26 +00002560let Defs = [EFLAGS], Uses = [AH] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002561def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
Evan Cheng55687072007-09-14 21:48:26 +00002562let Defs = [AH], Uses = [EFLAGS] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002563def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002564
Evan Cheng950aac02007-09-25 01:57:46 +00002565let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002566def SETEr : I<0x94, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002567 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002568 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002569 [(set GR8:$dst, (X86setcc X86_COND_E))]>,
2570 TB; // GR8 = ==
2571def SETEm : I<0x94, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002572 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002573 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002574 [(store (X86setcc X86_COND_E), addr:$dst)]>,
2575 TB; // [mem8] = ==
2576def SETNEr : I<0x95, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002577 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002578 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002579 [(set GR8:$dst, (X86setcc X86_COND_NE))]>,
2580 TB; // GR8 = !=
2581def SETNEm : I<0x95, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002582 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002583 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002584 [(store (X86setcc X86_COND_NE), addr:$dst)]>,
2585 TB; // [mem8] = !=
2586def SETLr : I<0x9C, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002587 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002588 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002589 [(set GR8:$dst, (X86setcc X86_COND_L))]>,
2590 TB; // GR8 = < signed
2591def SETLm : I<0x9C, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002592 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002593 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002594 [(store (X86setcc X86_COND_L), addr:$dst)]>,
2595 TB; // [mem8] = < signed
2596def SETGEr : I<0x9D, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002597 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002598 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002599 [(set GR8:$dst, (X86setcc X86_COND_GE))]>,
2600 TB; // GR8 = >= signed
2601def SETGEm : I<0x9D, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002602 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002603 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002604 [(store (X86setcc X86_COND_GE), addr:$dst)]>,
2605 TB; // [mem8] = >= signed
2606def SETLEr : I<0x9E, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002607 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002608 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002609 [(set GR8:$dst, (X86setcc X86_COND_LE))]>,
2610 TB; // GR8 = <= signed
2611def SETLEm : I<0x9E, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002612 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002613 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002614 [(store (X86setcc X86_COND_LE), addr:$dst)]>,
2615 TB; // [mem8] = <= signed
2616def SETGr : I<0x9F, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002617 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002618 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002619 [(set GR8:$dst, (X86setcc X86_COND_G))]>,
2620 TB; // GR8 = > signed
2621def SETGm : I<0x9F, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002622 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002623 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002624 [(store (X86setcc X86_COND_G), addr:$dst)]>,
2625 TB; // [mem8] = > signed
2626
2627def SETBr : I<0x92, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002628 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002629 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002630 [(set GR8:$dst, (X86setcc X86_COND_B))]>,
2631 TB; // GR8 = < unsign
2632def SETBm : I<0x92, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002633 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002634 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002635 [(store (X86setcc X86_COND_B), addr:$dst)]>,
2636 TB; // [mem8] = < unsign
2637def SETAEr : I<0x93, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002638 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002639 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002640 [(set GR8:$dst, (X86setcc X86_COND_AE))]>,
2641 TB; // GR8 = >= unsign
2642def SETAEm : I<0x93, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002643 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002644 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002645 [(store (X86setcc X86_COND_AE), addr:$dst)]>,
2646 TB; // [mem8] = >= unsign
2647def SETBEr : I<0x96, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002648 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002649 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002650 [(set GR8:$dst, (X86setcc X86_COND_BE))]>,
2651 TB; // GR8 = <= unsign
2652def SETBEm : I<0x96, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002653 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002654 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002655 [(store (X86setcc X86_COND_BE), addr:$dst)]>,
2656 TB; // [mem8] = <= unsign
2657def SETAr : I<0x97, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002658 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002659 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002660 [(set GR8:$dst, (X86setcc X86_COND_A))]>,
2661 TB; // GR8 = > signed
2662def SETAm : I<0x97, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002663 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002664 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002665 [(store (X86setcc X86_COND_A), addr:$dst)]>,
2666 TB; // [mem8] = > signed
2667
2668def SETSr : I<0x98, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002669 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002670 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002671 [(set GR8:$dst, (X86setcc X86_COND_S))]>,
2672 TB; // GR8 = <sign bit>
2673def SETSm : I<0x98, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002674 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002675 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002676 [(store (X86setcc X86_COND_S), addr:$dst)]>,
2677 TB; // [mem8] = <sign bit>
2678def SETNSr : I<0x99, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002679 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002680 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002681 [(set GR8:$dst, (X86setcc X86_COND_NS))]>,
2682 TB; // GR8 = !<sign bit>
2683def SETNSm : I<0x99, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002684 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002685 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002686 [(store (X86setcc X86_COND_NS), addr:$dst)]>,
2687 TB; // [mem8] = !<sign bit>
2688def SETPr : I<0x9A, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002689 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002690 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002691 [(set GR8:$dst, (X86setcc X86_COND_P))]>,
2692 TB; // GR8 = parity
2693def SETPm : I<0x9A, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002694 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002695 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002696 [(store (X86setcc X86_COND_P), addr:$dst)]>,
2697 TB; // [mem8] = parity
2698def SETNPr : I<0x9B, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002699 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002700 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002701 [(set GR8:$dst, (X86setcc X86_COND_NP))]>,
2702 TB; // GR8 = not parity
2703def SETNPm : I<0x9B, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002704 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002705 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002706 [(store (X86setcc X86_COND_NP), addr:$dst)]>,
2707 TB; // [mem8] = not parity
Evan Cheng950aac02007-09-25 01:57:46 +00002708} // Uses = [EFLAGS]
2709
2710let Uses = [EFLAGS] in {
2711def NEW_SETEr : I<0x94, MRM0r,
2712 (outs GR8 :$dst), (ins),
2713 "sete\t$dst",
2714 [(set GR8:$dst, (X86setcc_new X86_COND_E, EFLAGS))]>,
2715 TB; // GR8 = ==
2716def NEW_SETEm : I<0x94, MRM0m,
2717 (outs), (ins i8mem:$dst),
2718 "sete\t$dst",
2719 [(store (X86setcc_new X86_COND_E, EFLAGS), addr:$dst)]>,
2720 TB; // [mem8] = ==
2721def NEW_SETNEr : I<0x95, MRM0r,
2722 (outs GR8 :$dst), (ins),
2723 "setne\t$dst",
2724 [(set GR8:$dst, (X86setcc_new X86_COND_NE, EFLAGS))]>,
2725 TB; // GR8 = !=
2726def NEW_SETNEm : I<0x95, MRM0m,
2727 (outs), (ins i8mem:$dst),
2728 "setne\t$dst",
2729 [(store (X86setcc_new X86_COND_NE, EFLAGS), addr:$dst)]>,
2730 TB; // [mem8] = !=
2731def NEW_SETLr : I<0x9C, MRM0r,
2732 (outs GR8 :$dst), (ins),
2733 "setl\t$dst",
2734 [(set GR8:$dst, (X86setcc_new X86_COND_L, EFLAGS))]>,
2735 TB; // GR8 = < signed
2736def NEW_SETLm : I<0x9C, MRM0m,
2737 (outs), (ins i8mem:$dst),
2738 "setl\t$dst",
2739 [(store (X86setcc_new X86_COND_L, EFLAGS), addr:$dst)]>,
2740 TB; // [mem8] = < signed
2741def NEW_SETGEr : I<0x9D, MRM0r,
2742 (outs GR8 :$dst), (ins),
2743 "setge\t$dst",
2744 [(set GR8:$dst, (X86setcc_new X86_COND_GE, EFLAGS))]>,
2745 TB; // GR8 = >= signed
2746def NEW_SETGEm : I<0x9D, MRM0m,
2747 (outs), (ins i8mem:$dst),
2748 "setge\t$dst",
2749 [(store (X86setcc_new X86_COND_GE, EFLAGS), addr:$dst)]>,
2750 TB; // [mem8] = >= signed
2751def NEW_SETLEr : I<0x9E, MRM0r,
2752 (outs GR8 :$dst), (ins),
2753 "setle\t$dst",
2754 [(set GR8:$dst, (X86setcc_new X86_COND_LE, EFLAGS))]>,
2755 TB; // GR8 = <= signed
2756def NEW_SETLEm : I<0x9E, MRM0m,
2757 (outs), (ins i8mem:$dst),
2758 "setle\t$dst",
2759 [(store (X86setcc_new X86_COND_LE, EFLAGS), addr:$dst)]>,
2760 TB; // [mem8] = <= signed
2761def NEW_SETGr : I<0x9F, MRM0r,
2762 (outs GR8 :$dst), (ins),
2763 "setg\t$dst",
2764 [(set GR8:$dst, (X86setcc_new X86_COND_G, EFLAGS))]>,
2765 TB; // GR8 = > signed
2766def NEW_SETGm : I<0x9F, MRM0m,
2767 (outs), (ins i8mem:$dst),
2768 "setg\t$dst",
2769 [(store (X86setcc_new X86_COND_G, EFLAGS), addr:$dst)]>,
2770 TB; // [mem8] = > signed
2771
2772def NEW_SETBr : I<0x92, MRM0r,
2773 (outs GR8 :$dst), (ins),
2774 "setb\t$dst",
2775 [(set GR8:$dst, (X86setcc_new X86_COND_B, EFLAGS))]>,
2776 TB; // GR8 = < unsign
2777def NEW_SETBm : I<0x92, MRM0m,
2778 (outs), (ins i8mem:$dst),
2779 "setb\t$dst",
2780 [(store (X86setcc_new X86_COND_B, EFLAGS), addr:$dst)]>,
2781 TB; // [mem8] = < unsign
2782def NEW_SETAEr : I<0x93, MRM0r,
2783 (outs GR8 :$dst), (ins),
2784 "setae\t$dst",
2785 [(set GR8:$dst, (X86setcc_new X86_COND_AE, EFLAGS))]>,
2786 TB; // GR8 = >= unsign
2787def NEW_SETAEm : I<0x93, MRM0m,
2788 (outs), (ins i8mem:$dst),
2789 "setae\t$dst",
2790 [(store (X86setcc_new X86_COND_AE, EFLAGS), addr:$dst)]>,
2791 TB; // [mem8] = >= unsign
2792def NEW_SETBEr : I<0x96, MRM0r,
2793 (outs GR8 :$dst), (ins),
2794 "setbe\t$dst",
2795 [(set GR8:$dst, (X86setcc_new X86_COND_BE, EFLAGS))]>,
2796 TB; // GR8 = <= unsign
2797def NEW_SETBEm : I<0x96, MRM0m,
2798 (outs), (ins i8mem:$dst),
2799 "setbe\t$dst",
2800 [(store (X86setcc_new X86_COND_BE, EFLAGS), addr:$dst)]>,
2801 TB; // [mem8] = <= unsign
2802def NEW_SETAr : I<0x97, MRM0r,
2803 (outs GR8 :$dst), (ins),
2804 "seta\t$dst",
2805 [(set GR8:$dst, (X86setcc_new X86_COND_A, EFLAGS))]>,
2806 TB; // GR8 = > signed
2807def NEW_SETAm : I<0x97, MRM0m,
2808 (outs), (ins i8mem:$dst),
2809 "seta\t$dst",
2810 [(store (X86setcc_new X86_COND_A, EFLAGS), addr:$dst)]>,
2811 TB; // [mem8] = > signed
2812
2813def NEW_SETSr : I<0x98, MRM0r,
2814 (outs GR8 :$dst), (ins),
2815 "sets\t$dst",
2816 [(set GR8:$dst, (X86setcc_new X86_COND_S, EFLAGS))]>,
2817 TB; // GR8 = <sign bit>
2818def NEW_SETSm : I<0x98, MRM0m,
2819 (outs), (ins i8mem:$dst),
2820 "sets\t$dst",
2821 [(store (X86setcc_new X86_COND_S, EFLAGS), addr:$dst)]>,
2822 TB; // [mem8] = <sign bit>
2823def NEW_SETNSr : I<0x99, MRM0r,
2824 (outs GR8 :$dst), (ins),
2825 "setns\t$dst",
2826 [(set GR8:$dst, (X86setcc_new X86_COND_NS, EFLAGS))]>,
2827 TB; // GR8 = !<sign bit>
2828def NEW_SETNSm : I<0x99, MRM0m,
2829 (outs), (ins i8mem:$dst),
2830 "setns\t$dst",
2831 [(store (X86setcc_new X86_COND_NS, EFLAGS), addr:$dst)]>,
2832 TB; // [mem8] = !<sign bit>
2833def NEW_SETPr : I<0x9A, MRM0r,
2834 (outs GR8 :$dst), (ins),
2835 "setp\t$dst",
2836 [(set GR8:$dst, (X86setcc_new X86_COND_P, EFLAGS))]>,
2837 TB; // GR8 = parity
2838def NEW_SETPm : I<0x9A, MRM0m,
2839 (outs), (ins i8mem:$dst),
2840 "setp\t$dst",
2841 [(store (X86setcc_new X86_COND_P, EFLAGS), addr:$dst)]>,
2842 TB; // [mem8] = parity
2843def NEW_SETNPr : I<0x9B, MRM0r,
2844 (outs GR8 :$dst), (ins),
2845 "setnp\t$dst",
2846 [(set GR8:$dst, (X86setcc_new X86_COND_NP, EFLAGS))]>,
2847 TB; // GR8 = not parity
2848def NEW_SETNPm : I<0x9B, MRM0m,
2849 (outs), (ins i8mem:$dst),
2850 "setnp\t$dst",
2851 [(store (X86setcc_new X86_COND_NP, EFLAGS), addr:$dst)]>,
2852 TB; // [mem8] = not parity
2853} // Uses = [EFLAGS]
2854
2855
2856//def : Pat<(X86setcc_new X86_COND_E, EFLAGS), (SETEr)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002857
2858// Integer comparisons
Evan Cheng55687072007-09-14 21:48:26 +00002859let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002860def CMP8rr : I<0x38, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002861 (outs), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002862 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002863 [(X86cmp GR8:$src1, GR8:$src2)]>;
2864def CMP16rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002865 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002866 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002867 [(X86cmp GR16:$src1, GR16:$src2)]>, OpSize;
2868def CMP32rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002869 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002870 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002871 [(X86cmp GR32:$src1, GR32:$src2)]>;
2872def CMP8mr : I<0x38, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002873 (outs), (ins i8mem :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002874 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002875 [(X86cmp (loadi8 addr:$src1), GR8:$src2)]>;
2876def CMP16mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002877 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002878 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002879 [(X86cmp (loadi16 addr:$src1), GR16:$src2)]>, OpSize;
2880def CMP32mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002881 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002882 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002883 [(X86cmp (loadi32 addr:$src1), GR32:$src2)]>;
2884def CMP8rm : I<0x3A, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002885 (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002886 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002887 [(X86cmp GR8:$src1, (loadi8 addr:$src2))]>;
2888def CMP16rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002889 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002890 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002891 [(X86cmp GR16:$src1, (loadi16 addr:$src2))]>, OpSize;
2892def CMP32rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002893 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002894 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002895 [(X86cmp GR32:$src1, (loadi32 addr:$src2))]>;
2896def CMP8ri : Ii8<0x80, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002897 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002898 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002899 [(X86cmp GR8:$src1, imm:$src2)]>;
2900def CMP16ri : Ii16<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002901 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002902 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002903 [(X86cmp GR16:$src1, imm:$src2)]>, OpSize;
2904def CMP32ri : Ii32<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002905 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002906 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002907 [(X86cmp GR32:$src1, imm:$src2)]>;
2908def CMP8mi : Ii8 <0x80, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002909 (outs), (ins i8mem :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002910 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002911 [(X86cmp (loadi8 addr:$src1), imm:$src2)]>;
2912def CMP16mi : Ii16<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002913 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002914 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002915 [(X86cmp (loadi16 addr:$src1), imm:$src2)]>, OpSize;
2916def CMP32mi : Ii32<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002917 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002918 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002919 [(X86cmp (loadi32 addr:$src1), imm:$src2)]>;
2920def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002921 (outs), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002922 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002923 [(X86cmp GR16:$src1, i16immSExt8:$src2)]>, OpSize;
2924def CMP16mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002925 (outs), (ins i16mem:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002926 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002927 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2)]>, OpSize;
2928def CMP32mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002929 (outs), (ins i32mem:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002930 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002931 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2)]>;
2932def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002933 (outs), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002934 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002935 [(X86cmp GR32:$src1, i32immSExt8:$src2)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002936} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002937
Evan Cheng950aac02007-09-25 01:57:46 +00002938let Defs = [EFLAGS] in {
2939def NEW_CMP8rr : I<0x38, MRMDestReg,
2940 (outs), (ins GR8 :$src1, GR8 :$src2),
2941 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2942 [(X86cmp_new GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
2943def NEW_CMP16rr : I<0x39, MRMDestReg,
2944 (outs), (ins GR16:$src1, GR16:$src2),
2945 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2946 [(X86cmp_new GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
2947def NEW_CMP32rr : I<0x39, MRMDestReg,
2948 (outs), (ins GR32:$src1, GR32:$src2),
2949 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2950 [(X86cmp_new GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
2951def NEW_CMP8mr : I<0x38, MRMDestMem,
2952 (outs), (ins i8mem :$src1, GR8 :$src2),
2953 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2954 [(X86cmp_new (loadi8 addr:$src1), GR8:$src2),
2955 (implicit EFLAGS)]>;
2956def NEW_CMP16mr : I<0x39, MRMDestMem,
2957 (outs), (ins i16mem:$src1, GR16:$src2),
2958 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2959 [(X86cmp_new (loadi16 addr:$src1), GR16:$src2),
2960 (implicit EFLAGS)]>, OpSize;
2961def NEW_CMP32mr : I<0x39, MRMDestMem,
2962 (outs), (ins i32mem:$src1, GR32:$src2),
2963 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2964 [(X86cmp_new (loadi32 addr:$src1), GR32:$src2),
2965 (implicit EFLAGS)]>;
2966def NEW_CMP8rm : I<0x3A, MRMSrcMem,
2967 (outs), (ins GR8 :$src1, i8mem :$src2),
2968 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2969 [(X86cmp_new GR8:$src1, (loadi8 addr:$src2)),
2970 (implicit EFLAGS)]>;
2971def NEW_CMP16rm : I<0x3B, MRMSrcMem,
2972 (outs), (ins GR16:$src1, i16mem:$src2),
2973 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2974 [(X86cmp_new GR16:$src1, (loadi16 addr:$src2)),
2975 (implicit EFLAGS)]>, OpSize;
2976def NEW_CMP32rm : I<0x3B, MRMSrcMem,
2977 (outs), (ins GR32:$src1, i32mem:$src2),
2978 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2979 [(X86cmp_new GR32:$src1, (loadi32 addr:$src2)),
2980 (implicit EFLAGS)]>;
2981def NEW_CMP8ri : Ii8<0x80, MRM7r,
2982 (outs), (ins GR8:$src1, i8imm:$src2),
2983 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2984 [(X86cmp_new GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
2985def NEW_CMP16ri : Ii16<0x81, MRM7r,
2986 (outs), (ins GR16:$src1, i16imm:$src2),
2987 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2988 [(X86cmp_new GR16:$src1, imm:$src2),
2989 (implicit EFLAGS)]>, OpSize;
2990def NEW_CMP32ri : Ii32<0x81, MRM7r,
2991 (outs), (ins GR32:$src1, i32imm:$src2),
2992 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2993 [(X86cmp_new GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
2994def NEW_CMP8mi : Ii8 <0x80, MRM7m,
2995 (outs), (ins i8mem :$src1, i8imm :$src2),
2996 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2997 [(X86cmp_new (loadi8 addr:$src1), imm:$src2),
2998 (implicit EFLAGS)]>;
2999def NEW_CMP16mi : Ii16<0x81, MRM7m,
3000 (outs), (ins i16mem:$src1, i16imm:$src2),
3001 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3002 [(X86cmp_new (loadi16 addr:$src1), imm:$src2),
3003 (implicit EFLAGS)]>, OpSize;
3004def NEW_CMP32mi : Ii32<0x81, MRM7m,
3005 (outs), (ins i32mem:$src1, i32imm:$src2),
3006 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3007 [(X86cmp_new (loadi32 addr:$src1), imm:$src2),
3008 (implicit EFLAGS)]>;
3009def NEW_CMP16ri8 : Ii8<0x83, MRM7r,
3010 (outs), (ins GR16:$src1, i16i8imm:$src2),
3011 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3012 [(X86cmp_new GR16:$src1, i16immSExt8:$src2),
3013 (implicit EFLAGS)]>, OpSize;
3014def NEW_CMP16mi8 : Ii8<0x83, MRM7m,
3015 (outs), (ins i16mem:$src1, i16i8imm:$src2),
3016 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3017 [(X86cmp_new (loadi16 addr:$src1), i16immSExt8:$src2),
3018 (implicit EFLAGS)]>, OpSize;
3019def NEW_CMP32mi8 : Ii8<0x83, MRM7m,
3020 (outs), (ins i32mem:$src1, i32i8imm:$src2),
3021 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3022 [(X86cmp_new (loadi32 addr:$src1), i32immSExt8:$src2),
3023 (implicit EFLAGS)]>;
3024def NEW_CMP32ri8 : Ii8<0x83, MRM7r,
3025 (outs), (ins GR32:$src1, i32i8imm:$src2),
3026 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3027 [(X86cmp_new GR32:$src1, i32immSExt8:$src2),
3028 (implicit EFLAGS)]>;
3029} // Defs = [EFLAGS]
3030
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003031// Sign/Zero extenders
Evan Chengb783fa32007-07-19 01:14:50 +00003032def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003033 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003034 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003035def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003036 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003037 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003038def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003039 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003040 [(set GR32:$dst, (sext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003041def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003042 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003043 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003044def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003045 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003046 [(set GR32:$dst, (sext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003047def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003048 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003049 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
3050
Evan Chengb783fa32007-07-19 01:14:50 +00003051def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003052 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003053 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003054def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003055 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003056 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003057def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003058 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003059 [(set GR32:$dst, (zext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003060def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003061 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003062 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003063def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003064 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003065 [(set GR32:$dst, (zext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003066def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003067 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003068 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
3069
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003070let Defs = [AX], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +00003071def CBW : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003072 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
3073let Defs = [EAX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003074def CWDE : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003075 "{cwtl|cwde}", []>; // EAX = signext(AX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003076
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003077let Defs = [AX,DX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003078def CWD : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003079 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
3080let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003081def CDQ : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003082 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003083
3084
3085//===----------------------------------------------------------------------===//
3086// Alias Instructions
3087//===----------------------------------------------------------------------===//
3088
3089// Alias instructions that map movr0 to xor.
3090// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Evan Cheng55687072007-09-14 21:48:26 +00003091let Defs = [EFLAGS], isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003092def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003093 "xor{b}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003094 [(set GR8:$dst, 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00003095def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003096 "xor{w}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003097 [(set GR16:$dst, 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003098def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003099 "xor{l}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003100 [(set GR32:$dst, 0)]>;
Dan Gohman8aef09b2007-09-07 21:32:51 +00003101}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102
3103// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
3104// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
Evan Chengb783fa32007-07-19 01:14:50 +00003105def MOV16to16_ : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003106 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003107def MOV32to32_ : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003108 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003109
Evan Chengb783fa32007-07-19 01:14:50 +00003110def MOV16_rr : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003111 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003112def MOV32_rr : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003113 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003114let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003115def MOV16_rm : I<0x8B, MRMSrcMem, (outs GR16_:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003116 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003117def MOV32_rm : I<0x8B, MRMSrcMem, (outs GR32_:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003118 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003119}
Evan Chengb783fa32007-07-19 01:14:50 +00003120def MOV16_mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003121 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003122def MOV32_mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003123 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003124
3125//===----------------------------------------------------------------------===//
3126// Thread Local Storage Instructions
3127//
3128
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003129let Uses = [EBX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003130def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym),
Dan Gohman91888f02007-07-31 20:11:57 +00003131 "leal\t${sym:mem}(,%ebx,1), $dst",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003132 [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003133
3134let AddedComplexity = 10 in
Evan Chengb783fa32007-07-19 01:14:50 +00003135def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003136 "movl\t%gs:($src), $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003137 [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
3138
3139let AddedComplexity = 15 in
Evan Chengb783fa32007-07-19 01:14:50 +00003140def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003141 "movl\t%gs:${src:mem}, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003142 [(set GR32:$dst,
3143 (load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
3144
Evan Chengb783fa32007-07-19 01:14:50 +00003145def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003146 "movl\t%gs:0, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003147 [(set GR32:$dst, X86TLStp)]>;
3148
3149//===----------------------------------------------------------------------===//
3150// DWARF Pseudo Instructions
3151//
3152
Evan Chengb783fa32007-07-19 01:14:50 +00003153def DWARF_LOC : I<0, Pseudo, (outs),
3154 (ins i32imm:$line, i32imm:$col, i32imm:$file),
Dan Gohman77af4a82007-09-24 19:25:06 +00003155 ".loc\t${file:debug} ${line:debug} ${col:debug}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003156 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
3157 (i32 imm:$file))]>;
3158
3159//===----------------------------------------------------------------------===//
3160// EH Pseudo Instructions
3161//
3162let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +00003163 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003164def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
Dan Gohman91888f02007-07-31 20:11:57 +00003165 "ret\t#eh_return, addr: $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003166 [(X86ehret GR32:$addr)]>;
3167
3168}
3169
3170//===----------------------------------------------------------------------===//
3171// Non-Instruction Patterns
3172//===----------------------------------------------------------------------===//
3173
3174// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
3175def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
3176def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
3177def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)), (MOV32ri tglobaltlsaddr:$dst)>;
3178def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
3179def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
3180
3181def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
3182 (ADD32ri GR32:$src1, tconstpool:$src2)>;
3183def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
3184 (ADD32ri GR32:$src1, tjumptable:$src2)>;
3185def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
3186 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
3187def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
3188 (ADD32ri GR32:$src1, texternalsym:$src2)>;
3189
3190def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
3191 (MOV32mi addr:$dst, tglobaladdr:$src)>;
3192def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
3193 (MOV32mi addr:$dst, texternalsym:$src)>;
3194
3195// Calls
3196def : Pat<(X86tailcall GR32:$dst),
3197 (CALL32r GR32:$dst)>;
3198
3199def : Pat<(X86tailcall (i32 tglobaladdr:$dst)),
3200 (CALLpcrel32 tglobaladdr:$dst)>;
3201def : Pat<(X86tailcall (i32 texternalsym:$dst)),
3202 (CALLpcrel32 texternalsym:$dst)>;
3203
3204def : Pat<(X86call (i32 tglobaladdr:$dst)),
3205 (CALLpcrel32 tglobaladdr:$dst)>;
3206def : Pat<(X86call (i32 texternalsym:$dst)),
3207 (CALLpcrel32 texternalsym:$dst)>;
3208
3209// X86 specific add which produces a flag.
3210def : Pat<(addc GR32:$src1, GR32:$src2),
3211 (ADD32rr GR32:$src1, GR32:$src2)>;
3212def : Pat<(addc GR32:$src1, (load addr:$src2)),
3213 (ADD32rm GR32:$src1, addr:$src2)>;
3214def : Pat<(addc GR32:$src1, imm:$src2),
3215 (ADD32ri GR32:$src1, imm:$src2)>;
3216def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
3217 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
3218
3219def : Pat<(subc GR32:$src1, GR32:$src2),
3220 (SUB32rr GR32:$src1, GR32:$src2)>;
3221def : Pat<(subc GR32:$src1, (load addr:$src2)),
3222 (SUB32rm GR32:$src1, addr:$src2)>;
3223def : Pat<(subc GR32:$src1, imm:$src2),
3224 (SUB32ri GR32:$src1, imm:$src2)>;
3225def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
3226 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
3227
3228def : Pat<(truncstorei1 (i8 imm:$src), addr:$dst),
3229 (MOV8mi addr:$dst, imm:$src)>;
3230def : Pat<(truncstorei1 GR8:$src, addr:$dst),
3231 (MOV8mr addr:$dst, GR8:$src)>;
3232
3233// Comparisons.
3234
3235// TEST R,R is smaller than CMP R,0
3236def : Pat<(X86cmp GR8:$src1, 0),
3237 (TEST8rr GR8:$src1, GR8:$src1)>;
3238def : Pat<(X86cmp GR16:$src1, 0),
3239 (TEST16rr GR16:$src1, GR16:$src1)>;
3240def : Pat<(X86cmp GR32:$src1, 0),
3241 (TEST32rr GR32:$src1, GR32:$src1)>;
3242
Evan Cheng950aac02007-09-25 01:57:46 +00003243def : Pat<(parallel (X86cmp_new GR8:$src1, 0), (implicit EFLAGS)),
3244 (NEW_TEST8rr GR8:$src1, GR8:$src1)>;
3245def : Pat<(parallel (X86cmp_new GR16:$src1, 0), (implicit EFLAGS)),
3246 (NEW_TEST16rr GR16:$src1, GR16:$src1)>;
3247def : Pat<(parallel (X86cmp_new GR32:$src1, 0), (implicit EFLAGS)),
3248 (NEW_TEST32rr GR32:$src1, GR32:$src1)>;
3249
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003250// {s|z}extload bool -> {s|z}extload byte
3251def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
3252def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
3253def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3254def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3255def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3256
3257// extload bool -> extload byte
3258def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3259def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3260def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3261def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
3262def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
3263def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
3264
3265// anyext -> zext
3266def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
3267def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
3268def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
3269def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
3270def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
3271def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
3272
3273//===----------------------------------------------------------------------===//
3274// Some peepholes
3275//===----------------------------------------------------------------------===//
3276
3277// (shl x, 1) ==> (add x, x)
3278def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
3279def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
3280def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
3281
3282// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
3283def : Pat<(or (srl GR32:$src1, CL:$amt),
3284 (shl GR32:$src2, (sub 32, CL:$amt))),
3285 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
3286
3287def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
3288 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3289 (SHRD32mrCL addr:$dst, GR32:$src2)>;
3290
3291// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
3292def : Pat<(or (shl GR32:$src1, CL:$amt),
3293 (srl GR32:$src2, (sub 32, CL:$amt))),
3294 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
3295
3296def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
3297 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3298 (SHLD32mrCL addr:$dst, GR32:$src2)>;
3299
3300// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
3301def : Pat<(or (srl GR16:$src1, CL:$amt),
3302 (shl GR16:$src2, (sub 16, CL:$amt))),
3303 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
3304
3305def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
3306 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3307 (SHRD16mrCL addr:$dst, GR16:$src2)>;
3308
3309// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
3310def : Pat<(or (shl GR16:$src1, CL:$amt),
3311 (srl GR16:$src2, (sub 16, CL:$amt))),
3312 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
3313
3314def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
3315 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3316 (SHLD16mrCL addr:$dst, GR16:$src2)>;
3317
3318
3319//===----------------------------------------------------------------------===//
3320// Floating Point Stack Support
3321//===----------------------------------------------------------------------===//
3322
3323include "X86InstrFPStack.td"
3324
3325//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +00003326// X86-64 Support
3327//===----------------------------------------------------------------------===//
3328
3329include "X86InstrX86-64.td"
3330
3331//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003332// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
3333//===----------------------------------------------------------------------===//
3334
3335include "X86InstrMMX.td"
3336
3337//===----------------------------------------------------------------------===//
3338// XMM Floating point support (requires SSE / SSE2)
3339//===----------------------------------------------------------------------===//
3340
3341include "X86InstrSSE.td"