blob: bdce50a76dbd5ce78f31c2c2e28afeaa9949e705 [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 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000427def POP32r : I<0x58, AddRegFrm,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000428 (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000429
430def PUSH32r : I<0x50, AddRegFrm,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000431 (outs), (ins GR32:$reg), "push{l}\t$reg", []>;
432}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000433
Evan Chengb783fa32007-07-19 01:14:50 +0000434def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label),
Dan Gohman91888f02007-07-31 20:11:57 +0000435 "call\t$label", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000436
437let isTwoAddress = 1 in // GR32 = bswap GR32
438 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Chengb783fa32007-07-19 01:14:50 +0000439 (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000440 "bswap{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000441 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
442
Evan Chengb783fa32007-07-19 01:14:50 +0000443// FIXME: Model xchg* as two address instructions?
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000444def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
Evan Chengb783fa32007-07-19 01:14:50 +0000445 (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000446 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000447def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000448 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000449 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000450def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000451 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000452 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000453
454def XCHG8mr : I<0x86, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000455 (outs), (ins i8mem:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000456 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000457def XCHG16mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000458 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000459 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000460def XCHG32mr : I<0x87, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000461 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000462 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000463def XCHG8rm : I<0x86, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000464 (outs), (ins GR8:$src1, i8mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000465 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000466def XCHG16rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000467 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000468 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000469def XCHG32rm : I<0x87, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000470 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000471 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000472
473def LEA16r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000474 (outs GR16:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000475 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000476def LEA32r : I<0x8D, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +0000477 (outs GR32:$dst), (ins lea32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000478 "lea{l}\t{$src|$dst}, {$dst|$src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000479 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
480
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000481let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
Evan Chengb783fa32007-07-19 01:14:50 +0000482def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000483 [(X86rep_movs i8)]>, REP;
Evan Chengb783fa32007-07-19 01:14:50 +0000484def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000485 [(X86rep_movs i16)]>, REP, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000486def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000487 [(X86rep_movs i32)]>, REP;
488}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000489
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000490let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000491def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000492 [(X86rep_stos i8)]>, REP;
493let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000494def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000495 [(X86rep_stos i16)]>, REP, OpSize;
496let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
Evan Chengb783fa32007-07-19 01:14:50 +0000497def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000498 [(X86rep_stos i32)]>, REP;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000499
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000500let Defs = [RAX, RDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000501def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000502 TB;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000503
504//===----------------------------------------------------------------------===//
505// Input/Output Instructions...
506//
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000507let Defs = [AL], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000508def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000509 "in{b}\t{%dx, %al|%AL, %DX}", []>;
510let Defs = [AX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000511def IN16rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000512 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
513let Defs = [EAX], Uses = [DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000514def IN32rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000515 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000516
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000517let Defs = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000518def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000519 "in{b}\t{$port, %al|%AL, $port}", []>;
520let Defs = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000521def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000522 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
523let Defs = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000524def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000525 "in{l}\t{$port, %eax|%EAX, $port}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000526
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000527let Uses = [DX, AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000528def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000529 "out{b}\t{%al, %dx|%DX, %AL}", []>;
530let Uses = [DX, AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000531def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000532 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
533let Uses = [DX, EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000534def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000535 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000536
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000537let Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000538def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000539 "out{b}\t{%al, $port|$port, %AL}", []>;
540let Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000541def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000542 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
543let Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000544def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000545 "out{l}\t{%eax, $port|$port, %EAX}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000546
547//===----------------------------------------------------------------------===//
548// Move Instructions...
549//
Evan Chengb783fa32007-07-19 01:14:50 +0000550def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000551 "mov{b}\t{$src, $dst|$dst, $src}", []>;
Evan Chengb783fa32007-07-19 01:14:50 +0000552def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000553 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000554def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000555 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000556let isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000557def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000558 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000559 [(set GR8:$dst, imm:$src)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000560def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000561 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000562 [(set GR16:$dst, imm:$src)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000563def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000564 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000565 [(set GR32:$dst, imm:$src)]>;
566}
Evan Chengb783fa32007-07-19 01:14:50 +0000567def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000568 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000569 [(store (i8 imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000570def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000571 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000572 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000573def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000574 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000575 [(store (i32 imm:$src), addr:$dst)]>;
576
Evan Cheng4e84e452007-08-30 05:49:43 +0000577let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +0000578def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000579 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000580 [(set GR8:$dst, (load addr:$src))]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000581def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000582 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000583 [(set GR16:$dst, (load addr:$src))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000584def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000585 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000586 [(set GR32:$dst, (load addr:$src))]>;
Evan Cheng4e84e452007-08-30 05:49:43 +0000587}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000588
Evan Chengb783fa32007-07-19 01:14:50 +0000589def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000590 "mov{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000591 [(store GR8:$src, addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +0000592def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000593 "mov{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000594 [(store GR16:$src, addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +0000595def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000596 "mov{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000597 [(store GR32:$src, addr:$dst)]>;
598
599//===----------------------------------------------------------------------===//
600// Fixed-Register Multiplication and Division Instructions...
601//
602
603// Extra precision multiplication
Evan Cheng55687072007-09-14 21:48:26 +0000604let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Dan Gohman91888f02007-07-31 20:11:57 +0000605def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000606 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
607 // This probably ought to be moved to a def : Pat<> if the
608 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000609 [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000610let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000611def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000612 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000613let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000614def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>;
615 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000616let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000617def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
Dan Gohman91888f02007-07-31 20:11:57 +0000618 "mul{b}\t$src",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000619 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
620 // This probably ought to be moved to a def : Pat<> if the
621 // syntax can be accepted.
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000622 [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000623let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000624def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000625 "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
Evan Cheng55687072007-09-14 21:48:26 +0000626let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000627def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000628 "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000629
Evan Cheng55687072007-09-14 21:48:26 +0000630let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000631def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
632 // AL,AH = AL*GR8
Evan Cheng55687072007-09-14 21:48:26 +0000633let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohman91888f02007-07-31 20:11:57 +0000634def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000635 OpSize; // AX,DX = AX*GR16
Evan Cheng55687072007-09-14 21:48:26 +0000636let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000637def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
638 // EAX,EDX = EAX*GR32
Evan Cheng55687072007-09-14 21:48:26 +0000639let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +0000640def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000641 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
Evan Cheng55687072007-09-14 21:48:26 +0000642let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000643def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000644 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
645let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000646def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000647 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000648
649// unsigned division/remainder
Evan Cheng55687072007-09-14 21:48:26 +0000650let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000651def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000652 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000653let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000654def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000655 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000656let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000657def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000658 "div{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000659let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000660def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000661 "div{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000662let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000663def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000664 "div{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000665let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000666def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000667 "div{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000668
669// Signed division/remainder.
Evan Cheng55687072007-09-14 21:48:26 +0000670let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000671def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000672 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000673let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000674def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000675 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000676let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000677def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000678 "idiv{l}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000679let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Chengb783fa32007-07-19 01:14:50 +0000680def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000681 "idiv{b}\t$src", []>;
Evan Cheng55687072007-09-14 21:48:26 +0000682let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000683def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000684 "idiv{w}\t$src", []>, OpSize;
Evan Cheng55687072007-09-14 21:48:26 +0000685let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Chengb783fa32007-07-19 01:14:50 +0000686def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng6e4d1d92007-09-11 19:55:27 +0000687 "idiv{l}\t$src", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000688
689
690//===----------------------------------------------------------------------===//
691// Two address Instructions...
692//
693let isTwoAddress = 1 in {
694
695// Conditional moves
Evan Cheng950aac02007-09-25 01:57:46 +0000696let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000697def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000698 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000699 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000700 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
701 X86_COND_B))]>,
702 TB, OpSize;
703def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000704 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000705 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000706 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
707 X86_COND_B))]>,
708 TB, OpSize;
709def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000710 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000711 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000712 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
713 X86_COND_B))]>,
714 TB;
715def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000716 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000717 "cmovb\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000718 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
719 X86_COND_B))]>,
720 TB;
721
722def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000723 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000724 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000725 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
726 X86_COND_AE))]>,
727 TB, OpSize;
728def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000729 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000730 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000731 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
732 X86_COND_AE))]>,
733 TB, OpSize;
734def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000735 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000736 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000737 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
738 X86_COND_AE))]>,
739 TB;
740def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000741 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000742 "cmovae\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000743 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
744 X86_COND_AE))]>,
745 TB;
746
747def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000748 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000749 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000750 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
751 X86_COND_E))]>,
752 TB, OpSize;
753def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000754 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000755 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000756 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
757 X86_COND_E))]>,
758 TB, OpSize;
759def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000760 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000761 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000762 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
763 X86_COND_E))]>,
764 TB;
765def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000766 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000767 "cmove\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000768 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
769 X86_COND_E))]>,
770 TB;
771
772def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000773 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000774 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000775 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
776 X86_COND_NE))]>,
777 TB, OpSize;
778def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000779 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000780 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000781 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
782 X86_COND_NE))]>,
783 TB, OpSize;
784def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000785 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000786 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000787 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
788 X86_COND_NE))]>,
789 TB;
790def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000791 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000792 "cmovne\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000793 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
794 X86_COND_NE))]>,
795 TB;
796
797def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000798 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000799 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000800 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
801 X86_COND_BE))]>,
802 TB, OpSize;
803def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000804 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000805 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000806 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
807 X86_COND_BE))]>,
808 TB, OpSize;
809def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000810 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000811 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000812 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
813 X86_COND_BE))]>,
814 TB;
815def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000816 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000817 "cmovbe\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000818 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
819 X86_COND_BE))]>,
820 TB;
821
822def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000823 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000824 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000825 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
826 X86_COND_A))]>,
827 TB, OpSize;
828def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000829 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000830 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000831 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
832 X86_COND_A))]>,
833 TB, OpSize;
834def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000835 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000836 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000837 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
838 X86_COND_A))]>,
839 TB;
840def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000841 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000842 "cmova\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000843 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
844 X86_COND_A))]>,
845 TB;
846
847def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000848 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000849 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000850 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
851 X86_COND_L))]>,
852 TB, OpSize;
853def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000854 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000855 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000856 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
857 X86_COND_L))]>,
858 TB, OpSize;
859def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000860 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000861 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000862 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
863 X86_COND_L))]>,
864 TB;
865def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000866 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000867 "cmovl\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000868 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
869 X86_COND_L))]>,
870 TB;
871
872def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000873 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000874 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000875 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
876 X86_COND_GE))]>,
877 TB, OpSize;
878def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000879 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000880 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000881 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
882 X86_COND_GE))]>,
883 TB, OpSize;
884def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000885 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000886 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000887 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
888 X86_COND_GE))]>,
889 TB;
890def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000891 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000892 "cmovge\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000893 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
894 X86_COND_GE))]>,
895 TB;
896
897def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000898 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000899 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000900 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
901 X86_COND_LE))]>,
902 TB, OpSize;
903def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000904 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000905 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000906 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
907 X86_COND_LE))]>,
908 TB, OpSize;
909def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000910 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000911 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000912 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
913 X86_COND_LE))]>,
914 TB;
915def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000916 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000917 "cmovle\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000918 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
919 X86_COND_LE))]>,
920 TB;
921
922def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000923 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000924 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000925 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
926 X86_COND_G))]>,
927 TB, OpSize;
928def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000929 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000930 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000931 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
932 X86_COND_G))]>,
933 TB, OpSize;
934def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000935 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000936 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000937 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
938 X86_COND_G))]>,
939 TB;
940def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000941 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000942 "cmovg\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000943 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
944 X86_COND_G))]>,
945 TB;
946
947def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000948 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000949 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000950 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
951 X86_COND_S))]>,
952 TB, OpSize;
953def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000954 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000955 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000956 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
957 X86_COND_S))]>,
958 TB, OpSize;
959def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000960 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000961 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000962 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
963 X86_COND_S))]>,
964 TB;
965def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000966 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000967 "cmovs\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000968 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
969 X86_COND_S))]>,
970 TB;
971
972def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000973 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000974 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000975 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
976 X86_COND_NS))]>,
977 TB, OpSize;
978def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +0000979 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000980 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000981 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
982 X86_COND_NS))]>,
983 TB, OpSize;
984def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +0000985 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000986 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000987 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
988 X86_COND_NS))]>,
989 TB;
990def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +0000991 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000992 "cmovns\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000993 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
994 X86_COND_NS))]>,
995 TB;
996
997def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +0000998 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +0000999 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001000 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1001 X86_COND_P))]>,
1002 TB, OpSize;
1003def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001004 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001005 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001006 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1007 X86_COND_P))]>,
1008 TB, OpSize;
1009def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001010 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001011 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001012 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1013 X86_COND_P))]>,
1014 TB;
1015def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001016 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001017 "cmovp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001018 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1019 X86_COND_P))]>,
1020 TB;
1021
1022def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
Evan Chengb783fa32007-07-19 01:14:50 +00001023 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001024 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001025 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1026 X86_COND_NP))]>,
1027 TB, OpSize;
1028def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
Evan Chengb783fa32007-07-19 01:14:50 +00001029 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001030 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001031 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1032 X86_COND_NP))]>,
1033 TB, OpSize;
1034def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
Evan Chengb783fa32007-07-19 01:14:50 +00001035 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001036 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001037 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1038 X86_COND_NP))]>,
1039 TB;
1040def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
Evan Chengb783fa32007-07-19 01:14:50 +00001041 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001042 "cmovnp\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001043 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1044 X86_COND_NP))]>,
1045 TB;
1046
1047
Evan Cheng950aac02007-09-25 01:57:46 +00001048def NEW_CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
1049 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1050 "cmovb\t{$src2, $dst|$dst, $src2}",
1051 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1052 X86_COND_B, EFLAGS))]>,
1053 TB, OpSize;
1054def NEW_CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
1055 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1056 "cmovb\t{$src2, $dst|$dst, $src2}",
1057 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1058 X86_COND_B, EFLAGS))]>,
1059 TB, OpSize;
1060def NEW_CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
1061 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1062 "cmovb\t{$src2, $dst|$dst, $src2}",
1063 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1064 X86_COND_B, EFLAGS))]>,
1065 TB;
1066def NEW_CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
1067 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1068 "cmovb\t{$src2, $dst|$dst, $src2}",
1069 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1070 X86_COND_B, EFLAGS))]>,
1071 TB;
1072
1073def NEW_CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
1074 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1075 "cmovae\t{$src2, $dst|$dst, $src2}",
1076 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1077 X86_COND_AE, EFLAGS))]>,
1078 TB, OpSize;
1079def NEW_CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
1080 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1081 "cmovae\t{$src2, $dst|$dst, $src2}",
1082 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1083 X86_COND_AE, EFLAGS))]>,
1084 TB, OpSize;
1085def NEW_CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
1086 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1087 "cmovae\t{$src2, $dst|$dst, $src2}",
1088 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1089 X86_COND_AE, EFLAGS))]>,
1090 TB;
1091def NEW_CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
1092 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1093 "cmovae\t{$src2, $dst|$dst, $src2}",
1094 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1095 X86_COND_AE, EFLAGS))]>,
1096 TB;
1097
1098def NEW_CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
1099 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1100 "cmove\t{$src2, $dst|$dst, $src2}",
1101 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1102 X86_COND_E, EFLAGS))]>,
1103 TB, OpSize;
1104def NEW_CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
1105 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1106 "cmove\t{$src2, $dst|$dst, $src2}",
1107 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1108 X86_COND_E, EFLAGS))]>,
1109 TB, OpSize;
1110def NEW_CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
1111 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1112 "cmove\t{$src2, $dst|$dst, $src2}",
1113 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1114 X86_COND_E, EFLAGS))]>,
1115 TB;
1116def NEW_CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
1117 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1118 "cmove\t{$src2, $dst|$dst, $src2}",
1119 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1120 X86_COND_E, EFLAGS))]>,
1121 TB;
1122
1123def NEW_CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
1124 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1125 "cmovne\t{$src2, $dst|$dst, $src2}",
1126 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1127 X86_COND_NE, EFLAGS))]>,
1128 TB, OpSize;
1129def NEW_CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
1130 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1131 "cmovne\t{$src2, $dst|$dst, $src2}",
1132 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1133 X86_COND_NE, EFLAGS))]>,
1134 TB, OpSize;
1135def NEW_CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
1136 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1137 "cmovne\t{$src2, $dst|$dst, $src2}",
1138 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1139 X86_COND_NE, EFLAGS))]>,
1140 TB;
1141def NEW_CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
1142 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1143 "cmovne\t{$src2, $dst|$dst, $src2}",
1144 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1145 X86_COND_NE, EFLAGS))]>,
1146 TB;
1147
1148def NEW_CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
1149 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1150 "cmovbe\t{$src2, $dst|$dst, $src2}",
1151 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1152 X86_COND_BE, EFLAGS))]>,
1153 TB, OpSize;
1154def NEW_CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
1155 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1156 "cmovbe\t{$src2, $dst|$dst, $src2}",
1157 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1158 X86_COND_BE, EFLAGS))]>,
1159 TB, OpSize;
1160def NEW_CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
1161 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1162 "cmovbe\t{$src2, $dst|$dst, $src2}",
1163 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1164 X86_COND_BE, EFLAGS))]>,
1165 TB;
1166def NEW_CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
1167 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1168 "cmovbe\t{$src2, $dst|$dst, $src2}",
1169 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1170 X86_COND_BE, EFLAGS))]>,
1171 TB;
1172
1173def NEW_CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
1174 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1175 "cmova\t{$src2, $dst|$dst, $src2}",
1176 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1177 X86_COND_A, EFLAGS))]>,
1178 TB, OpSize;
1179def NEW_CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
1180 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1181 "cmova\t{$src2, $dst|$dst, $src2}",
1182 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1183 X86_COND_A, EFLAGS))]>,
1184 TB, OpSize;
1185def NEW_CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
1186 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1187 "cmova\t{$src2, $dst|$dst, $src2}",
1188 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1189 X86_COND_A, EFLAGS))]>,
1190 TB;
1191def NEW_CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
1192 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1193 "cmova\t{$src2, $dst|$dst, $src2}",
1194 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1195 X86_COND_A, EFLAGS))]>,
1196 TB;
1197
1198def NEW_CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
1199 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1200 "cmovl\t{$src2, $dst|$dst, $src2}",
1201 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1202 X86_COND_L, EFLAGS))]>,
1203 TB, OpSize;
1204def NEW_CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
1205 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1206 "cmovl\t{$src2, $dst|$dst, $src2}",
1207 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1208 X86_COND_L, EFLAGS))]>,
1209 TB, OpSize;
1210def NEW_CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
1211 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1212 "cmovl\t{$src2, $dst|$dst, $src2}",
1213 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1214 X86_COND_L, EFLAGS))]>,
1215 TB;
1216def NEW_CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
1217 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1218 "cmovl\t{$src2, $dst|$dst, $src2}",
1219 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1220 X86_COND_L, EFLAGS))]>,
1221 TB;
1222
1223def NEW_CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
1224 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1225 "cmovge\t{$src2, $dst|$dst, $src2}",
1226 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1227 X86_COND_GE, EFLAGS))]>,
1228 TB, OpSize;
1229def NEW_CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
1230 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1231 "cmovge\t{$src2, $dst|$dst, $src2}",
1232 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1233 X86_COND_GE, EFLAGS))]>,
1234 TB, OpSize;
1235def NEW_CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
1236 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1237 "cmovge\t{$src2, $dst|$dst, $src2}",
1238 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1239 X86_COND_GE, EFLAGS))]>,
1240 TB;
1241def NEW_CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
1242 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1243 "cmovge\t{$src2, $dst|$dst, $src2}",
1244 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1245 X86_COND_GE, EFLAGS))]>,
1246 TB;
1247
1248def NEW_CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
1249 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1250 "cmovle\t{$src2, $dst|$dst, $src2}",
1251 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1252 X86_COND_LE, EFLAGS))]>,
1253 TB, OpSize;
1254def NEW_CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
1255 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1256 "cmovle\t{$src2, $dst|$dst, $src2}",
1257 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1258 X86_COND_LE, EFLAGS))]>,
1259 TB, OpSize;
1260def NEW_CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
1261 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1262 "cmovle\t{$src2, $dst|$dst, $src2}",
1263 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1264 X86_COND_LE, EFLAGS))]>,
1265 TB;
1266def NEW_CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1267 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1268 "cmovle\t{$src2, $dst|$dst, $src2}",
1269 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1270 X86_COND_LE, EFLAGS))]>,
1271 TB;
1272
1273def NEW_CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
1274 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1275 "cmovg\t{$src2, $dst|$dst, $src2}",
1276 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1277 X86_COND_G, EFLAGS))]>,
1278 TB, OpSize;
1279def NEW_CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1280 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1281 "cmovg\t{$src2, $dst|$dst, $src2}",
1282 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1283 X86_COND_G, EFLAGS))]>,
1284 TB, OpSize;
1285def NEW_CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
1286 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1287 "cmovg\t{$src2, $dst|$dst, $src2}",
1288 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1289 X86_COND_G, EFLAGS))]>,
1290 TB;
1291def NEW_CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1292 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1293 "cmovg\t{$src2, $dst|$dst, $src2}",
1294 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1295 X86_COND_G, EFLAGS))]>,
1296 TB;
1297
1298def NEW_CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
1299 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1300 "cmovs\t{$src2, $dst|$dst, $src2}",
1301 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1302 X86_COND_S, EFLAGS))]>,
1303 TB, OpSize;
1304def NEW_CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1305 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1306 "cmovs\t{$src2, $dst|$dst, $src2}",
1307 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1308 X86_COND_S, EFLAGS))]>,
1309 TB, OpSize;
1310def NEW_CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
1311 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1312 "cmovs\t{$src2, $dst|$dst, $src2}",
1313 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1314 X86_COND_S, EFLAGS))]>,
1315 TB;
1316def NEW_CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1317 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1318 "cmovs\t{$src2, $dst|$dst, $src2}",
1319 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1320 X86_COND_S, EFLAGS))]>,
1321 TB;
1322
1323def NEW_CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
1324 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1325 "cmovns\t{$src2, $dst|$dst, $src2}",
1326 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1327 X86_COND_NS, EFLAGS))]>,
1328 TB, OpSize;
1329def NEW_CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1330 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1331 "cmovns\t{$src2, $dst|$dst, $src2}",
1332 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1333 X86_COND_NS, EFLAGS))]>,
1334 TB, OpSize;
1335def NEW_CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1336 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1337 "cmovns\t{$src2, $dst|$dst, $src2}",
1338 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1339 X86_COND_NS, EFLAGS))]>,
1340 TB;
1341def NEW_CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1342 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1343 "cmovns\t{$src2, $dst|$dst, $src2}",
1344 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1345 X86_COND_NS, EFLAGS))]>,
1346 TB;
1347
1348def NEW_CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1349 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1350 "cmovp\t{$src2, $dst|$dst, $src2}",
1351 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1352 X86_COND_P, EFLAGS))]>,
1353 TB, OpSize;
1354def NEW_CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1355 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1356 "cmovp\t{$src2, $dst|$dst, $src2}",
1357 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1358 X86_COND_P, EFLAGS))]>,
1359 TB, OpSize;
1360def NEW_CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1361 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1362 "cmovp\t{$src2, $dst|$dst, $src2}",
1363 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1364 X86_COND_P, EFLAGS))]>,
1365 TB;
1366def NEW_CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1367 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1368 "cmovp\t{$src2, $dst|$dst, $src2}",
1369 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1370 X86_COND_P, EFLAGS))]>,
1371 TB;
1372
1373def NEW_CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1374 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1375 "cmovnp\t{$src2, $dst|$dst, $src2}",
1376 [(set GR16:$dst, (X86cmov_new GR16:$src1, GR16:$src2,
1377 X86_COND_NP, EFLAGS))]>,
1378 TB, OpSize;
1379def NEW_CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1380 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1381 "cmovnp\t{$src2, $dst|$dst, $src2}",
1382 [(set GR16:$dst, (X86cmov_new GR16:$src1, (loadi16 addr:$src2),
1383 X86_COND_NP, EFLAGS))]>,
1384 TB, OpSize;
1385def NEW_CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1386 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1387 "cmovnp\t{$src2, $dst|$dst, $src2}",
1388 [(set GR32:$dst, (X86cmov_new GR32:$src1, GR32:$src2,
1389 X86_COND_NP, EFLAGS))]>,
1390 TB;
1391def NEW_CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1392 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1393 "cmovnp\t{$src2, $dst|$dst, $src2}",
1394 [(set GR32:$dst, (X86cmov_new GR32:$src1, (loadi32 addr:$src2),
1395 X86_COND_NP, EFLAGS))]>,
1396 TB;
1397} // Uses = [EFLAGS]
1398
1399
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001400// unary instructions
1401let CodeSize = 2 in {
Evan Cheng55687072007-09-14 21:48:26 +00001402let Defs = [EFLAGS] in {
Dan Gohman91888f02007-07-31 20:11:57 +00001403def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001404 [(set GR8:$dst, (ineg GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001405def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001406 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001407def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001408 [(set GR32:$dst, (ineg GR32:$src))]>;
1409let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001410 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001412 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001413 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001414 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001415 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1416
1417}
Evan Cheng55687072007-09-14 21:48:26 +00001418} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001419
Dan Gohman91888f02007-07-31 20:11:57 +00001420def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001421 [(set GR8:$dst, (not GR8:$src))]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001422def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001423 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001424def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001425 [(set GR32:$dst, (not GR32:$src))]>;
1426let isTwoAddress = 0 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001427 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001428 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001429 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001430 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001431 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001432 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1433}
1434} // CodeSize
1435
1436// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng55687072007-09-14 21:48:26 +00001437let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001438let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001439def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001440 [(set GR8:$dst, (add GR8:$src, 1))]>;
1441let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001442def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001443 [(set GR16:$dst, (add GR16:$src, 1))]>,
1444 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001445def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001446 [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>;
1447}
1448let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001449 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001450 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001451 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001452 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001453 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001454 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>;
1455}
1456
1457let CodeSize = 2 in
Dan Gohman91888f02007-07-31 20:11:57 +00001458def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001459 [(set GR8:$dst, (add GR8:$src, -1))]>;
1460let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohman91888f02007-07-31 20:11:57 +00001461def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001462 [(set GR16:$dst, (add GR16:$src, -1))]>,
1463 OpSize, Requires<[In32BitMode]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001464def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001465 [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>;
1466}
1467
1468let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohman91888f02007-07-31 20:11:57 +00001469 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001470 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Dan Gohman91888f02007-07-31 20:11:57 +00001471 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001472 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize;
Dan Gohman91888f02007-07-31 20:11:57 +00001473 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001474 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>;
1475}
Evan Cheng55687072007-09-14 21:48:26 +00001476} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001477
1478// Logical operators...
Evan Cheng55687072007-09-14 21:48:26 +00001479let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001480let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1481def AND8rr : I<0x20, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001482 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001483 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001484 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
1485def AND16rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001486 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001487 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001488 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
1489def AND32rr : I<0x21, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001490 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001491 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001492 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
1493}
1494
1495def AND8rm : I<0x22, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001496 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001497 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001498 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
1499def AND16rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001500 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001501 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001502 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
1503def AND32rm : I<0x23, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001504 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001505 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001506 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
1507
1508def AND8ri : Ii8<0x80, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001509 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001510 "and{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001511 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
1512def AND16ri : Ii16<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001513 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001514 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001515 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
1516def AND32ri : Ii32<0x81, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001517 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001518 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001519 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
1520def AND16ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001521 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001522 "and{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001523 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
1524 OpSize;
1525def AND32ri8 : Ii8<0x83, MRM4r,
Evan Chengb783fa32007-07-19 01:14:50 +00001526 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001527 "and{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001528 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
1529
1530let isTwoAddress = 0 in {
1531 def AND8mr : I<0x20, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001532 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001533 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001534 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
1535 def AND16mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001536 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001537 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001538 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
1539 OpSize;
1540 def AND32mr : I<0x21, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001541 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001542 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001543 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
1544 def AND8mi : Ii8<0x80, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001545 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001546 "and{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001547 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1548 def AND16mi : Ii16<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001549 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001550 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001551 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1552 OpSize;
1553 def AND32mi : Ii32<0x81, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001554 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001555 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001556 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1557 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001558 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001559 "and{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001560 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1561 OpSize;
1562 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Chengb783fa32007-07-19 01:14:50 +00001563 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001564 "and{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001565 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1566}
1567
1568
1569let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00001570def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001571 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001572 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001573def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001574 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001575 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001576def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001577 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001578 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
1579}
Evan Chengb783fa32007-07-19 01:14:50 +00001580def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001581 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001582 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001583def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001584 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001585 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001586def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001587 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001588 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
1589
Evan Chengb783fa32007-07-19 01:14:50 +00001590def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001591 "or{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001592 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001593def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001594 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001595 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001596def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001597 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001598 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
1599
Evan Chengb783fa32007-07-19 01:14:50 +00001600def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001601 "or{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001602 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001603def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001604 "or{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001605 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
1606let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00001607 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001608 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001609 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001610 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001611 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001612 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001613 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001614 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001615 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001616 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001617 "or{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001618 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001619 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001620 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001621 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1622 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001623 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001624 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001625 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001626 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001627 "or{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001628 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1629 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001630 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001631 "or{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001632 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1633}
1634
1635
1636let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1637def XOR8rr : I<0x30, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001638 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001639 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001640 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
1641def XOR16rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001642 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001643 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001644 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
1645def XOR32rr : I<0x31, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00001646 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001647 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001648 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
1649}
1650
1651def XOR8rm : I<0x32, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001652 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001653 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001654 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
1655def XOR16rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001656 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001657 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001658 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
1659def XOR32rm : I<0x33, MRMSrcMem ,
Evan Chengb783fa32007-07-19 01:14:50 +00001660 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001661 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001662 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
1663
1664def XOR8ri : Ii8<0x80, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001665 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001666 "xor{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001667 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
1668def XOR16ri : Ii16<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001669 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001670 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001671 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
1672def XOR32ri : Ii32<0x81, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001673 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001674 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001675 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
1676def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001677 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001678 "xor{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001679 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
1680 OpSize;
1681def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Chengb783fa32007-07-19 01:14:50 +00001682 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001683 "xor{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001684 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
1685let isTwoAddress = 0 in {
1686 def XOR8mr : I<0x30, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001687 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001688 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001689 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
1690 def XOR16mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001691 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001692 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001693 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
1694 OpSize;
1695 def XOR32mr : I<0x31, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00001696 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001697 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001698 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
1699 def XOR8mi : Ii8<0x80, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001700 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001701 "xor{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001702 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
1703 def XOR16mi : Ii16<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001704 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001705 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001706 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
1707 OpSize;
1708 def XOR32mi : Ii32<0x81, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001709 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001710 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001711 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
1712 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001713 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001714 "xor{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001715 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1716 OpSize;
1717 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Chengb783fa32007-07-19 01:14:50 +00001718 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001719 "xor{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001720 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
1721}
Evan Cheng55687072007-09-14 21:48:26 +00001722} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001723
1724// Shift instructions
Evan Cheng55687072007-09-14 21:48:26 +00001725let Defs = [EFLAGS] in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001726let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001727def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001728 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001729 [(set GR8:$dst, (shl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001730def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001731 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001732 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001733def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001734 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001735 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1736}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001737
Evan Chengb783fa32007-07-19 01:14:50 +00001738def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001739 "shl{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001740 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1741let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Chengb783fa32007-07-19 01:14:50 +00001742def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001743 "shl{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001744 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001745def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001746 "shl{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001747 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1748}
1749
1750// Shift left by one. Not used because (add x, x) is slightly cheaper.
Evan Chengb783fa32007-07-19 01:14:50 +00001751def SHL8r1 : I<0xD0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001752 "shl{b}\t$dst", []>;
Evan Chengb783fa32007-07-19 01:14:50 +00001753def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001754 "shl{w}\t$dst", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001755def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001756 "shl{l}\t$dst", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001757
1758let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001759 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001760 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001761 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001762 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001763 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001764 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001765 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001766 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001767 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001768 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1769 }
Evan Chengb783fa32007-07-19 01:14:50 +00001770 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001771 "shl{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001772 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001773 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001774 "shl{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001775 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1776 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001777 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001778 "shl{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001779 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1780
1781 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001782 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001783 "shl{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001784 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001785 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001786 "shl{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001787 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1788 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001789 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001790 "shl{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001791 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1792}
1793
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001794let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001795def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001796 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001797 [(set GR8:$dst, (srl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001798def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001799 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001800 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001801def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001802 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001803 [(set GR32:$dst, (srl GR32:$src, CL))]>;
1804}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001805
Evan Chengb783fa32007-07-19 01:14:50 +00001806def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001807 "shr{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001808 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001809def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001810 "shr{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001811 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001812def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001813 "shr{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001814 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
1815
1816// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001817def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001818 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001819 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001820def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001821 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001822 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001823def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001824 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001825 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1826
1827let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001828 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001829 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001830 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001831 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001832 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001833 "shr{w}\t{%cl, $dst|$dst, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001834 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001835 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001836 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001837 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001838 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1839 }
Evan Chengb783fa32007-07-19 01:14:50 +00001840 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001841 "shr{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001842 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001843 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001844 "shr{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001845 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1846 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001847 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001848 "shr{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001849 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1850
1851 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001852 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001853 "shr{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001854 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001855 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001856 "shr{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001857 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001858 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001859 "shr{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001860 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1861}
1862
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001863let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001864def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001865 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001866 [(set GR8:$dst, (sra GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001867def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001868 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001869 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001870def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001871 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001872 [(set GR32:$dst, (sra GR32:$src, CL))]>;
1873}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001874
Evan Chengb783fa32007-07-19 01:14:50 +00001875def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001876 "sar{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001877 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001878def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001879 "sar{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001880 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
1881 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001882def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001883 "sar{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001884 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
1885
1886// Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001887def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001888 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001889 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001890def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001891 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001892 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001893def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001894 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001895 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1896
1897let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001898 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001899 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001900 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001901 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001902 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001903 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001904 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001905 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001906 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001907 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1908 }
Evan Chengb783fa32007-07-19 01:14:50 +00001909 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001910 "sar{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001911 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001912 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001913 "sar{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001914 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1915 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001916 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001917 "sar{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001918 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1919
1920 // Shift by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001921 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001922 "sar{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001923 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001924 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001925 "sar{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001926 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1927 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001928 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001929 "sar{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001930 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1931}
1932
1933// Rotate instructions
1934// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001935let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001936def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001937 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001938 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001939def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001940 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001941 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001942def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001943 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001944 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
1945}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001946
Evan Chengb783fa32007-07-19 01:14:50 +00001947def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001948 "rol{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001949 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001950def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001951 "rol{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001952 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001953def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00001954 "rol{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001955 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
1956
1957// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001958def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001959 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001960 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001961def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001962 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001963 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001964def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00001965 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001966 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1967
1968let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001969 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00001970 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001971 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001972 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001973 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001974 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001975 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001976 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001977 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00001978 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1979 }
Evan Chengb783fa32007-07-19 01:14:50 +00001980 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001981 "rol{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001982 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001983 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001984 "rol{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001985 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1986 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001987 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00001988 "rol{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001989 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1990
1991 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00001992 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001993 "rol{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001994 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00001995 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00001996 "rol{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001997 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1998 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00001999 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002000 "rol{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002001 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2002}
2003
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002004let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002005def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002006 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002007 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002008def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002009 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002010 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002011def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002012 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002013 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
2014}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002015
Evan Chengb783fa32007-07-19 01:14:50 +00002016def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002017 "ror{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002018 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002019def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002020 "ror{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002021 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002022def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002023 "ror{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002024 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
2025
2026// Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002027def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002028 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002029 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002030def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002031 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002032 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002033def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohman91888f02007-07-31 20:11:57 +00002034 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002035 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
2036
2037let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002038 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002039 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002040 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002041 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002042 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002043 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002044 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002045 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002046 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002047 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
2048 }
Evan Chengb783fa32007-07-19 01:14:50 +00002049 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002050 "ror{b}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002051 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002052 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002053 "ror{w}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002054 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2055 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002056 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00002057 "ror{l}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002058 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2059
2060 // Rotate by 1
Evan Chengb783fa32007-07-19 01:14:50 +00002061 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002062 "ror{b}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002063 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002064 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002065 "ror{w}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002066 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2067 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002068 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002069 "ror{l}\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002070 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2071}
2072
2073
2074
2075// Double shift instructions (generalizations of rotate)
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002076let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002077def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002078 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002079 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002080def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002081 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002082 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002083def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002084 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002085 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002086 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002087def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002088 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002089 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002090 TB, OpSize;
2091}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002092
2093let isCommutable = 1 in { // These instructions commute to each other.
2094def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002095 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002096 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002097 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
2098 (i8 imm:$src3)))]>,
2099 TB;
2100def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002101 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002102 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002103 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
2104 (i8 imm:$src3)))]>,
2105 TB;
2106def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002107 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002108 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002109 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
2110 (i8 imm:$src3)))]>,
2111 TB, OpSize;
2112def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002113 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002114 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002115 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
2116 (i8 imm:$src3)))]>,
2117 TB, OpSize;
2118}
2119
2120let isTwoAddress = 0 in {
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002121 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002122 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002123 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002124 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002125 addr:$dst)]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00002126 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002127 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002128 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002129 addr:$dst)]>, TB;
2130 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002131 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002132 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002133 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002134 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
2135 (i8 imm:$src3)), addr:$dst)]>,
2136 TB;
2137 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002138 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002139 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002140 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
2141 (i8 imm:$src3)), addr:$dst)]>,
2142 TB;
2143
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002144 let Uses = [CL] in {
Evan Chengb783fa32007-07-19 01:14:50 +00002145 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002146 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002147 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002148 addr:$dst)]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002149 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002150 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002151 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002152 addr:$dst)]>, TB, OpSize;
2153 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002154 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002155 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002156 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002157 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
2158 (i8 imm:$src3)), addr:$dst)]>,
2159 TB, OpSize;
2160 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002161 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohman91888f02007-07-31 20:11:57 +00002162 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002163 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
2164 (i8 imm:$src3)), addr:$dst)]>,
2165 TB, OpSize;
2166}
Evan Cheng55687072007-09-14 21:48:26 +00002167} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002168
2169
2170// Arithmetic.
Evan Cheng55687072007-09-14 21:48:26 +00002171let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002172let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002173def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
2174 (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002175 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002176 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
2177let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002178def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
2179 (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002180 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002181 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002182def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
2183 (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002184 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002185 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
2186} // end isConvertibleToThreeAddress
2187} // end isCommutable
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002188def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
2189 (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002190 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002191 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002192def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
2193 (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002194 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002195 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize;
2196def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
2197 (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002198 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002199 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
2200
Evan Chengb783fa32007-07-19 01:14:50 +00002201def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002202 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002203 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
2204
2205let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002206def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
2207 (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002208 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002209 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002210def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
2211 (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002212 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002213 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002214def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
2215 (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002216 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002217 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize;
2218def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
2219 (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002220 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002221 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002222}
2223
2224let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002225 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002226 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002227 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002228 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002229 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002230 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002231 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002232 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002233 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002234 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002235 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002236 "add{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002237 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002238 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002239 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002240 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002241 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002242 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002243 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002244 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002245 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002246 "add{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002247 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002248 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002249 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002250 "add{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002251 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2252}
2253
2254let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002255def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002256 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002257 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
2258}
Evan Chengb783fa32007-07-19 01:14:50 +00002259def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002260 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002261 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002262def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$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, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002265def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$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, i32immSExt8:$src2))]>;
2268
2269let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002270 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002271 "adc{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002272 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002273 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$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 (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002276 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$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 (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2279}
2280
Evan Chengb783fa32007-07-19 01:14:50 +00002281def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002282 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002283 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002284def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002285 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002286 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002287def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002288 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002289 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002290def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002291 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002292 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002293def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002294 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002295 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002296def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002297 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002298 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
2299
Evan Chengb783fa32007-07-19 01:14:50 +00002300def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002301 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002302 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002303def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002304 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002305 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002306def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002307 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002308 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002309def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002310 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002311 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng55687072007-09-14 21:48:26 +00002312 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002313def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002314 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002315 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
2316let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002317 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002318 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002319 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002320 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002321 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002322 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002323 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002324 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002325 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002326 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002327 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002328 "sub{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002329 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002330 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002331 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002332 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002333 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002334 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002335 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002336 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002337 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002338 "sub{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002339 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng55687072007-09-14 21:48:26 +00002340 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002341 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002342 "sub{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002343 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2344}
2345
Evan Chengb783fa32007-07-19 01:14:50 +00002346def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002347 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002348 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002349
2350let isTwoAddress = 0 in {
Evan Chengb783fa32007-07-19 01:14:50 +00002351 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002352 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002353 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002354 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002355 "sbb{b}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002356 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002357 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002358 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002359 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002360 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002361 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng55687072007-09-14 21:48:26 +00002362 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002363}
Evan Chengb783fa32007-07-19 01:14:50 +00002364def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002365 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002366 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002367def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$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, imm:$src2))]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002370def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$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, i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002373} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002374
Evan Cheng55687072007-09-14 21:48:26 +00002375let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002376let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Chengb783fa32007-07-19 01:14:50 +00002377def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002378 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002379 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002380def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002381 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002382 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
2383}
Evan Chengb783fa32007-07-19 01:14:50 +00002384def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002385 "imul{w}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002386 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
2387 TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002388def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002389 "imul{l}\t{$src2, $dst|$dst, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002390 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Evan Cheng55687072007-09-14 21:48:26 +00002391} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002392} // end Two Address instructions
2393
2394// Suprisingly enough, these are not two address instructions!
Evan Cheng55687072007-09-14 21:48:26 +00002395let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002396def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002397 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002398 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002399 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
2400def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002401 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002402 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002403 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
2404def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002405 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002406 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002407 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
2408 OpSize;
2409def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002410 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002411 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002412 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
2413
2414def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
Evan Chengb783fa32007-07-19 01:14:50 +00002415 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002416 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002417 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
2418 OpSize;
2419def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
Evan Chengb783fa32007-07-19 01:14:50 +00002420 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002421 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002422 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
2423def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002424 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002425 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002426 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
2427 OpSize;
2428def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
Evan Chengb783fa32007-07-19 01:14:50 +00002429 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002430 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002431 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Evan Cheng55687072007-09-14 21:48:26 +00002432} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002433
2434//===----------------------------------------------------------------------===//
2435// Test instructions are just like AND, except they don't generate a result.
2436//
Evan Cheng950aac02007-09-25 01:57:46 +00002437let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002438let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Chengb783fa32007-07-19 01:14:50 +00002439def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002440 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002441 [(X86cmp (and GR8:$src1, GR8:$src2), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002442def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002443 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002444 [(X86cmp (and GR16:$src1, GR16:$src2), 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002445def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002446 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002447 [(X86cmp (and GR32:$src1, GR32:$src2), 0)]>;
2448}
2449
Evan Chengb783fa32007-07-19 01:14:50 +00002450def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002451 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002452 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00002453def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002454 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002455 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0)]>,
2456 OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00002457def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002458 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002459 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0)]>;
2460
2461def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002462 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002463 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002464 [(X86cmp (and GR8:$src1, imm:$src2), 0)]>;
2465def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002466 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002467 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002468 [(X86cmp (and GR16:$src1, imm:$src2), 0)]>, OpSize;
2469def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002470 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002471 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002472 [(X86cmp (and GR32:$src1, imm:$src2), 0)]>;
2473
2474def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengb783fa32007-07-19 01:14:50 +00002475 (outs), (ins i8mem:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002476 "test{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002477 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0)]>;
2478def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
Evan Chengb783fa32007-07-19 01:14:50 +00002479 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002480 "test{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002481 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0)]>,
2482 OpSize;
2483def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
Evan Chengb783fa32007-07-19 01:14:50 +00002484 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002485 "test{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002486 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002487} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002488
2489
Evan Cheng950aac02007-09-25 01:57:46 +00002490let Defs = [EFLAGS] in {
2491let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
2492def NEW_TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
2493 "test{b}\t{$src2, $src1|$src1, $src2}",
2494 [(X86cmp_new (and GR8:$src1, GR8:$src2), 0),
2495 (implicit EFLAGS)]>;
2496def NEW_TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2497 "test{w}\t{$src2, $src1|$src1, $src2}",
2498 [(X86cmp_new (and GR16:$src1, GR16:$src2), 0),
2499 (implicit EFLAGS)]>,
2500 OpSize;
2501def NEW_TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2502 "test{l}\t{$src2, $src1|$src1, $src2}",
2503 [(X86cmp_new (and GR32:$src1, GR32:$src2), 0),
2504 (implicit EFLAGS)]>;
2505}
2506
2507def NEW_TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
2508 "test{b}\t{$src2, $src1|$src1, $src2}",
2509 [(X86cmp_new (and GR8:$src1, (loadi8 addr:$src2)), 0),
2510 (implicit EFLAGS)]>;
2511def NEW_TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
2512 "test{w}\t{$src2, $src1|$src1, $src2}",
2513 [(X86cmp_new (and GR16:$src1, (loadi16 addr:$src2)), 0),
2514 (implicit EFLAGS)]>, OpSize;
2515def NEW_TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
2516 "test{l}\t{$src2, $src1|$src1, $src2}",
2517 [(X86cmp_new (and GR32:$src1, (loadi32 addr:$src2)), 0),
2518 (implicit EFLAGS)]>;
2519
2520def NEW_TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
2521 (outs), (ins GR8:$src1, i8imm:$src2),
2522 "test{b}\t{$src2, $src1|$src1, $src2}",
2523 [(X86cmp_new (and GR8:$src1, imm:$src2), 0),
2524 (implicit EFLAGS)]>;
2525def NEW_TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2526 (outs), (ins GR16:$src1, i16imm:$src2),
2527 "test{w}\t{$src2, $src1|$src1, $src2}",
2528 [(X86cmp_new (and GR16:$src1, imm:$src2), 0),
2529 (implicit EFLAGS)]>, OpSize;
2530def NEW_TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2531 (outs), (ins GR32:$src1, i32imm:$src2),
2532 "test{l}\t{$src2, $src1|$src1, $src2}",
2533 [(X86cmp_new (and GR32:$src1, imm:$src2), 0),
2534 (implicit EFLAGS)]>;
2535
2536def NEW_TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
2537 (outs), (ins i8mem:$src1, i8imm:$src2),
2538 "test{b}\t{$src2, $src1|$src1, $src2}",
2539 [(X86cmp_new (and (loadi8 addr:$src1), imm:$src2), 0),
2540 (implicit EFLAGS)]>;
2541def NEW_TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2542 (outs), (ins i16mem:$src1, i16imm:$src2),
2543 "test{w}\t{$src2, $src1|$src1, $src2}",
2544 [(X86cmp_new (and (loadi16 addr:$src1), imm:$src2), 0),
2545 (implicit EFLAGS)]>, OpSize;
2546def NEW_TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2547 (outs), (ins i32mem:$src1, i32imm:$src2),
2548 "test{l}\t{$src2, $src1|$src1, $src2}",
2549 [(X86cmp_new (and (loadi32 addr:$src1), imm:$src2), 0),
2550 (implicit EFLAGS)]>;
2551} // Defs = [EFLAGS]
2552
2553
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002554// Condition code ops, incl. set if equal/not equal/...
Evan Cheng55687072007-09-14 21:48:26 +00002555let Defs = [EFLAGS], Uses = [AH] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002556def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
Evan Cheng55687072007-09-14 21:48:26 +00002557let Defs = [AH], Uses = [EFLAGS] in
Evan Cheng6e4d1d92007-09-11 19:55:27 +00002558def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002559
Evan Cheng950aac02007-09-25 01:57:46 +00002560let Uses = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002561def SETEr : I<0x94, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002562 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002563 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002564 [(set GR8:$dst, (X86setcc X86_COND_E))]>,
2565 TB; // GR8 = ==
2566def SETEm : I<0x94, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002567 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002568 "sete\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002569 [(store (X86setcc X86_COND_E), addr:$dst)]>,
2570 TB; // [mem8] = ==
2571def SETNEr : I<0x95, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002572 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002573 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002574 [(set GR8:$dst, (X86setcc X86_COND_NE))]>,
2575 TB; // GR8 = !=
2576def SETNEm : I<0x95, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002577 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002578 "setne\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002579 [(store (X86setcc X86_COND_NE), addr:$dst)]>,
2580 TB; // [mem8] = !=
2581def SETLr : I<0x9C, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002582 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002583 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002584 [(set GR8:$dst, (X86setcc X86_COND_L))]>,
2585 TB; // GR8 = < signed
2586def SETLm : I<0x9C, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002587 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002588 "setl\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002589 [(store (X86setcc X86_COND_L), addr:$dst)]>,
2590 TB; // [mem8] = < signed
2591def SETGEr : I<0x9D, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002592 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002593 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002594 [(set GR8:$dst, (X86setcc X86_COND_GE))]>,
2595 TB; // GR8 = >= signed
2596def SETGEm : I<0x9D, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002597 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002598 "setge\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002599 [(store (X86setcc X86_COND_GE), addr:$dst)]>,
2600 TB; // [mem8] = >= signed
2601def SETLEr : I<0x9E, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002602 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002603 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002604 [(set GR8:$dst, (X86setcc X86_COND_LE))]>,
2605 TB; // GR8 = <= signed
2606def SETLEm : I<0x9E, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002607 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002608 "setle\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002609 [(store (X86setcc X86_COND_LE), addr:$dst)]>,
2610 TB; // [mem8] = <= signed
2611def SETGr : I<0x9F, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002612 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002613 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002614 [(set GR8:$dst, (X86setcc X86_COND_G))]>,
2615 TB; // GR8 = > signed
2616def SETGm : I<0x9F, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002617 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002618 "setg\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002619 [(store (X86setcc X86_COND_G), addr:$dst)]>,
2620 TB; // [mem8] = > signed
2621
2622def SETBr : I<0x92, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002623 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002624 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002625 [(set GR8:$dst, (X86setcc X86_COND_B))]>,
2626 TB; // GR8 = < unsign
2627def SETBm : I<0x92, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002628 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002629 "setb\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002630 [(store (X86setcc X86_COND_B), addr:$dst)]>,
2631 TB; // [mem8] = < unsign
2632def SETAEr : I<0x93, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002633 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002634 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002635 [(set GR8:$dst, (X86setcc X86_COND_AE))]>,
2636 TB; // GR8 = >= unsign
2637def SETAEm : I<0x93, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002638 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002639 "setae\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002640 [(store (X86setcc X86_COND_AE), addr:$dst)]>,
2641 TB; // [mem8] = >= unsign
2642def SETBEr : I<0x96, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002643 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002644 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002645 [(set GR8:$dst, (X86setcc X86_COND_BE))]>,
2646 TB; // GR8 = <= unsign
2647def SETBEm : I<0x96, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002648 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002649 "setbe\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002650 [(store (X86setcc X86_COND_BE), addr:$dst)]>,
2651 TB; // [mem8] = <= unsign
2652def SETAr : I<0x97, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002653 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002654 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002655 [(set GR8:$dst, (X86setcc X86_COND_A))]>,
2656 TB; // GR8 = > signed
2657def SETAm : I<0x97, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002658 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002659 "seta\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002660 [(store (X86setcc X86_COND_A), addr:$dst)]>,
2661 TB; // [mem8] = > signed
2662
2663def SETSr : I<0x98, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002664 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002665 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002666 [(set GR8:$dst, (X86setcc X86_COND_S))]>,
2667 TB; // GR8 = <sign bit>
2668def SETSm : I<0x98, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002669 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002670 "sets\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002671 [(store (X86setcc X86_COND_S), addr:$dst)]>,
2672 TB; // [mem8] = <sign bit>
2673def SETNSr : I<0x99, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002674 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002675 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002676 [(set GR8:$dst, (X86setcc X86_COND_NS))]>,
2677 TB; // GR8 = !<sign bit>
2678def SETNSm : I<0x99, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002679 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002680 "setns\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002681 [(store (X86setcc X86_COND_NS), addr:$dst)]>,
2682 TB; // [mem8] = !<sign bit>
2683def SETPr : I<0x9A, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002684 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002685 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002686 [(set GR8:$dst, (X86setcc X86_COND_P))]>,
2687 TB; // GR8 = parity
2688def SETPm : I<0x9A, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002689 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002690 "setp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002691 [(store (X86setcc X86_COND_P), addr:$dst)]>,
2692 TB; // [mem8] = parity
2693def SETNPr : I<0x9B, MRM0r,
Evan Chengb783fa32007-07-19 01:14:50 +00002694 (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00002695 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002696 [(set GR8:$dst, (X86setcc X86_COND_NP))]>,
2697 TB; // GR8 = not parity
2698def SETNPm : I<0x9B, MRM0m,
Evan Chengb783fa32007-07-19 01:14:50 +00002699 (outs), (ins i8mem:$dst),
Dan Gohman91888f02007-07-31 20:11:57 +00002700 "setnp\t$dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002701 [(store (X86setcc X86_COND_NP), addr:$dst)]>,
2702 TB; // [mem8] = not parity
Evan Cheng950aac02007-09-25 01:57:46 +00002703} // Uses = [EFLAGS]
2704
2705let Uses = [EFLAGS] in {
2706def NEW_SETEr : I<0x94, MRM0r,
2707 (outs GR8 :$dst), (ins),
2708 "sete\t$dst",
2709 [(set GR8:$dst, (X86setcc_new X86_COND_E, EFLAGS))]>,
2710 TB; // GR8 = ==
2711def NEW_SETEm : I<0x94, MRM0m,
2712 (outs), (ins i8mem:$dst),
2713 "sete\t$dst",
2714 [(store (X86setcc_new X86_COND_E, EFLAGS), addr:$dst)]>,
2715 TB; // [mem8] = ==
2716def NEW_SETNEr : I<0x95, MRM0r,
2717 (outs GR8 :$dst), (ins),
2718 "setne\t$dst",
2719 [(set GR8:$dst, (X86setcc_new X86_COND_NE, EFLAGS))]>,
2720 TB; // GR8 = !=
2721def NEW_SETNEm : I<0x95, MRM0m,
2722 (outs), (ins i8mem:$dst),
2723 "setne\t$dst",
2724 [(store (X86setcc_new X86_COND_NE, EFLAGS), addr:$dst)]>,
2725 TB; // [mem8] = !=
2726def NEW_SETLr : I<0x9C, MRM0r,
2727 (outs GR8 :$dst), (ins),
2728 "setl\t$dst",
2729 [(set GR8:$dst, (X86setcc_new X86_COND_L, EFLAGS))]>,
2730 TB; // GR8 = < signed
2731def NEW_SETLm : I<0x9C, MRM0m,
2732 (outs), (ins i8mem:$dst),
2733 "setl\t$dst",
2734 [(store (X86setcc_new X86_COND_L, EFLAGS), addr:$dst)]>,
2735 TB; // [mem8] = < signed
2736def NEW_SETGEr : I<0x9D, MRM0r,
2737 (outs GR8 :$dst), (ins),
2738 "setge\t$dst",
2739 [(set GR8:$dst, (X86setcc_new X86_COND_GE, EFLAGS))]>,
2740 TB; // GR8 = >= signed
2741def NEW_SETGEm : I<0x9D, MRM0m,
2742 (outs), (ins i8mem:$dst),
2743 "setge\t$dst",
2744 [(store (X86setcc_new X86_COND_GE, EFLAGS), addr:$dst)]>,
2745 TB; // [mem8] = >= signed
2746def NEW_SETLEr : I<0x9E, MRM0r,
2747 (outs GR8 :$dst), (ins),
2748 "setle\t$dst",
2749 [(set GR8:$dst, (X86setcc_new X86_COND_LE, EFLAGS))]>,
2750 TB; // GR8 = <= signed
2751def NEW_SETLEm : I<0x9E, MRM0m,
2752 (outs), (ins i8mem:$dst),
2753 "setle\t$dst",
2754 [(store (X86setcc_new X86_COND_LE, EFLAGS), addr:$dst)]>,
2755 TB; // [mem8] = <= signed
2756def NEW_SETGr : I<0x9F, MRM0r,
2757 (outs GR8 :$dst), (ins),
2758 "setg\t$dst",
2759 [(set GR8:$dst, (X86setcc_new X86_COND_G, EFLAGS))]>,
2760 TB; // GR8 = > signed
2761def NEW_SETGm : I<0x9F, MRM0m,
2762 (outs), (ins i8mem:$dst),
2763 "setg\t$dst",
2764 [(store (X86setcc_new X86_COND_G, EFLAGS), addr:$dst)]>,
2765 TB; // [mem8] = > signed
2766
2767def NEW_SETBr : I<0x92, MRM0r,
2768 (outs GR8 :$dst), (ins),
2769 "setb\t$dst",
2770 [(set GR8:$dst, (X86setcc_new X86_COND_B, EFLAGS))]>,
2771 TB; // GR8 = < unsign
2772def NEW_SETBm : I<0x92, MRM0m,
2773 (outs), (ins i8mem:$dst),
2774 "setb\t$dst",
2775 [(store (X86setcc_new X86_COND_B, EFLAGS), addr:$dst)]>,
2776 TB; // [mem8] = < unsign
2777def NEW_SETAEr : I<0x93, MRM0r,
2778 (outs GR8 :$dst), (ins),
2779 "setae\t$dst",
2780 [(set GR8:$dst, (X86setcc_new X86_COND_AE, EFLAGS))]>,
2781 TB; // GR8 = >= unsign
2782def NEW_SETAEm : I<0x93, MRM0m,
2783 (outs), (ins i8mem:$dst),
2784 "setae\t$dst",
2785 [(store (X86setcc_new X86_COND_AE, EFLAGS), addr:$dst)]>,
2786 TB; // [mem8] = >= unsign
2787def NEW_SETBEr : I<0x96, MRM0r,
2788 (outs GR8 :$dst), (ins),
2789 "setbe\t$dst",
2790 [(set GR8:$dst, (X86setcc_new X86_COND_BE, EFLAGS))]>,
2791 TB; // GR8 = <= unsign
2792def NEW_SETBEm : I<0x96, MRM0m,
2793 (outs), (ins i8mem:$dst),
2794 "setbe\t$dst",
2795 [(store (X86setcc_new X86_COND_BE, EFLAGS), addr:$dst)]>,
2796 TB; // [mem8] = <= unsign
2797def NEW_SETAr : I<0x97, MRM0r,
2798 (outs GR8 :$dst), (ins),
2799 "seta\t$dst",
2800 [(set GR8:$dst, (X86setcc_new X86_COND_A, EFLAGS))]>,
2801 TB; // GR8 = > signed
2802def NEW_SETAm : I<0x97, MRM0m,
2803 (outs), (ins i8mem:$dst),
2804 "seta\t$dst",
2805 [(store (X86setcc_new X86_COND_A, EFLAGS), addr:$dst)]>,
2806 TB; // [mem8] = > signed
2807
2808def NEW_SETSr : I<0x98, MRM0r,
2809 (outs GR8 :$dst), (ins),
2810 "sets\t$dst",
2811 [(set GR8:$dst, (X86setcc_new X86_COND_S, EFLAGS))]>,
2812 TB; // GR8 = <sign bit>
2813def NEW_SETSm : I<0x98, MRM0m,
2814 (outs), (ins i8mem:$dst),
2815 "sets\t$dst",
2816 [(store (X86setcc_new X86_COND_S, EFLAGS), addr:$dst)]>,
2817 TB; // [mem8] = <sign bit>
2818def NEW_SETNSr : I<0x99, MRM0r,
2819 (outs GR8 :$dst), (ins),
2820 "setns\t$dst",
2821 [(set GR8:$dst, (X86setcc_new X86_COND_NS, EFLAGS))]>,
2822 TB; // GR8 = !<sign bit>
2823def NEW_SETNSm : I<0x99, MRM0m,
2824 (outs), (ins i8mem:$dst),
2825 "setns\t$dst",
2826 [(store (X86setcc_new X86_COND_NS, EFLAGS), addr:$dst)]>,
2827 TB; // [mem8] = !<sign bit>
2828def NEW_SETPr : I<0x9A, MRM0r,
2829 (outs GR8 :$dst), (ins),
2830 "setp\t$dst",
2831 [(set GR8:$dst, (X86setcc_new X86_COND_P, EFLAGS))]>,
2832 TB; // GR8 = parity
2833def NEW_SETPm : I<0x9A, MRM0m,
2834 (outs), (ins i8mem:$dst),
2835 "setp\t$dst",
2836 [(store (X86setcc_new X86_COND_P, EFLAGS), addr:$dst)]>,
2837 TB; // [mem8] = parity
2838def NEW_SETNPr : I<0x9B, MRM0r,
2839 (outs GR8 :$dst), (ins),
2840 "setnp\t$dst",
2841 [(set GR8:$dst, (X86setcc_new X86_COND_NP, EFLAGS))]>,
2842 TB; // GR8 = not parity
2843def NEW_SETNPm : I<0x9B, MRM0m,
2844 (outs), (ins i8mem:$dst),
2845 "setnp\t$dst",
2846 [(store (X86setcc_new X86_COND_NP, EFLAGS), addr:$dst)]>,
2847 TB; // [mem8] = not parity
2848} // Uses = [EFLAGS]
2849
2850
2851//def : Pat<(X86setcc_new X86_COND_E, EFLAGS), (SETEr)>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002852
2853// Integer comparisons
Evan Cheng55687072007-09-14 21:48:26 +00002854let Defs = [EFLAGS] in {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002855def CMP8rr : I<0x38, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002856 (outs), (ins GR8 :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002857 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002858 [(X86cmp GR8:$src1, GR8:$src2)]>;
2859def CMP16rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002860 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002861 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002862 [(X86cmp GR16:$src1, GR16:$src2)]>, OpSize;
2863def CMP32rr : I<0x39, MRMDestReg,
Evan Chengb783fa32007-07-19 01:14:50 +00002864 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002865 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002866 [(X86cmp GR32:$src1, GR32:$src2)]>;
2867def CMP8mr : I<0x38, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002868 (outs), (ins i8mem :$src1, GR8 :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002869 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002870 [(X86cmp (loadi8 addr:$src1), GR8:$src2)]>;
2871def CMP16mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002872 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002873 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002874 [(X86cmp (loadi16 addr:$src1), GR16:$src2)]>, OpSize;
2875def CMP32mr : I<0x39, MRMDestMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002876 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002877 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002878 [(X86cmp (loadi32 addr:$src1), GR32:$src2)]>;
2879def CMP8rm : I<0x3A, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002880 (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002881 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002882 [(X86cmp GR8:$src1, (loadi8 addr:$src2))]>;
2883def CMP16rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002884 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002885 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002886 [(X86cmp GR16:$src1, (loadi16 addr:$src2))]>, OpSize;
2887def CMP32rm : I<0x3B, MRMSrcMem,
Evan Chengb783fa32007-07-19 01:14:50 +00002888 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002889 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002890 [(X86cmp GR32:$src1, (loadi32 addr:$src2))]>;
2891def CMP8ri : Ii8<0x80, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002892 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002893 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002894 [(X86cmp GR8:$src1, imm:$src2)]>;
2895def CMP16ri : Ii16<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002896 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002897 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002898 [(X86cmp GR16:$src1, imm:$src2)]>, OpSize;
2899def CMP32ri : Ii32<0x81, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002900 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002901 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002902 [(X86cmp GR32:$src1, imm:$src2)]>;
2903def CMP8mi : Ii8 <0x80, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002904 (outs), (ins i8mem :$src1, i8imm :$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002905 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002906 [(X86cmp (loadi8 addr:$src1), imm:$src2)]>;
2907def CMP16mi : Ii16<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002908 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002909 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002910 [(X86cmp (loadi16 addr:$src1), imm:$src2)]>, OpSize;
2911def CMP32mi : Ii32<0x81, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002912 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002913 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002914 [(X86cmp (loadi32 addr:$src1), imm:$src2)]>;
2915def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002916 (outs), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002917 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002918 [(X86cmp GR16:$src1, i16immSExt8:$src2)]>, OpSize;
2919def CMP16mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002920 (outs), (ins i16mem:$src1, i16i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002921 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002922 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2)]>, OpSize;
2923def CMP32mi8 : Ii8<0x83, MRM7m,
Evan Chengb783fa32007-07-19 01:14:50 +00002924 (outs), (ins i32mem:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002925 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002926 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2)]>;
2927def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Chengb783fa32007-07-19 01:14:50 +00002928 (outs), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohman91888f02007-07-31 20:11:57 +00002929 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002930 [(X86cmp GR32:$src1, i32immSExt8:$src2)]>;
Evan Cheng55687072007-09-14 21:48:26 +00002931} // Defs = [EFLAGS]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002932
Evan Cheng950aac02007-09-25 01:57:46 +00002933let Defs = [EFLAGS] in {
2934def NEW_CMP8rr : I<0x38, MRMDestReg,
2935 (outs), (ins GR8 :$src1, GR8 :$src2),
2936 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2937 [(X86cmp_new GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
2938def NEW_CMP16rr : I<0x39, MRMDestReg,
2939 (outs), (ins GR16:$src1, GR16:$src2),
2940 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2941 [(X86cmp_new GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
2942def NEW_CMP32rr : I<0x39, MRMDestReg,
2943 (outs), (ins GR32:$src1, GR32:$src2),
2944 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2945 [(X86cmp_new GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
2946def NEW_CMP8mr : I<0x38, MRMDestMem,
2947 (outs), (ins i8mem :$src1, GR8 :$src2),
2948 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2949 [(X86cmp_new (loadi8 addr:$src1), GR8:$src2),
2950 (implicit EFLAGS)]>;
2951def NEW_CMP16mr : I<0x39, MRMDestMem,
2952 (outs), (ins i16mem:$src1, GR16:$src2),
2953 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2954 [(X86cmp_new (loadi16 addr:$src1), GR16:$src2),
2955 (implicit EFLAGS)]>, OpSize;
2956def NEW_CMP32mr : I<0x39, MRMDestMem,
2957 (outs), (ins i32mem:$src1, GR32:$src2),
2958 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2959 [(X86cmp_new (loadi32 addr:$src1), GR32:$src2),
2960 (implicit EFLAGS)]>;
2961def NEW_CMP8rm : I<0x3A, MRMSrcMem,
2962 (outs), (ins GR8 :$src1, i8mem :$src2),
2963 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2964 [(X86cmp_new GR8:$src1, (loadi8 addr:$src2)),
2965 (implicit EFLAGS)]>;
2966def NEW_CMP16rm : I<0x3B, MRMSrcMem,
2967 (outs), (ins GR16:$src1, i16mem:$src2),
2968 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2969 [(X86cmp_new GR16:$src1, (loadi16 addr:$src2)),
2970 (implicit EFLAGS)]>, OpSize;
2971def NEW_CMP32rm : I<0x3B, MRMSrcMem,
2972 (outs), (ins GR32:$src1, i32mem:$src2),
2973 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2974 [(X86cmp_new GR32:$src1, (loadi32 addr:$src2)),
2975 (implicit EFLAGS)]>;
2976def NEW_CMP8ri : Ii8<0x80, MRM7r,
2977 (outs), (ins GR8:$src1, i8imm:$src2),
2978 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2979 [(X86cmp_new GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
2980def NEW_CMP16ri : Ii16<0x81, MRM7r,
2981 (outs), (ins GR16:$src1, i16imm:$src2),
2982 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2983 [(X86cmp_new GR16:$src1, imm:$src2),
2984 (implicit EFLAGS)]>, OpSize;
2985def NEW_CMP32ri : Ii32<0x81, MRM7r,
2986 (outs), (ins GR32:$src1, i32imm:$src2),
2987 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2988 [(X86cmp_new GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
2989def NEW_CMP8mi : Ii8 <0x80, MRM7m,
2990 (outs), (ins i8mem :$src1, i8imm :$src2),
2991 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2992 [(X86cmp_new (loadi8 addr:$src1), imm:$src2),
2993 (implicit EFLAGS)]>;
2994def NEW_CMP16mi : Ii16<0x81, MRM7m,
2995 (outs), (ins i16mem:$src1, i16imm:$src2),
2996 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2997 [(X86cmp_new (loadi16 addr:$src1), imm:$src2),
2998 (implicit EFLAGS)]>, OpSize;
2999def NEW_CMP32mi : Ii32<0x81, MRM7m,
3000 (outs), (ins i32mem:$src1, i32imm:$src2),
3001 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3002 [(X86cmp_new (loadi32 addr:$src1), imm:$src2),
3003 (implicit EFLAGS)]>;
3004def NEW_CMP16ri8 : Ii8<0x83, MRM7r,
3005 (outs), (ins GR16:$src1, i16i8imm:$src2),
3006 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3007 [(X86cmp_new GR16:$src1, i16immSExt8:$src2),
3008 (implicit EFLAGS)]>, OpSize;
3009def NEW_CMP16mi8 : Ii8<0x83, MRM7m,
3010 (outs), (ins i16mem:$src1, i16i8imm:$src2),
3011 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3012 [(X86cmp_new (loadi16 addr:$src1), i16immSExt8:$src2),
3013 (implicit EFLAGS)]>, OpSize;
3014def NEW_CMP32mi8 : Ii8<0x83, MRM7m,
3015 (outs), (ins i32mem:$src1, i32i8imm:$src2),
3016 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3017 [(X86cmp_new (loadi32 addr:$src1), i32immSExt8:$src2),
3018 (implicit EFLAGS)]>;
3019def NEW_CMP32ri8 : Ii8<0x83, MRM7r,
3020 (outs), (ins GR32:$src1, i32i8imm:$src2),
3021 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3022 [(X86cmp_new GR32:$src1, i32immSExt8:$src2),
3023 (implicit EFLAGS)]>;
3024} // Defs = [EFLAGS]
3025
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003026// Sign/Zero extenders
Evan Chengb783fa32007-07-19 01:14:50 +00003027def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003028 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003029 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003030def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$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, (sextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003033def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003034 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003035 [(set GR32:$dst, (sext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003036def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$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, (sextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003039def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003040 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003041 [(set GR32:$dst, (sext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003042def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$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, (sextloadi32i16 addr:$src))]>, TB;
3045
Evan Chengb783fa32007-07-19 01:14:50 +00003046def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003047 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003048 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003049def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$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, (zextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003052def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003053 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003054 [(set GR32:$dst, (zext GR8:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003055def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$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, (zextloadi32i8 addr:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003058def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003059 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003060 [(set GR32:$dst, (zext GR16:$src))]>, TB;
Evan Chengb783fa32007-07-19 01:14:50 +00003061def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$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, (zextloadi32i16 addr:$src))]>, TB;
3064
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003065let Defs = [AX], Uses = [AL] in
Evan Chengb783fa32007-07-19 01:14:50 +00003066def CBW : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003067 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
3068let Defs = [EAX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003069def CWDE : I<0x98, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003070 "{cwtl|cwde}", []>; // EAX = signext(AX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003071
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003072let Defs = [AX,DX], Uses = [AX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003073def CWD : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003074 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
3075let Defs = [EAX,EDX], Uses = [EAX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003076def CDQ : I<0x99, RawFrm, (outs), (ins),
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003077 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003078
3079
3080//===----------------------------------------------------------------------===//
3081// Alias Instructions
3082//===----------------------------------------------------------------------===//
3083
3084// Alias instructions that map movr0 to xor.
3085// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Evan Cheng55687072007-09-14 21:48:26 +00003086let Defs = [EFLAGS], isReMaterializable = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003087def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003088 "xor{b}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003089 [(set GR8:$dst, 0)]>;
Evan Chengb783fa32007-07-19 01:14:50 +00003090def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003091 "xor{w}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003092 [(set GR16:$dst, 0)]>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003093def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003094 "xor{l}\t$dst, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003095 [(set GR32:$dst, 0)]>;
Dan Gohman8aef09b2007-09-07 21:32:51 +00003096}
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003097
3098// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
3099// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
Evan Chengb783fa32007-07-19 01:14:50 +00003100def MOV16to16_ : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003101 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003102def MOV32to32_ : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003103 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003104
Evan Chengb783fa32007-07-19 01:14:50 +00003105def MOV16_rr : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003106 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003107def MOV32_rr : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003108 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003109let isLoad = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003110def MOV16_rm : I<0x8B, MRMSrcMem, (outs GR16_:$dst), (ins i16mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003111 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003112def MOV32_rm : I<0x8B, MRMSrcMem, (outs GR32_:$dst), (ins i32mem:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003113 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng4e84e452007-08-30 05:49:43 +00003114}
Evan Chengb783fa32007-07-19 01:14:50 +00003115def MOV16_mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003116 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Chengb783fa32007-07-19 01:14:50 +00003117def MOV32_mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32_:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003118 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003119
3120//===----------------------------------------------------------------------===//
3121// Thread Local Storage Instructions
3122//
3123
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003124let Uses = [EBX] in
Evan Chengb783fa32007-07-19 01:14:50 +00003125def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym),
Dan Gohman91888f02007-07-31 20:11:57 +00003126 "leal\t${sym:mem}(,%ebx,1), $dst",
Evan Cheng6e4d1d92007-09-11 19:55:27 +00003127 [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003128
3129let AddedComplexity = 10 in
Evan Chengb783fa32007-07-19 01:14:50 +00003130def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003131 "movl\t%gs:($src), $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003132 [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
3133
3134let AddedComplexity = 15 in
Evan Chengb783fa32007-07-19 01:14:50 +00003135def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohman91888f02007-07-31 20:11:57 +00003136 "movl\t%gs:${src:mem}, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003137 [(set GR32:$dst,
3138 (load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
3139
Evan Chengb783fa32007-07-19 01:14:50 +00003140def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohman91888f02007-07-31 20:11:57 +00003141 "movl\t%gs:0, $dst",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003142 [(set GR32:$dst, X86TLStp)]>;
3143
3144//===----------------------------------------------------------------------===//
3145// DWARF Pseudo Instructions
3146//
3147
Evan Chengb783fa32007-07-19 01:14:50 +00003148def DWARF_LOC : I<0, Pseudo, (outs),
3149 (ins i32imm:$line, i32imm:$col, i32imm:$file),
Dan Gohman77af4a82007-09-24 19:25:06 +00003150 ".loc\t${file:debug} ${line:debug} ${col:debug}",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003151 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
3152 (i32 imm:$file))]>;
3153
3154//===----------------------------------------------------------------------===//
3155// EH Pseudo Instructions
3156//
3157let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Cheng37e7c752007-07-21 00:34:19 +00003158 hasCtrlDep = 1 in {
Evan Chengb783fa32007-07-19 01:14:50 +00003159def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
Dan Gohman91888f02007-07-31 20:11:57 +00003160 "ret\t#eh_return, addr: $addr",
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003161 [(X86ehret GR32:$addr)]>;
3162
3163}
3164
3165//===----------------------------------------------------------------------===//
3166// Non-Instruction Patterns
3167//===----------------------------------------------------------------------===//
3168
3169// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
3170def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
3171def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
3172def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)), (MOV32ri tglobaltlsaddr:$dst)>;
3173def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
3174def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
3175
3176def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
3177 (ADD32ri GR32:$src1, tconstpool:$src2)>;
3178def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
3179 (ADD32ri GR32:$src1, tjumptable:$src2)>;
3180def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
3181 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
3182def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
3183 (ADD32ri GR32:$src1, texternalsym:$src2)>;
3184
3185def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
3186 (MOV32mi addr:$dst, tglobaladdr:$src)>;
3187def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
3188 (MOV32mi addr:$dst, texternalsym:$src)>;
3189
3190// Calls
3191def : Pat<(X86tailcall GR32:$dst),
3192 (CALL32r GR32:$dst)>;
3193
3194def : Pat<(X86tailcall (i32 tglobaladdr:$dst)),
3195 (CALLpcrel32 tglobaladdr:$dst)>;
3196def : Pat<(X86tailcall (i32 texternalsym:$dst)),
3197 (CALLpcrel32 texternalsym:$dst)>;
3198
3199def : Pat<(X86call (i32 tglobaladdr:$dst)),
3200 (CALLpcrel32 tglobaladdr:$dst)>;
3201def : Pat<(X86call (i32 texternalsym:$dst)),
3202 (CALLpcrel32 texternalsym:$dst)>;
3203
3204// X86 specific add which produces a flag.
3205def : Pat<(addc GR32:$src1, GR32:$src2),
3206 (ADD32rr GR32:$src1, GR32:$src2)>;
3207def : Pat<(addc GR32:$src1, (load addr:$src2)),
3208 (ADD32rm GR32:$src1, addr:$src2)>;
3209def : Pat<(addc GR32:$src1, imm:$src2),
3210 (ADD32ri GR32:$src1, imm:$src2)>;
3211def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
3212 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
3213
3214def : Pat<(subc GR32:$src1, GR32:$src2),
3215 (SUB32rr GR32:$src1, GR32:$src2)>;
3216def : Pat<(subc GR32:$src1, (load addr:$src2)),
3217 (SUB32rm GR32:$src1, addr:$src2)>;
3218def : Pat<(subc GR32:$src1, imm:$src2),
3219 (SUB32ri GR32:$src1, imm:$src2)>;
3220def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
3221 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
3222
3223def : Pat<(truncstorei1 (i8 imm:$src), addr:$dst),
3224 (MOV8mi addr:$dst, imm:$src)>;
3225def : Pat<(truncstorei1 GR8:$src, addr:$dst),
3226 (MOV8mr addr:$dst, GR8:$src)>;
3227
3228// Comparisons.
3229
3230// TEST R,R is smaller than CMP R,0
3231def : Pat<(X86cmp GR8:$src1, 0),
3232 (TEST8rr GR8:$src1, GR8:$src1)>;
3233def : Pat<(X86cmp GR16:$src1, 0),
3234 (TEST16rr GR16:$src1, GR16:$src1)>;
3235def : Pat<(X86cmp GR32:$src1, 0),
3236 (TEST32rr GR32:$src1, GR32:$src1)>;
3237
Evan Cheng950aac02007-09-25 01:57:46 +00003238def : Pat<(parallel (X86cmp_new GR8:$src1, 0), (implicit EFLAGS)),
3239 (NEW_TEST8rr GR8:$src1, GR8:$src1)>;
3240def : Pat<(parallel (X86cmp_new GR16:$src1, 0), (implicit EFLAGS)),
3241 (NEW_TEST16rr GR16:$src1, GR16:$src1)>;
3242def : Pat<(parallel (X86cmp_new GR32:$src1, 0), (implicit EFLAGS)),
3243 (NEW_TEST32rr GR32:$src1, GR32:$src1)>;
3244
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003245// {s|z}extload bool -> {s|z}extload byte
3246def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
3247def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
3248def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3249def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3250def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3251
3252// extload bool -> extload byte
3253def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3254def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3255def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3256def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
3257def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
3258def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
3259
3260// anyext -> zext
3261def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
3262def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
3263def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
3264def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
3265def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
3266def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
3267
3268//===----------------------------------------------------------------------===//
3269// Some peepholes
3270//===----------------------------------------------------------------------===//
3271
3272// (shl x, 1) ==> (add x, x)
3273def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
3274def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
3275def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
3276
3277// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
3278def : Pat<(or (srl GR32:$src1, CL:$amt),
3279 (shl GR32:$src2, (sub 32, CL:$amt))),
3280 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
3281
3282def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
3283 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3284 (SHRD32mrCL addr:$dst, GR32:$src2)>;
3285
3286// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
3287def : Pat<(or (shl GR32:$src1, CL:$amt),
3288 (srl GR32:$src2, (sub 32, CL:$amt))),
3289 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
3290
3291def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
3292 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3293 (SHLD32mrCL addr:$dst, GR32:$src2)>;
3294
3295// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
3296def : Pat<(or (srl GR16:$src1, CL:$amt),
3297 (shl GR16:$src2, (sub 16, CL:$amt))),
3298 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
3299
3300def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
3301 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3302 (SHRD16mrCL addr:$dst, GR16:$src2)>;
3303
3304// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
3305def : Pat<(or (shl GR16:$src1, CL:$amt),
3306 (srl GR16:$src2, (sub 16, CL:$amt))),
3307 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
3308
3309def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
3310 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3311 (SHLD16mrCL addr:$dst, GR16:$src2)>;
3312
3313
3314//===----------------------------------------------------------------------===//
3315// Floating Point Stack Support
3316//===----------------------------------------------------------------------===//
3317
3318include "X86InstrFPStack.td"
3319
3320//===----------------------------------------------------------------------===//
Evan Cheng86ab7d32007-07-31 08:04:03 +00003321// X86-64 Support
3322//===----------------------------------------------------------------------===//
3323
3324include "X86InstrX86-64.td"
3325
3326//===----------------------------------------------------------------------===//
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003327// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
3328//===----------------------------------------------------------------------===//
3329
3330include "X86InstrMMX.td"
3331
3332//===----------------------------------------------------------------------===//
3333// XMM Floating point support (requires SSE / SSE2)
3334//===----------------------------------------------------------------------===//
3335
3336include "X86InstrSSE.td"