1 //===- X86InstrInfo.td - Describe the X86 Instruction Set --*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
14 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
17 // X86 specific DAG Nodes.
20 def SDTIntShiftDOp: SDTypeProfile<1, 3,
21 [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
22 SDTCisInt<0>, SDTCisInt<3>]>;
24 def SDTX86CmpTest : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
26 def SDTX86Cmov : SDTypeProfile<1, 4,
27 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
28 SDTCisVT<3, i8>, SDTCisVT<4, i32>]>;
30 // Unary and binary operator instructions that set EFLAGS as a side-effect.
31 def SDTUnaryArithWithFlags : SDTypeProfile<1, 1,
33 def SDTBinaryArithWithFlags : SDTypeProfile<1, 2,
37 def SDTX86BrCond : SDTypeProfile<0, 3,
38 [SDTCisVT<0, OtherVT>,
39 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
41 def SDTX86SetCC : SDTypeProfile<1, 2,
43 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
45 def SDTX86cas : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisInt<1>,
47 def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
49 def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>,
50 SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>;
51 def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>;
53 def SDT_X86CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>;
54 def SDT_X86CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>,
57 def SDT_X86Call : SDTypeProfile<0, -1, [SDTCisVT<0, iPTR>]>;
59 def SDT_X86VASTART_SAVE_XMM_REGS : SDTypeProfile<0, -1, [SDTCisVT<0, i8>,
63 def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
65 def SDTX86RdTsc : SDTypeProfile<0, 0, []>;
67 def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
69 def SDT_X86TLSADDR : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
71 def SDT_X86SegmentBaseAddress : SDTypeProfile<1, 1, [SDTCisPtrTy<0>]>;
73 def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
75 def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
77 def X86bsf : SDNode<"X86ISD::BSF", SDTIntUnaryOp>;
78 def X86bsr : SDNode<"X86ISD::BSR", SDTIntUnaryOp>;
79 def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
80 def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
82 def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>;
84 def X86bt : SDNode<"X86ISD::BT", SDTX86CmpTest>;
86 def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>;
87 def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
89 def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>;
91 def X86cas : SDNode<"X86ISD::LCMPXCHG_DAG", SDTX86cas,
92 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
94 def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8,
95 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
97 def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary,
98 [SDNPHasChain, SDNPMayStore,
99 SDNPMayLoad, SDNPMemOperand]>;
100 def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary,
101 [SDNPHasChain, SDNPMayStore,
102 SDNPMayLoad, SDNPMemOperand]>;
103 def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary,
104 [SDNPHasChain, SDNPMayStore,
105 SDNPMayLoad, SDNPMemOperand]>;
106 def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary,
107 [SDNPHasChain, SDNPMayStore,
108 SDNPMayLoad, SDNPMemOperand]>;
109 def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary,
110 [SDNPHasChain, SDNPMayStore,
111 SDNPMayLoad, SDNPMemOperand]>;
112 def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary,
113 [SDNPHasChain, SDNPMayStore,
114 SDNPMayLoad, SDNPMemOperand]>;
115 def X86AtomSwap64 : SDNode<"X86ISD::ATOMSWAP64_DAG", SDTX86atomicBinary,
116 [SDNPHasChain, SDNPMayStore,
117 SDNPMayLoad, SDNPMemOperand]>;
118 def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
119 [SDNPHasChain, SDNPOptInFlag]>;
121 def X86vastart_save_xmm_regs :
122 SDNode<"X86ISD::VASTART_SAVE_XMM_REGS",
123 SDT_X86VASTART_SAVE_XMM_REGS,
126 def X86callseq_start :
127 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
128 [SDNPHasChain, SDNPOutFlag]>;
130 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
131 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
133 def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
134 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
136 def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
137 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>;
138 def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
139 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
142 def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc,
143 [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>;
145 def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
146 def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>;
148 def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
149 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
150 def X86SegmentBaseAddress : SDNode<"X86ISD::SegmentBaseAddress",
151 SDT_X86SegmentBaseAddress, []>;
153 def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
156 def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET,
157 [SDNPHasChain, SDNPOptInFlag]>;
159 def X86add_flag : SDNode<"X86ISD::ADD", SDTBinaryArithWithFlags>;
160 def X86sub_flag : SDNode<"X86ISD::SUB", SDTBinaryArithWithFlags>;
161 def X86smul_flag : SDNode<"X86ISD::SMUL", SDTBinaryArithWithFlags>;
162 def X86umul_flag : SDNode<"X86ISD::UMUL", SDTUnaryArithWithFlags>;
163 def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>;
164 def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>;
166 def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>;
168 //===----------------------------------------------------------------------===//
169 // X86 Operand Definitions.
172 def i32imm_pcrel : Operand<i32> {
173 let PrintMethod = "print_pcrel_imm";
176 // A version of ptr_rc which excludes SP, ESP, and RSP. This is used for
177 // the index operand of an address, to conform to x86 encoding restrictions.
178 def ptr_rc_nosp : PointerLikeRegClass<1>;
180 // *mem - Operand definitions for the funky X86 addressing mode operands.
182 def X86MemAsmOperand : AsmOperandClass {
186 class X86MemOperand<string printMethod> : Operand<iPTR> {
187 let PrintMethod = printMethod;
188 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
189 let ParserMatchClass = X86MemAsmOperand;
192 def opaque32mem : X86MemOperand<"printopaquemem">;
193 def opaque48mem : X86MemOperand<"printopaquemem">;
194 def opaque80mem : X86MemOperand<"printopaquemem">;
196 def i8mem : X86MemOperand<"printi8mem">;
197 def i16mem : X86MemOperand<"printi16mem">;
198 def i32mem : X86MemOperand<"printi32mem">;
199 def i64mem : X86MemOperand<"printi64mem">;
200 def i128mem : X86MemOperand<"printi128mem">;
201 def i256mem : X86MemOperand<"printi256mem">;
202 def f32mem : X86MemOperand<"printf32mem">;
203 def f64mem : X86MemOperand<"printf64mem">;
204 def f80mem : X86MemOperand<"printf80mem">;
205 def f128mem : X86MemOperand<"printf128mem">;
206 def f256mem : X86MemOperand<"printf256mem">;
208 // A version of i8mem for use on x86-64 that uses GR64_NOREX instead of
209 // plain GR64, so that it doesn't potentially require a REX prefix.
210 def i8mem_NOREX : Operand<i64> {
211 let PrintMethod = "printi8mem";
212 let MIOperandInfo = (ops GR64_NOREX, i8imm, GR64_NOREX_NOSP, i32imm, i8imm);
213 let ParserMatchClass = X86MemAsmOperand;
216 def lea32mem : Operand<i32> {
217 let PrintMethod = "printlea32mem";
218 let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm);
219 let ParserMatchClass = X86MemAsmOperand;
222 def SSECC : Operand<i8> {
223 let PrintMethod = "printSSECC";
226 def piclabel: Operand<i32> {
227 let PrintMethod = "printPICLabel";
230 def ImmSExt8AsmOperand : AsmOperandClass {
231 let Name = "ImmSExt8";
232 let SuperClass = ImmAsmOperand;
235 // A couple of more descriptive operand definitions.
236 // 16-bits but only 8 bits are significant.
237 def i16i8imm : Operand<i16> {
238 let ParserMatchClass = ImmSExt8AsmOperand;
240 // 32-bits but only 8 bits are significant.
241 def i32i8imm : Operand<i32> {
242 let ParserMatchClass = ImmSExt8AsmOperand;
245 // Branch targets have OtherVT type and print as pc-relative values.
246 def brtarget : Operand<OtherVT> {
247 let PrintMethod = "print_pcrel_imm";
250 def brtarget8 : Operand<OtherVT> {
251 let PrintMethod = "print_pcrel_imm";
254 //===----------------------------------------------------------------------===//
255 // X86 Complex Pattern Definitions.
258 // Define X86 specific addressing mode.
259 def addr : ComplexPattern<iPTR, 5, "SelectAddr", [], []>;
260 def lea32addr : ComplexPattern<i32, 4, "SelectLEAAddr",
261 [add, sub, mul, X86mul_imm, shl, or, frameindex],
263 def tls32addr : ComplexPattern<i32, 4, "SelectTLSADDRAddr",
264 [tglobaltlsaddr], []>;
266 //===----------------------------------------------------------------------===//
267 // X86 Instruction Predicate Definitions.
268 def HasMMX : Predicate<"Subtarget->hasMMX()">;
269 def HasSSE1 : Predicate<"Subtarget->hasSSE1()">;
270 def HasSSE2 : Predicate<"Subtarget->hasSSE2()">;
271 def HasSSE3 : Predicate<"Subtarget->hasSSE3()">;
272 def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">;
273 def HasSSE41 : Predicate<"Subtarget->hasSSE41()">;
274 def HasSSE42 : Predicate<"Subtarget->hasSSE42()">;
275 def HasSSE4A : Predicate<"Subtarget->hasSSE4A()">;
276 def HasAVX : Predicate<"Subtarget->hasAVX()">;
277 def HasFMA3 : Predicate<"Subtarget->hasFMA3()">;
278 def HasFMA4 : Predicate<"Subtarget->hasFMA4()">;
279 def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">;
280 def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">;
281 def In32BitMode : Predicate<"!Subtarget->is64Bit()">;
282 def In64BitMode : Predicate<"Subtarget->is64Bit()">;
283 def IsWin64 : Predicate<"Subtarget->isTargetWin64()">;
284 def NotWin64 : Predicate<"!Subtarget->isTargetWin64()">;
285 def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">;
286 def KernelCode : Predicate<"TM.getCodeModel() == CodeModel::Kernel">;
287 def FarData : Predicate<"TM.getCodeModel() != CodeModel::Small &&"
288 "TM.getCodeModel() != CodeModel::Kernel">;
289 def NearData : Predicate<"TM.getCodeModel() == CodeModel::Small ||"
290 "TM.getCodeModel() == CodeModel::Kernel">;
291 def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">;
292 def OptForSpeed : Predicate<"!OptForSize">;
293 def FastBTMem : Predicate<"!Subtarget->isBTMemSlow()">;
294 def CallImmAddr : Predicate<"Subtarget->IsLegalToCallImmediateAddr(TM)">;
296 //===----------------------------------------------------------------------===//
297 // X86 Instruction Format Definitions.
300 include "X86InstrFormats.td"
302 //===----------------------------------------------------------------------===//
303 // Pattern fragments...
306 // X86 specific condition code. These correspond to CondCode in
307 // X86InstrInfo.h. They must be kept in synch.
308 def X86_COND_A : PatLeaf<(i8 0)>; // alt. COND_NBE
309 def X86_COND_AE : PatLeaf<(i8 1)>; // alt. COND_NC
310 def X86_COND_B : PatLeaf<(i8 2)>; // alt. COND_C
311 def X86_COND_BE : PatLeaf<(i8 3)>; // alt. COND_NA
312 def X86_COND_E : PatLeaf<(i8 4)>; // alt. COND_Z
313 def X86_COND_G : PatLeaf<(i8 5)>; // alt. COND_NLE
314 def X86_COND_GE : PatLeaf<(i8 6)>; // alt. COND_NL
315 def X86_COND_L : PatLeaf<(i8 7)>; // alt. COND_NGE
316 def X86_COND_LE : PatLeaf<(i8 8)>; // alt. COND_NG
317 def X86_COND_NE : PatLeaf<(i8 9)>; // alt. COND_NZ
318 def X86_COND_NO : PatLeaf<(i8 10)>;
319 def X86_COND_NP : PatLeaf<(i8 11)>; // alt. COND_PO
320 def X86_COND_NS : PatLeaf<(i8 12)>;
321 def X86_COND_O : PatLeaf<(i8 13)>;
322 def X86_COND_P : PatLeaf<(i8 14)>; // alt. COND_PE
323 def X86_COND_S : PatLeaf<(i8 15)>;
325 def i16immSExt8 : PatLeaf<(i16 imm), [{
326 // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
327 // sign extended field.
328 return (int16_t)N->getZExtValue() == (int8_t)N->getZExtValue();
331 def i32immSExt8 : PatLeaf<(i32 imm), [{
332 // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
333 // sign extended field.
334 return (int32_t)N->getZExtValue() == (int8_t)N->getZExtValue();
337 // Helper fragments for loads.
338 // It's always safe to treat a anyext i16 load as a i32 load if the i16 is
339 // known to be 32-bit aligned or better. Ditto for i8 to i16.
340 def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{
341 LoadSDNode *LD = cast<LoadSDNode>(N);
342 if (const Value *Src = LD->getSrcValue())
343 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
344 if (PT->getAddressSpace() > 255)
346 ISD::LoadExtType ExtType = LD->getExtensionType();
347 if (ExtType == ISD::NON_EXTLOAD)
349 if (ExtType == ISD::EXTLOAD)
350 return LD->getAlignment() >= 2 && !LD->isVolatile();
354 def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
355 LoadSDNode *LD = cast<LoadSDNode>(N);
356 if (const Value *Src = LD->getSrcValue())
357 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
358 if (PT->getAddressSpace() > 255)
360 ISD::LoadExtType ExtType = LD->getExtensionType();
361 if (ExtType == ISD::EXTLOAD)
362 return LD->getAlignment() >= 2 && !LD->isVolatile();
366 def loadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
367 LoadSDNode *LD = cast<LoadSDNode>(N);
368 if (const Value *Src = LD->getSrcValue())
369 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
370 if (PT->getAddressSpace() > 255)
372 ISD::LoadExtType ExtType = LD->getExtensionType();
373 if (ExtType == ISD::NON_EXTLOAD)
375 if (ExtType == ISD::EXTLOAD)
376 return LD->getAlignment() >= 4 && !LD->isVolatile();
380 def nvloadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
381 LoadSDNode *LD = cast<LoadSDNode>(N);
382 if (const Value *Src = LD->getSrcValue())
383 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
384 if (PT->getAddressSpace() > 255)
386 if (LD->isVolatile())
388 ISD::LoadExtType ExtType = LD->getExtensionType();
389 if (ExtType == ISD::NON_EXTLOAD)
391 if (ExtType == ISD::EXTLOAD)
392 return LD->getAlignment() >= 4;
396 def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
397 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
398 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
399 return PT->getAddressSpace() == 256;
403 def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
404 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
405 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
406 return PT->getAddressSpace() == 257;
410 def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr)), [{
411 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
412 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
413 if (PT->getAddressSpace() > 255)
417 def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr)), [{
418 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
419 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
420 if (PT->getAddressSpace() > 255)
425 def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr)), [{
426 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
427 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
428 if (PT->getAddressSpace() > 255)
432 def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr)), [{
433 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
434 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
435 if (PT->getAddressSpace() > 255)
439 def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr)), [{
440 if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
441 if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
442 if (PT->getAddressSpace() > 255)
447 def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
448 def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
449 def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>;
451 def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>;
452 def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>;
453 def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>;
454 def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
455 def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>;
456 def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>;
458 def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>;
459 def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>;
460 def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>;
461 def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>;
462 def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>;
463 def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
466 // An 'and' node with a single use.
467 def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{
468 return N->hasOneUse();
470 // An 'srl' node with a single use.
471 def srl_su : PatFrag<(ops node:$lhs, node:$rhs), (srl node:$lhs, node:$rhs), [{
472 return N->hasOneUse();
474 // An 'trunc' node with a single use.
475 def trunc_su : PatFrag<(ops node:$src), (trunc node:$src), [{
476 return N->hasOneUse();
479 // 'shld' and 'shrd' instruction patterns. Note that even though these have
480 // the srl and shl in their patterns, the C++ code must still check for them,
481 // because predicates are tested before children nodes are explored.
483 def shrd : PatFrag<(ops node:$src1, node:$amt1, node:$src2, node:$amt2),
484 (or (srl node:$src1, node:$amt1),
485 (shl node:$src2, node:$amt2)), [{
486 assert(N->getOpcode() == ISD::OR);
487 return N->getOperand(0).getOpcode() == ISD::SRL &&
488 N->getOperand(1).getOpcode() == ISD::SHL &&
489 isa<ConstantSDNode>(N->getOperand(0).getOperand(1)) &&
490 isa<ConstantSDNode>(N->getOperand(1).getOperand(1)) &&
491 N->getOperand(0).getConstantOperandVal(1) ==
492 N->getValueSizeInBits(0) - N->getOperand(1).getConstantOperandVal(1);
495 def shld : PatFrag<(ops node:$src1, node:$amt1, node:$src2, node:$amt2),
496 (or (shl node:$src1, node:$amt1),
497 (srl node:$src2, node:$amt2)), [{
498 assert(N->getOpcode() == ISD::OR);
499 return N->getOperand(0).getOpcode() == ISD::SHL &&
500 N->getOperand(1).getOpcode() == ISD::SRL &&
501 isa<ConstantSDNode>(N->getOperand(0).getOperand(1)) &&
502 isa<ConstantSDNode>(N->getOperand(1).getOperand(1)) &&
503 N->getOperand(0).getConstantOperandVal(1) ==
504 N->getValueSizeInBits(0) - N->getOperand(1).getConstantOperandVal(1);
507 //===----------------------------------------------------------------------===//
508 // Instruction list...
511 // ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into
512 // a stack adjustment and the codegen must know that they may modify the stack
513 // pointer before prolog-epilog rewriting occurs.
514 // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become
515 // sub / add which can clobber EFLAGS.
516 let Defs = [ESP, EFLAGS], Uses = [ESP] in {
517 def ADJCALLSTACKDOWN32 : I<0, Pseudo, (outs), (ins i32imm:$amt),
519 [(X86callseq_start timm:$amt)]>,
520 Requires<[In32BitMode]>;
521 def ADJCALLSTACKUP32 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
523 [(X86callseq_end timm:$amt1, timm:$amt2)]>,
524 Requires<[In32BitMode]>;
527 // x86-64 va_start lowering magic.
528 let usesCustomDAGSchedInserter = 1 in
529 def VASTART_SAVE_XMM_REGS : I<0, Pseudo,
532 i64imm:$regsavefi, i64imm:$offset,
534 "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset",
535 [(X86vastart_save_xmm_regs GR8:$al,
540 let neverHasSideEffects = 1 in {
541 def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
542 def NOOPL : I<0x1f, MRM0m, (outs), (ins i32mem:$zero),
543 "nopl\t$zero", []>, TB;
547 def INT3 : I<0xcc, RawFrm, (outs), (ins), "int 3", []>;
548 def INT : I<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap", []>;
551 let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in
552 def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel:$label),
556 //===----------------------------------------------------------------------===//
557 // Control Flow Instructions...
560 // Return instructions.
561 let isTerminator = 1, isReturn = 1, isBarrier = 1,
562 hasCtrlDep = 1, FPForm = SpecialFP, FPFormBits = SpecialFP.Value in {
563 def RET : I <0xC3, RawFrm, (outs), (ins variable_ops),
566 def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops),
568 [(X86retflag timm:$amt)]>;
571 // All branches are RawFrm, Void, Branch, and Terminators
572 let isBranch = 1, isTerminator = 1 in
573 class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> :
574 I<opcode, RawFrm, (outs), ins, asm, pattern>;
576 let isBranch = 1, isBarrier = 1 in {
577 def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
578 def JMP8 : IBr<0xEB, (ins brtarget8:$dst), "jmp\t$dst", []>;
582 let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
583 def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
584 [(brind GR32:$dst)]>;
585 def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
586 [(brind (loadi32 addr:$dst))]>;
587 def FARJMP16 : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst),
588 "ljmp{w}\t{*}$dst", []>, OpSize;
589 def FARJMP32 : I<0xFF, MRM5m, (outs), (ins opaque48mem:$dst),
590 "ljmp{l}\t{*}$dst", []>;
593 // Conditional branches
594 let Uses = [EFLAGS] in {
595 // Short conditional jumps
596 def JO8 : IBr<0x70, (ins brtarget8:$dst), "jo\t$dst", []>;
597 def JNO8 : IBr<0x71, (ins brtarget8:$dst), "jno\t$dst", []>;
598 def JB8 : IBr<0x72, (ins brtarget8:$dst), "jb\t$dst", []>;
599 def JAE8 : IBr<0x73, (ins brtarget8:$dst), "jae\t$dst", []>;
600 def JE8 : IBr<0x74, (ins brtarget8:$dst), "je\t$dst", []>;
601 def JNE8 : IBr<0x75, (ins brtarget8:$dst), "jne\t$dst", []>;
602 def JBE8 : IBr<0x76, (ins brtarget8:$dst), "jbe\t$dst", []>;
603 def JA8 : IBr<0x77, (ins brtarget8:$dst), "ja\t$dst", []>;
604 def JS8 : IBr<0x78, (ins brtarget8:$dst), "js\t$dst", []>;
605 def JNS8 : IBr<0x79, (ins brtarget8:$dst), "jns\t$dst", []>;
606 def JP8 : IBr<0x7A, (ins brtarget8:$dst), "jp\t$dst", []>;
607 def JNP8 : IBr<0x7B, (ins brtarget8:$dst), "jnp\t$dst", []>;
608 def JL8 : IBr<0x7C, (ins brtarget8:$dst), "jl\t$dst", []>;
609 def JGE8 : IBr<0x7D, (ins brtarget8:$dst), "jge\t$dst", []>;
610 def JLE8 : IBr<0x7E, (ins brtarget8:$dst), "jle\t$dst", []>;
611 def JG8 : IBr<0x7F, (ins brtarget8:$dst), "jg\t$dst", []>;
613 def JCXZ8 : IBr<0xE3, (ins brtarget8:$dst), "jcxz\t$dst", []>;
615 def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
616 [(X86brcond bb:$dst, X86_COND_E, EFLAGS)]>, TB;
617 def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
618 [(X86brcond bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
619 def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
620 [(X86brcond bb:$dst, X86_COND_L, EFLAGS)]>, TB;
621 def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
622 [(X86brcond bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
623 def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
624 [(X86brcond bb:$dst, X86_COND_G, EFLAGS)]>, TB;
625 def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
626 [(X86brcond bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
628 def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
629 [(X86brcond bb:$dst, X86_COND_B, EFLAGS)]>, TB;
630 def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
631 [(X86brcond bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
632 def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
633 [(X86brcond bb:$dst, X86_COND_A, EFLAGS)]>, TB;
634 def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
635 [(X86brcond bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
637 def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
638 [(X86brcond bb:$dst, X86_COND_S, EFLAGS)]>, TB;
639 def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
640 [(X86brcond bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
641 def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
642 [(X86brcond bb:$dst, X86_COND_P, EFLAGS)]>, TB;
643 def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
644 [(X86brcond bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
645 def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
646 [(X86brcond bb:$dst, X86_COND_O, EFLAGS)]>, TB;
647 def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
648 [(X86brcond bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
651 //===----------------------------------------------------------------------===//
652 // Call Instructions...
655 // All calls clobber the non-callee saved registers. ESP is marked as
656 // a use to prevent stack-pointer assignments that appear immediately
657 // before calls from potentially appearing dead. Uses for argument
658 // registers are added manually.
659 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
660 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
661 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
662 XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS],
664 def CALLpcrel32 : Ii32<0xE8, RawFrm,
665 (outs), (ins i32imm_pcrel:$dst,variable_ops),
667 def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
668 "call\t{*}$dst", [(X86call GR32:$dst)]>;
669 def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
670 "call\t{*}$dst", [(X86call (loadi32 addr:$dst))]>;
672 def FARCALL16 : I<0xFF, MRM3m, (outs), (ins opaque32mem:$dst),
673 "lcall{w}\t{*}$dst", []>, OpSize;
674 def FARCALL32 : I<0xFF, MRM3m, (outs), (ins opaque48mem:$dst),
675 "lcall{l}\t{*}$dst", []>;
680 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
681 def TCRETURNdi : I<0, Pseudo, (outs), (ins i32imm:$dst, i32imm:$offset, variable_ops),
682 "#TC_RETURN $dst $offset",
685 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
686 def TCRETURNri : I<0, Pseudo, (outs), (ins GR32:$dst, i32imm:$offset, variable_ops),
687 "#TC_RETURN $dst $offset",
690 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
692 def TAILJMPd : IBr<0xE9, (ins i32imm_pcrel:$dst), "jmp\t$dst # TAILCALL",
694 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
695 def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst # TAILCALL",
697 let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
698 def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst),
699 "jmp\t{*}$dst # TAILCALL", []>;
701 //===----------------------------------------------------------------------===//
702 // Miscellaneous Instructions...
704 let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in
705 def LEAVE : I<0xC9, RawFrm,
706 (outs), (ins), "leave", []>;
708 let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in {
710 def POP16r : I<0x58, AddRegFrm, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
712 def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
713 def POP16rmr: I<0x8F, MRM0r, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
715 def POP16rmm: I<0x8F, MRM0m, (outs i16mem:$dst), (ins), "pop{w}\t$dst", []>,
717 def POP32rmr: I<0x8F, MRM0r, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
718 def POP32rmm: I<0x8F, MRM0m, (outs i32mem:$dst), (ins), "pop{l}\t$dst", []>;
721 let mayStore = 1 in {
722 def PUSH16r : I<0x50, AddRegFrm, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
724 def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
725 def PUSH16rmr: I<0xFF, MRM6r, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
727 def PUSH16rmm: I<0xFF, MRM6m, (outs), (ins i16mem:$src), "push{w}\t$src",[]>,
729 def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
730 def PUSH32rmm: I<0xFF, MRM6m, (outs), (ins i32mem:$src), "push{l}\t$src",[]>;
734 let Defs = [ESP], Uses = [ESP], neverHasSideEffects = 1, mayStore = 1 in {
735 def PUSH32i8 : Ii8<0x6a, RawFrm, (outs), (ins i8imm:$imm),
736 "push{l}\t$imm", []>;
737 def PUSH32i16 : Ii16<0x68, RawFrm, (outs), (ins i16imm:$imm),
738 "push{l}\t$imm", []>;
739 def PUSH32i32 : Ii32<0x68, RawFrm, (outs), (ins i32imm:$imm),
740 "push{l}\t$imm", []>;
743 let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in
744 def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
745 let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in
746 def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
748 let isTwoAddress = 1 in // GR32 = bswap GR32
749 def BSWAP32r : I<0xC8, AddRegFrm,
750 (outs GR32:$dst), (ins GR32:$src),
752 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
755 // Bit scan instructions.
756 let Defs = [EFLAGS] in {
757 def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
758 "bsf{w}\t{$src, $dst|$dst, $src}",
759 [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB;
760 def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
761 "bsf{w}\t{$src, $dst|$dst, $src}",
762 [(set GR16:$dst, (X86bsf (loadi16 addr:$src))),
763 (implicit EFLAGS)]>, TB;
764 def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
765 "bsf{l}\t{$src, $dst|$dst, $src}",
766 [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB;
767 def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
768 "bsf{l}\t{$src, $dst|$dst, $src}",
769 [(set GR32:$dst, (X86bsf (loadi32 addr:$src))),
770 (implicit EFLAGS)]>, TB;
772 def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
773 "bsr{w}\t{$src, $dst|$dst, $src}",
774 [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB;
775 def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
776 "bsr{w}\t{$src, $dst|$dst, $src}",
777 [(set GR16:$dst, (X86bsr (loadi16 addr:$src))),
778 (implicit EFLAGS)]>, TB;
779 def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
780 "bsr{l}\t{$src, $dst|$dst, $src}",
781 [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB;
782 def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
783 "bsr{l}\t{$src, $dst|$dst, $src}",
784 [(set GR32:$dst, (X86bsr (loadi32 addr:$src))),
785 (implicit EFLAGS)]>, TB;
788 let neverHasSideEffects = 1 in
789 def LEA16r : I<0x8D, MRMSrcMem,
790 (outs GR16:$dst), (ins i32mem:$src),
791 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
792 let isReMaterializable = 1 in
793 def LEA32r : I<0x8D, MRMSrcMem,
794 (outs GR32:$dst), (ins lea32mem:$src),
795 "lea{l}\t{$src|$dst}, {$dst|$src}",
796 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
798 let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
799 def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
800 [(X86rep_movs i8)]>, REP;
801 def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
802 [(X86rep_movs i16)]>, REP, OpSize;
803 def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
804 [(X86rep_movs i32)]>, REP;
807 let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
808 def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
809 [(X86rep_stos i8)]>, REP;
810 let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
811 def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
812 [(X86rep_stos i16)]>, REP, OpSize;
813 let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
814 def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
815 [(X86rep_stos i32)]>, REP;
817 def SCAS8 : I<0xAE, RawFrm, (outs), (ins), "scas{b}", []>;
818 def SCAS16 : I<0xAF, RawFrm, (outs), (ins), "scas{w}", []>, OpSize;
819 def SCAS32 : I<0xAF, RawFrm, (outs), (ins), "scas{l}", []>;
821 def CMPS8 : I<0xA6, RawFrm, (outs), (ins), "cmps{b}", []>;
822 def CMPS16 : I<0xA7, RawFrm, (outs), (ins), "cmps{w}", []>, OpSize;
823 def CMPS32 : I<0xA7, RawFrm, (outs), (ins), "cmps{l}", []>;
825 let Defs = [RAX, RDX] in
826 def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
829 let isBarrier = 1, hasCtrlDep = 1 in {
830 def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB;
833 def SYSCALL : I<0x05, RawFrm,
834 (outs), (ins), "syscall", []>, TB;
835 def SYSRET : I<0x07, RawFrm,
836 (outs), (ins), "sysret", []>, TB;
837 def SYSENTER : I<0x34, RawFrm,
838 (outs), (ins), "sysenter", []>, TB;
839 def SYSEXIT : I<0x35, RawFrm,
840 (outs), (ins), "sysexit", []>, TB;
842 def WAIT : I<0x9B, RawFrm, (outs), (ins), "wait", []>;
845 //===----------------------------------------------------------------------===//
846 // Input/Output Instructions...
848 let Defs = [AL], Uses = [DX] in
849 def IN8rr : I<0xEC, RawFrm, (outs), (ins),
850 "in{b}\t{%dx, %al|%AL, %DX}", []>;
851 let Defs = [AX], Uses = [DX] in
852 def IN16rr : I<0xED, RawFrm, (outs), (ins),
853 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
854 let Defs = [EAX], Uses = [DX] in
855 def IN32rr : I<0xED, RawFrm, (outs), (ins),
856 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
859 def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
860 "in{b}\t{$port, %al|%AL, $port}", []>;
862 def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
863 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
865 def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
866 "in{l}\t{$port, %eax|%EAX, $port}", []>;
868 let Uses = [DX, AL] in
869 def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
870 "out{b}\t{%al, %dx|%DX, %AL}", []>;
871 let Uses = [DX, AX] in
872 def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
873 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
874 let Uses = [DX, EAX] in
875 def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
876 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
879 def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
880 "out{b}\t{%al, $port|$port, %AL}", []>;
882 def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
883 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
885 def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
886 "out{l}\t{%eax, $port|$port, %EAX}", []>;
888 //===----------------------------------------------------------------------===//
889 // Move Instructions...
891 let neverHasSideEffects = 1 in {
892 def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
893 "mov{b}\t{$src, $dst|$dst, $src}", []>;
894 def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
895 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
896 def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
897 "mov{l}\t{$src, $dst|$dst, $src}", []>;
899 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
900 def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
901 "mov{b}\t{$src, $dst|$dst, $src}",
902 [(set GR8:$dst, imm:$src)]>;
903 def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
904 "mov{w}\t{$src, $dst|$dst, $src}",
905 [(set GR16:$dst, imm:$src)]>, OpSize;
906 def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
907 "mov{l}\t{$src, $dst|$dst, $src}",
908 [(set GR32:$dst, imm:$src)]>;
910 def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
911 "mov{b}\t{$src, $dst|$dst, $src}",
912 [(store (i8 imm:$src), addr:$dst)]>;
913 def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
914 "mov{w}\t{$src, $dst|$dst, $src}",
915 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
916 def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
917 "mov{l}\t{$src, $dst|$dst, $src}",
918 [(store (i32 imm:$src), addr:$dst)]>;
920 def MOV8o8a : Ii8 <0xA0, RawFrm, (outs), (ins i8imm:$src),
921 "mov{b}\t{$src, %al|%al, $src}", []>;
922 def MOV16o16a : Ii16 <0xA1, RawFrm, (outs), (ins i16imm:$src),
923 "mov{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
924 def MOV32o32a : Ii32 <0xA1, RawFrm, (outs), (ins i32imm:$src),
925 "mov{l}\t{$src, %eax|%eax, $src}", []>;
927 def MOV8ao8 : Ii8 <0xA2, RawFrm, (outs i8imm:$dst), (ins),
928 "mov{b}\t{%al, $dst|$dst, %al}", []>;
929 def MOV16ao16 : Ii16 <0xA3, RawFrm, (outs i16imm:$dst), (ins),
930 "mov{w}\t{%ax, $dst|$dst, %ax}", []>, OpSize;
931 def MOV32ao32 : Ii32 <0xA3, RawFrm, (outs i32imm:$dst), (ins),
932 "mov{l}\t{%eax, $dst|$dst, %eax}", []>;
934 let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
935 def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
936 "mov{b}\t{$src, $dst|$dst, $src}",
937 [(set GR8:$dst, (loadi8 addr:$src))]>;
938 def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
939 "mov{w}\t{$src, $dst|$dst, $src}",
940 [(set GR16:$dst, (loadi16 addr:$src))]>, OpSize;
941 def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
942 "mov{l}\t{$src, $dst|$dst, $src}",
943 [(set GR32:$dst, (loadi32 addr:$src))]>;
946 def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
947 "mov{b}\t{$src, $dst|$dst, $src}",
948 [(store GR8:$src, addr:$dst)]>;
949 def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
950 "mov{w}\t{$src, $dst|$dst, $src}",
951 [(store GR16:$src, addr:$dst)]>, OpSize;
952 def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
953 "mov{l}\t{$src, $dst|$dst, $src}",
954 [(store GR32:$src, addr:$dst)]>;
956 // Versions of MOV8rr, MOV8mr, and MOV8rm that use i8mem_NOREX and GR8_NOREX so
957 // that they can be used for copying and storing h registers, which can't be
958 // encoded when a REX prefix is present.
959 let neverHasSideEffects = 1 in
960 def MOV8rr_NOREX : I<0x88, MRMDestReg,
961 (outs GR8_NOREX:$dst), (ins GR8_NOREX:$src),
962 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
964 def MOV8mr_NOREX : I<0x88, MRMDestMem,
965 (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src),
966 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
968 canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
969 def MOV8rm_NOREX : I<0x8A, MRMSrcMem,
970 (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src),
971 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
973 //===----------------------------------------------------------------------===//
974 // Fixed-Register Multiplication and Division Instructions...
977 // Extra precision multiplication
978 let Defs = [AL,AH,EFLAGS], Uses = [AL] in
979 def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
980 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
981 // This probably ought to be moved to a def : Pat<> if the
982 // syntax can be accepted.
983 [(set AL, (mul AL, GR8:$src)),
984 (implicit EFLAGS)]>; // AL,AH = AL*GR8
986 let Defs = [AX,DX,EFLAGS], Uses = [AX], neverHasSideEffects = 1 in
987 def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src),
989 []>, OpSize; // AX,DX = AX*GR16
991 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], neverHasSideEffects = 1 in
992 def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src),
994 []>; // EAX,EDX = EAX*GR32
996 let Defs = [AL,AH,EFLAGS], Uses = [AL] in
997 def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
999 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
1000 // This probably ought to be moved to a def : Pat<> if the
1001 // syntax can be accepted.
1002 [(set AL, (mul AL, (loadi8 addr:$src))),
1003 (implicit EFLAGS)]>; // AL,AH = AL*[mem8]
1005 let mayLoad = 1, neverHasSideEffects = 1 in {
1006 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
1007 def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
1009 []>, OpSize; // AX,DX = AX*[mem16]
1011 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
1012 def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
1014 []>; // EAX,EDX = EAX*[mem32]
1017 let neverHasSideEffects = 1 in {
1018 let Defs = [AL,AH,EFLAGS], Uses = [AL] in
1019 def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
1021 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
1022 def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
1023 OpSize; // AX,DX = AX*GR16
1024 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
1025 def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
1026 // EAX,EDX = EAX*GR32
1027 let mayLoad = 1 in {
1028 let Defs = [AL,AH,EFLAGS], Uses = [AL] in
1029 def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
1030 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
1031 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
1032 def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
1033 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
1034 let Defs = [EAX,EDX], Uses = [EAX] in
1035 def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
1036 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
1038 } // neverHasSideEffects
1040 // unsigned division/remainder
1041 let Defs = [AL,AH,EFLAGS], Uses = [AX] in
1042 def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
1043 "div{b}\t$src", []>;
1044 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
1045 def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
1046 "div{w}\t$src", []>, OpSize;
1047 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
1048 def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
1049 "div{l}\t$src", []>;
1050 let mayLoad = 1 in {
1051 let Defs = [AL,AH,EFLAGS], Uses = [AX] in
1052 def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
1053 "div{b}\t$src", []>;
1054 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
1055 def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
1056 "div{w}\t$src", []>, OpSize;
1057 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
1058 def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
1059 "div{l}\t$src", []>;
1062 // Signed division/remainder.
1063 let Defs = [AL,AH,EFLAGS], Uses = [AX] in
1064 def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
1065 "idiv{b}\t$src", []>;
1066 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
1067 def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
1068 "idiv{w}\t$src", []>, OpSize;
1069 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
1070 def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
1071 "idiv{l}\t$src", []>;
1072 let mayLoad = 1, mayLoad = 1 in {
1073 let Defs = [AL,AH,EFLAGS], Uses = [AX] in
1074 def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
1075 "idiv{b}\t$src", []>;
1076 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
1077 def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
1078 "idiv{w}\t$src", []>, OpSize;
1079 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
1080 def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
1081 "idiv{l}\t$src", []>;
1084 //===----------------------------------------------------------------------===//
1085 // Two address Instructions.
1087 let isTwoAddress = 1 in {
1089 // Conditional moves
1090 let Uses = [EFLAGS] in {
1092 // X86 doesn't have 8-bit conditional moves. Use a customDAGSchedInserter to
1093 // emit control flow. An alternative to this is to mark i8 SELECT as Promote,
1094 // however that requires promoting the operands, and can induce additional
1095 // i8 register pressure. Note that CMOV_GR8 is conservatively considered to
1096 // clobber EFLAGS, because if one of the operands is zero, the expansion
1097 // could involve an xor.
1098 let usesCustomDAGSchedInserter = 1, isTwoAddress = 0, Defs = [EFLAGS] in
1099 def CMOV_GR8 : I<0, Pseudo,
1100 (outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cond),
1101 "#CMOV_GR8 PSEUDO!",
1102 [(set GR8:$dst, (X86cmov GR8:$src1, GR8:$src2,
1103 imm:$cond, EFLAGS))]>;
1105 let isCommutable = 1 in {
1106 def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
1107 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1108 "cmovb\t{$src2, $dst|$dst, $src2}",
1109 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1110 X86_COND_B, EFLAGS))]>,
1112 def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
1113 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1114 "cmovb\t{$src2, $dst|$dst, $src2}",
1115 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1116 X86_COND_B, EFLAGS))]>,
1118 def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
1119 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1120 "cmovae\t{$src2, $dst|$dst, $src2}",
1121 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1122 X86_COND_AE, EFLAGS))]>,
1124 def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
1125 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1126 "cmovae\t{$src2, $dst|$dst, $src2}",
1127 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1128 X86_COND_AE, EFLAGS))]>,
1130 def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
1131 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1132 "cmove\t{$src2, $dst|$dst, $src2}",
1133 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1134 X86_COND_E, EFLAGS))]>,
1136 def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
1137 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1138 "cmove\t{$src2, $dst|$dst, $src2}",
1139 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1140 X86_COND_E, EFLAGS))]>,
1142 def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
1143 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1144 "cmovne\t{$src2, $dst|$dst, $src2}",
1145 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1146 X86_COND_NE, EFLAGS))]>,
1148 def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
1149 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1150 "cmovne\t{$src2, $dst|$dst, $src2}",
1151 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1152 X86_COND_NE, EFLAGS))]>,
1154 def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
1155 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1156 "cmovbe\t{$src2, $dst|$dst, $src2}",
1157 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1158 X86_COND_BE, EFLAGS))]>,
1160 def 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 GR32:$src1, GR32:$src2,
1164 X86_COND_BE, EFLAGS))]>,
1166 def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
1167 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1168 "cmova\t{$src2, $dst|$dst, $src2}",
1169 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1170 X86_COND_A, EFLAGS))]>,
1172 def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
1173 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1174 "cmova\t{$src2, $dst|$dst, $src2}",
1175 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1176 X86_COND_A, EFLAGS))]>,
1178 def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
1179 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1180 "cmovl\t{$src2, $dst|$dst, $src2}",
1181 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1182 X86_COND_L, EFLAGS))]>,
1184 def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
1185 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1186 "cmovl\t{$src2, $dst|$dst, $src2}",
1187 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1188 X86_COND_L, EFLAGS))]>,
1190 def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
1191 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1192 "cmovge\t{$src2, $dst|$dst, $src2}",
1193 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1194 X86_COND_GE, EFLAGS))]>,
1196 def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
1197 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1198 "cmovge\t{$src2, $dst|$dst, $src2}",
1199 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1200 X86_COND_GE, EFLAGS))]>,
1202 def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
1203 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1204 "cmovle\t{$src2, $dst|$dst, $src2}",
1205 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1206 X86_COND_LE, EFLAGS))]>,
1208 def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
1209 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1210 "cmovle\t{$src2, $dst|$dst, $src2}",
1211 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1212 X86_COND_LE, EFLAGS))]>,
1214 def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
1215 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1216 "cmovg\t{$src2, $dst|$dst, $src2}",
1217 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1218 X86_COND_G, EFLAGS))]>,
1220 def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
1221 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1222 "cmovg\t{$src2, $dst|$dst, $src2}",
1223 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1224 X86_COND_G, EFLAGS))]>,
1226 def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
1227 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1228 "cmovs\t{$src2, $dst|$dst, $src2}",
1229 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1230 X86_COND_S, EFLAGS))]>,
1232 def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
1233 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1234 "cmovs\t{$src2, $dst|$dst, $src2}",
1235 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1236 X86_COND_S, EFLAGS))]>,
1238 def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
1239 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1240 "cmovns\t{$src2, $dst|$dst, $src2}",
1241 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1242 X86_COND_NS, EFLAGS))]>,
1244 def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1245 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1246 "cmovns\t{$src2, $dst|$dst, $src2}",
1247 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1248 X86_COND_NS, EFLAGS))]>,
1250 def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1251 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1252 "cmovp\t{$src2, $dst|$dst, $src2}",
1253 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1254 X86_COND_P, EFLAGS))]>,
1256 def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1257 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1258 "cmovp\t{$src2, $dst|$dst, $src2}",
1259 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1260 X86_COND_P, EFLAGS))]>,
1262 def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1263 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1264 "cmovnp\t{$src2, $dst|$dst, $src2}",
1265 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1266 X86_COND_NP, EFLAGS))]>,
1268 def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1269 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1270 "cmovnp\t{$src2, $dst|$dst, $src2}",
1271 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1272 X86_COND_NP, EFLAGS))]>,
1274 def CMOVO16rr : I<0x40, MRMSrcReg, // if overflow, GR16 = GR16
1275 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1276 "cmovo\t{$src2, $dst|$dst, $src2}",
1277 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1278 X86_COND_O, EFLAGS))]>,
1280 def CMOVO32rr : I<0x40, MRMSrcReg, // if overflow, GR32 = GR32
1281 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1282 "cmovo\t{$src2, $dst|$dst, $src2}",
1283 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1284 X86_COND_O, EFLAGS))]>,
1286 def CMOVNO16rr : I<0x41, MRMSrcReg, // if !overflow, GR16 = GR16
1287 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1288 "cmovno\t{$src2, $dst|$dst, $src2}",
1289 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
1290 X86_COND_NO, EFLAGS))]>,
1292 def CMOVNO32rr : I<0x41, MRMSrcReg, // if !overflow, GR32 = GR32
1293 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1294 "cmovno\t{$src2, $dst|$dst, $src2}",
1295 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
1296 X86_COND_NO, EFLAGS))]>,
1298 } // isCommutable = 1
1300 def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
1301 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1302 "cmovb\t{$src2, $dst|$dst, $src2}",
1303 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1304 X86_COND_B, EFLAGS))]>,
1306 def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
1307 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1308 "cmovb\t{$src2, $dst|$dst, $src2}",
1309 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1310 X86_COND_B, EFLAGS))]>,
1312 def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
1313 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1314 "cmovae\t{$src2, $dst|$dst, $src2}",
1315 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1316 X86_COND_AE, EFLAGS))]>,
1318 def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
1319 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1320 "cmovae\t{$src2, $dst|$dst, $src2}",
1321 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1322 X86_COND_AE, EFLAGS))]>,
1324 def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
1325 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1326 "cmove\t{$src2, $dst|$dst, $src2}",
1327 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1328 X86_COND_E, EFLAGS))]>,
1330 def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
1331 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1332 "cmove\t{$src2, $dst|$dst, $src2}",
1333 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1334 X86_COND_E, EFLAGS))]>,
1336 def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
1337 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1338 "cmovne\t{$src2, $dst|$dst, $src2}",
1339 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1340 X86_COND_NE, EFLAGS))]>,
1342 def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
1343 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1344 "cmovne\t{$src2, $dst|$dst, $src2}",
1345 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1346 X86_COND_NE, EFLAGS))]>,
1348 def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
1349 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1350 "cmovbe\t{$src2, $dst|$dst, $src2}",
1351 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1352 X86_COND_BE, EFLAGS))]>,
1354 def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
1355 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1356 "cmovbe\t{$src2, $dst|$dst, $src2}",
1357 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1358 X86_COND_BE, EFLAGS))]>,
1360 def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
1361 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1362 "cmova\t{$src2, $dst|$dst, $src2}",
1363 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1364 X86_COND_A, EFLAGS))]>,
1366 def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
1367 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1368 "cmova\t{$src2, $dst|$dst, $src2}",
1369 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1370 X86_COND_A, EFLAGS))]>,
1372 def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
1373 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1374 "cmovl\t{$src2, $dst|$dst, $src2}",
1375 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1376 X86_COND_L, EFLAGS))]>,
1378 def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
1379 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1380 "cmovl\t{$src2, $dst|$dst, $src2}",
1381 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1382 X86_COND_L, EFLAGS))]>,
1384 def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
1385 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1386 "cmovge\t{$src2, $dst|$dst, $src2}",
1387 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1388 X86_COND_GE, EFLAGS))]>,
1390 def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
1391 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1392 "cmovge\t{$src2, $dst|$dst, $src2}",
1393 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1394 X86_COND_GE, EFLAGS))]>,
1396 def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
1397 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1398 "cmovle\t{$src2, $dst|$dst, $src2}",
1399 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1400 X86_COND_LE, EFLAGS))]>,
1402 def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1403 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1404 "cmovle\t{$src2, $dst|$dst, $src2}",
1405 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1406 X86_COND_LE, EFLAGS))]>,
1408 def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1409 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1410 "cmovg\t{$src2, $dst|$dst, $src2}",
1411 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1412 X86_COND_G, EFLAGS))]>,
1414 def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1415 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1416 "cmovg\t{$src2, $dst|$dst, $src2}",
1417 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1418 X86_COND_G, EFLAGS))]>,
1420 def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1421 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1422 "cmovs\t{$src2, $dst|$dst, $src2}",
1423 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1424 X86_COND_S, EFLAGS))]>,
1426 def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1427 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1428 "cmovs\t{$src2, $dst|$dst, $src2}",
1429 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1430 X86_COND_S, EFLAGS))]>,
1432 def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1433 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1434 "cmovns\t{$src2, $dst|$dst, $src2}",
1435 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1436 X86_COND_NS, EFLAGS))]>,
1438 def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1439 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1440 "cmovns\t{$src2, $dst|$dst, $src2}",
1441 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1442 X86_COND_NS, EFLAGS))]>,
1444 def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1445 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1446 "cmovp\t{$src2, $dst|$dst, $src2}",
1447 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1448 X86_COND_P, EFLAGS))]>,
1450 def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1451 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1452 "cmovp\t{$src2, $dst|$dst, $src2}",
1453 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1454 X86_COND_P, EFLAGS))]>,
1456 def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1457 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1458 "cmovnp\t{$src2, $dst|$dst, $src2}",
1459 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1460 X86_COND_NP, EFLAGS))]>,
1462 def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1463 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1464 "cmovnp\t{$src2, $dst|$dst, $src2}",
1465 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1466 X86_COND_NP, EFLAGS))]>,
1468 def CMOVO16rm : I<0x40, MRMSrcMem, // if overflow, GR16 = [mem16]
1469 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1470 "cmovo\t{$src2, $dst|$dst, $src2}",
1471 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1472 X86_COND_O, EFLAGS))]>,
1474 def CMOVO32rm : I<0x40, MRMSrcMem, // if overflow, GR32 = [mem32]
1475 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1476 "cmovo\t{$src2, $dst|$dst, $src2}",
1477 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1478 X86_COND_O, EFLAGS))]>,
1480 def CMOVNO16rm : I<0x41, MRMSrcMem, // if !overflow, GR16 = [mem16]
1481 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1482 "cmovno\t{$src2, $dst|$dst, $src2}",
1483 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1484 X86_COND_NO, EFLAGS))]>,
1486 def CMOVNO32rm : I<0x41, MRMSrcMem, // if !overflow, GR32 = [mem32]
1487 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1488 "cmovno\t{$src2, $dst|$dst, $src2}",
1489 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1490 X86_COND_NO, EFLAGS))]>,
1492 } // Uses = [EFLAGS]
1495 // unary instructions
1496 let CodeSize = 2 in {
1497 let Defs = [EFLAGS] in {
1498 def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
1499 [(set GR8:$dst, (ineg GR8:$src)),
1500 (implicit EFLAGS)]>;
1501 def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
1502 [(set GR16:$dst, (ineg GR16:$src)),
1503 (implicit EFLAGS)]>, OpSize;
1504 def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
1505 [(set GR32:$dst, (ineg GR32:$src)),
1506 (implicit EFLAGS)]>;
1507 let isTwoAddress = 0 in {
1508 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
1509 [(store (ineg (loadi8 addr:$dst)), addr:$dst),
1510 (implicit EFLAGS)]>;
1511 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
1512 [(store (ineg (loadi16 addr:$dst)), addr:$dst),
1513 (implicit EFLAGS)]>, OpSize;
1514 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
1515 [(store (ineg (loadi32 addr:$dst)), addr:$dst),
1516 (implicit EFLAGS)]>;
1518 } // Defs = [EFLAGS]
1520 // Match xor -1 to not. Favors these over a move imm + xor to save code size.
1521 let AddedComplexity = 15 in {
1522 def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
1523 [(set GR8:$dst, (not GR8:$src))]>;
1524 def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
1525 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
1526 def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
1527 [(set GR32:$dst, (not GR32:$src))]>;
1529 let isTwoAddress = 0 in {
1530 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
1531 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
1532 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
1533 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
1534 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
1535 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1539 // TODO: inc/dec is slow for P4, but fast for Pentium-M.
1540 let Defs = [EFLAGS] in {
1542 def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
1543 [(set GR8:$dst, (add GR8:$src, 1)),
1544 (implicit EFLAGS)]>;
1545 let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
1546 def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
1547 [(set GR16:$dst, (add GR16:$src, 1)),
1548 (implicit EFLAGS)]>,
1549 OpSize, Requires<[In32BitMode]>;
1550 def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
1551 [(set GR32:$dst, (add GR32:$src, 1)),
1552 (implicit EFLAGS)]>, Requires<[In32BitMode]>;
1554 let isTwoAddress = 0, CodeSize = 2 in {
1555 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
1556 [(store (add (loadi8 addr:$dst), 1), addr:$dst),
1557 (implicit EFLAGS)]>;
1558 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
1559 [(store (add (loadi16 addr:$dst), 1), addr:$dst),
1560 (implicit EFLAGS)]>,
1561 OpSize, Requires<[In32BitMode]>;
1562 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
1563 [(store (add (loadi32 addr:$dst), 1), addr:$dst),
1564 (implicit EFLAGS)]>,
1565 Requires<[In32BitMode]>;
1569 def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
1570 [(set GR8:$dst, (add GR8:$src, -1)),
1571 (implicit EFLAGS)]>;
1572 let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
1573 def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
1574 [(set GR16:$dst, (add GR16:$src, -1)),
1575 (implicit EFLAGS)]>,
1576 OpSize, Requires<[In32BitMode]>;
1577 def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
1578 [(set GR32:$dst, (add GR32:$src, -1)),
1579 (implicit EFLAGS)]>, Requires<[In32BitMode]>;
1582 let isTwoAddress = 0, CodeSize = 2 in {
1583 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
1584 [(store (add (loadi8 addr:$dst), -1), addr:$dst),
1585 (implicit EFLAGS)]>;
1586 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
1587 [(store (add (loadi16 addr:$dst), -1), addr:$dst),
1588 (implicit EFLAGS)]>,
1589 OpSize, Requires<[In32BitMode]>;
1590 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
1591 [(store (add (loadi32 addr:$dst), -1), addr:$dst),
1592 (implicit EFLAGS)]>,
1593 Requires<[In32BitMode]>;
1595 } // Defs = [EFLAGS]
1597 // Logical operators...
1598 let Defs = [EFLAGS] in {
1599 let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1600 def AND8rr : I<0x20, MRMDestReg,
1601 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
1602 "and{b}\t{$src2, $dst|$dst, $src2}",
1603 [(set GR8:$dst, (and GR8:$src1, GR8:$src2)),
1604 (implicit EFLAGS)]>;
1605 def AND16rr : I<0x21, MRMDestReg,
1606 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1607 "and{w}\t{$src2, $dst|$dst, $src2}",
1608 [(set GR16:$dst, (and GR16:$src1, GR16:$src2)),
1609 (implicit EFLAGS)]>, OpSize;
1610 def AND32rr : I<0x21, MRMDestReg,
1611 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1612 "and{l}\t{$src2, $dst|$dst, $src2}",
1613 [(set GR32:$dst, (and GR32:$src1, GR32:$src2)),
1614 (implicit EFLAGS)]>;
1617 def AND8rm : I<0x22, MRMSrcMem,
1618 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
1619 "and{b}\t{$src2, $dst|$dst, $src2}",
1620 [(set GR8:$dst, (and GR8:$src1, (loadi8 addr:$src2))),
1621 (implicit EFLAGS)]>;
1622 def AND16rm : I<0x23, MRMSrcMem,
1623 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1624 "and{w}\t{$src2, $dst|$dst, $src2}",
1625 [(set GR16:$dst, (and GR16:$src1, (loadi16 addr:$src2))),
1626 (implicit EFLAGS)]>, OpSize;
1627 def AND32rm : I<0x23, MRMSrcMem,
1628 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1629 "and{l}\t{$src2, $dst|$dst, $src2}",
1630 [(set GR32:$dst, (and GR32:$src1, (loadi32 addr:$src2))),
1631 (implicit EFLAGS)]>;
1633 def AND8ri : Ii8<0x80, MRM4r,
1634 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
1635 "and{b}\t{$src2, $dst|$dst, $src2}",
1636 [(set GR8:$dst, (and GR8:$src1, imm:$src2)),
1637 (implicit EFLAGS)]>;
1638 def AND16ri : Ii16<0x81, MRM4r,
1639 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
1640 "and{w}\t{$src2, $dst|$dst, $src2}",
1641 [(set GR16:$dst, (and GR16:$src1, imm:$src2)),
1642 (implicit EFLAGS)]>, OpSize;
1643 def AND32ri : Ii32<0x81, MRM4r,
1644 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
1645 "and{l}\t{$src2, $dst|$dst, $src2}",
1646 [(set GR32:$dst, (and GR32:$src1, imm:$src2)),
1647 (implicit EFLAGS)]>;
1648 def AND16ri8 : Ii8<0x83, MRM4r,
1649 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
1650 "and{w}\t{$src2, $dst|$dst, $src2}",
1651 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2)),
1652 (implicit EFLAGS)]>,
1654 def AND32ri8 : Ii8<0x83, MRM4r,
1655 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
1656 "and{l}\t{$src2, $dst|$dst, $src2}",
1657 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2)),
1658 (implicit EFLAGS)]>;
1660 let isTwoAddress = 0 in {
1661 def AND8mr : I<0x20, MRMDestMem,
1662 (outs), (ins i8mem :$dst, GR8 :$src),
1663 "and{b}\t{$src, $dst|$dst, $src}",
1664 [(store (and (load addr:$dst), GR8:$src), addr:$dst),
1665 (implicit EFLAGS)]>;
1666 def AND16mr : I<0x21, MRMDestMem,
1667 (outs), (ins i16mem:$dst, GR16:$src),
1668 "and{w}\t{$src, $dst|$dst, $src}",
1669 [(store (and (load addr:$dst), GR16:$src), addr:$dst),
1670 (implicit EFLAGS)]>,
1672 def AND32mr : I<0x21, MRMDestMem,
1673 (outs), (ins i32mem:$dst, GR32:$src),
1674 "and{l}\t{$src, $dst|$dst, $src}",
1675 [(store (and (load addr:$dst), GR32:$src), addr:$dst),
1676 (implicit EFLAGS)]>;
1677 def AND8mi : Ii8<0x80, MRM4m,
1678 (outs), (ins i8mem :$dst, i8imm :$src),
1679 "and{b}\t{$src, $dst|$dst, $src}",
1680 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst),
1681 (implicit EFLAGS)]>;
1682 def AND16mi : Ii16<0x81, MRM4m,
1683 (outs), (ins i16mem:$dst, i16imm:$src),
1684 "and{w}\t{$src, $dst|$dst, $src}",
1685 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst),
1686 (implicit EFLAGS)]>,
1688 def AND32mi : Ii32<0x81, MRM4m,
1689 (outs), (ins i32mem:$dst, i32imm:$src),
1690 "and{l}\t{$src, $dst|$dst, $src}",
1691 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst),
1692 (implicit EFLAGS)]>;
1693 def AND16mi8 : Ii8<0x83, MRM4m,
1694 (outs), (ins i16mem:$dst, i16i8imm :$src),
1695 "and{w}\t{$src, $dst|$dst, $src}",
1696 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst),
1697 (implicit EFLAGS)]>,
1699 def AND32mi8 : Ii8<0x83, MRM4m,
1700 (outs), (ins i32mem:$dst, i32i8imm :$src),
1701 "and{l}\t{$src, $dst|$dst, $src}",
1702 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst),
1703 (implicit EFLAGS)]>;
1705 def AND8i8 : Ii8<0x24, RawFrm, (outs), (ins i8imm:$src),
1706 "and{b}\t{$src, %al|%al, $src}", []>;
1707 def AND16i16 : Ii16<0x25, RawFrm, (outs), (ins i16imm:$src),
1708 "and{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1709 def AND32i32 : Ii32<0x25, RawFrm, (outs), (ins i32imm:$src),
1710 "and{l}\t{$src, %eax|%eax, $src}", []>;
1715 let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
1716 def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
1717 "or{b}\t{$src2, $dst|$dst, $src2}",
1718 [(set GR8:$dst, (or GR8:$src1, GR8:$src2)),
1719 (implicit EFLAGS)]>;
1720 def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1721 "or{w}\t{$src2, $dst|$dst, $src2}",
1722 [(set GR16:$dst, (or GR16:$src1, GR16:$src2)),
1723 (implicit EFLAGS)]>, OpSize;
1724 def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1725 "or{l}\t{$src2, $dst|$dst, $src2}",
1726 [(set GR32:$dst, (or GR32:$src1, GR32:$src2)),
1727 (implicit EFLAGS)]>;
1729 def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
1730 "or{b}\t{$src2, $dst|$dst, $src2}",
1731 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2))),
1732 (implicit EFLAGS)]>;
1733 def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1734 "or{w}\t{$src2, $dst|$dst, $src2}",
1735 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2))),
1736 (implicit EFLAGS)]>, OpSize;
1737 def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1738 "or{l}\t{$src2, $dst|$dst, $src2}",
1739 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2))),
1740 (implicit EFLAGS)]>;
1742 def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1743 "or{b}\t{$src2, $dst|$dst, $src2}",
1744 [(set GR8:$dst, (or GR8:$src1, imm:$src2)),
1745 (implicit EFLAGS)]>;
1746 def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
1747 "or{w}\t{$src2, $dst|$dst, $src2}",
1748 [(set GR16:$dst, (or GR16:$src1, imm:$src2)),
1749 (implicit EFLAGS)]>, OpSize;
1750 def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
1751 "or{l}\t{$src2, $dst|$dst, $src2}",
1752 [(set GR32:$dst, (or GR32:$src1, imm:$src2)),
1753 (implicit EFLAGS)]>;
1755 def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
1756 "or{w}\t{$src2, $dst|$dst, $src2}",
1757 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2)),
1758 (implicit EFLAGS)]>, OpSize;
1759 def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
1760 "or{l}\t{$src2, $dst|$dst, $src2}",
1761 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2)),
1762 (implicit EFLAGS)]>;
1763 let isTwoAddress = 0 in {
1764 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
1765 "or{b}\t{$src, $dst|$dst, $src}",
1766 [(store (or (load addr:$dst), GR8:$src), addr:$dst),
1767 (implicit EFLAGS)]>;
1768 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
1769 "or{w}\t{$src, $dst|$dst, $src}",
1770 [(store (or (load addr:$dst), GR16:$src), addr:$dst),
1771 (implicit EFLAGS)]>, OpSize;
1772 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
1773 "or{l}\t{$src, $dst|$dst, $src}",
1774 [(store (or (load addr:$dst), GR32:$src), addr:$dst),
1775 (implicit EFLAGS)]>;
1776 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
1777 "or{b}\t{$src, $dst|$dst, $src}",
1778 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst),
1779 (implicit EFLAGS)]>;
1780 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
1781 "or{w}\t{$src, $dst|$dst, $src}",
1782 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst),
1783 (implicit EFLAGS)]>,
1785 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
1786 "or{l}\t{$src, $dst|$dst, $src}",
1787 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst),
1788 (implicit EFLAGS)]>;
1789 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
1790 "or{w}\t{$src, $dst|$dst, $src}",
1791 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst),
1792 (implicit EFLAGS)]>,
1794 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
1795 "or{l}\t{$src, $dst|$dst, $src}",
1796 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst),
1797 (implicit EFLAGS)]>;
1799 def OR8i8 : Ii8 <0x0C, RawFrm, (outs), (ins i8imm:$src),
1800 "or{b}\t{$src, %al|%al, $src}", []>;
1801 def OR16i16 : Ii16 <0x0D, RawFrm, (outs), (ins i16imm:$src),
1802 "or{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1803 def OR32i32 : Ii32 <0x0D, RawFrm, (outs), (ins i32imm:$src),
1804 "or{l}\t{$src, %eax|%eax, $src}", []>;
1805 } // isTwoAddress = 0
1808 let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1809 def XOR8rr : I<0x30, MRMDestReg,
1810 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
1811 "xor{b}\t{$src2, $dst|$dst, $src2}",
1812 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2)),
1813 (implicit EFLAGS)]>;
1814 def XOR16rr : I<0x31, MRMDestReg,
1815 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1816 "xor{w}\t{$src2, $dst|$dst, $src2}",
1817 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2)),
1818 (implicit EFLAGS)]>, OpSize;
1819 def XOR32rr : I<0x31, MRMDestReg,
1820 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1821 "xor{l}\t{$src2, $dst|$dst, $src2}",
1822 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2)),
1823 (implicit EFLAGS)]>;
1824 } // isCommutable = 1
1826 def XOR8rm : I<0x32, MRMSrcMem ,
1827 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
1828 "xor{b}\t{$src2, $dst|$dst, $src2}",
1829 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2))),
1830 (implicit EFLAGS)]>;
1831 def XOR16rm : I<0x33, MRMSrcMem ,
1832 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1833 "xor{w}\t{$src2, $dst|$dst, $src2}",
1834 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2))),
1835 (implicit EFLAGS)]>,
1837 def XOR32rm : I<0x33, MRMSrcMem ,
1838 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1839 "xor{l}\t{$src2, $dst|$dst, $src2}",
1840 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2))),
1841 (implicit EFLAGS)]>;
1843 def XOR8ri : Ii8<0x80, MRM6r,
1844 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
1845 "xor{b}\t{$src2, $dst|$dst, $src2}",
1846 [(set GR8:$dst, (xor GR8:$src1, imm:$src2)),
1847 (implicit EFLAGS)]>;
1848 def XOR16ri : Ii16<0x81, MRM6r,
1849 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
1850 "xor{w}\t{$src2, $dst|$dst, $src2}",
1851 [(set GR16:$dst, (xor GR16:$src1, imm:$src2)),
1852 (implicit EFLAGS)]>, OpSize;
1853 def XOR32ri : Ii32<0x81, MRM6r,
1854 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
1855 "xor{l}\t{$src2, $dst|$dst, $src2}",
1856 [(set GR32:$dst, (xor GR32:$src1, imm:$src2)),
1857 (implicit EFLAGS)]>;
1858 def XOR16ri8 : Ii8<0x83, MRM6r,
1859 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
1860 "xor{w}\t{$src2, $dst|$dst, $src2}",
1861 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2)),
1862 (implicit EFLAGS)]>,
1864 def XOR32ri8 : Ii8<0x83, MRM6r,
1865 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
1866 "xor{l}\t{$src2, $dst|$dst, $src2}",
1867 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2)),
1868 (implicit EFLAGS)]>;
1870 let isTwoAddress = 0 in {
1871 def XOR8mr : I<0x30, MRMDestMem,
1872 (outs), (ins i8mem :$dst, GR8 :$src),
1873 "xor{b}\t{$src, $dst|$dst, $src}",
1874 [(store (xor (load addr:$dst), GR8:$src), addr:$dst),
1875 (implicit EFLAGS)]>;
1876 def XOR16mr : I<0x31, MRMDestMem,
1877 (outs), (ins i16mem:$dst, GR16:$src),
1878 "xor{w}\t{$src, $dst|$dst, $src}",
1879 [(store (xor (load addr:$dst), GR16:$src), addr:$dst),
1880 (implicit EFLAGS)]>,
1882 def XOR32mr : I<0x31, MRMDestMem,
1883 (outs), (ins i32mem:$dst, GR32:$src),
1884 "xor{l}\t{$src, $dst|$dst, $src}",
1885 [(store (xor (load addr:$dst), GR32:$src), addr:$dst),
1886 (implicit EFLAGS)]>;
1887 def XOR8mi : Ii8<0x80, MRM6m,
1888 (outs), (ins i8mem :$dst, i8imm :$src),
1889 "xor{b}\t{$src, $dst|$dst, $src}",
1890 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst),
1891 (implicit EFLAGS)]>;
1892 def XOR16mi : Ii16<0x81, MRM6m,
1893 (outs), (ins i16mem:$dst, i16imm:$src),
1894 "xor{w}\t{$src, $dst|$dst, $src}",
1895 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst),
1896 (implicit EFLAGS)]>,
1898 def XOR32mi : Ii32<0x81, MRM6m,
1899 (outs), (ins i32mem:$dst, i32imm:$src),
1900 "xor{l}\t{$src, $dst|$dst, $src}",
1901 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst),
1902 (implicit EFLAGS)]>;
1903 def XOR16mi8 : Ii8<0x83, MRM6m,
1904 (outs), (ins i16mem:$dst, i16i8imm :$src),
1905 "xor{w}\t{$src, $dst|$dst, $src}",
1906 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst),
1907 (implicit EFLAGS)]>,
1909 def XOR32mi8 : Ii8<0x83, MRM6m,
1910 (outs), (ins i32mem:$dst, i32i8imm :$src),
1911 "xor{l}\t{$src, $dst|$dst, $src}",
1912 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst),
1913 (implicit EFLAGS)]>;
1915 def XOR8i8 : Ii8 <0x34, RawFrm, (outs), (ins i8imm:$src),
1916 "xor{b}\t{$src, %al|%al, $src}", []>;
1917 def XOR16i16 : Ii16 <0x35, RawFrm, (outs), (ins i16imm:$src),
1918 "xor{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1919 def XOR32i32 : Ii32 <0x35, RawFrm, (outs), (ins i32imm:$src),
1920 "xor{l}\t{$src, %eax|%eax, $src}", []>;
1921 } // isTwoAddress = 0
1922 } // Defs = [EFLAGS]
1924 // Shift instructions
1925 let Defs = [EFLAGS] in {
1926 let Uses = [CL] in {
1927 def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
1928 "shl{b}\t{%cl, $dst|$dst, CL}",
1929 [(set GR8:$dst, (shl GR8:$src, CL))]>;
1930 def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
1931 "shl{w}\t{%cl, $dst|$dst, CL}",
1932 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
1933 def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
1934 "shl{l}\t{%cl, $dst|$dst, CL}",
1935 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1938 def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1939 "shl{b}\t{$src2, $dst|$dst, $src2}",
1940 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1941 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
1942 def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1943 "shl{w}\t{$src2, $dst|$dst, $src2}",
1944 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1945 def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1946 "shl{l}\t{$src2, $dst|$dst, $src2}",
1947 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1948 // NOTE: We don't use shifts of a register by one, because 'add reg,reg' is
1950 } // isConvertibleToThreeAddress = 1
1952 let isTwoAddress = 0 in {
1953 let Uses = [CL] in {
1954 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
1955 "shl{b}\t{%cl, $dst|$dst, CL}",
1956 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
1957 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
1958 "shl{w}\t{%cl, $dst|$dst, CL}",
1959 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
1960 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
1961 "shl{l}\t{%cl, $dst|$dst, CL}",
1962 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1964 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
1965 "shl{b}\t{$src, $dst|$dst, $src}",
1966 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1967 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
1968 "shl{w}\t{$src, $dst|$dst, $src}",
1969 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1971 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
1972 "shl{l}\t{$src, $dst|$dst, $src}",
1973 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1976 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
1978 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1979 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
1981 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1983 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
1985 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1988 let Uses = [CL] in {
1989 def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
1990 "shr{b}\t{%cl, $dst|$dst, CL}",
1991 [(set GR8:$dst, (srl GR8:$src, CL))]>;
1992 def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
1993 "shr{w}\t{%cl, $dst|$dst, CL}",
1994 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
1995 def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
1996 "shr{l}\t{%cl, $dst|$dst, CL}",
1997 [(set GR32:$dst, (srl GR32:$src, CL))]>;
2000 def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2001 "shr{b}\t{$src2, $dst|$dst, $src2}",
2002 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
2003 def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
2004 "shr{w}\t{$src2, $dst|$dst, $src2}",
2005 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
2006 def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
2007 "shr{l}\t{$src2, $dst|$dst, $src2}",
2008 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
2011 def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
2013 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
2014 def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
2016 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
2017 def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
2019 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
2021 let isTwoAddress = 0 in {
2022 let Uses = [CL] in {
2023 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
2024 "shr{b}\t{%cl, $dst|$dst, CL}",
2025 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
2026 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
2027 "shr{w}\t{%cl, $dst|$dst, CL}",
2028 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
2030 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
2031 "shr{l}\t{%cl, $dst|$dst, CL}",
2032 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
2034 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
2035 "shr{b}\t{$src, $dst|$dst, $src}",
2036 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2037 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
2038 "shr{w}\t{$src, $dst|$dst, $src}",
2039 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2041 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
2042 "shr{l}\t{$src, $dst|$dst, $src}",
2043 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2046 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
2048 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
2049 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
2051 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
2052 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
2054 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2057 let Uses = [CL] in {
2058 def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
2059 "sar{b}\t{%cl, $dst|$dst, CL}",
2060 [(set GR8:$dst, (sra GR8:$src, CL))]>;
2061 def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
2062 "sar{w}\t{%cl, $dst|$dst, CL}",
2063 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
2064 def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
2065 "sar{l}\t{%cl, $dst|$dst, CL}",
2066 [(set GR32:$dst, (sra GR32:$src, CL))]>;
2069 def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
2070 "sar{b}\t{$src2, $dst|$dst, $src2}",
2071 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
2072 def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
2073 "sar{w}\t{$src2, $dst|$dst, $src2}",
2074 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
2076 def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
2077 "sar{l}\t{$src2, $dst|$dst, $src2}",
2078 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
2081 def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
2083 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
2084 def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
2086 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
2087 def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
2089 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
2091 let isTwoAddress = 0 in {
2092 let Uses = [CL] in {
2093 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
2094 "sar{b}\t{%cl, $dst|$dst, CL}",
2095 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
2096 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
2097 "sar{w}\t{%cl, $dst|$dst, CL}",
2098 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
2099 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
2100 "sar{l}\t{%cl, $dst|$dst, CL}",
2101 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
2103 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
2104 "sar{b}\t{$src, $dst|$dst, $src}",
2105 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2106 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
2107 "sar{w}\t{$src, $dst|$dst, $src}",
2108 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2110 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
2111 "sar{l}\t{$src, $dst|$dst, $src}",
2112 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2115 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
2117 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
2118 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
2120 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2122 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
2124 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2127 // Rotate instructions
2128 // FIXME: provide shorter instructions when imm8 == 1
2129 let Uses = [CL] in {
2130 def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
2131 "rol{b}\t{%cl, $dst|$dst, CL}",
2132 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
2133 def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
2134 "rol{w}\t{%cl, $dst|$dst, CL}",
2135 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
2136 def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
2137 "rol{l}\t{%cl, $dst|$dst, CL}",
2138 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
2141 def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
2142 "rol{b}\t{$src2, $dst|$dst, $src2}",
2143 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
2144 def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
2145 "rol{w}\t{$src2, $dst|$dst, $src2}",
2146 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
2147 def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
2148 "rol{l}\t{$src2, $dst|$dst, $src2}",
2149 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
2152 def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
2154 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
2155 def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
2157 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
2158 def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
2160 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
2162 let isTwoAddress = 0 in {
2163 let Uses = [CL] in {
2164 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
2165 "rol{b}\t{%cl, $dst|$dst, CL}",
2166 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
2167 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
2168 "rol{w}\t{%cl, $dst|$dst, CL}",
2169 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
2170 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
2171 "rol{l}\t{%cl, $dst|$dst, CL}",
2172 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
2174 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
2175 "rol{b}\t{$src, $dst|$dst, $src}",
2176 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2177 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
2178 "rol{w}\t{$src, $dst|$dst, $src}",
2179 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2181 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
2182 "rol{l}\t{$src, $dst|$dst, $src}",
2183 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2186 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
2188 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
2189 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
2191 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2193 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
2195 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2198 let Uses = [CL] in {
2199 def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
2200 "ror{b}\t{%cl, $dst|$dst, CL}",
2201 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
2202 def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
2203 "ror{w}\t{%cl, $dst|$dst, CL}",
2204 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
2205 def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
2206 "ror{l}\t{%cl, $dst|$dst, CL}",
2207 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
2210 def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
2211 "ror{b}\t{$src2, $dst|$dst, $src2}",
2212 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
2213 def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
2214 "ror{w}\t{$src2, $dst|$dst, $src2}",
2215 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
2216 def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
2217 "ror{l}\t{$src2, $dst|$dst, $src2}",
2218 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
2221 def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
2223 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
2224 def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
2226 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
2227 def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
2229 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
2231 let isTwoAddress = 0 in {
2232 let Uses = [CL] in {
2233 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
2234 "ror{b}\t{%cl, $dst|$dst, CL}",
2235 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
2236 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
2237 "ror{w}\t{%cl, $dst|$dst, CL}",
2238 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
2239 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
2240 "ror{l}\t{%cl, $dst|$dst, CL}",
2241 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
2243 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
2244 "ror{b}\t{$src, $dst|$dst, $src}",
2245 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2246 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
2247 "ror{w}\t{$src, $dst|$dst, $src}",
2248 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
2250 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
2251 "ror{l}\t{$src, $dst|$dst, $src}",
2252 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
2255 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
2257 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
2258 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
2260 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
2262 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
2264 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
2269 // Double shift instructions (generalizations of rotate)
2270 let Uses = [CL] in {
2271 def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
2272 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2273 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
2274 def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
2275 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2276 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
2277 def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
2278 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2279 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
2281 def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
2282 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2283 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
2287 let isCommutable = 1 in { // These instructions commute to each other.
2288 def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
2289 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
2290 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2291 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
2294 def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
2295 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
2296 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2297 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
2300 def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
2301 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
2302 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2303 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
2306 def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
2307 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
2308 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2309 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
2314 let isTwoAddress = 0 in {
2315 let Uses = [CL] in {
2316 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2317 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2318 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
2320 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2321 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2322 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
2325 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
2326 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
2327 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2328 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
2329 (i8 imm:$src3)), addr:$dst)]>,
2331 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
2332 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
2333 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2334 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
2335 (i8 imm:$src3)), addr:$dst)]>,
2338 let Uses = [CL] in {
2339 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2340 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2341 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
2342 addr:$dst)]>, TB, OpSize;
2343 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2344 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2345 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
2346 addr:$dst)]>, TB, OpSize;
2348 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
2349 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
2350 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2351 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
2352 (i8 imm:$src3)), addr:$dst)]>,
2354 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
2355 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
2356 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2357 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
2358 (i8 imm:$src3)), addr:$dst)]>,
2361 } // Defs = [EFLAGS]
2365 let Defs = [EFLAGS] in {
2366 let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
2367 // Register-Register Addition
2368 def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
2369 (ins GR8 :$src1, GR8 :$src2),
2370 "add{b}\t{$src2, $dst|$dst, $src2}",
2371 [(set GR8:$dst, (add GR8:$src1, GR8:$src2)),
2372 (implicit EFLAGS)]>;
2374 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
2375 // Register-Register Addition
2376 def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
2377 (ins GR16:$src1, GR16:$src2),
2378 "add{w}\t{$src2, $dst|$dst, $src2}",
2379 [(set GR16:$dst, (add GR16:$src1, GR16:$src2)),
2380 (implicit EFLAGS)]>, OpSize;
2381 def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
2382 (ins GR32:$src1, GR32:$src2),
2383 "add{l}\t{$src2, $dst|$dst, $src2}",
2384 [(set GR32:$dst, (add GR32:$src1, GR32:$src2)),
2385 (implicit EFLAGS)]>;
2386 } // end isConvertibleToThreeAddress
2387 } // end isCommutable
2389 // Register-Memory Addition
2390 def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
2391 (ins GR8 :$src1, i8mem :$src2),
2392 "add{b}\t{$src2, $dst|$dst, $src2}",
2393 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2))),
2394 (implicit EFLAGS)]>;
2395 def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
2396 (ins GR16:$src1, i16mem:$src2),
2397 "add{w}\t{$src2, $dst|$dst, $src2}",
2398 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2))),
2399 (implicit EFLAGS)]>, OpSize;
2400 def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
2401 (ins GR32:$src1, i32mem:$src2),
2402 "add{l}\t{$src2, $dst|$dst, $src2}",
2403 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2))),
2404 (implicit EFLAGS)]>;
2406 // Register-Integer Addition
2407 def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2408 "add{b}\t{$src2, $dst|$dst, $src2}",
2409 [(set GR8:$dst, (add GR8:$src1, imm:$src2)),
2410 (implicit EFLAGS)]>;
2412 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
2413 // Register-Integer Addition
2414 def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
2415 (ins GR16:$src1, i16imm:$src2),
2416 "add{w}\t{$src2, $dst|$dst, $src2}",
2417 [(set GR16:$dst, (add GR16:$src1, imm:$src2)),
2418 (implicit EFLAGS)]>, OpSize;
2419 def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
2420 (ins GR32:$src1, i32imm:$src2),
2421 "add{l}\t{$src2, $dst|$dst, $src2}",
2422 [(set GR32:$dst, (add GR32:$src1, imm:$src2)),
2423 (implicit EFLAGS)]>;
2424 def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
2425 (ins GR16:$src1, i16i8imm:$src2),
2426 "add{w}\t{$src2, $dst|$dst, $src2}",
2427 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2)),
2428 (implicit EFLAGS)]>, OpSize;
2429 def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
2430 (ins GR32:$src1, i32i8imm:$src2),
2431 "add{l}\t{$src2, $dst|$dst, $src2}",
2432 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2)),
2433 (implicit EFLAGS)]>;
2436 let isTwoAddress = 0 in {
2437 // Memory-Register Addition
2438 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2439 "add{b}\t{$src2, $dst|$dst, $src2}",
2440 [(store (add (load addr:$dst), GR8:$src2), addr:$dst),
2441 (implicit EFLAGS)]>;
2442 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2443 "add{w}\t{$src2, $dst|$dst, $src2}",
2444 [(store (add (load addr:$dst), GR16:$src2), addr:$dst),
2445 (implicit EFLAGS)]>, OpSize;
2446 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2447 "add{l}\t{$src2, $dst|$dst, $src2}",
2448 [(store (add (load addr:$dst), GR32:$src2), addr:$dst),
2449 (implicit EFLAGS)]>;
2450 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
2451 "add{b}\t{$src2, $dst|$dst, $src2}",
2452 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst),
2453 (implicit EFLAGS)]>;
2454 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
2455 "add{w}\t{$src2, $dst|$dst, $src2}",
2456 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst),
2457 (implicit EFLAGS)]>, OpSize;
2458 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
2459 "add{l}\t{$src2, $dst|$dst, $src2}",
2460 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst),
2461 (implicit EFLAGS)]>;
2462 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2463 "add{w}\t{$src2, $dst|$dst, $src2}",
2464 [(store (add (load addr:$dst), i16immSExt8:$src2),
2466 (implicit EFLAGS)]>, OpSize;
2467 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2468 "add{l}\t{$src2, $dst|$dst, $src2}",
2469 [(store (add (load addr:$dst), i32immSExt8:$src2),
2471 (implicit EFLAGS)]>;
2474 def ADD8i8 : Ii8<0x04, RawFrm, (outs), (ins i8imm:$src),
2475 "add{b}\t{$src, %al|%al, $src}", []>;
2476 def ADD16i16 : Ii16<0x05, RawFrm, (outs), (ins i16imm:$src),
2477 "add{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2478 def ADD32i32 : Ii32<0x05, RawFrm, (outs), (ins i32imm:$src),
2479 "add{l}\t{$src, %eax|%eax, $src}", []>;
2482 let Uses = [EFLAGS] in {
2483 let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
2484 def ADC8rr : I<0x10, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2485 "adc{b}\t{$src2, $dst|$dst, $src2}",
2486 [(set GR8:$dst, (adde GR8:$src1, GR8:$src2))]>;
2487 def ADC16rr : I<0x11, MRMDestReg, (outs GR16:$dst),
2488 (ins GR16:$src1, GR16:$src2),
2489 "adc{w}\t{$src2, $dst|$dst, $src2}",
2490 [(set GR16:$dst, (adde GR16:$src1, GR16:$src2))]>, OpSize;
2491 def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst),
2492 (ins GR32:$src1, GR32:$src2),
2493 "adc{l}\t{$src2, $dst|$dst, $src2}",
2494 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
2496 def ADC8rm : I<0x12, MRMSrcMem , (outs GR8:$dst),
2497 (ins GR8:$src1, i8mem:$src2),
2498 "adc{b}\t{$src2, $dst|$dst, $src2}",
2499 [(set GR8:$dst, (adde GR8:$src1, (load addr:$src2)))]>;
2500 def ADC16rm : I<0x13, MRMSrcMem , (outs GR16:$dst),
2501 (ins GR16:$src1, i16mem:$src2),
2502 "adc{w}\t{$src2, $dst|$dst, $src2}",
2503 [(set GR16:$dst, (adde GR16:$src1, (load addr:$src2)))]>,
2505 def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst),
2506 (ins GR32:$src1, i32mem:$src2),
2507 "adc{l}\t{$src2, $dst|$dst, $src2}",
2508 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
2509 def ADC8ri : Ii8<0x80, MRM2r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2510 "adc{b}\t{$src2, $dst|$dst, $src2}",
2511 [(set GR8:$dst, (adde GR8:$src1, imm:$src2))]>;
2512 def ADC16ri : Ii16<0x81, MRM2r, (outs GR16:$dst),
2513 (ins GR16:$src1, i16imm:$src2),
2514 "adc{w}\t{$src2, $dst|$dst, $src2}",
2515 [(set GR16:$dst, (adde GR16:$src1, imm:$src2))]>, OpSize;
2516 def ADC16ri8 : Ii8<0x83, MRM2r, (outs GR16:$dst),
2517 (ins GR16:$src1, i16i8imm:$src2),
2518 "adc{w}\t{$src2, $dst|$dst, $src2}",
2519 [(set GR16:$dst, (adde GR16:$src1, i16immSExt8:$src2))]>,
2521 def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst),
2522 (ins GR32:$src1, i32imm:$src2),
2523 "adc{l}\t{$src2, $dst|$dst, $src2}",
2524 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
2525 def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst),
2526 (ins GR32:$src1, i32i8imm:$src2),
2527 "adc{l}\t{$src2, $dst|$dst, $src2}",
2528 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
2530 let isTwoAddress = 0 in {
2531 def ADC8mr : I<0x10, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2532 "adc{b}\t{$src2, $dst|$dst, $src2}",
2533 [(store (adde (load addr:$dst), GR8:$src2), addr:$dst)]>;
2534 def ADC16mr : I<0x11, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2535 "adc{w}\t{$src2, $dst|$dst, $src2}",
2536 [(store (adde (load addr:$dst), GR16:$src2), addr:$dst)]>,
2538 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2539 "adc{l}\t{$src2, $dst|$dst, $src2}",
2540 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
2541 def ADC8mi : Ii8<0x80, MRM2m, (outs), (ins i8mem:$dst, i8imm:$src2),
2542 "adc{b}\t{$src2, $dst|$dst, $src2}",
2543 [(store (adde (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
2544 def ADC16mi : Ii16<0x81, MRM2m, (outs), (ins i16mem:$dst, i16imm:$src2),
2545 "adc{w}\t{$src2, $dst|$dst, $src2}",
2546 [(store (adde (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
2548 def ADC16mi8 : Ii8<0x83, MRM2m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2549 "adc{w}\t{$src2, $dst|$dst, $src2}",
2550 [(store (adde (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
2552 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
2553 "adc{l}\t{$src2, $dst|$dst, $src2}",
2554 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
2555 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2556 "adc{l}\t{$src2, $dst|$dst, $src2}",
2557 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2559 def ADC8i8 : Ii8<0x14, RawFrm, (outs), (ins i8imm:$src),
2560 "adc{b}\t{$src, %al|%al, $src}", []>;
2561 def ADC16i16 : Ii16<0x15, RawFrm, (outs), (ins i16imm:$src),
2562 "adc{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2563 def ADC32i32 : Ii32<0x15, RawFrm, (outs), (ins i32imm:$src),
2564 "adc{l}\t{$src, %eax|%eax, $src}", []>;
2566 } // Uses = [EFLAGS]
2568 // Register-Register Subtraction
2569 def SUB8rr : I<0x28, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2570 "sub{b}\t{$src2, $dst|$dst, $src2}",
2571 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2)),
2572 (implicit EFLAGS)]>;
2573 def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2),
2574 "sub{w}\t{$src2, $dst|$dst, $src2}",
2575 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2)),
2576 (implicit EFLAGS)]>, OpSize;
2577 def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),
2578 "sub{l}\t{$src2, $dst|$dst, $src2}",
2579 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2)),
2580 (implicit EFLAGS)]>;
2582 // Register-Memory Subtraction
2583 def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst),
2584 (ins GR8 :$src1, i8mem :$src2),
2585 "sub{b}\t{$src2, $dst|$dst, $src2}",
2586 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2))),
2587 (implicit EFLAGS)]>;
2588 def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst),
2589 (ins GR16:$src1, i16mem:$src2),
2590 "sub{w}\t{$src2, $dst|$dst, $src2}",
2591 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2))),
2592 (implicit EFLAGS)]>, OpSize;
2593 def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst),
2594 (ins GR32:$src1, i32mem:$src2),
2595 "sub{l}\t{$src2, $dst|$dst, $src2}",
2596 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2))),
2597 (implicit EFLAGS)]>;
2599 // Register-Integer Subtraction
2600 def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst),
2601 (ins GR8:$src1, i8imm:$src2),
2602 "sub{b}\t{$src2, $dst|$dst, $src2}",
2603 [(set GR8:$dst, (sub GR8:$src1, imm:$src2)),
2604 (implicit EFLAGS)]>;
2605 def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst),
2606 (ins GR16:$src1, i16imm:$src2),
2607 "sub{w}\t{$src2, $dst|$dst, $src2}",
2608 [(set GR16:$dst, (sub GR16:$src1, imm:$src2)),
2609 (implicit EFLAGS)]>, OpSize;
2610 def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst),
2611 (ins GR32:$src1, i32imm:$src2),
2612 "sub{l}\t{$src2, $dst|$dst, $src2}",
2613 [(set GR32:$dst, (sub GR32:$src1, imm:$src2)),
2614 (implicit EFLAGS)]>;
2615 def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst),
2616 (ins GR16:$src1, i16i8imm:$src2),
2617 "sub{w}\t{$src2, $dst|$dst, $src2}",
2618 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2)),
2619 (implicit EFLAGS)]>, OpSize;
2620 def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst),
2621 (ins GR32:$src1, i32i8imm:$src2),
2622 "sub{l}\t{$src2, $dst|$dst, $src2}",
2623 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2)),
2624 (implicit EFLAGS)]>;
2626 let isTwoAddress = 0 in {
2627 // Memory-Register Subtraction
2628 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
2629 "sub{b}\t{$src2, $dst|$dst, $src2}",
2630 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst),
2631 (implicit EFLAGS)]>;
2632 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2633 "sub{w}\t{$src2, $dst|$dst, $src2}",
2634 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst),
2635 (implicit EFLAGS)]>, OpSize;
2636 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2637 "sub{l}\t{$src2, $dst|$dst, $src2}",
2638 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst),
2639 (implicit EFLAGS)]>;
2641 // Memory-Integer Subtraction
2642 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
2643 "sub{b}\t{$src2, $dst|$dst, $src2}",
2644 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst),
2645 (implicit EFLAGS)]>;
2646 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
2647 "sub{w}\t{$src2, $dst|$dst, $src2}",
2648 [(store (sub (loadi16 addr:$dst), imm:$src2),addr:$dst),
2649 (implicit EFLAGS)]>, OpSize;
2650 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
2651 "sub{l}\t{$src2, $dst|$dst, $src2}",
2652 [(store (sub (loadi32 addr:$dst), imm:$src2),addr:$dst),
2653 (implicit EFLAGS)]>;
2654 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2655 "sub{w}\t{$src2, $dst|$dst, $src2}",
2656 [(store (sub (load addr:$dst), i16immSExt8:$src2),
2658 (implicit EFLAGS)]>, OpSize;
2659 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2660 "sub{l}\t{$src2, $dst|$dst, $src2}",
2661 [(store (sub (load addr:$dst), i32immSExt8:$src2),
2663 (implicit EFLAGS)]>;
2665 def SUB8i8 : Ii8<0x2C, RawFrm, (outs), (ins i8imm:$src),
2666 "sub{b}\t{$src, %al|%al, $src}", []>;
2667 def SUB16i16 : Ii16<0x2D, RawFrm, (outs), (ins i16imm:$src),
2668 "sub{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2669 def SUB32i32 : Ii32<0x2D, RawFrm, (outs), (ins i32imm:$src),
2670 "sub{l}\t{$src, %eax|%eax, $src}", []>;
2673 let Uses = [EFLAGS] in {
2674 def SBB8rr : I<0x18, MRMDestReg, (outs GR8:$dst),
2675 (ins GR8:$src1, GR8:$src2),
2676 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2677 [(set GR8:$dst, (sube GR8:$src1, GR8:$src2))]>;
2678 def SBB16rr : I<0x19, MRMDestReg, (outs GR16:$dst),
2679 (ins GR16:$src1, GR16:$src2),
2680 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2681 [(set GR16:$dst, (sube GR16:$src1, GR16:$src2))]>, OpSize;
2682 def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst),
2683 (ins GR32:$src1, GR32:$src2),
2684 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2685 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
2687 let isTwoAddress = 0 in {
2688 def SBB8mr : I<0x18, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2689 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2690 [(store (sube (load addr:$dst), GR8:$src2), addr:$dst)]>;
2691 def SBB16mr : I<0x19, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2692 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2693 [(store (sube (load addr:$dst), GR16:$src2), addr:$dst)]>,
2695 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2696 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2697 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
2698 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
2699 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2700 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
2701 def SBB16mi : Ii16<0x81, MRM3m, (outs), (ins i16mem:$dst, i16imm:$src2),
2702 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2703 [(store (sube (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
2705 def SBB16mi8 : Ii8<0x83, MRM3m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2706 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2707 [(store (sube (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
2709 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
2710 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2711 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
2712 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2713 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2714 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2716 def SBB8i8 : Ii8<0x1C, RawFrm, (outs), (ins i8imm:$src),
2717 "sbb{b}\t{$src, %al|%al, $src}", []>;
2718 def SBB16i16 : Ii16<0x1D, RawFrm, (outs), (ins i16imm:$src),
2719 "sbb{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2720 def SBB32i32 : Ii32<0x1D, RawFrm, (outs), (ins i32imm:$src),
2721 "sbb{l}\t{$src, %eax|%eax, $src}", []>;
2723 def SBB8rm : I<0x1A, MRMSrcMem, (outs GR8:$dst), (ins GR8:$src1, i8mem:$src2),
2724 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2725 [(set GR8:$dst, (sube GR8:$src1, (load addr:$src2)))]>;
2726 def SBB16rm : I<0x1B, MRMSrcMem, (outs GR16:$dst),
2727 (ins GR16:$src1, i16mem:$src2),
2728 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2729 [(set GR16:$dst, (sube GR16:$src1, (load addr:$src2)))]>,
2731 def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst),
2732 (ins GR32:$src1, i32mem:$src2),
2733 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2734 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
2735 def SBB8ri : Ii8<0x80, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2736 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2737 [(set GR8:$dst, (sube GR8:$src1, imm:$src2))]>;
2738 def SBB16ri : Ii16<0x81, MRM3r, (outs GR16:$dst),
2739 (ins GR16:$src1, i16imm:$src2),
2740 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2741 [(set GR16:$dst, (sube GR16:$src1, imm:$src2))]>, OpSize;
2742 def SBB16ri8 : Ii8<0x83, MRM3r, (outs GR16:$dst),
2743 (ins GR16:$src1, i16i8imm:$src2),
2744 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2745 [(set GR16:$dst, (sube GR16:$src1, i16immSExt8:$src2))]>,
2747 def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst),
2748 (ins GR32:$src1, i32imm:$src2),
2749 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2750 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
2751 def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst),
2752 (ins GR32:$src1, i32i8imm:$src2),
2753 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2754 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
2755 } // Uses = [EFLAGS]
2756 } // Defs = [EFLAGS]
2758 let Defs = [EFLAGS] in {
2759 let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
2760 // Register-Register Signed Integer Multiply
2761 def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2),
2762 "imul{w}\t{$src2, $dst|$dst, $src2}",
2763 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2)),
2764 (implicit EFLAGS)]>, TB, OpSize;
2765 def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),
2766 "imul{l}\t{$src2, $dst|$dst, $src2}",
2767 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2)),
2768 (implicit EFLAGS)]>, TB;
2771 // Register-Memory Signed Integer Multiply
2772 def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst),
2773 (ins GR16:$src1, i16mem:$src2),
2774 "imul{w}\t{$src2, $dst|$dst, $src2}",
2775 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2))),
2776 (implicit EFLAGS)]>, TB, OpSize;
2777 def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
2778 "imul{l}\t{$src2, $dst|$dst, $src2}",
2779 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2))),
2780 (implicit EFLAGS)]>, TB;
2781 } // Defs = [EFLAGS]
2782 } // end Two Address instructions
2784 // Suprisingly enough, these are not two address instructions!
2785 let Defs = [EFLAGS] in {
2786 // Register-Integer Signed Integer Multiply
2787 def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
2788 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
2789 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2790 [(set GR16:$dst, (mul GR16:$src1, imm:$src2)),
2791 (implicit EFLAGS)]>, OpSize;
2792 def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
2793 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
2794 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2795 [(set GR32:$dst, (mul GR32:$src1, imm:$src2)),
2796 (implicit EFLAGS)]>;
2797 def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
2798 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
2799 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2800 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2)),
2801 (implicit EFLAGS)]>, OpSize;
2802 def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
2803 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
2804 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2805 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2)),
2806 (implicit EFLAGS)]>;
2808 // Memory-Integer Signed Integer Multiply
2809 def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
2810 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
2811 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2812 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2)),
2813 (implicit EFLAGS)]>, OpSize;
2814 def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
2815 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
2816 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2817 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2)),
2818 (implicit EFLAGS)]>;
2819 def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
2820 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
2821 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2822 [(set GR16:$dst, (mul (load addr:$src1),
2823 i16immSExt8:$src2)),
2824 (implicit EFLAGS)]>, OpSize;
2825 def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
2826 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
2827 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2828 [(set GR32:$dst, (mul (load addr:$src1),
2829 i32immSExt8:$src2)),
2830 (implicit EFLAGS)]>;
2831 } // Defs = [EFLAGS]
2833 //===----------------------------------------------------------------------===//
2834 // Test instructions are just like AND, except they don't generate a result.
2836 let Defs = [EFLAGS] in {
2837 let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
2838 def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
2839 "test{b}\t{$src2, $src1|$src1, $src2}",
2840 [(X86cmp (and_su GR8:$src1, GR8:$src2), 0),
2841 (implicit EFLAGS)]>;
2842 def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2843 "test{w}\t{$src2, $src1|$src1, $src2}",
2844 [(X86cmp (and_su GR16:$src1, GR16:$src2), 0),
2845 (implicit EFLAGS)]>,
2847 def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2848 "test{l}\t{$src2, $src1|$src1, $src2}",
2849 [(X86cmp (and_su GR32:$src1, GR32:$src2), 0),
2850 (implicit EFLAGS)]>;
2853 def TEST8i8 : Ii8<0xA8, RawFrm, (outs), (ins i8imm:$src),
2854 "test{b}\t{$src, %al|%al, $src}", []>;
2855 def TEST16i16 : Ii16<0xA9, RawFrm, (outs), (ins i16imm:$src),
2856 "test{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2857 def TEST32i32 : Ii32<0xA9, RawFrm, (outs), (ins i32imm:$src),
2858 "test{l}\t{$src, %eax|%eax, $src}", []>;
2860 def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
2861 "test{b}\t{$src2, $src1|$src1, $src2}",
2862 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0),
2863 (implicit EFLAGS)]>;
2864 def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
2865 "test{w}\t{$src2, $src1|$src1, $src2}",
2866 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0),
2867 (implicit EFLAGS)]>, OpSize;
2868 def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
2869 "test{l}\t{$src2, $src1|$src1, $src2}",
2870 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0),
2871 (implicit EFLAGS)]>;
2873 def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
2874 (outs), (ins GR8:$src1, i8imm:$src2),
2875 "test{b}\t{$src2, $src1|$src1, $src2}",
2876 [(X86cmp (and_su GR8:$src1, imm:$src2), 0),
2877 (implicit EFLAGS)]>;
2878 def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2879 (outs), (ins GR16:$src1, i16imm:$src2),
2880 "test{w}\t{$src2, $src1|$src1, $src2}",
2881 [(X86cmp (and_su GR16:$src1, imm:$src2), 0),
2882 (implicit EFLAGS)]>, OpSize;
2883 def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2884 (outs), (ins GR32:$src1, i32imm:$src2),
2885 "test{l}\t{$src2, $src1|$src1, $src2}",
2886 [(X86cmp (and_su GR32:$src1, imm:$src2), 0),
2887 (implicit EFLAGS)]>;
2889 def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
2890 (outs), (ins i8mem:$src1, i8imm:$src2),
2891 "test{b}\t{$src2, $src1|$src1, $src2}",
2892 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0),
2893 (implicit EFLAGS)]>;
2894 def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2895 (outs), (ins i16mem:$src1, i16imm:$src2),
2896 "test{w}\t{$src2, $src1|$src1, $src2}",
2897 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0),
2898 (implicit EFLAGS)]>, OpSize;
2899 def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2900 (outs), (ins i32mem:$src1, i32imm:$src2),
2901 "test{l}\t{$src2, $src1|$src1, $src2}",
2902 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0),
2903 (implicit EFLAGS)]>;
2904 } // Defs = [EFLAGS]
2907 // Condition code ops, incl. set if equal/not equal/...
2908 let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in
2909 def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
2910 let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in
2911 def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
2913 let Uses = [EFLAGS] in {
2914 def SETEr : I<0x94, MRM0r,
2915 (outs GR8 :$dst), (ins),
2917 [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>,
2919 def SETEm : I<0x94, MRM0m,
2920 (outs), (ins i8mem:$dst),
2922 [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>,
2925 def SETNEr : I<0x95, MRM0r,
2926 (outs GR8 :$dst), (ins),
2928 [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>,
2930 def SETNEm : I<0x95, MRM0m,
2931 (outs), (ins i8mem:$dst),
2933 [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>,
2936 def SETLr : I<0x9C, MRM0r,
2937 (outs GR8 :$dst), (ins),
2939 [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>,
2940 TB; // GR8 = < signed
2941 def SETLm : I<0x9C, MRM0m,
2942 (outs), (ins i8mem:$dst),
2944 [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>,
2945 TB; // [mem8] = < signed
2947 def SETGEr : I<0x9D, MRM0r,
2948 (outs GR8 :$dst), (ins),
2950 [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>,
2951 TB; // GR8 = >= signed
2952 def SETGEm : I<0x9D, MRM0m,
2953 (outs), (ins i8mem:$dst),
2955 [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>,
2956 TB; // [mem8] = >= signed
2958 def SETLEr : I<0x9E, MRM0r,
2959 (outs GR8 :$dst), (ins),
2961 [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>,
2962 TB; // GR8 = <= signed
2963 def SETLEm : I<0x9E, MRM0m,
2964 (outs), (ins i8mem:$dst),
2966 [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>,
2967 TB; // [mem8] = <= signed
2969 def SETGr : I<0x9F, MRM0r,
2970 (outs GR8 :$dst), (ins),
2972 [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>,
2973 TB; // GR8 = > signed
2974 def SETGm : I<0x9F, MRM0m,
2975 (outs), (ins i8mem:$dst),
2977 [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>,
2978 TB; // [mem8] = > signed
2980 def SETBr : I<0x92, MRM0r,
2981 (outs GR8 :$dst), (ins),
2983 [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>,
2984 TB; // GR8 = < unsign
2985 def SETBm : I<0x92, MRM0m,
2986 (outs), (ins i8mem:$dst),
2988 [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>,
2989 TB; // [mem8] = < unsign
2991 def SETAEr : I<0x93, MRM0r,
2992 (outs GR8 :$dst), (ins),
2994 [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>,
2995 TB; // GR8 = >= unsign
2996 def SETAEm : I<0x93, MRM0m,
2997 (outs), (ins i8mem:$dst),
2999 [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>,
3000 TB; // [mem8] = >= unsign
3002 def SETBEr : I<0x96, MRM0r,
3003 (outs GR8 :$dst), (ins),
3005 [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>,
3006 TB; // GR8 = <= unsign
3007 def SETBEm : I<0x96, MRM0m,
3008 (outs), (ins i8mem:$dst),
3010 [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>,
3011 TB; // [mem8] = <= unsign
3013 def SETAr : I<0x97, MRM0r,
3014 (outs GR8 :$dst), (ins),
3016 [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>,
3017 TB; // GR8 = > signed
3018 def SETAm : I<0x97, MRM0m,
3019 (outs), (ins i8mem:$dst),
3021 [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>,
3022 TB; // [mem8] = > signed
3024 def SETSr : I<0x98, MRM0r,
3025 (outs GR8 :$dst), (ins),
3027 [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>,
3028 TB; // GR8 = <sign bit>
3029 def SETSm : I<0x98, MRM0m,
3030 (outs), (ins i8mem:$dst),
3032 [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>,
3033 TB; // [mem8] = <sign bit>
3034 def SETNSr : I<0x99, MRM0r,
3035 (outs GR8 :$dst), (ins),
3037 [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>,
3038 TB; // GR8 = !<sign bit>
3039 def SETNSm : I<0x99, MRM0m,
3040 (outs), (ins i8mem:$dst),
3042 [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>,
3043 TB; // [mem8] = !<sign bit>
3045 def SETPr : I<0x9A, MRM0r,
3046 (outs GR8 :$dst), (ins),
3048 [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>,
3050 def SETPm : I<0x9A, MRM0m,
3051 (outs), (ins i8mem:$dst),
3053 [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>,
3054 TB; // [mem8] = parity
3055 def SETNPr : I<0x9B, MRM0r,
3056 (outs GR8 :$dst), (ins),
3058 [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>,
3059 TB; // GR8 = not parity
3060 def SETNPm : I<0x9B, MRM0m,
3061 (outs), (ins i8mem:$dst),
3063 [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>,
3064 TB; // [mem8] = not parity
3066 def SETOr : I<0x90, MRM0r,
3067 (outs GR8 :$dst), (ins),
3069 [(set GR8:$dst, (X86setcc X86_COND_O, EFLAGS))]>,
3070 TB; // GR8 = overflow
3071 def SETOm : I<0x90, MRM0m,
3072 (outs), (ins i8mem:$dst),
3074 [(store (X86setcc X86_COND_O, EFLAGS), addr:$dst)]>,
3075 TB; // [mem8] = overflow
3076 def SETNOr : I<0x91, MRM0r,
3077 (outs GR8 :$dst), (ins),
3079 [(set GR8:$dst, (X86setcc X86_COND_NO, EFLAGS))]>,
3080 TB; // GR8 = not overflow
3081 def SETNOm : I<0x91, MRM0m,
3082 (outs), (ins i8mem:$dst),
3084 [(store (X86setcc X86_COND_NO, EFLAGS), addr:$dst)]>,
3085 TB; // [mem8] = not overflow
3086 } // Uses = [EFLAGS]
3089 // Integer comparisons
3090 let Defs = [EFLAGS] in {
3091 def CMP8i8 : Ii8<0x3C, RawFrm, (outs), (ins i8imm:$src),
3092 "cmp{b}\t{$src, %al|%al, $src}", []>;
3093 def CMP16i16 : Ii16<0x3D, RawFrm, (outs), (ins i16imm:$src),
3094 "cmp{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
3095 def CMP32i32 : Ii32<0x3D, RawFrm, (outs), (ins i32imm:$src),
3096 "cmp{l}\t{$src, %eax|%eax, $src}", []>;
3098 def CMP8rr : I<0x38, MRMDestReg,
3099 (outs), (ins GR8 :$src1, GR8 :$src2),
3100 "cmp{b}\t{$src2, $src1|$src1, $src2}",
3101 [(X86cmp GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
3102 def CMP16rr : I<0x39, MRMDestReg,
3103 (outs), (ins GR16:$src1, GR16:$src2),
3104 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3105 [(X86cmp GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
3106 def CMP32rr : I<0x39, MRMDestReg,
3107 (outs), (ins GR32:$src1, GR32:$src2),
3108 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3109 [(X86cmp GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
3110 def CMP8mr : I<0x38, MRMDestMem,
3111 (outs), (ins i8mem :$src1, GR8 :$src2),
3112 "cmp{b}\t{$src2, $src1|$src1, $src2}",
3113 [(X86cmp (loadi8 addr:$src1), GR8:$src2),
3114 (implicit EFLAGS)]>;
3115 def CMP16mr : I<0x39, MRMDestMem,
3116 (outs), (ins i16mem:$src1, GR16:$src2),
3117 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3118 [(X86cmp (loadi16 addr:$src1), GR16:$src2),
3119 (implicit EFLAGS)]>, OpSize;
3120 def CMP32mr : I<0x39, MRMDestMem,
3121 (outs), (ins i32mem:$src1, GR32:$src2),
3122 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3123 [(X86cmp (loadi32 addr:$src1), GR32:$src2),
3124 (implicit EFLAGS)]>;
3125 def CMP8rm : I<0x3A, MRMSrcMem,
3126 (outs), (ins GR8 :$src1, i8mem :$src2),
3127 "cmp{b}\t{$src2, $src1|$src1, $src2}",
3128 [(X86cmp GR8:$src1, (loadi8 addr:$src2)),
3129 (implicit EFLAGS)]>;
3130 def CMP16rm : I<0x3B, MRMSrcMem,
3131 (outs), (ins GR16:$src1, i16mem:$src2),
3132 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3133 [(X86cmp GR16:$src1, (loadi16 addr:$src2)),
3134 (implicit EFLAGS)]>, OpSize;
3135 def CMP32rm : I<0x3B, MRMSrcMem,
3136 (outs), (ins GR32:$src1, i32mem:$src2),
3137 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3138 [(X86cmp GR32:$src1, (loadi32 addr:$src2)),
3139 (implicit EFLAGS)]>;
3140 def CMP8ri : Ii8<0x80, MRM7r,
3141 (outs), (ins GR8:$src1, i8imm:$src2),
3142 "cmp{b}\t{$src2, $src1|$src1, $src2}",
3143 [(X86cmp GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
3144 def CMP16ri : Ii16<0x81, MRM7r,
3145 (outs), (ins GR16:$src1, i16imm:$src2),
3146 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3147 [(X86cmp GR16:$src1, imm:$src2),
3148 (implicit EFLAGS)]>, OpSize;
3149 def CMP32ri : Ii32<0x81, MRM7r,
3150 (outs), (ins GR32:$src1, i32imm:$src2),
3151 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3152 [(X86cmp GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
3153 def CMP8mi : Ii8 <0x80, MRM7m,
3154 (outs), (ins i8mem :$src1, i8imm :$src2),
3155 "cmp{b}\t{$src2, $src1|$src1, $src2}",
3156 [(X86cmp (loadi8 addr:$src1), imm:$src2),
3157 (implicit EFLAGS)]>;
3158 def CMP16mi : Ii16<0x81, MRM7m,
3159 (outs), (ins i16mem:$src1, i16imm:$src2),
3160 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3161 [(X86cmp (loadi16 addr:$src1), imm:$src2),
3162 (implicit EFLAGS)]>, OpSize;
3163 def CMP32mi : Ii32<0x81, MRM7m,
3164 (outs), (ins i32mem:$src1, i32imm:$src2),
3165 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3166 [(X86cmp (loadi32 addr:$src1), imm:$src2),
3167 (implicit EFLAGS)]>;
3168 def CMP16ri8 : Ii8<0x83, MRM7r,
3169 (outs), (ins GR16:$src1, i16i8imm:$src2),
3170 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3171 [(X86cmp GR16:$src1, i16immSExt8:$src2),
3172 (implicit EFLAGS)]>, OpSize;
3173 def CMP16mi8 : Ii8<0x83, MRM7m,
3174 (outs), (ins i16mem:$src1, i16i8imm:$src2),
3175 "cmp{w}\t{$src2, $src1|$src1, $src2}",
3176 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2),
3177 (implicit EFLAGS)]>, OpSize;
3178 def CMP32mi8 : Ii8<0x83, MRM7m,
3179 (outs), (ins i32mem:$src1, i32i8imm:$src2),
3180 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3181 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2),
3182 (implicit EFLAGS)]>;
3183 def CMP32ri8 : Ii8<0x83, MRM7r,
3184 (outs), (ins GR32:$src1, i32i8imm:$src2),
3185 "cmp{l}\t{$src2, $src1|$src1, $src2}",
3186 [(X86cmp GR32:$src1, i32immSExt8:$src2),
3187 (implicit EFLAGS)]>;
3188 } // Defs = [EFLAGS]
3191 // TODO: BTC, BTR, and BTS
3192 let Defs = [EFLAGS] in {
3193 def BT16rr : I<0xA3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
3194 "bt{w}\t{$src2, $src1|$src1, $src2}",
3195 [(X86bt GR16:$src1, GR16:$src2),
3196 (implicit EFLAGS)]>, OpSize, TB;
3197 def BT32rr : I<0xA3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
3198 "bt{l}\t{$src2, $src1|$src1, $src2}",
3199 [(X86bt GR32:$src1, GR32:$src2),
3200 (implicit EFLAGS)]>, TB;
3202 // Unlike with the register+register form, the memory+register form of the
3203 // bt instruction does not ignore the high bits of the index. From ISel's
3204 // perspective, this is pretty bizarre. Disable these instructions for now.
3205 //def BT16mr : I<0xA3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2),
3206 // "bt{w}\t{$src2, $src1|$src1, $src2}",
3207 // [(X86bt (loadi16 addr:$src1), GR16:$src2),
3208 // (implicit EFLAGS)]>, OpSize, TB, Requires<[FastBTMem]>;
3209 //def BT32mr : I<0xA3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2),
3210 // "bt{l}\t{$src2, $src1|$src1, $src2}",
3211 // [(X86bt (loadi32 addr:$src1), GR32:$src2),
3212 // (implicit EFLAGS)]>, TB, Requires<[FastBTMem]>;
3214 def BT16ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR16:$src1, i16i8imm:$src2),
3215 "bt{w}\t{$src2, $src1|$src1, $src2}",
3216 [(X86bt GR16:$src1, i16immSExt8:$src2),
3217 (implicit EFLAGS)]>, OpSize, TB;
3218 def BT32ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR32:$src1, i32i8imm:$src2),
3219 "bt{l}\t{$src2, $src1|$src1, $src2}",
3220 [(X86bt GR32:$src1, i32immSExt8:$src2),
3221 (implicit EFLAGS)]>, TB;
3222 // Note that these instructions don't need FastBTMem because that
3223 // only applies when the other operand is in a register. When it's
3224 // an immediate, bt is still fast.
3225 def BT16mi8 : Ii8<0xBA, MRM4m, (outs), (ins i16mem:$src1, i16i8imm:$src2),
3226 "bt{w}\t{$src2, $src1|$src1, $src2}",
3227 [(X86bt (loadi16 addr:$src1), i16immSExt8:$src2),
3228 (implicit EFLAGS)]>, OpSize, TB;
3229 def BT32mi8 : Ii8<0xBA, MRM4m, (outs), (ins i32mem:$src1, i32i8imm:$src2),
3230 "bt{l}\t{$src2, $src1|$src1, $src2}",
3231 [(X86bt (loadi32 addr:$src1), i32immSExt8:$src2),
3232 (implicit EFLAGS)]>, TB;
3233 } // Defs = [EFLAGS]
3235 // Sign/Zero extenders
3236 // Use movsbl intead of movsbw; we don't care about the high 16 bits
3237 // of the register here. This has a smaller encoding and avoids a
3238 // partial-register update.
3239 def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
3240 "movs{bl|x}\t{$src, ${dst:subreg32}|${dst:subreg32}, $src}",
3241 [(set GR16:$dst, (sext GR8:$src))]>, TB;
3242 def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
3243 "movs{bl|x}\t{$src, ${dst:subreg32}|${dst:subreg32}, $src}",
3244 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB;
3245 def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
3246 "movs{bl|x}\t{$src, $dst|$dst, $src}",
3247 [(set GR32:$dst, (sext GR8:$src))]>, TB;
3248 def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
3249 "movs{bl|x}\t{$src, $dst|$dst, $src}",
3250 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
3251 def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
3252 "movs{wl|x}\t{$src, $dst|$dst, $src}",
3253 [(set GR32:$dst, (sext GR16:$src))]>, TB;
3254 def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
3255 "movs{wl|x}\t{$src, $dst|$dst, $src}",
3256 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
3258 // Use movzbl intead of movzbw; we don't care about the high 16 bits
3259 // of the register here. This has a smaller encoding and avoids a
3260 // partial-register update.
3261 def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
3262 "movz{bl|x}\t{$src, ${dst:subreg32}|${dst:subreg32}, $src}",
3263 [(set GR16:$dst, (zext GR8:$src))]>, TB;
3264 def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
3265 "movz{bl|x}\t{$src, ${dst:subreg32}|${dst:subreg32}, $src}",
3266 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB;
3267 def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
3268 "movz{bl|x}\t{$src, $dst|$dst, $src}",
3269 [(set GR32:$dst, (zext GR8:$src))]>, TB;
3270 def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
3271 "movz{bl|x}\t{$src, $dst|$dst, $src}",
3272 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
3273 def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
3274 "movz{wl|x}\t{$src, $dst|$dst, $src}",
3275 [(set GR32:$dst, (zext GR16:$src))]>, TB;
3276 def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
3277 "movz{wl|x}\t{$src, $dst|$dst, $src}",
3278 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
3280 // These are the same as the regular regular MOVZX32rr8 and MOVZX32rm8
3281 // except that they use GR32_NOREX for the output operand register class
3282 // instead of GR32. This allows them to operate on h registers on x86-64.
3283 def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg,
3284 (outs GR32_NOREX:$dst), (ins GR8:$src),
3285 "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX",
3288 def MOVZX32_NOREXrm8 : I<0xB6, MRMSrcMem,
3289 (outs GR32_NOREX:$dst), (ins i8mem:$src),
3290 "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX",
3293 let neverHasSideEffects = 1 in {
3294 let Defs = [AX], Uses = [AL] in
3295 def CBW : I<0x98, RawFrm, (outs), (ins),
3296 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
3297 let Defs = [EAX], Uses = [AX] in
3298 def CWDE : I<0x98, RawFrm, (outs), (ins),
3299 "{cwtl|cwde}", []>; // EAX = signext(AX)
3301 let Defs = [AX,DX], Uses = [AX] in
3302 def CWD : I<0x99, RawFrm, (outs), (ins),
3303 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
3304 let Defs = [EAX,EDX], Uses = [EAX] in
3305 def CDQ : I<0x99, RawFrm, (outs), (ins),
3306 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
3309 //===----------------------------------------------------------------------===//
3310 // Alias Instructions
3311 //===----------------------------------------------------------------------===//
3313 // Alias instructions that map movr0 to xor.
3314 // FIXME: remove when we can teach regalloc that xor reg, reg is ok.
3315 let Defs = [EFLAGS], isReMaterializable = 1, isAsCheapAsAMove = 1,
3316 isCodeGenOnly = 1 in {
3317 def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
3318 "xor{b}\t$dst, $dst",
3319 [(set GR8:$dst, 0)]>;
3320 // Use xorl instead of xorw since we don't care about the high 16 bits,
3321 // it's smaller, and it avoids a partial-register update.
3322 def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
3323 "xor{l}\t${dst:subreg32}, ${dst:subreg32}",
3324 [(set GR16:$dst, 0)]>;
3325 def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
3326 "xor{l}\t$dst, $dst",
3327 [(set GR32:$dst, 0)]>;
3330 //===----------------------------------------------------------------------===//
3331 // Thread Local Storage Instructions
3334 // All calls clobber the non-callee saved registers. ESP is marked as
3335 // a use to prevent stack-pointer assignments that appear immediately
3336 // before calls from potentially appearing dead.
3337 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
3338 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
3339 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
3340 XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS],
3342 def TLS_addr32 : I<0, Pseudo, (outs), (ins lea32mem:$sym),
3343 "leal\t$sym, %eax; "
3344 "call\t___tls_get_addr@PLT",
3345 [(X86tlsaddr tls32addr:$sym)]>,
3346 Requires<[In32BitMode]>;
3348 let AddedComplexity = 5, isCodeGenOnly = 1 in
3349 def GS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
3350 "movl\t%gs:$src, $dst",
3351 [(set GR32:$dst, (gsload addr:$src))]>, SegGS;
3353 let AddedComplexity = 5, isCodeGenOnly = 1 in
3354 def FS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
3355 "movl\t%fs:$src, $dst",
3356 [(set GR32:$dst, (fsload addr:$src))]>, SegFS;
3358 //===----------------------------------------------------------------------===//
3359 // DWARF Pseudo Instructions
3362 def DWARF_LOC : I<0, Pseudo, (outs),
3363 (ins i32imm:$line, i32imm:$col, i32imm:$file),
3364 ".loc\t$file $line $col",
3365 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
3368 //===----------------------------------------------------------------------===//
3369 // EH Pseudo Instructions
3371 let isTerminator = 1, isReturn = 1, isBarrier = 1,
3372 hasCtrlDep = 1, isCodeGenOnly = 1 in {
3373 def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
3374 "ret\t#eh_return, addr: $addr",
3375 [(X86ehret GR32:$addr)]>;
3379 //===----------------------------------------------------------------------===//
3383 // Atomic swap. These are just normal xchg instructions. But since a memory
3384 // operand is referenced, the atomicity is ensured.
3385 let Constraints = "$val = $dst" in {
3386 def XCHG32rm : I<0x87, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val),
3387 "xchg{l}\t{$val, $ptr|$ptr, $val}",
3388 [(set GR32:$dst, (atomic_swap_32 addr:$ptr, GR32:$val))]>;
3389 def XCHG16rm : I<0x87, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$ptr, GR16:$val),
3390 "xchg{w}\t{$val, $ptr|$ptr, $val}",
3391 [(set GR16:$dst, (atomic_swap_16 addr:$ptr, GR16:$val))]>,
3393 def XCHG8rm : I<0x86, MRMSrcMem, (outs GR8:$dst), (ins i8mem:$ptr, GR8:$val),
3394 "xchg{b}\t{$val, $ptr|$ptr, $val}",
3395 [(set GR8:$dst, (atomic_swap_8 addr:$ptr, GR8:$val))]>;
3398 // Atomic compare and swap.
3399 let Defs = [EAX, EFLAGS], Uses = [EAX] in {
3400 def LCMPXCHG32 : I<0xB1, MRMDestMem, (outs), (ins i32mem:$ptr, GR32:$swap),
3402 "cmpxchg{l}\t{$swap, $ptr|$ptr, $swap}",
3403 [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK;
3405 let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in {
3406 def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i32mem:$ptr),
3409 [(X86cas8 addr:$ptr)]>, TB, LOCK;
3412 let Defs = [AX, EFLAGS], Uses = [AX] in {
3413 def LCMPXCHG16 : I<0xB1, MRMDestMem, (outs), (ins i16mem:$ptr, GR16:$swap),
3415 "cmpxchg{w}\t{$swap, $ptr|$ptr, $swap}",
3416 [(X86cas addr:$ptr, GR16:$swap, 2)]>, TB, OpSize, LOCK;
3418 let Defs = [AL, EFLAGS], Uses = [AL] in {
3419 def LCMPXCHG8 : I<0xB0, MRMDestMem, (outs), (ins i8mem:$ptr, GR8:$swap),
3421 "cmpxchg{b}\t{$swap, $ptr|$ptr, $swap}",
3422 [(X86cas addr:$ptr, GR8:$swap, 1)]>, TB, LOCK;
3425 // Atomic exchange and add
3426 let Constraints = "$val = $dst", Defs = [EFLAGS] in {
3427 def LXADD32 : I<0xC1, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val),
3429 "xadd{l}\t{$val, $ptr|$ptr, $val}",
3430 [(set GR32:$dst, (atomic_load_add_32 addr:$ptr, GR32:$val))]>,
3432 def LXADD16 : I<0xC1, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$ptr, GR16:$val),
3434 "xadd{w}\t{$val, $ptr|$ptr, $val}",
3435 [(set GR16:$dst, (atomic_load_add_16 addr:$ptr, GR16:$val))]>,
3437 def LXADD8 : I<0xC0, MRMSrcMem, (outs GR8:$dst), (ins i8mem:$ptr, GR8:$val),
3439 "xadd{b}\t{$val, $ptr|$ptr, $val}",
3440 [(set GR8:$dst, (atomic_load_add_8 addr:$ptr, GR8:$val))]>,
3444 // Optimized codegen when the non-memory output is not used.
3445 // FIXME: Use normal add / sub instructions and add lock prefix dynamically.
3446 def LOCK_ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
3448 "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3449 def LOCK_ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
3451 "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK;
3452 def LOCK_ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
3454 "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3455 def LOCK_ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
3457 "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3458 def LOCK_ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
3460 "add{w}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3461 def LOCK_ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
3463 "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3464 def LOCK_ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
3466 "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK;
3467 def LOCK_ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
3469 "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3471 def LOCK_INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst),
3473 "inc{b}\t$dst", []>, LOCK;
3474 def LOCK_INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst),
3476 "inc{w}\t$dst", []>, OpSize, LOCK;
3477 def LOCK_INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst),
3479 "inc{l}\t$dst", []>, LOCK;
3481 def LOCK_SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
3483 "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3484 def LOCK_SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
3486 "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK;
3487 def LOCK_SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
3489 "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3490 def LOCK_SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
3492 "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3493 def LOCK_SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
3495 "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK;
3496 def LOCK_SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
3498 "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3499 def LOCK_SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
3501 "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK;
3502 def LOCK_SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
3504 "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK;
3506 def LOCK_DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst),
3508 "dec{b}\t$dst", []>, LOCK;
3509 def LOCK_DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst),
3511 "dec{w}\t$dst", []>, OpSize, LOCK;
3512 def LOCK_DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst),
3514 "dec{l}\t$dst", []>, LOCK;
3516 // Atomic exchange, and, or, xor
3517 let Constraints = "$val = $dst", Defs = [EFLAGS],
3518 usesCustomDAGSchedInserter = 1 in {
3519 def ATOMAND32 : I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3520 "#ATOMAND32 PSEUDO!",
3521 [(set GR32:$dst, (atomic_load_and_32 addr:$ptr, GR32:$val))]>;
3522 def ATOMOR32 : I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3523 "#ATOMOR32 PSEUDO!",
3524 [(set GR32:$dst, (atomic_load_or_32 addr:$ptr, GR32:$val))]>;
3525 def ATOMXOR32 : I<0, Pseudo,(outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3526 "#ATOMXOR32 PSEUDO!",
3527 [(set GR32:$dst, (atomic_load_xor_32 addr:$ptr, GR32:$val))]>;
3528 def ATOMNAND32 : I<0, Pseudo,(outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3529 "#ATOMNAND32 PSEUDO!",
3530 [(set GR32:$dst, (atomic_load_nand_32 addr:$ptr, GR32:$val))]>;
3531 def ATOMMIN32: I<0, Pseudo, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val),
3532 "#ATOMMIN32 PSEUDO!",
3533 [(set GR32:$dst, (atomic_load_min_32 addr:$ptr, GR32:$val))]>;
3534 def ATOMMAX32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3535 "#ATOMMAX32 PSEUDO!",
3536 [(set GR32:$dst, (atomic_load_max_32 addr:$ptr, GR32:$val))]>;
3537 def ATOMUMIN32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3538 "#ATOMUMIN32 PSEUDO!",
3539 [(set GR32:$dst, (atomic_load_umin_32 addr:$ptr, GR32:$val))]>;
3540 def ATOMUMAX32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val),
3541 "#ATOMUMAX32 PSEUDO!",
3542 [(set GR32:$dst, (atomic_load_umax_32 addr:$ptr, GR32:$val))]>;
3544 def ATOMAND16 : I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3545 "#ATOMAND16 PSEUDO!",
3546 [(set GR16:$dst, (atomic_load_and_16 addr:$ptr, GR16:$val))]>;
3547 def ATOMOR16 : I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3548 "#ATOMOR16 PSEUDO!",
3549 [(set GR16:$dst, (atomic_load_or_16 addr:$ptr, GR16:$val))]>;
3550 def ATOMXOR16 : I<0, Pseudo,(outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3551 "#ATOMXOR16 PSEUDO!",
3552 [(set GR16:$dst, (atomic_load_xor_16 addr:$ptr, GR16:$val))]>;
3553 def ATOMNAND16 : I<0, Pseudo,(outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3554 "#ATOMNAND16 PSEUDO!",
3555 [(set GR16:$dst, (atomic_load_nand_16 addr:$ptr, GR16:$val))]>;
3556 def ATOMMIN16: I<0, Pseudo, (outs GR16:$dst), (ins i16mem:$ptr, GR16:$val),
3557 "#ATOMMIN16 PSEUDO!",
3558 [(set GR16:$dst, (atomic_load_min_16 addr:$ptr, GR16:$val))]>;
3559 def ATOMMAX16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3560 "#ATOMMAX16 PSEUDO!",
3561 [(set GR16:$dst, (atomic_load_max_16 addr:$ptr, GR16:$val))]>;
3562 def ATOMUMIN16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3563 "#ATOMUMIN16 PSEUDO!",
3564 [(set GR16:$dst, (atomic_load_umin_16 addr:$ptr, GR16:$val))]>;
3565 def ATOMUMAX16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val),
3566 "#ATOMUMAX16 PSEUDO!",
3567 [(set GR16:$dst, (atomic_load_umax_16 addr:$ptr, GR16:$val))]>;
3569 def ATOMAND8 : I<0, Pseudo, (outs GR8:$dst),(ins i8mem:$ptr, GR8:$val),
3570 "#ATOMAND8 PSEUDO!",
3571 [(set GR8:$dst, (atomic_load_and_8 addr:$ptr, GR8:$val))]>;
3572 def ATOMOR8 : I<0, Pseudo, (outs GR8:$dst),(ins i8mem:$ptr, GR8:$val),
3574 [(set GR8:$dst, (atomic_load_or_8 addr:$ptr, GR8:$val))]>;
3575 def ATOMXOR8 : I<0, Pseudo,(outs GR8:$dst),(ins i8mem:$ptr, GR8:$val),
3576 "#ATOMXOR8 PSEUDO!",
3577 [(set GR8:$dst, (atomic_load_xor_8 addr:$ptr, GR8:$val))]>;
3578 def ATOMNAND8 : I<0, Pseudo,(outs GR8:$dst),(ins i8mem:$ptr, GR8:$val),
3579 "#ATOMNAND8 PSEUDO!",
3580 [(set GR8:$dst, (atomic_load_nand_8 addr:$ptr, GR8:$val))]>;
3583 let Constraints = "$val1 = $dst1, $val2 = $dst2",
3584 Defs = [EFLAGS, EAX, EBX, ECX, EDX],
3585 Uses = [EAX, EBX, ECX, EDX],
3586 mayLoad = 1, mayStore = 1,
3587 usesCustomDAGSchedInserter = 1 in {
3588 def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3589 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3590 "#ATOMAND6432 PSEUDO!", []>;
3591 def ATOMOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3592 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3593 "#ATOMOR6432 PSEUDO!", []>;
3594 def ATOMXOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3595 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3596 "#ATOMXOR6432 PSEUDO!", []>;
3597 def ATOMNAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3598 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3599 "#ATOMNAND6432 PSEUDO!", []>;
3600 def ATOMADD6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3601 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3602 "#ATOMADD6432 PSEUDO!", []>;
3603 def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3604 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3605 "#ATOMSUB6432 PSEUDO!", []>;
3606 def ATOMSWAP6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2),
3607 (ins i64mem:$ptr, GR32:$val1, GR32:$val2),
3608 "#ATOMSWAP6432 PSEUDO!", []>;
3611 //===----------------------------------------------------------------------===//
3612 // Non-Instruction Patterns
3613 //===----------------------------------------------------------------------===//
3615 // ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
3616 def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
3617 def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
3618 def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
3619 def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
3620 def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
3622 def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
3623 (ADD32ri GR32:$src1, tconstpool:$src2)>;
3624 def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
3625 (ADD32ri GR32:$src1, tjumptable:$src2)>;
3626 def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
3627 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
3628 def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
3629 (ADD32ri GR32:$src1, texternalsym:$src2)>;
3631 def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
3632 (MOV32mi addr:$dst, tglobaladdr:$src)>;
3633 def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
3634 (MOV32mi addr:$dst, texternalsym:$src)>;
3638 def : Pat<(X86tcret GR32:$dst, imm:$off),
3639 (TCRETURNri GR32:$dst, imm:$off)>;
3641 def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off),
3642 (TCRETURNdi texternalsym:$dst, imm:$off)>;
3644 def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off),
3645 (TCRETURNdi texternalsym:$dst, imm:$off)>;
3647 // Normal calls, with various flavors of addresses.
3648 def : Pat<(X86call (i32 tglobaladdr:$dst)),
3649 (CALLpcrel32 tglobaladdr:$dst)>;
3650 def : Pat<(X86call (i32 texternalsym:$dst)),
3651 (CALLpcrel32 texternalsym:$dst)>;
3652 def : Pat<(X86call (i32 imm:$dst)),
3653 (CALLpcrel32 imm:$dst)>, Requires<[CallImmAddr]>;
3655 // X86 specific add which produces a flag.
3656 def : Pat<(addc GR32:$src1, GR32:$src2),
3657 (ADD32rr GR32:$src1, GR32:$src2)>;
3658 def : Pat<(addc GR32:$src1, (load addr:$src2)),
3659 (ADD32rm GR32:$src1, addr:$src2)>;
3660 def : Pat<(addc GR32:$src1, imm:$src2),
3661 (ADD32ri GR32:$src1, imm:$src2)>;
3662 def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
3663 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
3665 def : Pat<(subc GR32:$src1, GR32:$src2),
3666 (SUB32rr GR32:$src1, GR32:$src2)>;
3667 def : Pat<(subc GR32:$src1, (load addr:$src2)),
3668 (SUB32rm GR32:$src1, addr:$src2)>;
3669 def : Pat<(subc GR32:$src1, imm:$src2),
3670 (SUB32ri GR32:$src1, imm:$src2)>;
3671 def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
3672 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
3676 // TEST R,R is smaller than CMP R,0
3677 def : Pat<(parallel (X86cmp GR8:$src1, 0), (implicit EFLAGS)),
3678 (TEST8rr GR8:$src1, GR8:$src1)>;
3679 def : Pat<(parallel (X86cmp GR16:$src1, 0), (implicit EFLAGS)),
3680 (TEST16rr GR16:$src1, GR16:$src1)>;
3681 def : Pat<(parallel (X86cmp GR32:$src1, 0), (implicit EFLAGS)),
3682 (TEST32rr GR32:$src1, GR32:$src1)>;
3684 // Conditional moves with folded loads with operands swapped and conditions
3686 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_B, EFLAGS),
3687 (CMOVAE16rm GR16:$src2, addr:$src1)>;
3688 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_B, EFLAGS),
3689 (CMOVAE32rm GR32:$src2, addr:$src1)>;
3690 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_AE, EFLAGS),
3691 (CMOVB16rm GR16:$src2, addr:$src1)>;
3692 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_AE, EFLAGS),
3693 (CMOVB32rm GR32:$src2, addr:$src1)>;
3694 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_E, EFLAGS),
3695 (CMOVNE16rm GR16:$src2, addr:$src1)>;
3696 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_E, EFLAGS),
3697 (CMOVNE32rm GR32:$src2, addr:$src1)>;
3698 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NE, EFLAGS),
3699 (CMOVE16rm GR16:$src2, addr:$src1)>;
3700 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NE, EFLAGS),
3701 (CMOVE32rm GR32:$src2, addr:$src1)>;
3702 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_BE, EFLAGS),
3703 (CMOVA16rm GR16:$src2, addr:$src1)>;
3704 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_BE, EFLAGS),
3705 (CMOVA32rm GR32:$src2, addr:$src1)>;
3706 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_A, EFLAGS),
3707 (CMOVBE16rm GR16:$src2, addr:$src1)>;
3708 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_A, EFLAGS),
3709 (CMOVBE32rm GR32:$src2, addr:$src1)>;
3710 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_L, EFLAGS),
3711 (CMOVGE16rm GR16:$src2, addr:$src1)>;
3712 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_L, EFLAGS),
3713 (CMOVGE32rm GR32:$src2, addr:$src1)>;
3714 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_GE, EFLAGS),
3715 (CMOVL16rm GR16:$src2, addr:$src1)>;
3716 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_GE, EFLAGS),
3717 (CMOVL32rm GR32:$src2, addr:$src1)>;
3718 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_LE, EFLAGS),
3719 (CMOVG16rm GR16:$src2, addr:$src1)>;
3720 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_LE, EFLAGS),
3721 (CMOVG32rm GR32:$src2, addr:$src1)>;
3722 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_G, EFLAGS),
3723 (CMOVLE16rm GR16:$src2, addr:$src1)>;
3724 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_G, EFLAGS),
3725 (CMOVLE32rm GR32:$src2, addr:$src1)>;
3726 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_P, EFLAGS),
3727 (CMOVNP16rm GR16:$src2, addr:$src1)>;
3728 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_P, EFLAGS),
3729 (CMOVNP32rm GR32:$src2, addr:$src1)>;
3730 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NP, EFLAGS),
3731 (CMOVP16rm GR16:$src2, addr:$src1)>;
3732 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NP, EFLAGS),
3733 (CMOVP32rm GR32:$src2, addr:$src1)>;
3734 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_S, EFLAGS),
3735 (CMOVNS16rm GR16:$src2, addr:$src1)>;
3736 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_S, EFLAGS),
3737 (CMOVNS32rm GR32:$src2, addr:$src1)>;
3738 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NS, EFLAGS),
3739 (CMOVS16rm GR16:$src2, addr:$src1)>;
3740 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NS, EFLAGS),
3741 (CMOVS32rm GR32:$src2, addr:$src1)>;
3742 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_O, EFLAGS),
3743 (CMOVNO16rm GR16:$src2, addr:$src1)>;
3744 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_O, EFLAGS),
3745 (CMOVNO32rm GR32:$src2, addr:$src1)>;
3746 def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NO, EFLAGS),
3747 (CMOVO16rm GR16:$src2, addr:$src1)>;
3748 def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NO, EFLAGS),
3749 (CMOVO32rm GR32:$src2, addr:$src1)>;
3751 // zextload bool -> zextload byte
3752 def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3753 def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3754 def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3756 // extload bool -> extload byte
3757 def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
3758 def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
3759 def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
3760 def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
3761 def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
3762 def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
3764 // anyext. Define these to do an explicit zero-extend to
3765 // avoid partial-register updates.
3766 def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
3767 def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
3768 def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
3770 // (and (i32 load), 255) -> (zextload i8)
3771 def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 255))),
3772 (MOVZX32rm8 addr:$src)>;
3773 def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 65535))),
3774 (MOVZX32rm16 addr:$src)>;
3776 //===----------------------------------------------------------------------===//
3778 //===----------------------------------------------------------------------===//
3780 // Odd encoding trick: -128 fits into an 8-bit immediate field while
3781 // +128 doesn't, so in this special case use a sub instead of an add.
3782 def : Pat<(add GR16:$src1, 128),
3783 (SUB16ri8 GR16:$src1, -128)>;
3784 def : Pat<(store (add (loadi16 addr:$dst), 128), addr:$dst),
3785 (SUB16mi8 addr:$dst, -128)>;
3786 def : Pat<(add GR32:$src1, 128),
3787 (SUB32ri8 GR32:$src1, -128)>;
3788 def : Pat<(store (add (loadi32 addr:$dst), 128), addr:$dst),
3789 (SUB32mi8 addr:$dst, -128)>;
3791 // r & (2^16-1) ==> movz
3792 def : Pat<(and GR32:$src1, 0xffff),
3793 (MOVZX32rr16 (EXTRACT_SUBREG GR32:$src1, x86_subreg_16bit))>;
3794 // r & (2^8-1) ==> movz
3795 def : Pat<(and GR32:$src1, 0xff),
3796 (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src1, GR32_ABCD),
3798 Requires<[In32BitMode]>;
3799 // r & (2^8-1) ==> movz
3800 def : Pat<(and GR16:$src1, 0xff),
3801 (MOVZX16rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src1, GR16_ABCD),
3803 Requires<[In32BitMode]>;
3805 // sext_inreg patterns
3806 def : Pat<(sext_inreg GR32:$src, i16),
3807 (MOVSX32rr16 (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit))>;
3808 def : Pat<(sext_inreg GR32:$src, i8),
3809 (MOVSX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
3811 Requires<[In32BitMode]>;
3812 def : Pat<(sext_inreg GR16:$src, i8),
3813 (MOVSX16rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3815 Requires<[In32BitMode]>;
3818 def : Pat<(i16 (trunc GR32:$src)),
3819 (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit)>;
3820 def : Pat<(i8 (trunc GR32:$src)),
3821 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
3823 Requires<[In32BitMode]>;
3824 def : Pat<(i8 (trunc GR16:$src)),
3825 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3827 Requires<[In32BitMode]>;
3829 // h-register tricks
3830 def : Pat<(i8 (trunc (srl_su GR16:$src, (i8 8)))),
3831 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3832 x86_subreg_8bit_hi)>,
3833 Requires<[In32BitMode]>;
3834 def : Pat<(i8 (trunc (srl_su GR32:$src, (i8 8)))),
3835 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
3836 x86_subreg_8bit_hi)>,
3837 Requires<[In32BitMode]>;
3838 def : Pat<(srl_su GR16:$src, (i8 8)),
3841 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3842 x86_subreg_8bit_hi)),
3844 Requires<[In32BitMode]>;
3845 def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))),
3846 (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3847 x86_subreg_8bit_hi))>,
3848 Requires<[In32BitMode]>;
3849 def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))),
3850 (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
3851 x86_subreg_8bit_hi))>,
3852 Requires<[In32BitMode]>;
3853 def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)),
3854 (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
3855 x86_subreg_8bit_hi))>,
3856 Requires<[In32BitMode]>;
3858 // (shl x, 1) ==> (add x, x)
3859 def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
3860 def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
3861 def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
3863 // (shl x (and y, 31)) ==> (shl x, y)
3864 def : Pat<(shl GR8:$src1, (and CL:$amt, 31)),
3865 (SHL8rCL GR8:$src1)>;
3866 def : Pat<(shl GR16:$src1, (and CL:$amt, 31)),
3867 (SHL16rCL GR16:$src1)>;
3868 def : Pat<(shl GR32:$src1, (and CL:$amt, 31)),
3869 (SHL32rCL GR32:$src1)>;
3870 def : Pat<(store (shl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3871 (SHL8mCL addr:$dst)>;
3872 def : Pat<(store (shl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3873 (SHL16mCL addr:$dst)>;
3874 def : Pat<(store (shl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3875 (SHL32mCL addr:$dst)>;
3877 def : Pat<(srl GR8:$src1, (and CL:$amt, 31)),
3878 (SHR8rCL GR8:$src1)>;
3879 def : Pat<(srl GR16:$src1, (and CL:$amt, 31)),
3880 (SHR16rCL GR16:$src1)>;
3881 def : Pat<(srl GR32:$src1, (and CL:$amt, 31)),
3882 (SHR32rCL GR32:$src1)>;
3883 def : Pat<(store (srl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3884 (SHR8mCL addr:$dst)>;
3885 def : Pat<(store (srl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3886 (SHR16mCL addr:$dst)>;
3887 def : Pat<(store (srl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3888 (SHR32mCL addr:$dst)>;
3890 def : Pat<(sra GR8:$src1, (and CL:$amt, 31)),
3891 (SAR8rCL GR8:$src1)>;
3892 def : Pat<(sra GR16:$src1, (and CL:$amt, 31)),
3893 (SAR16rCL GR16:$src1)>;
3894 def : Pat<(sra GR32:$src1, (and CL:$amt, 31)),
3895 (SAR32rCL GR32:$src1)>;
3896 def : Pat<(store (sra (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3897 (SAR8mCL addr:$dst)>;
3898 def : Pat<(store (sra (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3899 (SAR16mCL addr:$dst)>;
3900 def : Pat<(store (sra (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
3901 (SAR32mCL addr:$dst)>;
3903 // (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
3904 def : Pat<(or (srl GR32:$src1, CL:$amt),
3905 (shl GR32:$src2, (sub 32, CL:$amt))),
3906 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
3908 def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
3909 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3910 (SHRD32mrCL addr:$dst, GR32:$src2)>;
3912 def : Pat<(or (srl GR32:$src1, (i8 (trunc ECX:$amt))),
3913 (shl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))),
3914 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
3916 def : Pat<(store (or (srl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))),
3917 (shl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))),
3919 (SHRD32mrCL addr:$dst, GR32:$src2)>;
3921 def : Pat<(shrd GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)),
3922 (SHRD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>;
3924 def : Pat<(store (shrd (loadi32 addr:$dst), (i8 imm:$amt1),
3925 GR32:$src2, (i8 imm:$amt2)), addr:$dst),
3926 (SHRD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>;
3928 // (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
3929 def : Pat<(or (shl GR32:$src1, CL:$amt),
3930 (srl GR32:$src2, (sub 32, CL:$amt))),
3931 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
3933 def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
3934 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
3935 (SHLD32mrCL addr:$dst, GR32:$src2)>;
3937 def : Pat<(or (shl GR32:$src1, (i8 (trunc ECX:$amt))),
3938 (srl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))),
3939 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
3941 def : Pat<(store (or (shl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))),
3942 (srl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))),
3944 (SHLD32mrCL addr:$dst, GR32:$src2)>;
3946 def : Pat<(shld GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)),
3947 (SHLD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>;
3949 def : Pat<(store (shld (loadi32 addr:$dst), (i8 imm:$amt1),
3950 GR32:$src2, (i8 imm:$amt2)), addr:$dst),
3951 (SHLD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>;
3953 // (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
3954 def : Pat<(or (srl GR16:$src1, CL:$amt),
3955 (shl GR16:$src2, (sub 16, CL:$amt))),
3956 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
3958 def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
3959 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3960 (SHRD16mrCL addr:$dst, GR16:$src2)>;
3962 def : Pat<(or (srl GR16:$src1, (i8 (trunc CX:$amt))),
3963 (shl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))),
3964 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
3966 def : Pat<(store (or (srl (loadi16 addr:$dst), (i8 (trunc CX:$amt))),
3967 (shl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))),
3969 (SHRD16mrCL addr:$dst, GR16:$src2)>;
3971 def : Pat<(shrd GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)),
3972 (SHRD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>;
3974 def : Pat<(store (shrd (loadi16 addr:$dst), (i8 imm:$amt1),
3975 GR16:$src2, (i8 imm:$amt2)), addr:$dst),
3976 (SHRD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>;
3978 // (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
3979 def : Pat<(or (shl GR16:$src1, CL:$amt),
3980 (srl GR16:$src2, (sub 16, CL:$amt))),
3981 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
3983 def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
3984 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
3985 (SHLD16mrCL addr:$dst, GR16:$src2)>;
3987 def : Pat<(or (shl GR16:$src1, (i8 (trunc CX:$amt))),
3988 (srl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))),
3989 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
3991 def : Pat<(store (or (shl (loadi16 addr:$dst), (i8 (trunc CX:$amt))),
3992 (srl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))),
3994 (SHLD16mrCL addr:$dst, GR16:$src2)>;
3996 def : Pat<(shld GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)),
3997 (SHLD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>;
3999 def : Pat<(store (shld (loadi16 addr:$dst), (i8 imm:$amt1),
4000 GR16:$src2, (i8 imm:$amt2)), addr:$dst),
4001 (SHLD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>;
4003 //===----------------------------------------------------------------------===//
4004 // EFLAGS-defining Patterns
4005 //===----------------------------------------------------------------------===//
4007 // Register-Register Addition with EFLAGS result
4008 def : Pat<(parallel (X86add_flag GR8:$src1, GR8:$src2),
4010 (ADD8rr GR8:$src1, GR8:$src2)>;
4011 def : Pat<(parallel (X86add_flag GR16:$src1, GR16:$src2),
4013 (ADD16rr GR16:$src1, GR16:$src2)>;
4014 def : Pat<(parallel (X86add_flag GR32:$src1, GR32:$src2),
4016 (ADD32rr GR32:$src1, GR32:$src2)>;
4018 // Register-Memory Addition with EFLAGS result
4019 def : Pat<(parallel (X86add_flag GR8:$src1, (loadi8 addr:$src2)),
4021 (ADD8rm GR8:$src1, addr:$src2)>;
4022 def : Pat<(parallel (X86add_flag GR16:$src1, (loadi16 addr:$src2)),
4024 (ADD16rm GR16:$src1, addr:$src2)>;
4025 def : Pat<(parallel (X86add_flag GR32:$src1, (loadi32 addr:$src2)),
4027 (ADD32rm GR32:$src1, addr:$src2)>;
4029 // Register-Integer Addition with EFLAGS result
4030 def : Pat<(parallel (X86add_flag GR8:$src1, imm:$src2),
4032 (ADD8ri GR8:$src1, imm:$src2)>;
4033 def : Pat<(parallel (X86add_flag GR16:$src1, imm:$src2),
4035 (ADD16ri GR16:$src1, imm:$src2)>;
4036 def : Pat<(parallel (X86add_flag GR32:$src1, imm:$src2),
4038 (ADD32ri GR32:$src1, imm:$src2)>;
4039 def : Pat<(parallel (X86add_flag GR16:$src1, i16immSExt8:$src2),
4041 (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>;
4042 def : Pat<(parallel (X86add_flag GR32:$src1, i32immSExt8:$src2),
4044 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
4046 // Memory-Register Addition with EFLAGS result
4047 def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), GR8:$src2),
4050 (ADD8mr addr:$dst, GR8:$src2)>;
4051 def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), GR16:$src2),
4054 (ADD16mr addr:$dst, GR16:$src2)>;
4055 def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), GR32:$src2),
4058 (ADD32mr addr:$dst, GR32:$src2)>;
4060 // Memory-Integer Addition with EFLAGS result
4061 def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), imm:$src2),
4064 (ADD8mi addr:$dst, imm:$src2)>;
4065 def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), imm:$src2),
4068 (ADD16mi addr:$dst, imm:$src2)>;
4069 def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), imm:$src2),
4072 (ADD32mi addr:$dst, imm:$src2)>;
4073 def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), i16immSExt8:$src2),
4076 (ADD16mi8 addr:$dst, i16immSExt8:$src2)>;
4077 def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), i32immSExt8:$src2),
4080 (ADD32mi8 addr:$dst, i32immSExt8:$src2)>;
4082 // Register-Register Subtraction with EFLAGS result
4083 def : Pat<(parallel (X86sub_flag GR8:$src1, GR8:$src2),
4085 (SUB8rr GR8:$src1, GR8:$src2)>;
4086 def : Pat<(parallel (X86sub_flag GR16:$src1, GR16:$src2),
4088 (SUB16rr GR16:$src1, GR16:$src2)>;
4089 def : Pat<(parallel (X86sub_flag GR32:$src1, GR32:$src2),
4091 (SUB32rr GR32:$src1, GR32:$src2)>;
4093 // Register-Memory Subtraction with EFLAGS result
4094 def : Pat<(parallel (X86sub_flag GR8:$src1, (loadi8 addr:$src2)),
4096 (SUB8rm GR8:$src1, addr:$src2)>;
4097 def : Pat<(parallel (X86sub_flag GR16:$src1, (loadi16 addr:$src2)),
4099 (SUB16rm GR16:$src1, addr:$src2)>;
4100 def : Pat<(parallel (X86sub_flag GR32:$src1, (loadi32 addr:$src2)),
4102 (SUB32rm GR32:$src1, addr:$src2)>;
4104 // Register-Integer Subtraction with EFLAGS result
4105 def : Pat<(parallel (X86sub_flag GR8:$src1, imm:$src2),
4107 (SUB8ri GR8:$src1, imm:$src2)>;
4108 def : Pat<(parallel (X86sub_flag GR16:$src1, imm:$src2),
4110 (SUB16ri GR16:$src1, imm:$src2)>;
4111 def : Pat<(parallel (X86sub_flag GR32:$src1, imm:$src2),
4113 (SUB32ri GR32:$src1, imm:$src2)>;
4114 def : Pat<(parallel (X86sub_flag GR16:$src1, i16immSExt8:$src2),
4116 (SUB16ri8 GR16:$src1, i16immSExt8:$src2)>;
4117 def : Pat<(parallel (X86sub_flag GR32:$src1, i32immSExt8:$src2),
4119 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
4121 // Memory-Register Subtraction with EFLAGS result
4122 def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), GR8:$src2),
4125 (SUB8mr addr:$dst, GR8:$src2)>;
4126 def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), GR16:$src2),
4129 (SUB16mr addr:$dst, GR16:$src2)>;
4130 def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), GR32:$src2),
4133 (SUB32mr addr:$dst, GR32:$src2)>;
4135 // Memory-Integer Subtraction with EFLAGS result
4136 def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), imm:$src2),
4139 (SUB8mi addr:$dst, imm:$src2)>;
4140 def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), imm:$src2),
4143 (SUB16mi addr:$dst, imm:$src2)>;
4144 def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), imm:$src2),
4147 (SUB32mi addr:$dst, imm:$src2)>;
4148 def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), i16immSExt8:$src2),
4151 (SUB16mi8 addr:$dst, i16immSExt8:$src2)>;
4152 def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), i32immSExt8:$src2),
4155 (SUB32mi8 addr:$dst, i32immSExt8:$src2)>;
4158 // Register-Register Signed Integer Multiply with EFLAGS result
4159 def : Pat<(parallel (X86smul_flag GR16:$src1, GR16:$src2),
4161 (IMUL16rr GR16:$src1, GR16:$src2)>;
4162 def : Pat<(parallel (X86smul_flag GR32:$src1, GR32:$src2),
4164 (IMUL32rr GR32:$src1, GR32:$src2)>;
4166 // Register-Memory Signed Integer Multiply with EFLAGS result
4167 def : Pat<(parallel (X86smul_flag GR16:$src1, (loadi16 addr:$src2)),
4169 (IMUL16rm GR16:$src1, addr:$src2)>;
4170 def : Pat<(parallel (X86smul_flag GR32:$src1, (loadi32 addr:$src2)),
4172 (IMUL32rm GR32:$src1, addr:$src2)>;
4174 // Register-Integer Signed Integer Multiply with EFLAGS result
4175 def : Pat<(parallel (X86smul_flag GR16:$src1, imm:$src2),
4177 (IMUL16rri GR16:$src1, imm:$src2)>;
4178 def : Pat<(parallel (X86smul_flag GR32:$src1, imm:$src2),
4180 (IMUL32rri GR32:$src1, imm:$src2)>;
4181 def : Pat<(parallel (X86smul_flag GR16:$src1, i16immSExt8:$src2),
4183 (IMUL16rri8 GR16:$src1, i16immSExt8:$src2)>;
4184 def : Pat<(parallel (X86smul_flag GR32:$src1, i32immSExt8:$src2),
4186 (IMUL32rri8 GR32:$src1, i32immSExt8:$src2)>;
4188 // Memory-Integer Signed Integer Multiply with EFLAGS result
4189 def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), imm:$src2),
4191 (IMUL16rmi addr:$src1, imm:$src2)>;
4192 def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), imm:$src2),
4194 (IMUL32rmi addr:$src1, imm:$src2)>;
4195 def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), i16immSExt8:$src2),
4197 (IMUL16rmi8 addr:$src1, i16immSExt8:$src2)>;
4198 def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), i32immSExt8:$src2),
4200 (IMUL32rmi8 addr:$src1, i32immSExt8:$src2)>;
4202 // Optimize multiply by 2 with EFLAGS result.
4203 let AddedComplexity = 2 in {
4204 def : Pat<(parallel (X86smul_flag GR16:$src1, 2),
4206 (ADD16rr GR16:$src1, GR16:$src1)>;
4208 def : Pat<(parallel (X86smul_flag GR32:$src1, 2),
4210 (ADD32rr GR32:$src1, GR32:$src1)>;
4213 // INC and DEC with EFLAGS result. Note that these do not set CF.
4214 def : Pat<(parallel (X86inc_flag GR8:$src), (implicit EFLAGS)),
4216 def : Pat<(parallel (store (i8 (X86inc_flag (loadi8 addr:$dst))), addr:$dst),
4219 def : Pat<(parallel (X86dec_flag GR8:$src), (implicit EFLAGS)),
4221 def : Pat<(parallel (store (i8 (X86dec_flag (loadi8 addr:$dst))), addr:$dst),
4225 def : Pat<(parallel (X86inc_flag GR16:$src), (implicit EFLAGS)),
4226 (INC16r GR16:$src)>, Requires<[In32BitMode]>;
4227 def : Pat<(parallel (store (i16 (X86inc_flag (loadi16 addr:$dst))), addr:$dst),
4229 (INC16m addr:$dst)>, Requires<[In32BitMode]>;
4230 def : Pat<(parallel (X86dec_flag GR16:$src), (implicit EFLAGS)),
4231 (DEC16r GR16:$src)>, Requires<[In32BitMode]>;
4232 def : Pat<(parallel (store (i16 (X86dec_flag (loadi16 addr:$dst))), addr:$dst),
4234 (DEC16m addr:$dst)>, Requires<[In32BitMode]>;
4236 def : Pat<(parallel (X86inc_flag GR32:$src), (implicit EFLAGS)),
4237 (INC32r GR32:$src)>, Requires<[In32BitMode]>;
4238 def : Pat<(parallel (store (i32 (X86inc_flag (loadi32 addr:$dst))), addr:$dst),
4240 (INC32m addr:$dst)>, Requires<[In32BitMode]>;
4241 def : Pat<(parallel (X86dec_flag GR32:$src), (implicit EFLAGS)),
4242 (DEC32r GR32:$src)>, Requires<[In32BitMode]>;
4243 def : Pat<(parallel (store (i32 (X86dec_flag (loadi32 addr:$dst))), addr:$dst),
4245 (DEC32m addr:$dst)>, Requires<[In32BitMode]>;
4247 // -disable-16bit support.
4248 def : Pat<(truncstorei16 (i32 imm:$src), addr:$dst),
4249 (MOV16mi addr:$dst, imm:$src)>;
4250 def : Pat<(truncstorei16 GR32:$src, addr:$dst),
4251 (MOV16mr addr:$dst, (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit))>;
4252 def : Pat<(i32 (sextloadi16 addr:$dst)),
4253 (MOVSX32rm16 addr:$dst)>;
4254 def : Pat<(i32 (zextloadi16 addr:$dst)),
4255 (MOVZX32rm16 addr:$dst)>;
4256 def : Pat<(i32 (extloadi16 addr:$dst)),
4257 (MOVZX32rm16 addr:$dst)>;
4259 //===----------------------------------------------------------------------===//
4260 // Floating Point Stack Support
4261 //===----------------------------------------------------------------------===//
4263 include "X86InstrFPStack.td"
4265 //===----------------------------------------------------------------------===//
4267 //===----------------------------------------------------------------------===//
4269 include "X86Instr64bit.td"
4271 //===----------------------------------------------------------------------===//
4272 // XMM Floating point support (requires SSE / SSE2)
4273 //===----------------------------------------------------------------------===//
4275 include "X86InstrSSE.td"
4277 //===----------------------------------------------------------------------===//
4278 // MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
4279 //===----------------------------------------------------------------------===//
4281 include "X86InstrMMX.td"