blob: 126677d40742fa41e2cc97dced3b53ab51da9797 [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 Cheng6e4d1d92007-09-11 19:55:27 +0000264let Defs = [ESP], Uses = [ESP] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000265def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt), "#ADJCALLSTACKDOWN",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000266 [(X86callseq_start imm:$amt)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000267def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000268 "#ADJCALLSTACKUP",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000269 [(X86callseq_end imm:$amt1, imm:$amt2)]>;
270}
Evan Chengb783fa32007-07-19 01:14:50 +0000271def IMPLICIT_USE : I<0, Pseudo, (outs), (ins variable_ops),
272 "#IMPLICIT_USE", []>;
273def IMPLICIT_DEF : I<0, Pseudo, (outs variable_ops), (ins),
274 "#IMPLICIT_DEF", []>;
275def IMPLICIT_DEF_GR8 : I<0, Pseudo, (outs GR8:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000276 "#IMPLICIT_DEF $dst",
277 [(set GR8:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000278def IMPLICIT_DEF_GR16 : I<0, Pseudo, (outs GR16:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000279 "#IMPLICIT_DEF $dst",
280 [(set GR16:$dst, (undef))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000281def IMPLICIT_DEF_GR32 : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000282 "#IMPLICIT_DEF $dst",
283 [(set GR32:$dst, (undef))]>;
284
285// Nop
Evan Chengb783fa32007-07-19 01:14:50 +0000286def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000287
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000288
289//===----------------------------------------------------------------------===//
290// Control Flow Instructions...
291//
292
293// Return instructions.
294let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +0000295 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000296 def RET : I<0xC3, RawFrm, (outs), (ins), "ret", [(X86retflag 0)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000297 def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt), "ret\t$amt",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000298 [(X86retflag imm:$amt)]>;
299}
300
301// All branches are RawFrm, Void, Branch, and Terminators
Evan Cheng37e7c752007-07-21 00:34:19 +0000302let isBranch = 1, isTerminator = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000303 class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> :
304 I<opcode, RawFrm, (outs), ins, asm, pattern>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000305
306// Indirect branches
307let isBranch = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000308 def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000309
Evan Cheng37e7c752007-07-21 00:34:19 +0000310let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
Dan Gohman91888f02007-07-31 20:11:57 +0000311 def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000312 [(brind GR32:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +0000313 def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000314 [(brind (loadi32 addr:$dst))]>;
315}
316
317// Conditional branches
Evan Cheng950aac02007-09-25 01:57:46 +0000318let Uses = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +0000319def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000320 [(X86brcond bb:$dst, X86_COND_E)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000321def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000322 [(X86brcond bb:$dst, X86_COND_NE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000323def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000324 [(X86brcond bb:$dst, X86_COND_L)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000325def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000326 [(X86brcond bb:$dst, X86_COND_LE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000327def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000328 [(X86brcond bb:$dst, X86_COND_G)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000329def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000330 [(X86brcond bb:$dst, X86_COND_GE)]>, TB;
331
Dan Gohman91888f02007-07-31 20:11:57 +0000332def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000333 [(X86brcond bb:$dst, X86_COND_B)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000334def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000335 [(X86brcond bb:$dst, X86_COND_BE)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000336def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000337 [(X86brcond bb:$dst, X86_COND_A)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000338def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000339 [(X86brcond bb:$dst, X86_COND_AE)]>, TB;
340
Dan Gohman91888f02007-07-31 20:11:57 +0000341def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000342 [(X86brcond bb:$dst, X86_COND_S)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000343def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000344 [(X86brcond bb:$dst, X86_COND_NS)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000345def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000346 [(X86brcond bb:$dst, X86_COND_P)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000347def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000348 [(X86brcond bb:$dst, X86_COND_NP)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000349def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000350 [(X86brcond bb:$dst, X86_COND_O)]>, TB;
Dan Gohman91888f02007-07-31 20:11:57 +0000351def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000352 [(X86brcond bb:$dst, X86_COND_NO)]>, TB;
Evan Cheng950aac02007-09-25 01:57:46 +0000353} // Uses = [EFLAGS]
354
355let Uses = [EFLAGS] in {
356def NEW_JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
357 [(X86brcond_new bb:$dst, X86_COND_E, EFLAGS)]>, TB;
358def NEW_JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
359 [(X86brcond_new bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
360def NEW_JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
361 [(X86brcond_new bb:$dst, X86_COND_L, EFLAGS)]>, TB;
362def NEW_JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
363 [(X86brcond_new bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
364def NEW_JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
365 [(X86brcond_new bb:$dst, X86_COND_G, EFLAGS)]>, TB;
366def NEW_JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
367 [(X86brcond_new bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
368
369def NEW_JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
370 [(X86brcond_new bb:$dst, X86_COND_B, EFLAGS)]>, TB;
371def NEW_JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
372 [(X86brcond_new bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
373def NEW_JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
374 [(X86brcond_new bb:$dst, X86_COND_A, EFLAGS)]>, TB;
375def NEW_JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
376 [(X86brcond_new bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
377
378def NEW_JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
379 [(X86brcond_new bb:$dst, X86_COND_S, EFLAGS)]>, TB;
380def NEW_JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
381 [(X86brcond_new bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
382def NEW_JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
383 [(X86brcond_new bb:$dst, X86_COND_P, EFLAGS)]>, TB;
384def NEW_JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
385 [(X86brcond_new bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
386def NEW_JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
387 [(X86brcond_new bb:$dst, X86_COND_O, EFLAGS)]>, TB;
388def NEW_JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
389 [(X86brcond_new bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
390} // Uses = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000391
392//===----------------------------------------------------------------------===//
393// Call Instructions...
394//
Evan Cheng37e7c752007-07-21 00:34:19 +0000395let isCall = 1 in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000396 // All calls clobber the non-callee saved registers...
397 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
398 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
Evan Cheng950aac02007-09-25 01:57:46 +0000399 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000400 def CALLpcrel32 : I<0xE8, RawFrm, (outs), (ins i32imm:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000401 "call\t${dst:call}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000402 def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000403 "call\t{*}$dst", [(X86call GR32:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000404 def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
Dan Gohman91888f02007-07-31 20:11:57 +0000405 "call\t{*}$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000406 }
407
408// Tail call stuff.
Evan Cheng37e7c752007-07-21 00:34:19 +0000409let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000410 def TAILJMPd : IBr<0xE9, (ins i32imm:$dst), "jmp\t${dst:call} # TAIL CALL",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000411 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000412let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Dan Gohman91888f02007-07-31 20:11:57 +0000413 def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp\t{*}$dst # TAIL CALL",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000414 []>;
Evan Cheng37e7c752007-07-21 00:34:19 +0000415let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Evan Chengb783fa32007-07-19 01:14:50 +0000416 def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +0000417 "jmp\t{*}$dst # TAIL CALL", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000418
419//===----------------------------------------------------------------------===//
420// Miscellaneous Instructions...
421//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000422let Defs = [EBP, ESP], Uses = [EBP, ESP] in
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000423def LEAVE : I<0xC9, RawFrm,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000424 (outs), (ins), "leave", []>;
425
426let Defs = [ESP], Uses = [ESP] in {
Evan Chengd8434332007-09-26 01:29:06 +0000427def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000428
Evan Chengd8434332007-09-26 01:29:06 +0000429def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000430}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000431
Evan Chengd8434332007-09-26 01:29:06 +0000432let Defs = [ESP, EFLAGS], Uses = [ESP] in
Evan Chengf1341312007-09-26 21:28:00 +0000433def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
Evan Chengd8434332007-09-26 01:29:06 +0000434let Defs = [ESP], Uses = [ESP, EFLAGS] in
Evan Chengf1341312007-09-26 21:28:00 +0000435def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
Evan Chengd8434332007-09-26 01:29:06 +0000436
Evan Chengb783fa32007-07-19 01:14:50 +0000437def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label),
Dan Gohman91888f02007-07-31 20:11:57 +0000438 "call\t$label", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000439
440let isTwoAddress = 1 in // GR32 = bswap GR32
441 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Chengb783fa32007-07-19 01:14:50 +0000442 (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000443 "bswap{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000444 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
445
Evan Chengb783fa32007-07-19 01:14:50 +0000446// FIXME: Model xchg* as two address instructions?
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000447def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
Evan Chengb783fa32007-07-19 01:14:50 +0000448 (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000449 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000450def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000451 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000452 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000453def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000454 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000455 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000456
457def XCHG8mr : I<0x86, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000458 (outs), (ins i8mem:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000459 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000460def XCHG16mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000461 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000462 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000463def XCHG32mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000464 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000465 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000466def XCHG8rm : I<0x86, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000467 (outs), (ins GR8:$src1, i8mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000468 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000469def XCHG16rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000470 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000471 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000472def XCHG32rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000473 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000474 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000475
476def LEA16r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000477 (outs GR16:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000478 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000479def LEA32r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000480 (outs GR32:$dst), (ins lea32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000481 "lea{l}\t{$src|$dst}, {$dst|$src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000482 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
483
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000484let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000485def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000486 [(X86rep_movs i8)]>, REP;
Evan Chengb783fa32007-07-19 01:14:50 +0000487def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000488 [(X86rep_movs i16)]>, REP, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000489def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000490 [(X86rep_movs i32)]>, REP;
491}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000492
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000493let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000494def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000495 [(X86rep_stos i8)]>, REP;
496let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000497def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000498 [(X86rep_stos i16)]>, REP, OpSize;
499let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000500def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000501 [(X86rep_stos i32)]>, REP;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000502
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000503let Defs = [RAX, RDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000504def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000505 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000506
507//===----------------------------------------------------------------------===//
508// Input/Output Instructions...
509//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000510let Defs = [AL], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000511def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000512 "in{b}\t{%dx, %al|%AL, %DX}", []>;
513let Defs = [AX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000514def IN16rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000515 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
516let Defs = [EAX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000517def IN32rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000518 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000519
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000520let Defs = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000521def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000522 "in{b}\t{$port, %al|%AL, $port}", []>;
523let Defs = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000524def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000525 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
526let Defs = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000527def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000528 "in{l}\t{$port, %eax|%EAX, $port}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000529
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000530let Uses = [DX, AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000531def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000532 "out{b}\t{%al, %dx|%DX, %AL}", []>;
533let Uses = [DX, AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000534def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000535 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
536let Uses = [DX, EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000537def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000538 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000539
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000540let Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000541def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000542 "out{b}\t{%al, $port|$port, %AL}", []>;
543let Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000544def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000545 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
546let Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000547def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000548 "out{l}\t{%eax, $port|$port, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000549
550//===----------------------------------------------------------------------===//
551// Move Instructions...
552//
Evan Chengb783fa32007-07-19 01:14:50 +0000553def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000554 "mov{b}\t{$src, $dst|$dst, $src}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000555def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000556 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000557def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000558 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000559let isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000560def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000561 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000562 [(set GR8:$dst, imm:$src)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000563def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000564 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000565 [(set GR16:$dst, imm:$src)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000566def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000567 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000568 [(set GR32:$dst, imm:$src)]>;
569}
Evan Chengb783fa32007-07-19 01:14:50 +0000570def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000571 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000572 [(store (i8 imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000573def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000574 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000575 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000576def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000577 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000578 [(store (i32 imm:$src), addr:$dst)]>;
579
Evan Cheng4e84e452007-08-30 05:49:43 +0000580let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000581def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000582 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000583 [(set GR8:$dst, (load addr:$src))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000584def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000585 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000586 [(set GR16:$dst, (load addr:$src))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000587def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000588 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000589 [(set GR32:$dst, (load addr:$src))]>;
Evan Cheng4e84e452007-08-30 05:49:43 +0000590}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000591
Evan Chengb783fa32007-07-19 01:14:50 +0000592def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000593 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000594 [(store GR8:$src, addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000595def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000596 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000597 [(store GR16:$src, addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000598def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000599 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000600 [(store GR32:$src, addr:$dst)]>;
601
602//===----------------------------------------------------------------------===//
603// Fixed-Register Multiplication and Division Instructions...
604//
605
606// Extra precision multiplication
Evan Cheng55687072007-09-14 21:48:26 +0000607let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Dan Gohman91888f02007-07-31 20:11:57 +0000608def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000609 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
610 // This probably ought to be moved to a def : Pat<> if the
611 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000612 [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000613let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000614def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000615 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000616let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000617def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>;
618 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000619let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000620def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000621 "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000622 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
623 // This probably ought to be moved to a def : Pat<> if the
624 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000625 [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000626let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000627def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000628 "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
Evan Cheng55687072007-09-14 21:48:26 +0000629let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000630def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000631 "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000632
Evan Cheng55687072007-09-14 21:48:26 +0000633let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000634def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
635 // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000636let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000637def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000638 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000639let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000640def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
641 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000642let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000643def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000644 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000645let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000646def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000647 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
648let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000649def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000650 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000651
652// unsigned division/remainder
Evan Cheng55687072007-09-14 21:48:26 +0000653let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000654def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000655 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000656let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000657def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000658 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000659let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000660def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000661 "div{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000662let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000663def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000664 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000665let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000666def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000667 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000668let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000669def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000670 "div{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000671
672// Signed division/remainder.
Evan Cheng55687072007-09-14 21:48:26 +0000673let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000674def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000675 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000676let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000677def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000678 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000679let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000680def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000681 "idiv{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000682let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000683def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000684 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000685let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000686def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000687 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000688let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000689def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000690 "idiv{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000691
692
693//===----------------------------------------------------------------------===//
694// Two address Instructions...
695//
696let isTwoAddress = 1 in {
697
698// Conditional moves
Evan Cheng950aac02007-09-25 01:57:46 +0000699let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000700def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000701 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000702 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000703 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
704 X86_COND_B))]>,
705 TB, OpSize;
706def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000707 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000708 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000709 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
710 X86_COND_B))]>,
711 TB, OpSize;
712def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000713 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000714 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000715 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
716 X86_COND_B))]>,
717 TB;
718def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000719 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000720 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000721 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
722 X86_COND_B))]>,
723 TB;
724
725def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000726 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000727 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000728 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
729 X86_COND_AE))]>,
730 TB, OpSize;
731def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000732 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000733 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000734 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
735 X86_COND_AE))]>,
736 TB, OpSize;
737def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000738 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000739 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000740 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
741 X86_COND_AE))]>,
742 TB;
743def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000744 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000745 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000746 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
747 X86_COND_AE))]>,
748 TB;
749
750def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000751 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000752 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000753 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
754 X86_COND_E))]>,
755 TB, OpSize;
756def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000757 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000758 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000759 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
760 X86_COND_E))]>,
761 TB, OpSize;
762def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000763 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000764 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000765 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
766 X86_COND_E))]>,
767 TB;
768def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000769 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000770 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000771 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
772 X86_COND_E))]>,
773 TB;
774
775def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000776 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000777 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000778 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
779 X86_COND_NE))]>,
780 TB, OpSize;
781def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000782 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000783 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000784 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
785 X86_COND_NE))]>,
786 TB, OpSize;
787def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000788 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000789 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000790 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
791 X86_COND_NE))]>,
792 TB;
793def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000794 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000795 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000796 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
797 X86_COND_NE))]>,
798 TB;
799
800def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000801 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000802 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000803 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
804 X86_COND_BE))]>,
805 TB, OpSize;
806def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000807 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000808 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000809 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
810 X86_COND_BE))]>,
811 TB, OpSize;
812def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000813 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000814 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000815 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
816 X86_COND_BE))]>,
817 TB;
818def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000819 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000820 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000821 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
822 X86_COND_BE))]>,
823 TB;
824
825def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000826 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000827 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000828 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
829 X86_COND_A))]>,
830 TB, OpSize;
831def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000832 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000833 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000834 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
835 X86_COND_A))]>,
836 TB, OpSize;
837def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000838 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000839 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000840 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
841 X86_COND_A))]>,
842 TB;
843def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000844 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000845 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000846 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
847 X86_COND_A))]>,
848 TB;
849
850def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000851 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000852 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000853 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
854 X86_COND_L))]>,
855 TB, OpSize;
856def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000857 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000858 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000859 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
860 X86_COND_L))]>,
861 TB, OpSize;
862def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000863 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000864 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000865 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
866 X86_COND_L))]>,
867 TB;
868def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000869 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000870 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000871 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
872 X86_COND_L))]>,
873 TB;
874
875def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000876 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000877 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000878 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
879 X86_COND_GE))]>,
880 TB, OpSize;
881def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000882 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000883 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000884 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
885 X86_COND_GE))]>,
886 TB, OpSize;
887def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000888 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000889 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000890 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
891 X86_COND_GE))]>,
892 TB;
893def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000894 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000895 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000896 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
897 X86_COND_GE))]>,
898 TB;
899
900def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000901 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000902 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000903 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
904 X86_COND_LE))]>,
905 TB, OpSize;
906def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000907 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000908 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000909 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
910 X86_COND_LE))]>,
911 TB, OpSize;
912def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000913 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000914 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000915 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
916 X86_COND_LE))]>,
917 TB;
918def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000919 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000920 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000921 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
922 X86_COND_LE))]>,
923 TB;
924
925def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000926 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000927 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000928 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
929 X86_COND_G))]>,
930 TB, OpSize;
931def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000932 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000933 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000934 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
935 X86_COND_G))]>,
936 TB, OpSize;
937def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000938 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000939 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000940 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
941 X86_COND_G))]>,
942 TB;
943def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000944 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000945 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000946 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
947 X86_COND_G))]>,
948 TB;
949
950def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000951 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000952 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000953 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
954 X86_COND_S))]>,
955 TB, OpSize;
956def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000957 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000958 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000959 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
960 X86_COND_S))]>,
961 TB, OpSize;
962def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000963 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000964 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000965 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
966 X86_COND_S))]>,
967 TB;
968def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000969 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000970 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000971 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
972 X86_COND_S))]>,
973 TB;
974
975def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000976 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000977 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000978 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
979 X86_COND_NS))]>,
980 TB, OpSize;
981def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000982 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000983 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000984 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
985 X86_COND_NS))]>,
986 TB, OpSize;
987def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000988 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000989 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000990 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
991 X86_COND_NS))]>,
992 TB;
993def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000994 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000995 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000996 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
997 X86_COND_NS))]>,
998 TB;
999
1000def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +00001001 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001002 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001003 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1004 X86_COND_P))]>,
1005 TB, OpSize;
1006def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001007 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001008 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001009 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1010 X86_COND_P))]>,
1011 TB, OpSize;
1012def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001013 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001014 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001015 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1016 X86_COND_P))]>,
1017 TB;
1018def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001019 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001020 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001021 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1022 X86_COND_P))]>,
1023 TB;
1024
1025def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +00001026 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001027 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001028 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1029 X86_COND_NP))]>,
1030 TB, OpSize;
1031def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001032 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001033 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001034 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1035 X86_COND_NP))]>,
1036 TB, OpSize;
1037def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001038 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001039 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001040 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1041 X86_COND_NP))]>,
1042 TB;
1043def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001044 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001045 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001046 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1047 X86_COND_NP))]>,
1048 TB;
1049
1050
Evan Cheng950aac02007-09-25 01:57:46 +00001051def NEW_CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
1052 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1053 "cmovb\t{$src2, $dst|$dst, $src2}",
1054 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1055 X86_COND_B, EFLAGS))]>,
1056 TB, OpSize;
1057def NEW_CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
1058 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1059 "cmovb\t{$src2, $dst|$dst, $src2}",
1060 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1061 X86_COND_B, EFLAGS))]>,
1062 TB, OpSize;
1063def NEW_CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
1064 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1065 "cmovb\t{$src2, $dst|$dst, $src2}",
1066 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1067 X86_COND_B, EFLAGS))]>,
1068 TB;
1069def NEW_CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
1070 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1071 "cmovb\t{$src2, $dst|$dst, $src2}",
1072 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1073 X86_COND_B, EFLAGS))]>,
1074 TB;
1075
1076def NEW_CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
1077 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1078 "cmovae\t{$src2, $dst|$dst, $src2}",
1079 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1080 X86_COND_AE, EFLAGS))]>,
1081 TB, OpSize;
1082def NEW_CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
1083 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1084 "cmovae\t{$src2, $dst|$dst, $src2}",
1085 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1086 X86_COND_AE, EFLAGS))]>,
1087 TB, OpSize;
1088def NEW_CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
1089 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1090 "cmovae\t{$src2, $dst|$dst, $src2}",
1091 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1092 X86_COND_AE, EFLAGS))]>,
1093 TB;
1094def NEW_CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
1095 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1096 "cmovae\t{$src2, $dst|$dst, $src2}",
1097 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1098 X86_COND_AE, EFLAGS))]>,
1099 TB;
1100
1101def NEW_CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
1102 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1103 "cmove\t{$src2, $dst|$dst, $src2}",
1104 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1105 X86_COND_E, EFLAGS))]>,
1106 TB, OpSize;
1107def NEW_CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
1108 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1109 "cmove\t{$src2, $dst|$dst, $src2}",
1110 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1111 X86_COND_E, EFLAGS))]>,
1112 TB, OpSize;
1113def NEW_CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
1114 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1115 "cmove\t{$src2, $dst|$dst, $src2}",
1116 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1117 X86_COND_E, EFLAGS))]>,
1118 TB;
1119def NEW_CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
1120 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1121 "cmove\t{$src2, $dst|$dst, $src2}",
1122 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1123 X86_COND_E, EFLAGS))]>,
1124 TB;
1125
1126def NEW_CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
1127 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1128 "cmovne\t{$src2, $dst|$dst, $src2}",
1129 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1130 X86_COND_NE, EFLAGS))]>,
1131 TB, OpSize;
1132def NEW_CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
1133 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1134 "cmovne\t{$src2, $dst|$dst, $src2}",
1135 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1136 X86_COND_NE, EFLAGS))]>,
1137 TB, OpSize;
1138def NEW_CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
1139 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1140 "cmovne\t{$src2, $dst|$dst, $src2}",
1141 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1142 X86_COND_NE, EFLAGS))]>,
1143 TB;
1144def NEW_CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
1145 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1146 "cmovne\t{$src2, $dst|$dst, $src2}",
1147 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1148 X86_COND_NE, EFLAGS))]>,
1149 TB;
1150
1151def NEW_CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
1152 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1153 "cmovbe\t{$src2, $dst|$dst, $src2}",
1154 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1155 X86_COND_BE, EFLAGS))]>,
1156 TB, OpSize;
1157def NEW_CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
1158 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1159 "cmovbe\t{$src2, $dst|$dst, $src2}",
1160 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1161 X86_COND_BE, EFLAGS))]>,
1162 TB, OpSize;
1163def NEW_CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
1164 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1165 "cmovbe\t{$src2, $dst|$dst, $src2}",
1166 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1167 X86_COND_BE, EFLAGS))]>,
1168 TB;
1169def NEW_CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
1170 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1171 "cmovbe\t{$src2, $dst|$dst, $src2}",
1172 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1173 X86_COND_BE, EFLAGS))]>,
1174 TB;
1175
1176def NEW_CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
1177 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1178 "cmova\t{$src2, $dst|$dst, $src2}",
1179 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1180 X86_COND_A, EFLAGS))]>,
1181 TB, OpSize;
1182def NEW_CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
1183 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1184 "cmova\t{$src2, $dst|$dst, $src2}",
1185 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1186 X86_COND_A, EFLAGS))]>,
1187 TB, OpSize;
1188def NEW_CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
1189 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1190 "cmova\t{$src2, $dst|$dst, $src2}",
1191 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1192 X86_COND_A, EFLAGS))]>,
1193 TB;
1194def NEW_CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
1195 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1196 "cmova\t{$src2, $dst|$dst, $src2}",
1197 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1198 X86_COND_A, EFLAGS))]>,
1199 TB;
1200
1201def NEW_CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
1202 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1203 "cmovl\t{$src2, $dst|$dst, $src2}",
1204 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1205 X86_COND_L, EFLAGS))]>,
1206 TB, OpSize;
1207def NEW_CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
1208 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1209 "cmovl\t{$src2, $dst|$dst, $src2}",
1210 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1211 X86_COND_L, EFLAGS))]>,
1212 TB, OpSize;
1213def NEW_CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
1214 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1215 "cmovl\t{$src2, $dst|$dst, $src2}",
1216 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1217 X86_COND_L, EFLAGS))]>,
1218 TB;
1219def NEW_CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
1220 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1221 "cmovl\t{$src2, $dst|$dst, $src2}",
1222 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1223 X86_COND_L, EFLAGS))]>,
1224 TB;
1225
1226def NEW_CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
1227 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1228 "cmovge\t{$src2, $dst|$dst, $src2}",
1229 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1230 X86_COND_GE, EFLAGS))]>,
1231 TB, OpSize;
1232def NEW_CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
1233 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1234 "cmovge\t{$src2, $dst|$dst, $src2}",
1235 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1236 X86_COND_GE, EFLAGS))]>,
1237 TB, OpSize;
1238def NEW_CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
1239 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1240 "cmovge\t{$src2, $dst|$dst, $src2}",
1241 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1242 X86_COND_GE, EFLAGS))]>,
1243 TB;
1244def NEW_CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
1245 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1246 "cmovge\t{$src2, $dst|$dst, $src2}",
1247 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1248 X86_COND_GE, EFLAGS))]>,
1249 TB;
1250
1251def NEW_CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
1252 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1253 "cmovle\t{$src2, $dst|$dst, $src2}",
1254 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1255 X86_COND_LE, EFLAGS))]>,
1256 TB, OpSize;
1257def NEW_CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
1258 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1259 "cmovle\t{$src2, $dst|$dst, $src2}",
1260 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1261 X86_COND_LE, EFLAGS))]>,
1262 TB, OpSize;
1263def NEW_CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
1264 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1265 "cmovle\t{$src2, $dst|$dst, $src2}",
1266 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1267 X86_COND_LE, EFLAGS))]>,
1268 TB;
1269def NEW_CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1270 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1271 "cmovle\t{$src2, $dst|$dst, $src2}",
1272 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1273 X86_COND_LE, EFLAGS))]>,
1274 TB;
1275
1276def NEW_CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
1277 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1278 "cmovg\t{$src2, $dst|$dst, $src2}",
1279 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1280 X86_COND_G, EFLAGS))]>,
1281 TB, OpSize;
1282def NEW_CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1283 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1284 "cmovg\t{$src2, $dst|$dst, $src2}",
1285 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1286 X86_COND_G, EFLAGS))]>,
1287 TB, OpSize;
1288def NEW_CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
1289 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1290 "cmovg\t{$src2, $dst|$dst, $src2}",
1291 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1292 X86_COND_G, EFLAGS))]>,
1293 TB;
1294def NEW_CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1295 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1296 "cmovg\t{$src2, $dst|$dst, $src2}",
1297 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1298 X86_COND_G, EFLAGS))]>,
1299 TB;
1300
1301def NEW_CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
1302 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1303 "cmovs\t{$src2, $dst|$dst, $src2}",
1304 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1305 X86_COND_S, EFLAGS))]>,
1306 TB, OpSize;
1307def NEW_CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1308 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1309 "cmovs\t{$src2, $dst|$dst, $src2}",
1310 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1311 X86_COND_S, EFLAGS))]>,
1312 TB, OpSize;
1313def NEW_CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
1314 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1315 "cmovs\t{$src2, $dst|$dst, $src2}",
1316 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1317 X86_COND_S, EFLAGS))]>,
1318 TB;
1319def NEW_CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1320 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1321 "cmovs\t{$src2, $dst|$dst, $src2}",
1322 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1323 X86_COND_S, EFLAGS))]>,
1324 TB;
1325
1326def NEW_CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
1327 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1328 "cmovns\t{$src2, $dst|$dst, $src2}",
1329 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1330 X86_COND_NS, EFLAGS))]>,
1331 TB, OpSize;
1332def NEW_CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1333 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1334 "cmovns\t{$src2, $dst|$dst, $src2}",
1335 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1336 X86_COND_NS, EFLAGS))]>,
1337 TB, OpSize;
1338def NEW_CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1339 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1340 "cmovns\t{$src2, $dst|$dst, $src2}",
1341 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1342 X86_COND_NS, EFLAGS))]>,
1343 TB;
1344def NEW_CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1345 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1346 "cmovns\t{$src2, $dst|$dst, $src2}",
1347 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1348 X86_COND_NS, EFLAGS))]>,
1349 TB;
1350
1351def NEW_CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1352 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1353 "cmovp\t{$src2, $dst|$dst, $src2}",
1354 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1355 X86_COND_P, EFLAGS))]>,
1356 TB, OpSize;
1357def NEW_CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1358 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1359 "cmovp\t{$src2, $dst|$dst, $src2}",
1360 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1361 X86_COND_P, EFLAGS))]>,
1362 TB, OpSize;
1363def NEW_CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1364 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1365 "cmovp\t{$src2, $dst|$dst, $src2}",
1366 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1367 X86_COND_P, EFLAGS))]>,
1368 TB;
1369def NEW_CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1370 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1371 "cmovp\t{$src2, $dst|$dst, $src2}",
1372 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1373 X86_COND_P, EFLAGS))]>,
1374 TB;
1375
1376def NEW_CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1377 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1378 "cmovnp\t{$src2, $dst|$dst, $src2}",
1379 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1380 X86_COND_NP, EFLAGS))]>,
1381 TB, OpSize;
1382def NEW_CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1383 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1384 "cmovnp\t{$src2, $dst|$dst, $src2}",
1385 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1386 X86_COND_NP, EFLAGS))]>,
1387 TB, OpSize;
1388def NEW_CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1389 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1390 "cmovnp\t{$src2, $dst|$dst, $src2}",
1391 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1392 X86_COND_NP, EFLAGS))]>,
1393 TB;
1394def NEW_CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1395 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1396 "cmovnp\t{$src2, $dst|$dst, $src2}",
1397 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1398 X86_COND_NP, EFLAGS))]>,
1399 TB;
1400} // Uses = [EFLAGS]
1401
1402
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001403// unary instructions
1404let CodeSize = 2 in {
Evan Cheng55687072007-09-14 21:48:26 +00001405let Defs = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +00001406def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001407 [(set GR8:$dst, (ineg GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001408def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001410def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411 [(set GR32:$dst, (ineg GR32:$src))]>;
1412let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001413 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001414 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001415 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001416 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001417 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001418 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1419
1420}
Evan Cheng55687072007-09-14 21:48:26 +00001421} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001422
Dan Gohman91888f02007-07-31 20:11:57 +00001423def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001424 [(set GR8:$dst, (not GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001425def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001426 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001427def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001428 [(set GR32:$dst, (not GR32:$src))]>;
1429let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001430 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001431 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001432 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001433 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001434 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001435 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1436}
1437} // CodeSize
1438
1439// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng55687072007-09-14 21:48:26 +00001440let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001441let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001442def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001443 [(set GR8:$dst, (add GR8:$src, 1))]>;
1444let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001445def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001446 [(set GR16:$dst, (add GR16:$src, 1))]>,
1447 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001448def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001449 [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>;
1450}
1451let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001452 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001453 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001454 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001455 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001456 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001457 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>;
1458}
1459
1460let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001461def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001462 [(set GR8:$dst, (add GR8:$src, -1))]>;
1463let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001464def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001465 [(set GR16:$dst, (add GR16:$src, -1))]>,
1466 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001467def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001468 [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>;
1469}
1470
1471let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001472 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001473 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001474 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001475 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001476 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001477 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>;
1478}
Evan Cheng55687072007-09-14 21:48:26 +00001479} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001480
1481// Logical operators...
Evan Cheng55687072007-09-14 21:48:26 +00001482let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001483let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1484def AND8rr : I<0x20, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001485 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001486 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001487 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
1488def AND16rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001489 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001490 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001491 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
1492def AND32rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001493 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001494 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001495 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
1496}
1497
1498def AND8rm : I<0x22, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001499 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001500 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001501 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
1502def AND16rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001503 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001504 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001505 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
1506def AND32rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001507 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001508 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001509 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
1510
1511def AND8ri : Ii8<0x80, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001512 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001513 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001514 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
1515def AND16ri : Ii16<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001516 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001517 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001518 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
1519def AND32ri : Ii32<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001520 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001521 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001522 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
1523def AND16ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001524 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001525 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001526 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
1527 OpSize;
1528def AND32ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001529 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001530 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001531 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
1532
1533let isTwoAddress = 0 in {
1534 def AND8mr : I<0x20, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001535 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001536 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001537 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
1538 def AND16mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001539 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001540 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001541 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
1542 OpSize;
1543 def AND32mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001544 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001545 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001546 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
1547 def AND8mi : Ii8<0x80, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001548 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001549 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001550 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1551 def AND16mi : Ii16<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001552 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001553 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001554 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1555 OpSize;
1556 def AND32mi : Ii32<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001557 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001558 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001559 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1560 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001561 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001562 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001563 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1564 OpSize;
1565 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001566 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001567 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001568 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1569}
1570
1571
1572let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00001573def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001574 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001575 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001576def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001577 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001578 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001579def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001580 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001581 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
1582}
Evan Chengb783fa32007-07-19 01:14:50 +00001583def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001584 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001585 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001586def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001587 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001588 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001589def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001590 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001591 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
1592
Evan Chengb783fa32007-07-19 01:14:50 +00001593def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001594 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001595 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001596def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001597 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001598 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001599def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001600 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001601 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
1602
Evan Chengb783fa32007-07-19 01:14:50 +00001603def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001604 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001605 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001606def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001607 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001608 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
1609let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001610 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001611 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001612 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001613 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001614 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001615 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001616 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001617 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001618 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001619 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001620 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001621 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001622 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001623 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001624 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1625 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001626 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001627 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001628 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001629 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001630 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001631 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1632 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001633 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001634 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001635 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1636}
1637
1638
1639let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1640def XOR8rr : I<0x30, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001641 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001642 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001643 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
1644def XOR16rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001645 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001646 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001647 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
1648def XOR32rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001649 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001650 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001651 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
1652}
1653
1654def XOR8rm : I<0x32, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001655 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001656 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001657 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
1658def XOR16rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001659 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001660 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001661 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
1662def XOR32rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001663 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001664 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001665 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
1666
1667def XOR8ri : Ii8<0x80, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001668 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001669 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001670 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
1671def XOR16ri : Ii16<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001672 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001673 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001674 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
1675def XOR32ri : Ii32<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001676 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001677 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001678 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
1679def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001680 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001681 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001682 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
1683 OpSize;
1684def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001685 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001686 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001687 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
1688let isTwoAddress = 0 in {
1689 def XOR8mr : I<0x30, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001690 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001691 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001692 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
1693 def XOR16mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001694 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001695 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001696 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
1697 OpSize;
1698 def XOR32mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001699 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001700 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001701 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
1702 def XOR8mi : Ii8<0x80, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001703 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001704 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001705 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1706 def XOR16mi : Ii16<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001707 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001708 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001709 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1710 OpSize;
1711 def XOR32mi : Ii32<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001712 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001713 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001714 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1715 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001716 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001717 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001718 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1719 OpSize;
1720 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001721 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001722 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001723 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1724}
Evan Cheng55687072007-09-14 21:48:26 +00001725} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001726
1727// Shift instructions
Evan Cheng55687072007-09-14 21:48:26 +00001728let Defs = [EFLAGS] in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001729let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001730def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001731 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001732 [(set GR8:$dst, (shl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001733def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001734 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001735 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001736def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001737 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001738 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1739}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001740
Evan Chengb783fa32007-07-19 01:14:50 +00001741def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001742 "shl{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001743 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1744let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Chengb783fa32007-07-19 01:14:50 +00001745def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001746 "shl{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001747 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001748def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001749 "shl{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001750 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1751}
1752
1753// Shift left by one. Not used because (add x, x) is slightly cheaper.
Evan Chengb783fa32007-07-19 01:14:50 +00001754def SHL8r1 : I<0xD0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001755 "shl{b}\t$dst", []>;
Evan Chengb783fa32007-07-19 01:14:50 +00001756def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001757 "shl{w}\t$dst", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001758def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001759 "shl{l}\t$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001760
1761let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001762 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001763 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001764 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001765 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001766 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001767 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001768 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001769 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001770 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001771 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1772 }
Evan Chengb783fa32007-07-19 01:14:50 +00001773 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001774 "shl{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001775 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001776 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001777 "shl{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001778 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1779 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001780 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001781 "shl{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001782 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1783
1784 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001785 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001786 "shl{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001787 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001788 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001789 "shl{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001790 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1791 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001792 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001793 "shl{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001794 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1795}
1796
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001797let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001798def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001799 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001800 [(set GR8:$dst, (srl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001801def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001802 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001803 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001804def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001805 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001806 [(set GR32:$dst, (srl GR32:$src, CL))]>;
1807}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001808
Evan Chengb783fa32007-07-19 01:14:50 +00001809def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001810 "shr{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001811 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001812def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001813 "shr{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001814 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001815def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001816 "shr{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001817 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
1818
1819// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001820def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001821 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001822 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001823def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001824 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001825 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001826def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001827 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001828 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1829
1830let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001831 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001832 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001833 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001834 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001835 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001836 "shr{w}\t{%cl, $dst|$dst, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001837 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001838 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001839 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001840 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001841 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1842 }
Evan Chengb783fa32007-07-19 01:14:50 +00001843 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001844 "shr{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001845 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001846 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001847 "shr{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001848 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1849 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001850 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001851 "shr{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001852 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1853
1854 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001855 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001856 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001857 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001858 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001859 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001860 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001861 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001862 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001863 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1864}
1865
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001866let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001867def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001868 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001869 [(set GR8:$dst, (sra GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001870def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001871 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001872 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001873def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001874 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001875 [(set GR32:$dst, (sra GR32:$src, CL))]>;
1876}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001877
Evan Chengb783fa32007-07-19 01:14:50 +00001878def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001879 "sar{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001880 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001881def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001882 "sar{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001883 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
1884 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001885def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001886 "sar{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001887 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
1888
1889// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001890def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001891 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001892 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001893def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001894 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001895 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001896def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001897 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001898 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1899
1900let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001901 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001902 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001903 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001904 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001905 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001906 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001907 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001908 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001909 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001910 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1911 }
Evan Chengb783fa32007-07-19 01:14:50 +00001912 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001913 "sar{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001914 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001915 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001916 "sar{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001917 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1918 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001919 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001920 "sar{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001921 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1922
1923 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001924 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001925 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001926 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001927 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001928 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001929 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1930 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001931 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001932 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001933 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1934}
1935
1936// Rotate instructions
1937// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001938let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001939def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001940 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001941 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001942def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001943 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001944 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001945def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001946 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001947 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
1948}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001949
Evan Chengb783fa32007-07-19 01:14:50 +00001950def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001951 "rol{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001952 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001953def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001954 "rol{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001955 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001956def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001957 "rol{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001958 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
1959
1960// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001961def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001962 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001963 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001964def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001965 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001966 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001967def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001968 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001969 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1970
1971let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001972 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001973 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001974 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001975 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001976 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001977 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001978 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001979 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001980 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001981 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1982 }
Evan Chengb783fa32007-07-19 01:14:50 +00001983 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001984 "rol{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001985 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001986 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001987 "rol{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001988 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1989 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001990 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001991 "rol{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001992 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1993
1994 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001995 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001996 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001997 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001998 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001999 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002000 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2001 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002002 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002003 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002004 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2005}
2006
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002007let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002008def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002009 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002010 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002011def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002012 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002013 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002014def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002015 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002016 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
2017}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002018
Evan Chengb783fa32007-07-19 01:14:50 +00002019def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002020 "ror{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002021 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002022def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002023 "ror{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002024 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002025def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002026 "ror{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002027 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
2028
2029// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002030def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002031 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002032 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002033def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002034 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002035 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002036def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002037 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002038 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
2039
2040let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002041 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002042 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002043 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002044 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002045 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002046 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002047 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002048 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002049 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002050 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
2051 }
Evan Chengb783fa32007-07-19 01:14:50 +00002052 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002053 "ror{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002054 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002055 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002056 "ror{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002057 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2058 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002059 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002060 "ror{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002061 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2062
2063 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002064 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002065 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002066 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002067 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002068 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002069 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2070 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002071 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002072 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002073 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2074}
2075
2076
2077
2078// Double shift instructions (generalizations of rotate)
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002079let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002080def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002081 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002082 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002083def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002084 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002085 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002086def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002087 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002088 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002089 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002090def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002091 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002092 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002093 TB, OpSize;
2094}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002095
2096let isCommutable = 1 in { // These instructions commute to each other.
2097def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002098 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002099 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002100 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
2101 (i8 imm:$src3)))]>,
2102 TB;
2103def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002104 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002105 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002106 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
2107 (i8 imm:$src3)))]>,
2108 TB;
2109def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002110 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002111 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002112 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
2113 (i8 imm:$src3)))]>,
2114 TB, OpSize;
2115def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002116 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002117 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002118 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
2119 (i8 imm:$src3)))]>,
2120 TB, OpSize;
2121}
2122
2123let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002124 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002125 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002126 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002127 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002128 addr:$dst)]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002129 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002130 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002131 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002132 addr:$dst)]>, TB;
2133 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002134 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002135 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002136 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002137 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
2138 (i8 imm:$src3)), addr:$dst)]>,
2139 TB;
2140 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002141 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002142 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002143 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
2144 (i8 imm:$src3)), addr:$dst)]>,
2145 TB;
2146
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002147 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002148 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002149 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002150 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002151 addr:$dst)]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002152 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002153 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002154 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002155 addr:$dst)]>, TB, OpSize;
2156 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002157 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002158 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002159 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002160 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
2161 (i8 imm:$src3)), addr:$dst)]>,
2162 TB, OpSize;
2163 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002164 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002165 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002166 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
2167 (i8 imm:$src3)), addr:$dst)]>,
2168 TB, OpSize;
2169}
Evan Cheng55687072007-09-14 21:48:26 +00002170} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002171
2172
2173// Arithmetic.
Evan Cheng55687072007-09-14 21:48:26 +00002174let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002175let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002176def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
2177 (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002178 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002179 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
2180let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002181def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
2182 (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002183 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002184 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002185def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
2186 (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002187 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002188 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
2189} // end isConvertibleToThreeAddress
2190} // end isCommutable
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002191def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
2192 (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002193 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002194 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002195def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
2196 (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002197 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002198 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize;
2199def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
2200 (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002201 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002202 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
2203
Evan Chengb783fa32007-07-19 01:14:50 +00002204def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002205 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002206 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
2207
2208let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002209def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
2210 (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002211 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002212 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002213def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
2214 (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002215 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002216 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002217def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
2218 (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002219 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002220 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize;
2221def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
2222 (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002223 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002224 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002225}
2226
2227let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002228 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002229 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002230 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002231 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002232 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002233 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002234 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002235 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002236 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002237 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002238 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002239 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002240 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002241 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002242 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002243 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002244 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002245 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002246 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002247 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002248 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002249 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002250 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002251 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002252 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002253 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002254 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2255}
2256
2257let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002258def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002259 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002260 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
2261}
Evan Chengb783fa32007-07-19 01:14:50 +00002262def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002263 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002264 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002265def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002266 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002267 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002268def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002269 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002270 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
2271
2272let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002273 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002274 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002275 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002276 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002277 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002278 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002279 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002280 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002281 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2282}
2283
Evan Chengb783fa32007-07-19 01:14:50 +00002284def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002285 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002286 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002287def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002288 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002289 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002290def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002291 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002292 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002293def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002294 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002295 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002296def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002297 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002298 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002299def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002300 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002301 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
2302
Evan Chengb783fa32007-07-19 01:14:50 +00002303def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002304 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002305 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002306def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002307 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002308 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002309def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002310 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002311 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002312def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002313 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002314 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng55687072007-09-14 21:48:26 +00002315 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002316def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002317 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002318 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
2319let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002320 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002321 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002322 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002323 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002324 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002325 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002326 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002327 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002328 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002329 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002330 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002331 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002332 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002333 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002334 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002335 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002336 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002337 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002338 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002339 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002340 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002341 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002342 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002343 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002344 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002345 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002346 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2347}
2348
Evan Chengb783fa32007-07-19 01:14:50 +00002349def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002350 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002351 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002352
2353let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002354 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002355 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002356 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002357 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002358 "sbb{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002359 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002360 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002361 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002362 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002363 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002364 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002365 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002366}
Evan Chengb783fa32007-07-19 01:14:50 +00002367def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002368 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002369 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002370def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002371 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002372 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002373def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002374 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002375 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002376} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002377
Evan Cheng55687072007-09-14 21:48:26 +00002378let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002379let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002380def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002381 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002382 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002383def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002384 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002385 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
2386}
Evan Chengb783fa32007-07-19 01:14:50 +00002387def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002388 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002389 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
2390 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002391def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002392 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002393 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Evan Cheng55687072007-09-14 21:48:26 +00002394} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002395} // end Two Address instructions
2396
2397// Suprisingly enough, these are not two address instructions!
Evan Cheng55687072007-09-14 21:48:26 +00002398let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002399def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002400 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002401 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002402 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
2403def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002404 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002405 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002406 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
2407def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002408 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002409 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002410 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
2411 OpSize;
2412def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002413 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002414 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002415 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
2416
2417def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002418 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002419 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002420 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
2421 OpSize;
2422def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002423 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002424 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002425 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
2426def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002427 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002428 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002429 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
2430 OpSize;
2431def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002432 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002433 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002434 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002435} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002436
2437//===----------------------------------------------------------------------===//
2438// Test instructions are just like AND, except they don't generate a result.
2439//
Evan Cheng950aac02007-09-25 01:57:46 +00002440let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002441let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Chengb783fa32007-07-19 01:14:50 +00002442def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002443 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002444 [(X86cmp (and GR8:$src1, GR8:$src2), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002445def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002446 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002447 [(X86cmp (and GR16:$src1, GR16:$src2), 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002448def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002449 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002450 [(X86cmp (and GR32:$src1, GR32:$src2), 0)]>;
2451}
2452
Evan Chengb783fa32007-07-19 01:14:50 +00002453def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002454 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002455 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002456def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002457 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002458 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0)]>,
2459 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002460def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002461 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002462 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0)]>;
2463
2464def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002465 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002466 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002467 [(X86cmp (and GR8:$src1, imm:$src2), 0)]>;
2468def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002469 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002470 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002471 [(X86cmp (and GR16:$src1, imm:$src2), 0)]>, OpSize;
2472def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002473 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002474 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002475 [(X86cmp (and GR32:$src1, imm:$src2), 0)]>;
2476
2477def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002478 (outs), (ins i8mem:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002479 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002480 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0)]>;
2481def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002482 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002483 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002484 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0)]>,
2485 OpSize;
2486def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002487 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002488 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002489 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002490} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002491
2492
Evan Cheng950aac02007-09-25 01:57:46 +00002493let Defs = [EFLAGS] in {
2494let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
2495def NEW_TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
2496 "test{b}\t{$src2, $src1|$src1, $src2}",
2497 [(X86cmp_new (and GR8:$src1, GR8:$src2), 0),
2498 (implicit EFLAGS)]>;
2499def NEW_TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2500 "test{w}\t{$src2, $src1|$src1, $src2}",
2501 [(X86cmp_new (and GR16:$src1, GR16:$src2), 0),
2502 (implicit EFLAGS)]>,
2503 OpSize;
2504def NEW_TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2505 "test{l}\t{$src2, $src1|$src1, $src2}",
2506 [(X86cmp_new (and GR32:$src1, GR32:$src2), 0),
2507 (implicit EFLAGS)]>;
2508}
2509
2510def NEW_TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
2511 "test{b}\t{$src2, $src1|$src1, $src2}",
2512 [(X86cmp_new (and GR8:$src1, (loadi8 addr:$src2)), 0),
2513 (implicit EFLAGS)]>;
2514def NEW_TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
2515 "test{w}\t{$src2, $src1|$src1, $src2}",
2516 [(X86cmp_new (and GR16:$src1, (loadi16 addr:$src2)), 0),
2517 (implicit EFLAGS)]>, OpSize;
2518def NEW_TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
2519 "test{l}\t{$src2, $src1|$src1, $src2}",
2520 [(X86cmp_new (and GR32:$src1, (loadi32 addr:$src2)), 0),
2521 (implicit EFLAGS)]>;
2522
2523def NEW_TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
2524 (outs), (ins GR8:$src1, i8imm:$src2),
2525 "test{b}\t{$src2, $src1|$src1, $src2}",
2526 [(X86cmp_new (and GR8:$src1, imm:$src2), 0),
2527 (implicit EFLAGS)]>;
2528def NEW_TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2529 (outs), (ins GR16:$src1, i16imm:$src2),
2530 "test{w}\t{$src2, $src1|$src1, $src2}",
2531 [(X86cmp_new (and GR16:$src1, imm:$src2), 0),
2532 (implicit EFLAGS)]>, OpSize;
2533def NEW_TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2534 (outs), (ins GR32:$src1, i32imm:$src2),
2535 "test{l}\t{$src2, $src1|$src1, $src2}",
2536 [(X86cmp_new (and GR32:$src1, imm:$src2), 0),
2537 (implicit EFLAGS)]>;
2538
2539def NEW_TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
2540 (outs), (ins i8mem:$src1, i8imm:$src2),
2541 "test{b}\t{$src2, $src1|$src1, $src2}",
2542 [(X86cmp_new (and (loadi8 addr:$src1), imm:$src2), 0),
2543 (implicit EFLAGS)]>;
2544def NEW_TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2545 (outs), (ins i16mem:$src1, i16imm:$src2),
2546 "test{w}\t{$src2, $src1|$src1, $src2}",
2547 [(X86cmp_new (and (loadi16 addr:$src1), imm:$src2), 0),
2548 (implicit EFLAGS)]>, OpSize;
2549def NEW_TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2550 (outs), (ins i32mem:$src1, i32imm:$src2),
2551 "test{l}\t{$src2, $src1|$src1, $src2}",
2552 [(X86cmp_new (and (loadi32 addr:$src1), imm:$src2), 0),
2553 (implicit EFLAGS)]>;
2554} // Defs = [EFLAGS]
2555
2556
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002557// Condition code ops, incl. set if equal/not equal/...
Evan Cheng55687072007-09-14 21:48:26 +00002558let Defs = [EFLAGS], Uses = [AH] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002559def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
Evan Cheng55687072007-09-14 21:48:26 +00002560let Defs = [AH], Uses = [EFLAGS] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002561def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002562
Evan Cheng950aac02007-09-25 01:57:46 +00002563let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002564def SETEr : I<0x94, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002565 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002566 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002567 [(set GR8:$dst, (X86setcc X86_COND_E))]>,
2568 TB; // GR8 = ==
2569def SETEm : I<0x94, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002570 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002571 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002572 [(store (X86setcc X86_COND_E), addr:$dst)]>,
2573 TB; // [mem8] = ==
2574def SETNEr : I<0x95, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002575 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002576 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002577 [(set GR8:$dst, (X86setcc X86_COND_NE))]>,
2578 TB; // GR8 = !=
2579def SETNEm : I<0x95, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002580 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002581 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002582 [(store (X86setcc X86_COND_NE), addr:$dst)]>,
2583 TB; // [mem8] = !=
2584def SETLr : I<0x9C, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002585 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002586 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002587 [(set GR8:$dst, (X86setcc X86_COND_L))]>,
2588 TB; // GR8 = < signed
2589def SETLm : I<0x9C, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002590 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002591 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002592 [(store (X86setcc X86_COND_L), addr:$dst)]>,
2593 TB; // [mem8] = < signed
2594def SETGEr : I<0x9D, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002595 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002596 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002597 [(set GR8:$dst, (X86setcc X86_COND_GE))]>,
2598 TB; // GR8 = >= signed
2599def SETGEm : I<0x9D, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002600 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002601 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002602 [(store (X86setcc X86_COND_GE), addr:$dst)]>,
2603 TB; // [mem8] = >= signed
2604def SETLEr : I<0x9E, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002605 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002606 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002607 [(set GR8:$dst, (X86setcc X86_COND_LE))]>,
2608 TB; // GR8 = <= signed
2609def SETLEm : I<0x9E, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002610 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002611 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002612 [(store (X86setcc X86_COND_LE), addr:$dst)]>,
2613 TB; // [mem8] = <= signed
2614def SETGr : I<0x9F, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002615 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002616 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002617 [(set GR8:$dst, (X86setcc X86_COND_G))]>,
2618 TB; // GR8 = > signed
2619def SETGm : I<0x9F, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002620 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002621 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002622 [(store (X86setcc X86_COND_G), addr:$dst)]>,
2623 TB; // [mem8] = > signed
2624
2625def SETBr : I<0x92, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002626 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002627 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002628 [(set GR8:$dst, (X86setcc X86_COND_B))]>,
2629 TB; // GR8 = < unsign
2630def SETBm : I<0x92, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002631 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002632 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002633 [(store (X86setcc X86_COND_B), addr:$dst)]>,
2634 TB; // [mem8] = < unsign
2635def SETAEr : I<0x93, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002636 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002637 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002638 [(set GR8:$dst, (X86setcc X86_COND_AE))]>,
2639 TB; // GR8 = >= unsign
2640def SETAEm : I<0x93, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002641 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002642 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002643 [(store (X86setcc X86_COND_AE), addr:$dst)]>,
2644 TB; // [mem8] = >= unsign
2645def SETBEr : I<0x96, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002646 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002647 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002648 [(set GR8:$dst, (X86setcc X86_COND_BE))]>,
2649 TB; // GR8 = <= unsign
2650def SETBEm : I<0x96, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002651 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002652 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002653 [(store (X86setcc X86_COND_BE), addr:$dst)]>,
2654 TB; // [mem8] = <= unsign
2655def SETAr : I<0x97, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002656 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002657 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002658 [(set GR8:$dst, (X86setcc X86_COND_A))]>,
2659 TB; // GR8 = > signed
2660def SETAm : I<0x97, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002661 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002662 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002663 [(store (X86setcc X86_COND_A), addr:$dst)]>,
2664 TB; // [mem8] = > signed
2665
2666def SETSr : I<0x98, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002667 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002668 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002669 [(set GR8:$dst, (X86setcc X86_COND_S))]>,
2670 TB; // GR8 = <sign bit>
2671def SETSm : I<0x98, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002672 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002673 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002674 [(store (X86setcc X86_COND_S), addr:$dst)]>,
2675 TB; // [mem8] = <sign bit>
2676def SETNSr : I<0x99, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002677 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002678 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002679 [(set GR8:$dst, (X86setcc X86_COND_NS))]>,
2680 TB; // GR8 = !<sign bit>
2681def SETNSm : I<0x99, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002682 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002683 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002684 [(store (X86setcc X86_COND_NS), addr:$dst)]>,
2685 TB; // [mem8] = !<sign bit>
2686def SETPr : I<0x9A, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002687 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002688 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002689 [(set GR8:$dst, (X86setcc X86_COND_P))]>,
2690 TB; // GR8 = parity
2691def SETPm : I<0x9A, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002692 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002693 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002694 [(store (X86setcc X86_COND_P), addr:$dst)]>,
2695 TB; // [mem8] = parity
2696def SETNPr : I<0x9B, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002697 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002698 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002699 [(set GR8:$dst, (X86setcc X86_COND_NP))]>,
2700 TB; // GR8 = not parity
2701def SETNPm : I<0x9B, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002702 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002703 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002704 [(store (X86setcc X86_COND_NP), addr:$dst)]>,
2705 TB; // [mem8] = not parity
Evan Cheng950aac02007-09-25 01:57:46 +00002706} // Uses = [EFLAGS]
2707
2708let Uses = [EFLAGS] in {
2709def NEW_SETEr : I<0x94, MRM0r,
2710 (outs GR8 :$dst), (ins),
2711 "sete\t$dst",
2712 [(set GR8:$dst, (X86setcc_new X86_COND_E, EFLAGS))]>,
2713 TB; // GR8 = ==
2714def NEW_SETEm : I<0x94, MRM0m,
2715 (outs), (ins i8mem:$dst),
2716 "sete\t$dst",
2717 [(store (X86setcc_new X86_COND_E, EFLAGS), addr:$dst)]>,
2718 TB; // [mem8] = ==
2719def NEW_SETNEr : I<0x95, MRM0r,
2720 (outs GR8 :$dst), (ins),
2721 "setne\t$dst",
2722 [(set GR8:$dst, (X86setcc_new X86_COND_NE, EFLAGS))]>,
2723 TB; // GR8 = !=
2724def NEW_SETNEm : I<0x95, MRM0m,
2725 (outs), (ins i8mem:$dst),
2726 "setne\t$dst",
2727 [(store (X86setcc_new X86_COND_NE, EFLAGS), addr:$dst)]>,
2728 TB; // [mem8] = !=
2729def NEW_SETLr : I<0x9C, MRM0r,
2730 (outs GR8 :$dst), (ins),
2731 "setl\t$dst",
2732 [(set GR8:$dst, (X86setcc_new X86_COND_L, EFLAGS))]>,
2733 TB; // GR8 = < signed
2734def NEW_SETLm : I<0x9C, MRM0m,
2735 (outs), (ins i8mem:$dst),
2736 "setl\t$dst",
2737 [(store (X86setcc_new X86_COND_L, EFLAGS), addr:$dst)]>,
2738 TB; // [mem8] = < signed
2739def NEW_SETGEr : I<0x9D, MRM0r,
2740 (outs GR8 :$dst), (ins),
2741 "setge\t$dst",
2742 [(set GR8:$dst, (X86setcc_new X86_COND_GE, EFLAGS))]>,
2743 TB; // GR8 = >= signed
2744def NEW_SETGEm : I<0x9D, MRM0m,
2745 (outs), (ins i8mem:$dst),
2746 "setge\t$dst",
2747 [(store (X86setcc_new X86_COND_GE, EFLAGS), addr:$dst)]>,
2748 TB; // [mem8] = >= signed
2749def NEW_SETLEr : I<0x9E, MRM0r,
2750 (outs GR8 :$dst), (ins),
2751 "setle\t$dst",
2752 [(set GR8:$dst, (X86setcc_new X86_COND_LE, EFLAGS))]>,
2753 TB; // GR8 = <= signed
2754def NEW_SETLEm : I<0x9E, MRM0m,
2755 (outs), (ins i8mem:$dst),
2756 "setle\t$dst",
2757 [(store (X86setcc_new X86_COND_LE, EFLAGS), addr:$dst)]>,
2758 TB; // [mem8] = <= signed
2759def NEW_SETGr : I<0x9F, MRM0r,
2760 (outs GR8 :$dst), (ins),
2761 "setg\t$dst",
2762 [(set GR8:$dst, (X86setcc_new X86_COND_G, EFLAGS))]>,
2763 TB; // GR8 = > signed
2764def NEW_SETGm : I<0x9F, MRM0m,
2765 (outs), (ins i8mem:$dst),
2766 "setg\t$dst",
2767 [(store (X86setcc_new X86_COND_G, EFLAGS), addr:$dst)]>,
2768 TB; // [mem8] = > signed
2769
2770def NEW_SETBr : I<0x92, MRM0r,
2771 (outs GR8 :$dst), (ins),
2772 "setb\t$dst",
2773 [(set GR8:$dst, (X86setcc_new X86_COND_B, EFLAGS))]>,
2774 TB; // GR8 = < unsign
2775def NEW_SETBm : I<0x92, MRM0m,
2776 (outs), (ins i8mem:$dst),
2777 "setb\t$dst",
2778 [(store (X86setcc_new X86_COND_B, EFLAGS), addr:$dst)]>,
2779 TB; // [mem8] = < unsign
2780def NEW_SETAEr : I<0x93, MRM0r,
2781 (outs GR8 :$dst), (ins),
2782 "setae\t$dst",
2783 [(set GR8:$dst, (X86setcc_new X86_COND_AE, EFLAGS))]>,
2784 TB; // GR8 = >= unsign
2785def NEW_SETAEm : I<0x93, MRM0m,
2786 (outs), (ins i8mem:$dst),
2787 "setae\t$dst",
2788 [(store (X86setcc_new X86_COND_AE, EFLAGS), addr:$dst)]>,
2789 TB; // [mem8] = >= unsign
2790def NEW_SETBEr : I<0x96, MRM0r,
2791 (outs GR8 :$dst), (ins),
2792 "setbe\t$dst",
2793 [(set GR8:$dst, (X86setcc_new X86_COND_BE, EFLAGS))]>,
2794 TB; // GR8 = <= unsign
2795def NEW_SETBEm : I<0x96, MRM0m,
2796 (outs), (ins i8mem:$dst),
2797 "setbe\t$dst",
2798 [(store (X86setcc_new X86_COND_BE, EFLAGS), addr:$dst)]>,
2799 TB; // [mem8] = <= unsign
2800def NEW_SETAr : I<0x97, MRM0r,
2801 (outs GR8 :$dst), (ins),
2802 "seta\t$dst",
2803 [(set GR8:$dst, (X86setcc_new X86_COND_A, EFLAGS))]>,
2804 TB; // GR8 = > signed
2805def NEW_SETAm : I<0x97, MRM0m,
2806 (outs), (ins i8mem:$dst),
2807 "seta\t$dst",
2808 [(store (X86setcc_new X86_COND_A, EFLAGS), addr:$dst)]>,
2809 TB; // [mem8] = > signed
2810
2811def NEW_SETSr : I<0x98, MRM0r,
2812 (outs GR8 :$dst), (ins),
2813 "sets\t$dst",
2814 [(set GR8:$dst, (X86setcc_new X86_COND_S, EFLAGS))]>,
2815 TB; // GR8 = <sign bit>
2816def NEW_SETSm : I<0x98, MRM0m,
2817 (outs), (ins i8mem:$dst),
2818 "sets\t$dst",
2819 [(store (X86setcc_new X86_COND_S, EFLAGS), addr:$dst)]>,
2820 TB; // [mem8] = <sign bit>
2821def NEW_SETNSr : I<0x99, MRM0r,
2822 (outs GR8 :$dst), (ins),
2823 "setns\t$dst",
2824 [(set GR8:$dst, (X86setcc_new X86_COND_NS, EFLAGS))]>,
2825 TB; // GR8 = !<sign bit>
2826def NEW_SETNSm : I<0x99, MRM0m,
2827 (outs), (ins i8mem:$dst),
2828 "setns\t$dst",
2829 [(store (X86setcc_new X86_COND_NS, EFLAGS), addr:$dst)]>,
2830 TB; // [mem8] = !<sign bit>
2831def NEW_SETPr : I<0x9A, MRM0r,
2832 (outs GR8 :$dst), (ins),
2833 "setp\t$dst",
2834 [(set GR8:$dst, (X86setcc_new X86_COND_P, EFLAGS))]>,
2835 TB; // GR8 = parity
2836def NEW_SETPm : I<0x9A, MRM0m,
2837 (outs), (ins i8mem:$dst),
2838 "setp\t$dst",
2839 [(store (X86setcc_new X86_COND_P, EFLAGS), addr:$dst)]>,
2840 TB; // [mem8] = parity
2841def NEW_SETNPr : I<0x9B, MRM0r,
2842 (outs GR8 :$dst), (ins),
2843 "setnp\t$dst",
2844 [(set GR8:$dst, (X86setcc_new X86_COND_NP, EFLAGS))]>,
2845 TB; // GR8 = not parity
2846def NEW_SETNPm : I<0x9B, MRM0m,
2847 (outs), (ins i8mem:$dst),
2848 "setnp\t$dst",
2849 [(store (X86setcc_new X86_COND_NP, EFLAGS), addr:$dst)]>,
2850 TB; // [mem8] = not parity
2851} // Uses = [EFLAGS]
2852
2853
2854//def : Pat<(X86setcc_new X86_COND_E, EFLAGS), (SETEr)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002855
2856// Integer comparisons
Evan Cheng55687072007-09-14 21:48:26 +00002857let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002858def CMP8rr : I<0x38, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002859 (outs), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002860 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002861 [(X86cmp GR8:$src1, GR8:$src2)]>;
2862def CMP16rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002863 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002864 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002865 [(X86cmp GR16:$src1, GR16:$src2)]>, OpSize;
2866def CMP32rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002867 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002868 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002869 [(X86cmp GR32:$src1, GR32:$src2)]>;
2870def CMP8mr : I<0x38, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002871 (outs), (ins i8mem :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002872 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002873 [(X86cmp (loadi8 addr:$src1), GR8:$src2)]>;
2874def CMP16mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002875 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002876 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002877 [(X86cmp (loadi16 addr:$src1), GR16:$src2)]>, OpSize;
2878def CMP32mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002879 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002880 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002881 [(X86cmp (loadi32 addr:$src1), GR32:$src2)]>;
2882def CMP8rm : I<0x3A, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002883 (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002884 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002885 [(X86cmp GR8:$src1, (loadi8 addr:$src2))]>;
2886def CMP16rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002887 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002888 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002889 [(X86cmp GR16:$src1, (loadi16 addr:$src2))]>, OpSize;
2890def CMP32rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002891 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002892 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002893 [(X86cmp GR32:$src1, (loadi32 addr:$src2))]>;
2894def CMP8ri : Ii8<0x80, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002895 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002896 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002897 [(X86cmp GR8:$src1, imm:$src2)]>;
2898def CMP16ri : Ii16<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002899 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002900 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002901 [(X86cmp GR16:$src1, imm:$src2)]>, OpSize;
2902def CMP32ri : Ii32<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002903 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002904 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002905 [(X86cmp GR32:$src1, imm:$src2)]>;
2906def CMP8mi : Ii8 <0x80, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002907 (outs), (ins i8mem :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002908 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002909 [(X86cmp (loadi8 addr:$src1), imm:$src2)]>;
2910def CMP16mi : Ii16<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002911 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002912 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002913 [(X86cmp (loadi16 addr:$src1), imm:$src2)]>, OpSize;
2914def CMP32mi : Ii32<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002915 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002916 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002917 [(X86cmp (loadi32 addr:$src1), imm:$src2)]>;
2918def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002919 (outs), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002920 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002921 [(X86cmp GR16:$src1, i16immSExt8:$src2)]>, OpSize;
2922def CMP16mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002923 (outs), (ins i16mem:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002924 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002925 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2)]>, OpSize;
2926def CMP32mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002927 (outs), (ins i32mem:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002928 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002929 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2)]>;
2930def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002931 (outs), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002932 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002933 [(X86cmp GR32:$src1, i32immSExt8:$src2)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002934} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002935
Evan Cheng950aac02007-09-25 01:57:46 +00002936let Defs = [EFLAGS] in {
2937def NEW_CMP8rr : I<0x38, MRMDestReg,
2938 (outs), (ins GR8 :$src1, GR8 :$src2),
2939 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2940 [(X86cmp_new GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
2941def NEW_CMP16rr : I<0x39, MRMDestReg,
2942 (outs), (ins GR16:$src1, GR16:$src2),
2943 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2944 [(X86cmp_new GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
2945def NEW_CMP32rr : I<0x39, MRMDestReg,
2946 (outs), (ins GR32:$src1, GR32:$src2),
2947 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2948 [(X86cmp_new GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
2949def NEW_CMP8mr : I<0x38, MRMDestMem,
2950 (outs), (ins i8mem :$src1, GR8 :$src2),
2951 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2952 [(X86cmp_new (loadi8 addr:$src1), GR8:$src2),
2953 (implicit EFLAGS)]>;
2954def NEW_CMP16mr : I<0x39, MRMDestMem,
2955 (outs), (ins i16mem:$src1, GR16:$src2),
2956 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2957 [(X86cmp_new (loadi16 addr:$src1), GR16:$src2),
2958 (implicit EFLAGS)]>, OpSize;
2959def NEW_CMP32mr : I<0x39, MRMDestMem,
2960 (outs), (ins i32mem:$src1, GR32:$src2),
2961 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2962 [(X86cmp_new (loadi32 addr:$src1), GR32:$src2),
2963 (implicit EFLAGS)]>;
2964def NEW_CMP8rm : I<0x3A, MRMSrcMem,
2965 (outs), (ins GR8 :$src1, i8mem :$src2),
2966 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2967 [(X86cmp_new GR8:$src1, (loadi8 addr:$src2)),
2968 (implicit EFLAGS)]>;
2969def NEW_CMP16rm : I<0x3B, MRMSrcMem,
2970 (outs), (ins GR16:$src1, i16mem:$src2),
2971 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2972 [(X86cmp_new GR16:$src1, (loadi16 addr:$src2)),
2973 (implicit EFLAGS)]>, OpSize;
2974def NEW_CMP32rm : I<0x3B, MRMSrcMem,
2975 (outs), (ins GR32:$src1, i32mem:$src2),
2976 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2977 [(X86cmp_new GR32:$src1, (loadi32 addr:$src2)),
2978 (implicit EFLAGS)]>;
2979def NEW_CMP8ri : Ii8<0x80, MRM7r,
2980 (outs), (ins GR8:$src1, i8imm:$src2),
2981 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2982 [(X86cmp_new GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
2983def NEW_CMP16ri : Ii16<0x81, MRM7r,
2984 (outs), (ins GR16:$src1, i16imm:$src2),
2985 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2986 [(X86cmp_new GR16:$src1, imm:$src2),
2987 (implicit EFLAGS)]>, OpSize;
2988def NEW_CMP32ri : Ii32<0x81, MRM7r,
2989 (outs), (ins GR32:$src1, i32imm:$src2),
2990 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2991 [(X86cmp_new GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
2992def NEW_CMP8mi : Ii8 <0x80, MRM7m,
2993 (outs), (ins i8mem :$src1, i8imm :$src2),
2994 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2995 [(X86cmp_new (loadi8 addr:$src1), imm:$src2),
2996 (implicit EFLAGS)]>;
2997def NEW_CMP16mi : Ii16<0x81, MRM7m,
2998 (outs), (ins i16mem:$src1, i16imm:$src2),
2999 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3000 [(X86cmp_new (loadi16 addr:$src1), imm:$src2),
3001 (implicit EFLAGS)]>, OpSize;
3002def NEW_CMP32mi : Ii32<0x81, MRM7m,
3003 (outs), (ins i32mem:$src1, i32imm:$src2),
3004 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3005 [(X86cmp_new (loadi32 addr:$src1), imm:$src2),
3006 (implicit EFLAGS)]>;
3007def NEW_CMP16ri8 : Ii8<0x83, MRM7r,
3008 (outs), (ins GR16:$src1, i16i8imm:$src2),
3009 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3010 [(X86cmp_new GR16:$src1, i16immSExt8:$src2),
3011 (implicit EFLAGS)]>, OpSize;
3012def NEW_CMP16mi8 : Ii8<0x83, MRM7m,
3013 (outs), (ins i16mem:$src1, i16i8imm:$src2),
3014 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3015 [(X86cmp_new (loadi16 addr:$src1), i16immSExt8:$src2),
3016 (implicit EFLAGS)]>, OpSize;
3017def NEW_CMP32mi8 : Ii8<0x83, MRM7m,
3018 (outs), (ins i32mem:$src1, i32i8imm:$src2),
3019 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3020 [(X86cmp_new (loadi32 addr:$src1), i32immSExt8:$src2),
3021 (implicit EFLAGS)]>;
3022def NEW_CMP32ri8 : Ii8<0x83, MRM7r,
3023 (outs), (ins GR32:$src1, i32i8imm:$src2),
3024 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3025 [(X86cmp_new GR32:$src1, i32immSExt8:$src2),
3026 (implicit EFLAGS)]>;
3027} // Defs = [EFLAGS]
3028
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003029// Sign/Zero extenders
Evan Chengb783fa32007-07-19 01:14:50 +00003030def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003031 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003032 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003033def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003034 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003035 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003036def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003037 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003038 [(set GR32:$dst, (sext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003039def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003040 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003041 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003042def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003043 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003044 [(set GR32:$dst, (sext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003045def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003046 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003047 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
3048
Evan Chengb783fa32007-07-19 01:14:50 +00003049def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003050 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003051 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003052def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003053 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003054 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003055def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003056 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003057 [(set GR32:$dst, (zext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003058def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003059 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003060 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003061def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003062 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003063 [(set GR32:$dst, (zext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003064def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003065 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003066 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
3067
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003068let Defs = [AX], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +00003069def CBW : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003070 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
3071let Defs = [EAX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003072def CWDE : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003073 "{cwtl|cwde}", []>; // EAX = signext(AX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003074
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003075let Defs = [AX,DX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003076def CWD : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003077 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
3078let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003079def CDQ : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003080 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003081
3082
3083//===----------------------------------------------------------------------===//
3084// Alias Instructions
3085//===----------------------------------------------------------------------===//
3086
3087// Alias instructions that map movr0 to xor.
3088// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Evan Cheng55687072007-09-14 21:48:26 +00003089let Defs = [EFLAGS], isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003090def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003091 "xor{b}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003092 [(set GR8:$dst, 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00003093def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003094 "xor{w}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003095 [(set GR16:$dst, 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003096def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003097 "xor{l}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003098 [(set GR32:$dst, 0)]>;
Dan Gohman8aef09b2007-09-07 21:32:51 +00003099}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003100
3101// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
3102// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
Evan Chengb783fa32007-07-19 01:14:50 +00003103def MOV16to16_ : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003104 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003105def MOV32to32_ : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003106 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003107
Evan Chengb783fa32007-07-19 01:14:50 +00003108def MOV16_rr : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003109 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003110def MOV32_rr : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003111 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003112let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003113def MOV16_rm : I<0x8B, MRMSrcMem, (outs GR16_:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003114 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003115def MOV32_rm : I<0x8B, MRMSrcMem, (outs GR32_:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003116 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003117}
Evan Chengb783fa32007-07-19 01:14:50 +00003118def MOV16_mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003119 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003120def MOV32_mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003121 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003122
3123//===----------------------------------------------------------------------===//
3124// Thread Local Storage Instructions
3125//
3126
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003127let Uses = [EBX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003128def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym),
Dan Gohman91888f02007-07-31 20:11:57 +00003129 "leal\t${sym:mem}(,%ebx,1), $dst",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003130 [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003131
3132let AddedComplexity = 10 in
Evan Chengb783fa32007-07-19 01:14:50 +00003133def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003134 "movl\t%gs:($src), $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003135 [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
3136
3137let AddedComplexity = 15 in
Evan Chengb783fa32007-07-19 01:14:50 +00003138def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003139 "movl\t%gs:${src:mem}, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003140 [(set GR32:$dst,
3141 (load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
3142
Evan Chengb783fa32007-07-19 01:14:50 +00003143def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003144 "movl\t%gs:0, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003145 [(set GR32:$dst, X86TLStp)]>;
3146
3147//===----------------------------------------------------------------------===//
3148// DWARF Pseudo Instructions
3149//
3150
Evan Chengb783fa32007-07-19 01:14:50 +00003151def DWARF_LOC : I<0, Pseudo, (outs),
3152 (ins i32imm:$line, i32imm:$col, i32imm:$file),
Dan Gohman77af4a82007-09-24 19:25:06 +00003153 ".loc\t${file:debug} ${line:debug} ${col:debug}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003154 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
3155 (i32 imm:$file))]>;
3156
3157//===----------------------------------------------------------------------===//
3158// EH Pseudo Instructions
3159//
3160let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +00003161 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003162def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
Dan Gohman91888f02007-07-31 20:11:57 +00003163 "ret\t#eh_return, addr: $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003164 [(X86ehret GR32:$addr)]>;
3165
3166}
3167
3168//===----------------------------------------------------------------------===//
3169// Non-Instruction Patterns
3170//===----------------------------------------------------------------------===//
3171
3172// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
3173def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
3174def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
3175def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)), (MOV32ri tglobaltlsaddr:$dst)>;
3176def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
3177def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
3178
3179def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
3180 (ADD32ri GR32:$src1, tconstpool:$src2)>;
3181def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
3182 (ADD32ri GR32:$src1, tjumptable:$src2)>;
3183def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
3184 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
3185def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
3186 (ADD32ri GR32:$src1, texternalsym:$src2)>;
3187
3188def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
3189 (MOV32mi addr:$dst, tglobaladdr:$src)>;
3190def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
3191 (MOV32mi addr:$dst, texternalsym:$src)>;
3192
3193// Calls
3194def : Pat<(X86tailcall GR32:$dst),
3195 (CALL32r GR32:$dst)>;
3196
3197def : Pat<(X86tailcall (i32 tglobaladdr:$dst)),
3198 (CALLpcrel32 tglobaladdr:$dst)>;
3199def : Pat<(X86tailcall (i32 texternalsym:$dst)),
3200 (CALLpcrel32 texternalsym:$dst)>;
3201
3202def : Pat<(X86call (i32 tglobaladdr:$dst)),
3203 (CALLpcrel32 tglobaladdr:$dst)>;
3204def : Pat<(X86call (i32 texternalsym:$dst)),
3205 (CALLpcrel32 texternalsym:$dst)>;
3206
3207// X86 specific add which produces a flag.
3208def : Pat<(addc GR32:$src1, GR32:$src2),
3209 (ADD32rr GR32:$src1, GR32:$src2)>;
3210def : Pat<(addc GR32:$src1, (load addr:$src2)),
3211 (ADD32rm GR32:$src1, addr:$src2)>;
3212def : Pat<(addc GR32:$src1, imm:$src2),
3213 (ADD32ri GR32:$src1, imm:$src2)>;
3214def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
3215 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
3216
3217def : Pat<(subc GR32:$src1, GR32:$src2),
3218 (SUB32rr GR32:$src1, GR32:$src2)>;
3219def : Pat<(subc GR32:$src1, (load addr:$src2)),
3220 (SUB32rm GR32:$src1, addr:$src2)>;
3221def : Pat<(subc GR32:$src1, imm:$src2),
3222 (SUB32ri GR32:$src1, imm:$src2)>;
3223def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
3224 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
3225
3226def : Pat<(truncstorei1 (i8 imm:$src), addr:$dst),
3227 (MOV8mi addr:$dst, imm:$src)>;
3228def : Pat<(truncstorei1 GR8:$src, addr:$dst),
3229 (MOV8mr addr:$dst, GR8:$src)>;
3230
3231// Comparisons.
3232
3233// TEST R,R is smaller than CMP R,0
3234def : Pat<(X86cmp GR8:$src1, 0),
3235 (TEST8rr GR8:$src1, GR8:$src1)>;
3236def : Pat<(X86cmp GR16:$src1, 0),
3237 (TEST16rr GR16:$src1, GR16:$src1)>;
3238def : Pat<(X86cmp GR32:$src1, 0),
3239 (TEST32rr GR32:$src1, GR32:$src1)>;
3240
Evan Cheng950aac02007-09-25 01:57:46 +00003241def : Pat<(parallel (X86cmp_new GR8:$src1, 0), (implicit EFLAGS)),
3242 (NEW_TEST8rr GR8:$src1, GR8:$src1)>;
3243def : Pat<(parallel (X86cmp_new GR16:$src1, 0), (implicit EFLAGS)),
3244 (NEW_TEST16rr GR16:$src1, GR16:$src1)>;
3245def : Pat<(parallel (X86cmp_new GR32:$src1, 0), (implicit EFLAGS)),
3246 (NEW_TEST32rr GR32:$src1, GR32:$src1)>;
3247
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003248// {s|z}extload bool -> {s|z}extload byte
3249def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
3250def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
3251def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3252def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3253def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3254
3255// extload bool -> extload byte
3256def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3257def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3258def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3259def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
3260def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
3261def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
3262
3263// anyext -> zext
3264def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
3265def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
3266def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
3267def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
3268def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
3269def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
3270
3271//===----------------------------------------------------------------------===//
3272// Some peepholes
3273//===----------------------------------------------------------------------===//
3274
3275// (shl x, 1) ==> (add x, x)
3276def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
3277def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
3278def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
3279
3280// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
3281def : Pat<(or (srl GR32:$src1, CL:$amt),
3282 (shl GR32:$src2, (sub 32, CL:$amt))),
3283 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
3284
3285def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
3286 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3287 (SHRD32mrCL addr:$dst, GR32:$src2)>;
3288
3289// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
3290def : Pat<(or (shl GR32:$src1, CL:$amt),
3291 (srl GR32:$src2, (sub 32, CL:$amt))),
3292 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
3293
3294def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
3295 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3296 (SHLD32mrCL addr:$dst, GR32:$src2)>;
3297
3298// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
3299def : Pat<(or (srl GR16:$src1, CL:$amt),
3300 (shl GR16:$src2, (sub 16, CL:$amt))),
3301 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
3302
3303def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
3304 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3305 (SHRD16mrCL addr:$dst, GR16:$src2)>;
3306
3307// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
3308def : Pat<(or (shl GR16:$src1, CL:$amt),
3309 (srl GR16:$src2, (sub 16, CL:$amt))),
3310 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
3311
3312def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
3313 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3314 (SHLD16mrCL addr:$dst, GR16:$src2)>;
3315
3316
3317//===----------------------------------------------------------------------===//
3318// Floating Point Stack Support
3319//===----------------------------------------------------------------------===//
3320
3321include "X86InstrFPStack.td"
3322
3323//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +00003324// X86-64 Support
3325//===----------------------------------------------------------------------===//
3326
3327include "X86InstrX86-64.td"
3328
3329//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003330// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
3331//===----------------------------------------------------------------------===//
3332
3333include "X86InstrMMX.td"
3334
3335//===----------------------------------------------------------------------===//
3336// XMM Floating point support (requires SSE / SSE2)
3337//===----------------------------------------------------------------------===//
3338
3339include "X86InstrSSE.td"