1 //===- X86InstrInfo.td - Main X86 Instruction Definition ---*- 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<1, 2, [SDTCisVT<0, i32>, SDTCisSameAs<1, 2>]>;
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<2, 1,
32 [SDTCisInt<0>, SDTCisVT<1, i32>]>;
34 def SDTBinaryArithWithFlags : SDTypeProfile<2, 2,
37 SDTCisInt<0>, SDTCisVT<1, i32>]>;
38 def SDTX86BrCond : SDTypeProfile<0, 3,
39 [SDTCisVT<0, OtherVT>,
40 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
42 def SDTX86SetCC : SDTypeProfile<1, 2,
44 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
45 def SDTX86SetCC_C : SDTypeProfile<1, 2,
47 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
49 def SDTX86cas : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisInt<1>,
51 def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
53 def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>,
54 SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>;
55 def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>;
57 def SDT_X86CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>;
58 def SDT_X86CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>,
61 def SDT_X86Call : SDTypeProfile<0, -1, [SDTCisVT<0, iPTR>]>;
63 def SDT_X86VASTART_SAVE_XMM_REGS : SDTypeProfile<0, -1, [SDTCisVT<0, i8>,
67 def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
69 def SDTX86Void : SDTypeProfile<0, 0, []>;
71 def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
73 def SDT_X86TLSADDR : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
75 def SDT_X86TLSCALL : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>;
77 def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
79 def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
81 def SDT_X86MEMBARRIER : SDTypeProfile<0, 0, []>;
82 def SDT_X86MEMBARRIERNoSSE : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
84 def X86MemBarrier : SDNode<"X86ISD::MEMBARRIER", SDT_X86MEMBARRIER,
86 def X86MemBarrierNoSSE : SDNode<"X86ISD::MEMBARRIER", SDT_X86MEMBARRIERNoSSE,
88 def X86MFence : SDNode<"X86ISD::MFENCE", SDT_X86MEMBARRIER,
90 def X86SFence : SDNode<"X86ISD::SFENCE", SDT_X86MEMBARRIER,
92 def X86LFence : SDNode<"X86ISD::LFENCE", SDT_X86MEMBARRIER,
96 def X86bsf : SDNode<"X86ISD::BSF", SDTUnaryArithWithFlags>;
97 def X86bsr : SDNode<"X86ISD::BSR", SDTUnaryArithWithFlags>;
98 def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
99 def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
101 def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>;
102 def X86bt : SDNode<"X86ISD::BT", SDTX86CmpTest>;
104 def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>;
105 def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
107 def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>;
108 def X86setcc_c : SDNode<"X86ISD::SETCC_CARRY", SDTX86SetCC_C>;
110 def X86cas : SDNode<"X86ISD::LCMPXCHG_DAG", SDTX86cas,
111 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
112 SDNPMayLoad, SDNPMemOperand]>;
113 def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8,
114 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
115 SDNPMayLoad, SDNPMemOperand]>;
116 def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary,
117 [SDNPHasChain, SDNPMayStore,
118 SDNPMayLoad, SDNPMemOperand]>;
119 def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary,
120 [SDNPHasChain, SDNPMayStore,
121 SDNPMayLoad, SDNPMemOperand]>;
122 def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary,
123 [SDNPHasChain, SDNPMayStore,
124 SDNPMayLoad, SDNPMemOperand]>;
125 def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary,
126 [SDNPHasChain, SDNPMayStore,
127 SDNPMayLoad, SDNPMemOperand]>;
128 def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary,
129 [SDNPHasChain, SDNPMayStore,
130 SDNPMayLoad, SDNPMemOperand]>;
131 def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary,
132 [SDNPHasChain, SDNPMayStore,
133 SDNPMayLoad, SDNPMemOperand]>;
134 def X86AtomSwap64 : SDNode<"X86ISD::ATOMSWAP64_DAG", SDTX86atomicBinary,
135 [SDNPHasChain, SDNPMayStore,
136 SDNPMayLoad, SDNPMemOperand]>;
137 def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
138 [SDNPHasChain, SDNPOptInFlag, SDNPVariadic]>;
140 def X86vastart_save_xmm_regs :
141 SDNode<"X86ISD::VASTART_SAVE_XMM_REGS",
142 SDT_X86VASTART_SAVE_XMM_REGS,
143 [SDNPHasChain, SDNPVariadic]>;
145 def X86callseq_start :
146 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
147 [SDNPHasChain, SDNPOutFlag]>;
149 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
150 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
152 def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
153 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag,
156 def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
157 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>;
158 def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
159 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
162 def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG", SDTX86Void,
163 [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>;
165 def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
166 def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>;
168 def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
169 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
171 def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
174 def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET,
175 [SDNPHasChain, SDNPOptInFlag, SDNPVariadic]>;
177 def X86add_flag : SDNode<"X86ISD::ADD", SDTBinaryArithWithFlags,
179 def X86sub_flag : SDNode<"X86ISD::SUB", SDTBinaryArithWithFlags>;
180 def X86smul_flag : SDNode<"X86ISD::SMUL", SDTBinaryArithWithFlags,
182 def X86umul_flag : SDNode<"X86ISD::UMUL", SDTUnaryArithWithFlags,
185 def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>;
186 def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>;
187 def X86or_flag : SDNode<"X86ISD::OR", SDTBinaryArithWithFlags,
189 def X86xor_flag : SDNode<"X86ISD::XOR", SDTBinaryArithWithFlags,
191 def X86and_flag : SDNode<"X86ISD::AND", SDTBinaryArithWithFlags,
194 def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>;
196 def X86MingwAlloca : SDNode<"X86ISD::MINGW_ALLOCA", SDTX86Void,
197 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
199 def X86TLSCall : SDNode<"X86ISD::TLSCALL", SDT_X86TLSCALL,
202 //===----------------------------------------------------------------------===//
203 // X86 Operand Definitions.
206 // A version of ptr_rc which excludes SP, ESP, and RSP. This is used for
207 // the index operand of an address, to conform to x86 encoding restrictions.
208 def ptr_rc_nosp : PointerLikeRegClass<1>;
210 // *mem - Operand definitions for the funky X86 addressing mode operands.
212 def X86MemAsmOperand : AsmOperandClass {
214 let SuperClasses = [];
216 def X86AbsMemAsmOperand : AsmOperandClass {
218 let SuperClasses = [X86MemAsmOperand];
220 class X86MemOperand<string printMethod> : Operand<iPTR> {
221 let PrintMethod = printMethod;
222 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
223 let ParserMatchClass = X86MemAsmOperand;
226 def opaque32mem : X86MemOperand<"printopaquemem">;
227 def opaque48mem : X86MemOperand<"printopaquemem">;
228 def opaque80mem : X86MemOperand<"printopaquemem">;
229 def opaque512mem : X86MemOperand<"printopaquemem">;
231 def i8mem : X86MemOperand<"printi8mem">;
232 def i16mem : X86MemOperand<"printi16mem">;
233 def i32mem : X86MemOperand<"printi32mem">;
234 def i64mem : X86MemOperand<"printi64mem">;
235 def i128mem : X86MemOperand<"printi128mem">;
236 def i256mem : X86MemOperand<"printi256mem">;
237 def f32mem : X86MemOperand<"printf32mem">;
238 def f64mem : X86MemOperand<"printf64mem">;
239 def f80mem : X86MemOperand<"printf80mem">;
240 def f128mem : X86MemOperand<"printf128mem">;
241 def f256mem : X86MemOperand<"printf256mem">;
243 // A version of i8mem for use on x86-64 that uses GR64_NOREX instead of
244 // plain GR64, so that it doesn't potentially require a REX prefix.
245 def i8mem_NOREX : Operand<i64> {
246 let PrintMethod = "printi8mem";
247 let MIOperandInfo = (ops GR64_NOREX, i8imm, GR64_NOREX_NOSP, i32imm, i8imm);
248 let ParserMatchClass = X86MemAsmOperand;
251 // Special i32mem for addresses of load folding tail calls. These are not
252 // allowed to use callee-saved registers since they must be scheduled
253 // after callee-saved register are popped.
254 def i32mem_TC : Operand<i32> {
255 let PrintMethod = "printi32mem";
256 let MIOperandInfo = (ops GR32_TC, i8imm, GR32_TC, i32imm, i8imm);
257 let ParserMatchClass = X86MemAsmOperand;
260 // Special i64mem for addresses of load folding tail calls. These are not
261 // allowed to use callee-saved registers since they must be scheduled
262 // after callee-saved register are popped.
263 def i64mem_TC : Operand<i64> {
264 let PrintMethod = "printi64mem";
265 let MIOperandInfo = (ops GR64_TC, i8imm, GR64_TC, i32imm, i8imm);
266 let ParserMatchClass = X86MemAsmOperand;
269 let ParserMatchClass = X86AbsMemAsmOperand,
270 PrintMethod = "print_pcrel_imm" in {
271 def i32imm_pcrel : Operand<i32>;
272 def i16imm_pcrel : Operand<i16>;
274 def offset8 : Operand<i64>;
275 def offset16 : Operand<i64>;
276 def offset32 : Operand<i64>;
277 def offset64 : Operand<i64>;
279 // Branch targets have OtherVT type and print as pc-relative values.
280 def brtarget : Operand<OtherVT>;
281 def brtarget8 : Operand<OtherVT>;
285 def SSECC : Operand<i8> {
286 let PrintMethod = "printSSECC";
289 class ImmSExtAsmOperandClass : AsmOperandClass {
290 let SuperClasses = [ImmAsmOperand];
291 let RenderMethod = "addImmOperands";
294 // Sign-extended immediate classes. We don't need to define the full lattice
295 // here because there is no instruction with an ambiguity between ImmSExti64i32
298 // The strange ranges come from the fact that the assembler always works with
299 // 64-bit immediates, but for a 16-bit target value we want to accept both "-1"
300 // (which will be a -1ULL), and "0xFF" (-1 in 16-bits).
303 // [0xFFFFFFFF80000000, 0xFFFFFFFFFFFFFFFF]
304 def ImmSExti64i32AsmOperand : ImmSExtAsmOperandClass {
305 let Name = "ImmSExti64i32";
308 // [0, 0x0000007F] | [0x000000000000FF80, 0x000000000000FFFF] |
309 // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF]
310 def ImmSExti16i8AsmOperand : ImmSExtAsmOperandClass {
311 let Name = "ImmSExti16i8";
312 let SuperClasses = [ImmSExti64i32AsmOperand];
315 // [0, 0x0000007F] | [0x00000000FFFFFF80, 0x00000000FFFFFFFF] |
316 // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF]
317 def ImmSExti32i8AsmOperand : ImmSExtAsmOperandClass {
318 let Name = "ImmSExti32i8";
322 // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF]
323 def ImmSExti64i8AsmOperand : ImmSExtAsmOperandClass {
324 let Name = "ImmSExti64i8";
325 let SuperClasses = [ImmSExti16i8AsmOperand, ImmSExti32i8AsmOperand,
326 ImmSExti64i32AsmOperand];
329 // A couple of more descriptive operand definitions.
330 // 16-bits but only 8 bits are significant.
331 def i16i8imm : Operand<i16> {
332 let ParserMatchClass = ImmSExti16i8AsmOperand;
334 // 32-bits but only 8 bits are significant.
335 def i32i8imm : Operand<i32> {
336 let ParserMatchClass = ImmSExti32i8AsmOperand;
339 // 64-bits but only 32 bits are significant.
340 def i64i32imm : Operand<i64> {
341 let ParserMatchClass = ImmSExti64i32AsmOperand;
344 // 64-bits but only 32 bits are significant, and those bits are treated as being
346 def i64i32imm_pcrel : Operand<i64> {
347 let PrintMethod = "print_pcrel_imm";
348 let ParserMatchClass = X86AbsMemAsmOperand;
351 // 64-bits but only 8 bits are significant.
352 def i64i8imm : Operand<i64> {
353 let ParserMatchClass = ImmSExti64i8AsmOperand;
356 def lea64_32mem : Operand<i32> {
357 let PrintMethod = "printi32mem";
358 let AsmOperandLowerMethod = "lower_lea64_32mem";
359 let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm, i8imm);
360 let ParserMatchClass = X86MemAsmOperand;
364 //===----------------------------------------------------------------------===//
365 // X86 Complex Pattern Definitions.
368 // Define X86 specific addressing mode.
369 def addr : ComplexPattern<iPTR, 5, "SelectAddr", [], [SDNPWantParent]>;
370 def lea32addr : ComplexPattern<i32, 5, "SelectLEAAddr",
371 [add, sub, mul, X86mul_imm, shl, or, frameindex],
373 def tls32addr : ComplexPattern<i32, 5, "SelectTLSADDRAddr",
374 [tglobaltlsaddr], []>;
376 def lea64addr : ComplexPattern<i64, 5, "SelectLEAAddr",
377 [add, sub, mul, X86mul_imm, shl, or, frameindex,
380 def tls64addr : ComplexPattern<i64, 5, "SelectTLSADDRAddr",
381 [tglobaltlsaddr], []>;
383 //===----------------------------------------------------------------------===//
384 // X86 Instruction Predicate Definitions.
385 def HasCMov : Predicate<"Subtarget->hasCMov()">;
386 def NoCMov : Predicate<"!Subtarget->hasCMov()">;
388 // FIXME: temporary hack to let codegen assert or generate poor code in case
389 // no AVX version of the desired intructions is present, this is better for
390 // incremental dev (without fallbacks it's easier to spot what's missing)
391 def HasMMX : Predicate<"Subtarget->hasMMX() && !Subtarget->hasAVX()">;
392 def Has3DNow : Predicate<"Subtarget->has3DNow()">;
393 def Has3DNowA : Predicate<"Subtarget->has3DNowA()">;
394 def HasSSE1 : Predicate<"Subtarget->hasSSE1() && !Subtarget->hasAVX()">;
395 def HasSSE2 : Predicate<"Subtarget->hasSSE2() && !Subtarget->hasAVX()">;
396 def HasSSE3 : Predicate<"Subtarget->hasSSE3() && !Subtarget->hasAVX()">;
397 def HasSSSE3 : Predicate<"Subtarget->hasSSSE3() && !Subtarget->hasAVX()">;
398 def HasSSE41 : Predicate<"Subtarget->hasSSE41() && !Subtarget->hasAVX()">;
399 def HasSSE42 : Predicate<"Subtarget->hasSSE42() && !Subtarget->hasAVX()">;
400 def HasSSE4A : Predicate<"Subtarget->hasSSE4A() && !Subtarget->hasAVX()">;
402 def HasAVX : Predicate<"Subtarget->hasAVX()">;
403 def HasCLMUL : Predicate<"Subtarget->hasCLMUL()">;
404 def HasFMA3 : Predicate<"Subtarget->hasFMA3()">;
405 def HasFMA4 : Predicate<"Subtarget->hasFMA4()">;
406 def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">;
407 def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">;
408 def In32BitMode : Predicate<"!Subtarget->is64Bit()">;
409 def In64BitMode : Predicate<"Subtarget->is64Bit()">;
410 def IsWin64 : Predicate<"Subtarget->isTargetWin64()">;
411 def NotWin64 : Predicate<"!Subtarget->isTargetWin64()">;
412 def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">;
413 def KernelCode : Predicate<"TM.getCodeModel() == CodeModel::Kernel">;
414 def FarData : Predicate<"TM.getCodeModel() != CodeModel::Small &&"
415 "TM.getCodeModel() != CodeModel::Kernel">;
416 def NearData : Predicate<"TM.getCodeModel() == CodeModel::Small ||"
417 "TM.getCodeModel() == CodeModel::Kernel">;
418 def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">;
419 def IsNotPIC : Predicate<"TM.getRelocationModel() != Reloc::PIC_">;
420 def OptForSize : Predicate<"OptForSize">;
421 def OptForSpeed : Predicate<"!OptForSize">;
422 def FastBTMem : Predicate<"!Subtarget->isBTMemSlow()">;
423 def CallImmAddr : Predicate<"Subtarget->IsLegalToCallImmediateAddr(TM)">;
424 def HasAES : Predicate<"Subtarget->hasAES()">;
426 //===----------------------------------------------------------------------===//
427 // X86 Instruction Format Definitions.
430 include "X86InstrFormats.td"
432 //===----------------------------------------------------------------------===//
433 // Pattern fragments...
436 // X86 specific condition code. These correspond to CondCode in
437 // X86InstrInfo.h. They must be kept in synch.
438 def X86_COND_A : PatLeaf<(i8 0)>; // alt. COND_NBE
439 def X86_COND_AE : PatLeaf<(i8 1)>; // alt. COND_NC
440 def X86_COND_B : PatLeaf<(i8 2)>; // alt. COND_C
441 def X86_COND_BE : PatLeaf<(i8 3)>; // alt. COND_NA
442 def X86_COND_E : PatLeaf<(i8 4)>; // alt. COND_Z
443 def X86_COND_G : PatLeaf<(i8 5)>; // alt. COND_NLE
444 def X86_COND_GE : PatLeaf<(i8 6)>; // alt. COND_NL
445 def X86_COND_L : PatLeaf<(i8 7)>; // alt. COND_NGE
446 def X86_COND_LE : PatLeaf<(i8 8)>; // alt. COND_NG
447 def X86_COND_NE : PatLeaf<(i8 9)>; // alt. COND_NZ
448 def X86_COND_NO : PatLeaf<(i8 10)>;
449 def X86_COND_NP : PatLeaf<(i8 11)>; // alt. COND_PO
450 def X86_COND_NS : PatLeaf<(i8 12)>;
451 def X86_COND_O : PatLeaf<(i8 13)>;
452 def X86_COND_P : PatLeaf<(i8 14)>; // alt. COND_PE
453 def X86_COND_S : PatLeaf<(i8 15)>;
455 def immSext8 : PatLeaf<(imm), [{ return immSext8(N); }]>;
457 def i16immSExt8 : PatLeaf<(i16 immSext8)>;
458 def i32immSExt8 : PatLeaf<(i32 immSext8)>;
459 def i64immSExt8 : PatLeaf<(i64 immSext8)>;
460 def i64immSExt32 : PatLeaf<(i64 imm), [{ return i64immSExt32(N); }]>;
461 def i64immZExt32 : PatLeaf<(i64 imm), [{
462 // i64immZExt32 predicate - True if the 64-bit immediate fits in a 32-bit
463 // unsignedsign extended field.
464 return (uint64_t)N->getZExtValue() == (uint32_t)N->getZExtValue();
467 // Helper fragments for loads.
468 // It's always safe to treat a anyext i16 load as a i32 load if the i16 is
469 // known to be 32-bit aligned or better. Ditto for i8 to i16.
470 def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{
471 LoadSDNode *LD = cast<LoadSDNode>(N);
472 ISD::LoadExtType ExtType = LD->getExtensionType();
473 if (ExtType == ISD::NON_EXTLOAD)
475 if (ExtType == ISD::EXTLOAD)
476 return LD->getAlignment() >= 2 && !LD->isVolatile();
480 def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),[{
481 LoadSDNode *LD = cast<LoadSDNode>(N);
482 ISD::LoadExtType ExtType = LD->getExtensionType();
483 if (ExtType == ISD::EXTLOAD)
484 return LD->getAlignment() >= 2 && !LD->isVolatile();
488 def loadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
489 LoadSDNode *LD = cast<LoadSDNode>(N);
490 ISD::LoadExtType ExtType = LD->getExtensionType();
491 if (ExtType == ISD::NON_EXTLOAD)
493 if (ExtType == ISD::EXTLOAD)
494 return LD->getAlignment() >= 4 && !LD->isVolatile();
498 def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>;
499 def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>;
500 def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>;
501 def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>;
502 def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr))>;
504 def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
505 def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
506 def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>;
507 def sextloadi64i8 : PatFrag<(ops node:$ptr), (i64 (sextloadi8 node:$ptr))>;
508 def sextloadi64i16 : PatFrag<(ops node:$ptr), (i64 (sextloadi16 node:$ptr))>;
509 def sextloadi64i32 : PatFrag<(ops node:$ptr), (i64 (sextloadi32 node:$ptr))>;
511 def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>;
512 def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>;
513 def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>;
514 def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
515 def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>;
516 def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>;
517 def zextloadi64i1 : PatFrag<(ops node:$ptr), (i64 (zextloadi1 node:$ptr))>;
518 def zextloadi64i8 : PatFrag<(ops node:$ptr), (i64 (zextloadi8 node:$ptr))>;
519 def zextloadi64i16 : PatFrag<(ops node:$ptr), (i64 (zextloadi16 node:$ptr))>;
520 def zextloadi64i32 : PatFrag<(ops node:$ptr), (i64 (zextloadi32 node:$ptr))>;
522 def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>;
523 def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>;
524 def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>;
525 def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>;
526 def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>;
527 def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
528 def extloadi64i1 : PatFrag<(ops node:$ptr), (i64 (extloadi1 node:$ptr))>;
529 def extloadi64i8 : PatFrag<(ops node:$ptr), (i64 (extloadi8 node:$ptr))>;
530 def extloadi64i16 : PatFrag<(ops node:$ptr), (i64 (extloadi16 node:$ptr))>;
531 def extloadi64i32 : PatFrag<(ops node:$ptr), (i64 (extloadi32 node:$ptr))>;
534 // An 'and' node with a single use.
535 def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{
536 return N->hasOneUse();
538 // An 'srl' node with a single use.
539 def srl_su : PatFrag<(ops node:$lhs, node:$rhs), (srl node:$lhs, node:$rhs), [{
540 return N->hasOneUse();
542 // An 'trunc' node with a single use.
543 def trunc_su : PatFrag<(ops node:$src), (trunc node:$src), [{
544 return N->hasOneUse();
547 // Treat an 'or' node is as an 'add' if the or'ed bits are known to be zero.
548 def or_is_add : PatFrag<(ops node:$lhs, node:$rhs), (or node:$lhs, node:$rhs),[{
549 if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1)))
550 return CurDAG->MaskedValueIsZero(N->getOperand(0), CN->getAPIntValue());
552 unsigned BitWidth = N->getValueType(0).getScalarType().getSizeInBits();
553 APInt Mask = APInt::getAllOnesValue(BitWidth);
554 APInt KnownZero0, KnownOne0;
555 CurDAG->ComputeMaskedBits(N->getOperand(0), Mask, KnownZero0, KnownOne0, 0);
556 APInt KnownZero1, KnownOne1;
557 CurDAG->ComputeMaskedBits(N->getOperand(1), Mask, KnownZero1, KnownOne1, 0);
558 return (~KnownZero0 & ~KnownZero1) == 0;
561 //===----------------------------------------------------------------------===//
566 let neverHasSideEffects = 1 in {
567 def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
568 def NOOPW : I<0x1f, MRM0m, (outs), (ins i16mem:$zero),
569 "nop{w}\t$zero", []>, TB, OpSize;
570 def NOOPL : I<0x1f, MRM0m, (outs), (ins i32mem:$zero),
571 "nop{l}\t$zero", []>, TB;
575 // Constructing a stack frame.
576 def ENTER : Ii16<0xC8, RawFrmImm8, (outs), (ins i16imm:$len, i8imm:$lvl),
577 "enter\t$len, $lvl", []>;
579 let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in
580 def LEAVE : I<0xC9, RawFrm,
581 (outs), (ins), "leave", []>, Requires<[In32BitMode]>;
583 let Defs = [RBP,RSP], Uses = [RBP,RSP], mayLoad = 1, neverHasSideEffects = 1 in
584 def LEAVE64 : I<0xC9, RawFrm,
585 (outs), (ins), "leave", []>, Requires<[In64BitMode]>;
587 //===----------------------------------------------------------------------===//
588 // Miscellaneous Instructions.
591 let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in {
593 def POP16r : I<0x58, AddRegFrm, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
595 def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
596 def POP16rmr: I<0x8F, MRM0r, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>,
598 def POP16rmm: I<0x8F, MRM0m, (outs i16mem:$dst), (ins), "pop{w}\t$dst", []>,
600 def POP32rmr: I<0x8F, MRM0r, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
601 def POP32rmm: I<0x8F, MRM0m, (outs i32mem:$dst), (ins), "pop{l}\t$dst", []>;
604 let mayStore = 1 in {
605 def PUSH16r : I<0x50, AddRegFrm, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
607 def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
608 def PUSH16rmr: I<0xFF, MRM6r, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>,
610 def PUSH16rmm: I<0xFF, MRM6m, (outs), (ins i16mem:$src), "push{w}\t$src",[]>,
612 def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
613 def PUSH32rmm: I<0xFF, MRM6m, (outs), (ins i32mem:$src), "push{l}\t$src",[]>;
617 let Defs = [ESP], Uses = [ESP], neverHasSideEffects = 1, mayStore = 1 in {
618 def PUSHi8 : Ii8<0x6a, RawFrm, (outs), (ins i32i8imm:$imm),
619 "push{l}\t$imm", []>;
620 def PUSHi16 : Ii16<0x68, RawFrm, (outs), (ins i16imm:$imm),
621 "push{w}\t$imm", []>, OpSize;
622 def PUSHi32 : Ii32<0x68, RawFrm, (outs), (ins i32imm:$imm),
623 "push{l}\t$imm", []>;
626 let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in {
627 def POPF16 : I<0x9D, RawFrm, (outs), (ins), "popf{w}", []>, OpSize;
628 def POPF32 : I<0x9D, RawFrm, (outs), (ins), "popf{l|d}", []>,
629 Requires<[In32BitMode]>;
631 let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in {
632 def PUSHF16 : I<0x9C, RawFrm, (outs), (ins), "pushf{w}", []>, OpSize;
633 def PUSHF32 : I<0x9C, RawFrm, (outs), (ins), "pushf{l|d}", []>,
634 Requires<[In32BitMode]>;
637 let Defs = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP], Uses = [ESP],
638 mayLoad=1, neverHasSideEffects=1 in {
639 def POPA32 : I<0x61, RawFrm, (outs), (ins), "popa{l}", []>,
640 Requires<[In32BitMode]>;
642 let Defs = [ESP], Uses = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP],
643 mayStore=1, neverHasSideEffects=1 in {
644 def PUSHA32 : I<0x60, RawFrm, (outs), (ins), "pusha{l}", []>,
645 Requires<[In32BitMode]>;
648 let Uses = [EFLAGS], Constraints = "$src = $dst" in // GR32 = bswap GR32
649 def BSWAP32r : I<0xC8, AddRegFrm,
650 (outs GR32:$dst), (ins GR32:$src),
652 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
655 // Bit scan instructions.
656 let Defs = [EFLAGS] in {
657 def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
658 "bsf{w}\t{$src, $dst|$dst, $src}",
659 [(set GR16:$dst, EFLAGS, (X86bsf GR16:$src))]>, TB, OpSize;
660 def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
661 "bsf{w}\t{$src, $dst|$dst, $src}",
662 [(set GR16:$dst, EFLAGS, (X86bsf (loadi16 addr:$src)))]>, TB,
664 def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
665 "bsf{l}\t{$src, $dst|$dst, $src}",
666 [(set GR32:$dst, EFLAGS, (X86bsf GR32:$src))]>, TB;
667 def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
668 "bsf{l}\t{$src, $dst|$dst, $src}",
669 [(set GR32:$dst, EFLAGS, (X86bsf (loadi32 addr:$src)))]>, TB;
671 def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
672 "bsr{w}\t{$src, $dst|$dst, $src}",
673 [(set GR16:$dst, EFLAGS, (X86bsr GR16:$src))]>, TB, OpSize;
674 def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
675 "bsr{w}\t{$src, $dst|$dst, $src}",
676 [(set GR16:$dst, EFLAGS, (X86bsr (loadi16 addr:$src)))]>, TB,
678 def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
679 "bsr{l}\t{$src, $dst|$dst, $src}",
680 [(set GR32:$dst, EFLAGS, (X86bsr GR32:$src))]>, TB;
681 def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
682 "bsr{l}\t{$src, $dst|$dst, $src}",
683 [(set GR32:$dst, EFLAGS, (X86bsr (loadi32 addr:$src)))]>, TB;
686 let neverHasSideEffects = 1 in
687 def LEA16r : I<0x8D, MRMSrcMem,
688 (outs GR16:$dst), (ins i32mem:$src),
689 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
690 let isReMaterializable = 1 in
691 def LEA32r : I<0x8D, MRMSrcMem,
692 (outs GR32:$dst), (ins i32mem:$src),
693 "lea{l}\t{$src|$dst}, {$dst|$src}",
694 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
697 // These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI
698 let Defs = [EDI,ESI], Uses = [EDI,ESI,EFLAGS] in {
699 def MOVSB : I<0xA4, RawFrm, (outs), (ins), "{movsb}", []>;
700 def MOVSW : I<0xA5, RawFrm, (outs), (ins), "{movsw}", []>, OpSize;
701 def MOVSD : I<0xA5, RawFrm, (outs), (ins), "{movsl|movsd}", []>;
702 def MOVSQ : RI<0xA5, RawFrm, (outs), (ins), "movsq", []>;
705 // These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI
706 let Defs = [EDI], Uses = [AL,EDI,EFLAGS] in
707 def STOSB : I<0xAA, RawFrm, (outs), (ins), "{stosb}", []>;
708 let Defs = [EDI], Uses = [AX,EDI,EFLAGS] in
709 def STOSW : I<0xAB, RawFrm, (outs), (ins), "{stosw}", []>, OpSize;
710 let Defs = [EDI], Uses = [EAX,EDI,EFLAGS] in
711 def STOSD : I<0xAB, RawFrm, (outs), (ins), "{stosl|stosd}", []>;
712 let Defs = [RCX,RDI], Uses = [RAX,RCX,RDI,EFLAGS] in
713 def STOSQ : RI<0xAB, RawFrm, (outs), (ins), "stosq", []>;
715 def SCAS8 : I<0xAE, RawFrm, (outs), (ins), "scas{b}", []>;
716 def SCAS16 : I<0xAF, RawFrm, (outs), (ins), "scas{w}", []>, OpSize;
717 def SCAS32 : I<0xAF, RawFrm, (outs), (ins), "scas{l}", []>;
718 def SCAS64 : RI<0xAF, RawFrm, (outs), (ins), "scasq", []>;
720 def CMPS8 : I<0xA6, RawFrm, (outs), (ins), "cmps{b}", []>;
721 def CMPS16 : I<0xA7, RawFrm, (outs), (ins), "cmps{w}", []>, OpSize;
722 def CMPS32 : I<0xA7, RawFrm, (outs), (ins), "cmps{l}", []>;
723 def CMPS64 : RI<0xA7, RawFrm, (outs), (ins), "cmpsq", []>;
726 //===----------------------------------------------------------------------===//
727 // Move Instructions.
729 let neverHasSideEffects = 1 in {
730 def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
731 "mov{b}\t{$src, $dst|$dst, $src}", []>;
732 def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
733 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
734 def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
735 "mov{l}\t{$src, $dst|$dst, $src}", []>;
737 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
738 def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
739 "mov{b}\t{$src, $dst|$dst, $src}",
740 [(set GR8:$dst, imm:$src)]>;
741 def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
742 "mov{w}\t{$src, $dst|$dst, $src}",
743 [(set GR16:$dst, imm:$src)]>, OpSize;
744 def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
745 "mov{l}\t{$src, $dst|$dst, $src}",
746 [(set GR32:$dst, imm:$src)]>;
749 def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
750 "mov{b}\t{$src, $dst|$dst, $src}",
751 [(store (i8 imm:$src), addr:$dst)]>;
752 def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
753 "mov{w}\t{$src, $dst|$dst, $src}",
754 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
755 def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
756 "mov{l}\t{$src, $dst|$dst, $src}",
757 [(store (i32 imm:$src), addr:$dst)]>;
759 /// moffs8, moffs16 and moffs32 versions of moves. The immediate is a
760 /// 32-bit offset from the PC. These are only valid in x86-32 mode.
761 def MOV8o8a : Ii32 <0xA0, RawFrm, (outs), (ins offset8:$src),
762 "mov{b}\t{$src, %al|%al, $src}", []>,
763 Requires<[In32BitMode]>;
764 def MOV16o16a : Ii32 <0xA1, RawFrm, (outs), (ins offset16:$src),
765 "mov{w}\t{$src, %ax|%ax, $src}", []>, OpSize,
766 Requires<[In32BitMode]>;
767 def MOV32o32a : Ii32 <0xA1, RawFrm, (outs), (ins offset32:$src),
768 "mov{l}\t{$src, %eax|%eax, $src}", []>,
769 Requires<[In32BitMode]>;
770 def MOV8ao8 : Ii32 <0xA2, RawFrm, (outs offset8:$dst), (ins),
771 "mov{b}\t{%al, $dst|$dst, %al}", []>,
772 Requires<[In32BitMode]>;
773 def MOV16ao16 : Ii32 <0xA3, RawFrm, (outs offset16:$dst), (ins),
774 "mov{w}\t{%ax, $dst|$dst, %ax}", []>, OpSize,
775 Requires<[In32BitMode]>;
776 def MOV32ao32 : Ii32 <0xA3, RawFrm, (outs offset32:$dst), (ins),
777 "mov{l}\t{%eax, $dst|$dst, %eax}", []>,
778 Requires<[In32BitMode]>;
781 let isCodeGenOnly = 1 in {
782 def MOV8rr_REV : I<0x8A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src),
783 "mov{b}\t{$src, $dst|$dst, $src}", []>;
784 def MOV16rr_REV : I<0x8B, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
785 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
786 def MOV32rr_REV : I<0x8B, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
787 "mov{l}\t{$src, $dst|$dst, $src}", []>;
790 let canFoldAsLoad = 1, isReMaterializable = 1 in {
791 def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
792 "mov{b}\t{$src, $dst|$dst, $src}",
793 [(set GR8:$dst, (loadi8 addr:$src))]>;
794 def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
795 "mov{w}\t{$src, $dst|$dst, $src}",
796 [(set GR16:$dst, (loadi16 addr:$src))]>, OpSize;
797 def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
798 "mov{l}\t{$src, $dst|$dst, $src}",
799 [(set GR32:$dst, (loadi32 addr:$src))]>;
802 def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
803 "mov{b}\t{$src, $dst|$dst, $src}",
804 [(store GR8:$src, addr:$dst)]>;
805 def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
806 "mov{w}\t{$src, $dst|$dst, $src}",
807 [(store GR16:$src, addr:$dst)]>, OpSize;
808 def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
809 "mov{l}\t{$src, $dst|$dst, $src}",
810 [(store GR32:$src, addr:$dst)]>;
812 /// Versions of MOV32rr, MOV32rm, and MOV32mr for i32mem_TC and GR32_TC.
813 let isCodeGenOnly = 1 in {
814 let neverHasSideEffects = 1 in
815 def MOV32rr_TC : I<0x89, MRMDestReg, (outs GR32_TC:$dst), (ins GR32_TC:$src),
816 "mov{l}\t{$src, $dst|$dst, $src}", []>;
819 canFoldAsLoad = 1, isReMaterializable = 1 in
820 def MOV32rm_TC : I<0x8B, MRMSrcMem, (outs GR32_TC:$dst), (ins i32mem_TC:$src),
821 "mov{l}\t{$src, $dst|$dst, $src}",
825 def MOV32mr_TC : I<0x89, MRMDestMem, (outs), (ins i32mem_TC:$dst, GR32_TC:$src),
826 "mov{l}\t{$src, $dst|$dst, $src}",
830 // Versions of MOV8rr, MOV8mr, and MOV8rm that use i8mem_NOREX and GR8_NOREX so
831 // that they can be used for copying and storing h registers, which can't be
832 // encoded when a REX prefix is present.
833 let isCodeGenOnly = 1 in {
834 let neverHasSideEffects = 1 in
835 def MOV8rr_NOREX : I<0x88, MRMDestReg,
836 (outs GR8_NOREX:$dst), (ins GR8_NOREX:$src),
837 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
839 def MOV8mr_NOREX : I<0x88, MRMDestMem,
840 (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src),
841 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
843 canFoldAsLoad = 1, isReMaterializable = 1 in
844 def MOV8rm_NOREX : I<0x8A, MRMSrcMem,
845 (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src),
846 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
849 //===----------------------------------------------------------------------===//
850 // Fixed-Register Multiplication and Division Instructions...
853 // Extra precision multiplication
855 // AL is really implied by AX, but the registers in Defs must match the
856 // SDNode results (i8, i32).
857 let Defs = [AL,EFLAGS,AX], Uses = [AL] in
858 def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
859 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
860 // This probably ought to be moved to a def : Pat<> if the
861 // syntax can be accepted.
862 [(set AL, (mul AL, GR8:$src)),
863 (implicit EFLAGS)]>; // AL,AH = AL*GR8
865 let Defs = [AX,DX,EFLAGS], Uses = [AX], neverHasSideEffects = 1 in
866 def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src),
868 []>, OpSize; // AX,DX = AX*GR16
870 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], neverHasSideEffects = 1 in
871 def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src),
873 []>; // EAX,EDX = EAX*GR32
875 let Defs = [AL,EFLAGS,AX], Uses = [AL] in
876 def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
878 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
879 // This probably ought to be moved to a def : Pat<> if the
880 // syntax can be accepted.
881 [(set AL, (mul AL, (loadi8 addr:$src))),
882 (implicit EFLAGS)]>; // AL,AH = AL*[mem8]
884 let mayLoad = 1, neverHasSideEffects = 1 in {
885 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
886 def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
888 []>, OpSize; // AX,DX = AX*[mem16]
890 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
891 def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
893 []>; // EAX,EDX = EAX*[mem32]
896 let neverHasSideEffects = 1 in {
897 let Defs = [AL,EFLAGS,AX], Uses = [AL] in
898 def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
900 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
901 def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
902 OpSize; // AX,DX = AX*GR16
903 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
904 def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
905 // EAX,EDX = EAX*GR32
907 let Defs = [AL,EFLAGS,AX], Uses = [AL] in
908 def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
909 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
910 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
911 def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
912 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
913 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
914 def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
915 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
917 } // neverHasSideEffects
919 // unsigned division/remainder
920 let Defs = [AL,EFLAGS,AX], Uses = [AX] in
921 def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
923 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
924 def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
925 "div{w}\t$src", []>, OpSize;
926 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
927 def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
930 let Defs = [AL,EFLAGS,AX], Uses = [AX] in
931 def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
933 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
934 def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
935 "div{w}\t$src", []>, OpSize;
936 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
937 // EDX:EAX/[mem32] = EAX,EDX
938 def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src),
942 // Signed division/remainder.
943 let Defs = [AL,EFLAGS,AX], Uses = [AX] in
944 def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
945 "idiv{b}\t$src", []>;
946 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
947 def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
948 "idiv{w}\t$src", []>, OpSize;
949 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
950 def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
951 "idiv{l}\t$src", []>;
952 let mayLoad = 1, mayLoad = 1 in {
953 let Defs = [AL,EFLAGS,AX], Uses = [AX] in
954 def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
955 "idiv{b}\t$src", []>;
956 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
957 def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
958 "idiv{w}\t$src", []>, OpSize;
959 let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
960 def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src),
961 // EDX:EAX/[mem32] = EAX,EDX
962 "idiv{l}\t$src", []>;
965 //===----------------------------------------------------------------------===//
966 // Two address Instructions.
968 let Constraints = "$src1 = $dst" in {
970 // unary instructions
971 let CodeSize = 2 in {
972 let Defs = [EFLAGS] in {
973 def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src1),
975 [(set GR8:$dst, (ineg GR8:$src1)),
977 def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src1),
979 [(set GR16:$dst, (ineg GR16:$src1)),
980 (implicit EFLAGS)]>, OpSize;
981 def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src1),
983 [(set GR32:$dst, (ineg GR32:$src1)),
986 let Constraints = "" in {
987 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst),
989 [(store (ineg (loadi8 addr:$dst)), addr:$dst),
991 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst),
993 [(store (ineg (loadi16 addr:$dst)), addr:$dst),
994 (implicit EFLAGS)]>, OpSize;
995 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst),
997 [(store (ineg (loadi32 addr:$dst)), addr:$dst),
999 } // Constraints = ""
1000 } // Defs = [EFLAGS]
1002 // Match xor -1 to not. Favors these over a move imm + xor to save code size.
1003 let AddedComplexity = 15 in {
1004 def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src1),
1006 [(set GR8:$dst, (not GR8:$src1))]>;
1007 def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src1),
1009 [(set GR16:$dst, (not GR16:$src1))]>, OpSize;
1010 def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src1),
1012 [(set GR32:$dst, (not GR32:$src1))]>;
1014 let Constraints = "" in {
1015 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst),
1017 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
1018 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst),
1020 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
1021 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst),
1023 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
1024 } // Constraints = ""
1027 // TODO: inc/dec is slow for P4, but fast for Pentium-M.
1028 let Defs = [EFLAGS] in {
1030 def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
1032 [(set GR8:$dst, EFLAGS, (X86inc_flag GR8:$src1))]>;
1034 let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
1035 def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1),
1037 [(set GR16:$dst, EFLAGS, (X86inc_flag GR16:$src1))]>,
1038 OpSize, Requires<[In32BitMode]>;
1039 def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1),
1041 [(set GR32:$dst, EFLAGS, (X86inc_flag GR32:$src1))]>,
1042 Requires<[In32BitMode]>;
1044 let Constraints = "", CodeSize = 2 in {
1045 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
1046 [(store (add (loadi8 addr:$dst), 1), addr:$dst),
1047 (implicit EFLAGS)]>;
1048 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
1049 [(store (add (loadi16 addr:$dst), 1), addr:$dst),
1050 (implicit EFLAGS)]>,
1051 OpSize, Requires<[In32BitMode]>;
1052 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
1053 [(store (add (loadi32 addr:$dst), 1), addr:$dst),
1054 (implicit EFLAGS)]>,
1055 Requires<[In32BitMode]>;
1056 } // Constraints = "", CodeSize = 2
1059 def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
1061 [(set GR8:$dst, EFLAGS, (X86dec_flag GR8:$src1))]>;
1062 let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
1063 def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1),
1065 [(set GR16:$dst, EFLAGS, (X86dec_flag GR16:$src1))]>,
1066 OpSize, Requires<[In32BitMode]>;
1067 def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1),
1069 [(set GR32:$dst, EFLAGS, (X86dec_flag GR32:$src1))]>,
1070 Requires<[In32BitMode]>;
1073 let Constraints = "", CodeSize = 2 in {
1074 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
1075 [(store (add (loadi8 addr:$dst), -1), addr:$dst),
1076 (implicit EFLAGS)]>;
1077 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
1078 [(store (add (loadi16 addr:$dst), -1), addr:$dst),
1079 (implicit EFLAGS)]>,
1080 OpSize, Requires<[In32BitMode]>;
1081 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
1082 [(store (add (loadi32 addr:$dst), -1), addr:$dst),
1083 (implicit EFLAGS)]>,
1084 Requires<[In32BitMode]>;
1085 } // Constraints = "", CodeSize = 2
1086 } // Defs = [EFLAGS]
1088 // Logical operators...
1089 let Defs = [EFLAGS] in {
1090 let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
1091 def AND8rr : I<0x20, MRMDestReg,
1092 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
1093 "and{b}\t{$src2, $dst|$dst, $src2}",
1094 [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1, GR8:$src2))]>;
1095 def AND16rr : I<0x21, MRMDestReg,
1096 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1097 "and{w}\t{$src2, $dst|$dst, $src2}",
1098 [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1,
1099 GR16:$src2))]>, OpSize;
1100 def AND32rr : I<0x21, MRMDestReg,
1101 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1102 "and{l}\t{$src2, $dst|$dst, $src2}",
1103 [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1,
1107 // AND instructions with the destination register in REG and the source register
1108 // in R/M. Included for the disassembler.
1109 let isCodeGenOnly = 1 in {
1110 def AND8rr_REV : I<0x22, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
1111 "and{b}\t{$src2, $dst|$dst, $src2}", []>;
1112 def AND16rr_REV : I<0x23, MRMSrcReg, (outs GR16:$dst),
1113 (ins GR16:$src1, GR16:$src2),
1114 "and{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
1115 def AND32rr_REV : I<0x23, MRMSrcReg, (outs GR32:$dst),
1116 (ins GR32:$src1, GR32:$src2),
1117 "and{l}\t{$src2, $dst|$dst, $src2}", []>;
1120 def AND8rm : I<0x22, MRMSrcMem,
1121 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
1122 "and{b}\t{$src2, $dst|$dst, $src2}",
1123 [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1,
1124 (loadi8 addr:$src2)))]>;
1125 def AND16rm : I<0x23, MRMSrcMem,
1126 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1127 "and{w}\t{$src2, $dst|$dst, $src2}",
1128 [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1,
1129 (loadi16 addr:$src2)))]>,
1131 def AND32rm : I<0x23, MRMSrcMem,
1132 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1133 "and{l}\t{$src2, $dst|$dst, $src2}",
1134 [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1,
1135 (loadi32 addr:$src2)))]>;
1137 def AND8ri : Ii8<0x80, MRM4r,
1138 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
1139 "and{b}\t{$src2, $dst|$dst, $src2}",
1140 [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1,
1142 def AND16ri : Ii16<0x81, MRM4r,
1143 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
1144 "and{w}\t{$src2, $dst|$dst, $src2}",
1145 [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1,
1146 imm:$src2))]>, OpSize;
1147 def AND32ri : Ii32<0x81, MRM4r,
1148 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
1149 "and{l}\t{$src2, $dst|$dst, $src2}",
1150 [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1,
1152 def AND16ri8 : Ii8<0x83, MRM4r,
1153 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
1154 "and{w}\t{$src2, $dst|$dst, $src2}",
1155 [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1,
1156 i16immSExt8:$src2))]>,
1158 def AND32ri8 : Ii8<0x83, MRM4r,
1159 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
1160 "and{l}\t{$src2, $dst|$dst, $src2}",
1161 [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1,
1162 i32immSExt8:$src2))]>;
1164 let Constraints = "" in {
1165 def AND8mr : I<0x20, MRMDestMem,
1166 (outs), (ins i8mem :$dst, GR8 :$src),
1167 "and{b}\t{$src, $dst|$dst, $src}",
1168 [(store (and (load addr:$dst), GR8:$src), addr:$dst),
1169 (implicit EFLAGS)]>;
1170 def AND16mr : I<0x21, MRMDestMem,
1171 (outs), (ins i16mem:$dst, GR16:$src),
1172 "and{w}\t{$src, $dst|$dst, $src}",
1173 [(store (and (load addr:$dst), GR16:$src), addr:$dst),
1174 (implicit EFLAGS)]>,
1176 def AND32mr : I<0x21, MRMDestMem,
1177 (outs), (ins i32mem:$dst, GR32:$src),
1178 "and{l}\t{$src, $dst|$dst, $src}",
1179 [(store (and (load addr:$dst), GR32:$src), addr:$dst),
1180 (implicit EFLAGS)]>;
1181 def AND8mi : Ii8<0x80, MRM4m,
1182 (outs), (ins i8mem :$dst, i8imm :$src),
1183 "and{b}\t{$src, $dst|$dst, $src}",
1184 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst),
1185 (implicit EFLAGS)]>;
1186 def AND16mi : Ii16<0x81, MRM4m,
1187 (outs), (ins i16mem:$dst, i16imm:$src),
1188 "and{w}\t{$src, $dst|$dst, $src}",
1189 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst),
1190 (implicit EFLAGS)]>,
1192 def AND32mi : Ii32<0x81, MRM4m,
1193 (outs), (ins i32mem:$dst, i32imm:$src),
1194 "and{l}\t{$src, $dst|$dst, $src}",
1195 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst),
1196 (implicit EFLAGS)]>;
1197 def AND16mi8 : Ii8<0x83, MRM4m,
1198 (outs), (ins i16mem:$dst, i16i8imm :$src),
1199 "and{w}\t{$src, $dst|$dst, $src}",
1200 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst),
1201 (implicit EFLAGS)]>,
1203 def AND32mi8 : Ii8<0x83, MRM4m,
1204 (outs), (ins i32mem:$dst, i32i8imm :$src),
1205 "and{l}\t{$src, $dst|$dst, $src}",
1206 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst),
1207 (implicit EFLAGS)]>;
1209 def AND8i8 : Ii8<0x24, RawFrm, (outs), (ins i8imm:$src),
1210 "and{b}\t{$src, %al|%al, $src}", []>;
1211 def AND16i16 : Ii16<0x25, RawFrm, (outs), (ins i16imm:$src),
1212 "and{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1213 def AND32i32 : Ii32<0x25, RawFrm, (outs), (ins i32imm:$src),
1214 "and{l}\t{$src, %eax|%eax, $src}", []>;
1216 } // Constraints = ""
1219 let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
1220 def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst),
1221 (ins GR8 :$src1, GR8 :$src2),
1222 "or{b}\t{$src2, $dst|$dst, $src2}",
1223 [(set GR8:$dst, EFLAGS, (X86or_flag GR8:$src1, GR8:$src2))]>;
1224 def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst),
1225 (ins GR16:$src1, GR16:$src2),
1226 "or{w}\t{$src2, $dst|$dst, $src2}",
1227 [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1,GR16:$src2))]>,
1229 def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst),
1230 (ins GR32:$src1, GR32:$src2),
1231 "or{l}\t{$src2, $dst|$dst, $src2}",
1232 [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1,GR32:$src2))]>;
1235 // OR instructions with the destination register in REG and the source register
1236 // in R/M. Included for the disassembler.
1237 let isCodeGenOnly = 1 in {
1238 def OR8rr_REV : I<0x0A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
1239 "or{b}\t{$src2, $dst|$dst, $src2}", []>;
1240 def OR16rr_REV : I<0x0B, MRMSrcReg, (outs GR16:$dst),
1241 (ins GR16:$src1, GR16:$src2),
1242 "or{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
1243 def OR32rr_REV : I<0x0B, MRMSrcReg, (outs GR32:$dst),
1244 (ins GR32:$src1, GR32:$src2),
1245 "or{l}\t{$src2, $dst|$dst, $src2}", []>;
1248 def OR8rm : I<0x0A, MRMSrcMem, (outs GR8 :$dst),
1249 (ins GR8 :$src1, i8mem :$src2),
1250 "or{b}\t{$src2, $dst|$dst, $src2}",
1251 [(set GR8:$dst, EFLAGS, (X86or_flag GR8:$src1,
1252 (load addr:$src2)))]>;
1253 def OR16rm : I<0x0B, MRMSrcMem, (outs GR16:$dst),
1254 (ins GR16:$src1, i16mem:$src2),
1255 "or{w}\t{$src2, $dst|$dst, $src2}",
1256 [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1,
1257 (load addr:$src2)))]>,
1259 def OR32rm : I<0x0B, MRMSrcMem, (outs GR32:$dst),
1260 (ins GR32:$src1, i32mem:$src2),
1261 "or{l}\t{$src2, $dst|$dst, $src2}",
1262 [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1,
1263 (load addr:$src2)))]>;
1265 def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst),
1266 (ins GR8 :$src1, i8imm:$src2),
1267 "or{b}\t{$src2, $dst|$dst, $src2}",
1268 [(set GR8:$dst,EFLAGS, (X86or_flag GR8:$src1, imm:$src2))]>;
1269 def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst),
1270 (ins GR16:$src1, i16imm:$src2),
1271 "or{w}\t{$src2, $dst|$dst, $src2}",
1272 [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1,
1273 imm:$src2))]>, OpSize;
1274 def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst),
1275 (ins GR32:$src1, i32imm:$src2),
1276 "or{l}\t{$src2, $dst|$dst, $src2}",
1277 [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1,
1280 def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst),
1281 (ins GR16:$src1, i16i8imm:$src2),
1282 "or{w}\t{$src2, $dst|$dst, $src2}",
1283 [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1,
1284 i16immSExt8:$src2))]>, OpSize;
1285 def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst),
1286 (ins GR32:$src1, i32i8imm:$src2),
1287 "or{l}\t{$src2, $dst|$dst, $src2}",
1288 [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1,
1289 i32immSExt8:$src2))]>;
1290 let Constraints = "" in {
1291 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
1292 "or{b}\t{$src, $dst|$dst, $src}",
1293 [(store (or (load addr:$dst), GR8:$src), addr:$dst),
1294 (implicit EFLAGS)]>;
1295 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
1296 "or{w}\t{$src, $dst|$dst, $src}",
1297 [(store (or (load addr:$dst), GR16:$src), addr:$dst),
1298 (implicit EFLAGS)]>, OpSize;
1299 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
1300 "or{l}\t{$src, $dst|$dst, $src}",
1301 [(store (or (load addr:$dst), GR32:$src), addr:$dst),
1302 (implicit EFLAGS)]>;
1303 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
1304 "or{b}\t{$src, $dst|$dst, $src}",
1305 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst),
1306 (implicit EFLAGS)]>;
1307 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
1308 "or{w}\t{$src, $dst|$dst, $src}",
1309 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst),
1310 (implicit EFLAGS)]>,
1312 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
1313 "or{l}\t{$src, $dst|$dst, $src}",
1314 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst),
1315 (implicit EFLAGS)]>;
1316 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
1317 "or{w}\t{$src, $dst|$dst, $src}",
1318 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst),
1319 (implicit EFLAGS)]>,
1321 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
1322 "or{l}\t{$src, $dst|$dst, $src}",
1323 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst),
1324 (implicit EFLAGS)]>;
1326 def OR8i8 : Ii8 <0x0C, RawFrm, (outs), (ins i8imm:$src),
1327 "or{b}\t{$src, %al|%al, $src}", []>;
1328 def OR16i16 : Ii16 <0x0D, RawFrm, (outs), (ins i16imm:$src),
1329 "or{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1330 def OR32i32 : Ii32 <0x0D, RawFrm, (outs), (ins i32imm:$src),
1331 "or{l}\t{$src, %eax|%eax, $src}", []>;
1332 } // Constraints = ""
1335 let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
1336 def XOR8rr : I<0x30, MRMDestReg,
1337 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
1338 "xor{b}\t{$src2, $dst|$dst, $src2}",
1339 [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1,
1341 def XOR16rr : I<0x31, MRMDestReg,
1342 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
1343 "xor{w}\t{$src2, $dst|$dst, $src2}",
1344 [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1,
1345 GR16:$src2))]>, OpSize;
1346 def XOR32rr : I<0x31, MRMDestReg,
1347 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
1348 "xor{l}\t{$src2, $dst|$dst, $src2}",
1349 [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1,
1351 } // isCommutable = 1
1353 // XOR instructions with the destination register in REG and the source register
1354 // in R/M. Included for the disassembler.
1355 let isCodeGenOnly = 1 in {
1356 def XOR8rr_REV : I<0x32, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
1357 "xor{b}\t{$src2, $dst|$dst, $src2}", []>;
1358 def XOR16rr_REV : I<0x33, MRMSrcReg, (outs GR16:$dst),
1359 (ins GR16:$src1, GR16:$src2),
1360 "xor{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
1361 def XOR32rr_REV : I<0x33, MRMSrcReg, (outs GR32:$dst),
1362 (ins GR32:$src1, GR32:$src2),
1363 "xor{l}\t{$src2, $dst|$dst, $src2}", []>;
1366 def XOR8rm : I<0x32, MRMSrcMem,
1367 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
1368 "xor{b}\t{$src2, $dst|$dst, $src2}",
1369 [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1,
1370 (load addr:$src2)))]>;
1371 def XOR16rm : I<0x33, MRMSrcMem,
1372 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1373 "xor{w}\t{$src2, $dst|$dst, $src2}",
1374 [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1,
1375 (load addr:$src2)))]>,
1377 def XOR32rm : I<0x33, MRMSrcMem,
1378 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1379 "xor{l}\t{$src2, $dst|$dst, $src2}",
1380 [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1,
1381 (load addr:$src2)))]>;
1383 def XOR8ri : Ii8<0x80, MRM6r,
1384 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
1385 "xor{b}\t{$src2, $dst|$dst, $src2}",
1386 [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1, imm:$src2))]>;
1387 def XOR16ri : Ii16<0x81, MRM6r,
1388 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
1389 "xor{w}\t{$src2, $dst|$dst, $src2}",
1390 [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1,
1391 imm:$src2))]>, OpSize;
1392 def XOR32ri : Ii32<0x81, MRM6r,
1393 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
1394 "xor{l}\t{$src2, $dst|$dst, $src2}",
1395 [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1,
1397 def XOR16ri8 : Ii8<0x83, MRM6r,
1398 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
1399 "xor{w}\t{$src2, $dst|$dst, $src2}",
1400 [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1,
1401 i16immSExt8:$src2))]>,
1403 def XOR32ri8 : Ii8<0x83, MRM6r,
1404 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
1405 "xor{l}\t{$src2, $dst|$dst, $src2}",
1406 [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1,
1407 i32immSExt8:$src2))]>;
1409 let Constraints = "" in {
1410 def XOR8mr : I<0x30, MRMDestMem,
1411 (outs), (ins i8mem :$dst, GR8 :$src),
1412 "xor{b}\t{$src, $dst|$dst, $src}",
1413 [(store (xor (load addr:$dst), GR8:$src), addr:$dst),
1414 (implicit EFLAGS)]>;
1415 def XOR16mr : I<0x31, MRMDestMem,
1416 (outs), (ins i16mem:$dst, GR16:$src),
1417 "xor{w}\t{$src, $dst|$dst, $src}",
1418 [(store (xor (load addr:$dst), GR16:$src), addr:$dst),
1419 (implicit EFLAGS)]>,
1421 def XOR32mr : I<0x31, MRMDestMem,
1422 (outs), (ins i32mem:$dst, GR32:$src),
1423 "xor{l}\t{$src, $dst|$dst, $src}",
1424 [(store (xor (load addr:$dst), GR32:$src), addr:$dst),
1425 (implicit EFLAGS)]>;
1426 def XOR8mi : Ii8<0x80, MRM6m,
1427 (outs), (ins i8mem :$dst, i8imm :$src),
1428 "xor{b}\t{$src, $dst|$dst, $src}",
1429 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst),
1430 (implicit EFLAGS)]>;
1431 def XOR16mi : Ii16<0x81, MRM6m,
1432 (outs), (ins i16mem:$dst, i16imm:$src),
1433 "xor{w}\t{$src, $dst|$dst, $src}",
1434 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst),
1435 (implicit EFLAGS)]>,
1437 def XOR32mi : Ii32<0x81, MRM6m,
1438 (outs), (ins i32mem:$dst, i32imm:$src),
1439 "xor{l}\t{$src, $dst|$dst, $src}",
1440 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst),
1441 (implicit EFLAGS)]>;
1442 def XOR16mi8 : Ii8<0x83, MRM6m,
1443 (outs), (ins i16mem:$dst, i16i8imm :$src),
1444 "xor{w}\t{$src, $dst|$dst, $src}",
1445 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst),
1446 (implicit EFLAGS)]>,
1448 def XOR32mi8 : Ii8<0x83, MRM6m,
1449 (outs), (ins i32mem:$dst, i32i8imm :$src),
1450 "xor{l}\t{$src, $dst|$dst, $src}",
1451 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst),
1452 (implicit EFLAGS)]>;
1454 def XOR8i8 : Ii8 <0x34, RawFrm, (outs), (ins i8imm:$src),
1455 "xor{b}\t{$src, %al|%al, $src}", []>;
1456 def XOR16i16 : Ii16<0x35, RawFrm, (outs), (ins i16imm:$src),
1457 "xor{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
1458 def XOR32i32 : Ii32<0x35, RawFrm, (outs), (ins i32imm:$src),
1459 "xor{l}\t{$src, %eax|%eax, $src}", []>;
1460 } // Constraints = ""
1461 } // Defs = [EFLAGS]
1463 // Shift instructions
1464 let Defs = [EFLAGS] in {
1465 let Uses = [CL] in {
1466 def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
1467 "shl{b}\t{%cl, $dst|$dst, CL}",
1468 [(set GR8:$dst, (shl GR8:$src1, CL))]>;
1469 def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
1470 "shl{w}\t{%cl, $dst|$dst, CL}",
1471 [(set GR16:$dst, (shl GR16:$src1, CL))]>, OpSize;
1472 def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
1473 "shl{l}\t{%cl, $dst|$dst, CL}",
1474 [(set GR32:$dst, (shl GR32:$src1, CL))]>;
1477 def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1478 "shl{b}\t{$src2, $dst|$dst, $src2}",
1479 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
1481 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
1482 def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1483 "shl{w}\t{$src2, $dst|$dst, $src2}",
1484 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1485 def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1486 "shl{l}\t{$src2, $dst|$dst, $src2}",
1487 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
1489 // NOTE: We don't include patterns for shifts of a register by one, because
1490 // 'add reg,reg' is cheaper.
1492 def SHL8r1 : I<0xD0, MRM4r, (outs GR8:$dst), (ins GR8:$src1),
1493 "shl{b}\t$dst", []>;
1494 def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
1495 "shl{w}\t$dst", []>, OpSize;
1496 def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
1497 "shl{l}\t$dst", []>;
1499 } // isConvertibleToThreeAddress = 1
1501 let Constraints = "" in {
1502 let Uses = [CL] in {
1503 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
1504 "shl{b}\t{%cl, $dst|$dst, CL}",
1505 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
1506 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
1507 "shl{w}\t{%cl, $dst|$dst, CL}",
1508 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
1509 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
1510 "shl{l}\t{%cl, $dst|$dst, CL}",
1511 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1513 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
1514 "shl{b}\t{$src, $dst|$dst, $src}",
1515 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1516 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
1517 "shl{w}\t{$src, $dst|$dst, $src}",
1518 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1520 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
1521 "shl{l}\t{$src, $dst|$dst, $src}",
1522 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1525 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
1527 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1528 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
1530 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1532 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
1534 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1535 } // Constraints = ""
1537 let Uses = [CL] in {
1538 def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src1),
1539 "shr{b}\t{%cl, $dst|$dst, CL}",
1540 [(set GR8:$dst, (srl GR8:$src1, CL))]>;
1541 def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
1542 "shr{w}\t{%cl, $dst|$dst, CL}",
1543 [(set GR16:$dst, (srl GR16:$src1, CL))]>, OpSize;
1544 def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
1545 "shr{l}\t{%cl, $dst|$dst, CL}",
1546 [(set GR32:$dst, (srl GR32:$src1, CL))]>;
1549 def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
1550 "shr{b}\t{$src2, $dst|$dst, $src2}",
1551 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
1552 def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1553 "shr{w}\t{$src2, $dst|$dst, $src2}",
1554 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1555 def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1556 "shr{l}\t{$src2, $dst|$dst, $src2}",
1557 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
1560 def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
1562 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
1563 def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
1565 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
1566 def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
1568 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1570 let Constraints = "" in {
1571 let Uses = [CL] in {
1572 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
1573 "shr{b}\t{%cl, $dst|$dst, CL}",
1574 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
1575 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
1576 "shr{w}\t{%cl, $dst|$dst, CL}",
1577 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
1579 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
1580 "shr{l}\t{%cl, $dst|$dst, CL}",
1581 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1583 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
1584 "shr{b}\t{$src, $dst|$dst, $src}",
1585 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1586 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
1587 "shr{w}\t{$src, $dst|$dst, $src}",
1588 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1590 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
1591 "shr{l}\t{$src, $dst|$dst, $src}",
1592 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1595 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
1597 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1598 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
1600 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
1601 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
1603 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1604 } // Constraints = ""
1606 let Uses = [CL] in {
1607 def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
1608 "sar{b}\t{%cl, $dst|$dst, CL}",
1609 [(set GR8:$dst, (sra GR8:$src1, CL))]>;
1610 def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
1611 "sar{w}\t{%cl, $dst|$dst, CL}",
1612 [(set GR16:$dst, (sra GR16:$src1, CL))]>, OpSize;
1613 def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
1614 "sar{l}\t{%cl, $dst|$dst, CL}",
1615 [(set GR32:$dst, (sra GR32:$src1, CL))]>;
1618 def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1619 "sar{b}\t{$src2, $dst|$dst, $src2}",
1620 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
1621 def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1622 "sar{w}\t{$src2, $dst|$dst, $src2}",
1623 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
1625 def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1626 "sar{l}\t{$src2, $dst|$dst, $src2}",
1627 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
1630 def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
1632 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
1633 def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
1635 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
1636 def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
1638 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1640 let Constraints = "" in {
1641 let Uses = [CL] in {
1642 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
1643 "sar{b}\t{%cl, $dst|$dst, CL}",
1644 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
1645 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
1646 "sar{w}\t{%cl, $dst|$dst, CL}",
1647 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
1648 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
1649 "sar{l}\t{%cl, $dst|$dst, CL}",
1650 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1652 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
1653 "sar{b}\t{$src, $dst|$dst, $src}",
1654 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1655 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
1656 "sar{w}\t{$src, $dst|$dst, $src}",
1657 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1659 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
1660 "sar{l}\t{$src, $dst|$dst, $src}",
1661 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1664 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
1666 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1667 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
1669 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1671 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
1673 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1674 } // Constraints = ""
1676 // Rotate instructions
1678 def RCL8r1 : I<0xD0, MRM2r, (outs GR8:$dst), (ins GR8:$src1),
1679 "rcl{b}\t{1, $dst|$dst, 1}", []>;
1680 let Uses = [CL] in {
1681 def RCL8rCL : I<0xD2, MRM2r, (outs GR8:$dst), (ins GR8:$src1),
1682 "rcl{b}\t{%cl, $dst|$dst, CL}", []>;
1684 def RCL8ri : Ii8<0xC0, MRM2r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$cnt),
1685 "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>;
1687 def RCL16r1 : I<0xD1, MRM2r, (outs GR16:$dst), (ins GR16:$src1),
1688 "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize;
1689 let Uses = [CL] in {
1690 def RCL16rCL : I<0xD3, MRM2r, (outs GR16:$dst), (ins GR16:$src1),
1691 "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize;
1693 def RCL16ri : Ii8<0xC1, MRM2r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$cnt),
1694 "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize;
1696 def RCL32r1 : I<0xD1, MRM2r, (outs GR32:$dst), (ins GR32:$src1),
1697 "rcl{l}\t{1, $dst|$dst, 1}", []>;
1698 let Uses = [CL] in {
1699 def RCL32rCL : I<0xD3, MRM2r, (outs GR32:$dst), (ins GR32:$src1),
1700 "rcl{l}\t{%cl, $dst|$dst, CL}", []>;
1702 def RCL32ri : Ii8<0xC1, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$cnt),
1703 "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>;
1705 def RCR8r1 : I<0xD0, MRM3r, (outs GR8:$dst), (ins GR8:$src1),
1706 "rcr{b}\t{1, $dst|$dst, 1}", []>;
1707 let Uses = [CL] in {
1708 def RCR8rCL : I<0xD2, MRM3r, (outs GR8:$dst), (ins GR8:$src1),
1709 "rcr{b}\t{%cl, $dst|$dst, CL}", []>;
1711 def RCR8ri : Ii8<0xC0, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$cnt),
1712 "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>;
1714 def RCR16r1 : I<0xD1, MRM3r, (outs GR16:$dst), (ins GR16:$src1),
1715 "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize;
1716 let Uses = [CL] in {
1717 def RCR16rCL : I<0xD3, MRM3r, (outs GR16:$dst), (ins GR16:$src1),
1718 "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize;
1720 def RCR16ri : Ii8<0xC1, MRM3r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$cnt),
1721 "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize;
1723 def RCR32r1 : I<0xD1, MRM3r, (outs GR32:$dst), (ins GR32:$src1),
1724 "rcr{l}\t{1, $dst|$dst, 1}", []>;
1725 let Uses = [CL] in {
1726 def RCR32rCL : I<0xD3, MRM3r, (outs GR32:$dst), (ins GR32:$src1),
1727 "rcr{l}\t{%cl, $dst|$dst, CL}", []>;
1729 def RCR32ri : Ii8<0xC1, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$cnt),
1730 "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>;
1732 let Constraints = "" in {
1733 def RCL8m1 : I<0xD0, MRM2m, (outs), (ins i8mem:$dst),
1734 "rcl{b}\t{1, $dst|$dst, 1}", []>;
1735 def RCL8mi : Ii8<0xC0, MRM2m, (outs), (ins i8mem:$dst, i8imm:$cnt),
1736 "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>;
1737 def RCL16m1 : I<0xD1, MRM2m, (outs), (ins i16mem:$dst),
1738 "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize;
1739 def RCL16mi : Ii8<0xC1, MRM2m, (outs), (ins i16mem:$dst, i8imm:$cnt),
1740 "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize;
1741 def RCL32m1 : I<0xD1, MRM2m, (outs), (ins i32mem:$dst),
1742 "rcl{l}\t{1, $dst|$dst, 1}", []>;
1743 def RCL32mi : Ii8<0xC1, MRM2m, (outs), (ins i32mem:$dst, i8imm:$cnt),
1744 "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>;
1745 def RCR8m1 : I<0xD0, MRM3m, (outs), (ins i8mem:$dst),
1746 "rcr{b}\t{1, $dst|$dst, 1}", []>;
1747 def RCR8mi : Ii8<0xC0, MRM3m, (outs), (ins i8mem:$dst, i8imm:$cnt),
1748 "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>;
1749 def RCR16m1 : I<0xD1, MRM3m, (outs), (ins i16mem:$dst),
1750 "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize;
1751 def RCR16mi : Ii8<0xC1, MRM3m, (outs), (ins i16mem:$dst, i8imm:$cnt),
1752 "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize;
1753 def RCR32m1 : I<0xD1, MRM3m, (outs), (ins i32mem:$dst),
1754 "rcr{l}\t{1, $dst|$dst, 1}", []>;
1755 def RCR32mi : Ii8<0xC1, MRM3m, (outs), (ins i32mem:$dst, i8imm:$cnt),
1756 "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>;
1758 let Uses = [CL] in {
1759 def RCL8mCL : I<0xD2, MRM2m, (outs), (ins i8mem:$dst),
1760 "rcl{b}\t{%cl, $dst|$dst, CL}", []>;
1761 def RCL16mCL : I<0xD3, MRM2m, (outs), (ins i16mem:$dst),
1762 "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize;
1763 def RCL32mCL : I<0xD3, MRM2m, (outs), (ins i32mem:$dst),
1764 "rcl{l}\t{%cl, $dst|$dst, CL}", []>;
1765 def RCR8mCL : I<0xD2, MRM3m, (outs), (ins i8mem:$dst),
1766 "rcr{b}\t{%cl, $dst|$dst, CL}", []>;
1767 def RCR16mCL : I<0xD3, MRM3m, (outs), (ins i16mem:$dst),
1768 "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize;
1769 def RCR32mCL : I<0xD3, MRM3m, (outs), (ins i32mem:$dst),
1770 "rcr{l}\t{%cl, $dst|$dst, CL}", []>;
1772 } // Constraints = ""
1774 // FIXME: provide shorter instructions when imm8 == 1
1775 let Uses = [CL] in {
1776 def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
1777 "rol{b}\t{%cl, $dst|$dst, CL}",
1778 [(set GR8:$dst, (rotl GR8:$src1, CL))]>;
1779 def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
1780 "rol{w}\t{%cl, $dst|$dst, CL}",
1781 [(set GR16:$dst, (rotl GR16:$src1, CL))]>, OpSize;
1782 def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
1783 "rol{l}\t{%cl, $dst|$dst, CL}",
1784 [(set GR32:$dst, (rotl GR32:$src1, CL))]>;
1787 def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1788 "rol{b}\t{$src2, $dst|$dst, $src2}",
1789 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
1790 def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1791 "rol{w}\t{$src2, $dst|$dst, $src2}",
1792 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>,
1794 def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1795 "rol{l}\t{$src2, $dst|$dst, $src2}",
1796 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
1799 def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
1801 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
1802 def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
1804 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
1805 def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
1807 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1809 let Constraints = "" in {
1810 let Uses = [CL] in {
1811 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
1812 "rol{b}\t{%cl, $dst|$dst, CL}",
1813 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
1814 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
1815 "rol{w}\t{%cl, $dst|$dst, CL}",
1816 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
1817 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
1818 "rol{l}\t{%cl, $dst|$dst, CL}",
1819 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1821 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
1822 "rol{b}\t{$src, $dst|$dst, $src}",
1823 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1824 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
1825 "rol{w}\t{$src, $dst|$dst, $src}",
1826 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1828 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
1829 "rol{l}\t{$src, $dst|$dst, $src}",
1830 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1833 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
1835 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1836 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
1838 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1840 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
1842 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1843 } // Constraints = ""
1845 let Uses = [CL] in {
1846 def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
1847 "ror{b}\t{%cl, $dst|$dst, CL}",
1848 [(set GR8:$dst, (rotr GR8:$src1, CL))]>;
1849 def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
1850 "ror{w}\t{%cl, $dst|$dst, CL}",
1851 [(set GR16:$dst, (rotr GR16:$src1, CL))]>, OpSize;
1852 def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
1853 "ror{l}\t{%cl, $dst|$dst, CL}",
1854 [(set GR32:$dst, (rotr GR32:$src1, CL))]>;
1857 def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
1858 "ror{b}\t{$src2, $dst|$dst, $src2}",
1859 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
1860 def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
1861 "ror{w}\t{$src2, $dst|$dst, $src2}",
1862 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>,
1864 def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
1865 "ror{l}\t{$src2, $dst|$dst, $src2}",
1866 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
1869 def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
1871 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
1872 def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
1874 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
1875 def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
1877 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
1879 let Constraints = "" in {
1880 let Uses = [CL] in {
1881 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
1882 "ror{b}\t{%cl, $dst|$dst, CL}",
1883 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
1884 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
1885 "ror{w}\t{%cl, $dst|$dst, CL}",
1886 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
1887 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
1888 "ror{l}\t{%cl, $dst|$dst, CL}",
1889 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
1891 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
1892 "ror{b}\t{$src, $dst|$dst, $src}",
1893 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1894 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
1895 "ror{w}\t{$src, $dst|$dst, $src}",
1896 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1898 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
1899 "ror{l}\t{$src, $dst|$dst, $src}",
1900 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
1903 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
1905 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
1906 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
1908 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1910 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
1912 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
1913 } // Constraints = ""
1916 // Double shift instructions (generalizations of rotate)
1917 let Uses = [CL] in {
1918 def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst),
1919 (ins GR32:$src1, GR32:$src2),
1920 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1921 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
1922 def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst),
1923 (ins GR32:$src1, GR32:$src2),
1924 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1925 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
1926 def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst),
1927 (ins GR16:$src1, GR16:$src2),
1928 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1929 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
1931 def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst),
1932 (ins GR16:$src1, GR16:$src2),
1933 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1934 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
1938 let isCommutable = 1 in { // These instructions commute to each other.
1939 def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
1941 (ins GR32:$src1, GR32:$src2, i8imm:$src3),
1942 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1943 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
1946 def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
1948 (ins GR32:$src1, GR32:$src2, i8imm:$src3),
1949 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1950 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
1953 def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
1955 (ins GR16:$src1, GR16:$src2, i8imm:$src3),
1956 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1957 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
1960 def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
1962 (ins GR16:$src1, GR16:$src2, i8imm:$src3),
1963 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1964 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
1969 let Constraints = "" in {
1970 let Uses = [CL] in {
1971 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
1972 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1973 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
1975 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
1976 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1977 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
1980 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
1981 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
1982 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1983 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
1984 (i8 imm:$src3)), addr:$dst)]>,
1986 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
1987 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
1988 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
1989 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
1990 (i8 imm:$src3)), addr:$dst)]>,
1993 let Uses = [CL] in {
1994 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
1995 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
1996 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
1997 addr:$dst)]>, TB, OpSize;
1998 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
1999 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}",
2000 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
2001 addr:$dst)]>, TB, OpSize;
2003 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
2004 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
2005 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2006 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
2007 (i8 imm:$src3)), addr:$dst)]>,
2009 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
2010 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
2011 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
2012 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
2013 (i8 imm:$src3)), addr:$dst)]>,
2015 } // Constraints = ""
2016 } // Defs = [EFLAGS]
2020 let Defs = [EFLAGS] in {
2021 let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
2022 // Register-Register Addition
2023 def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
2024 (ins GR8 :$src1, GR8 :$src2),
2025 "add{b}\t{$src2, $dst|$dst, $src2}",
2026 [(set GR8:$dst, EFLAGS, (X86add_flag GR8:$src1, GR8:$src2))]>;
2028 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
2029 // Register-Register Addition
2030 def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
2031 (ins GR16:$src1, GR16:$src2),
2032 "add{w}\t{$src2, $dst|$dst, $src2}",
2033 [(set GR16:$dst, EFLAGS, (X86add_flag GR16:$src1,
2034 GR16:$src2))]>, OpSize;
2035 def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
2036 (ins GR32:$src1, GR32:$src2),
2037 "add{l}\t{$src2, $dst|$dst, $src2}",
2038 [(set GR32:$dst, EFLAGS, (X86add_flag GR32:$src1,
2040 } // end isConvertibleToThreeAddress
2041 } // end isCommutable
2043 // These are alternate spellings for use by the disassembler, we mark them as
2044 // code gen only to ensure they aren't matched by the assembler.
2045 let isCodeGenOnly = 1 in {
2046 def ADD8rr_alt: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2047 "add{b}\t{$src2, $dst|$dst, $src2}", []>;
2048 def ADD16rr_alt: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2),
2049 "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
2050 def ADD32rr_alt: I<0x03, MRMSrcReg,(outs GR32:$dst),(ins GR32:$src1, GR32:$src2),
2051 "add{l}\t{$src2, $dst|$dst, $src2}", []>;
2054 // Register-Memory Addition
2055 def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
2056 (ins GR8 :$src1, i8mem :$src2),
2057 "add{b}\t{$src2, $dst|$dst, $src2}",
2058 [(set GR8:$dst, EFLAGS, (X86add_flag GR8:$src1,
2059 (load addr:$src2)))]>;
2060 def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
2061 (ins GR16:$src1, i16mem:$src2),
2062 "add{w}\t{$src2, $dst|$dst, $src2}",
2063 [(set GR16:$dst, EFLAGS, (X86add_flag GR16:$src1,
2064 (load addr:$src2)))]>, OpSize;
2065 def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
2066 (ins GR32:$src1, i32mem:$src2),
2067 "add{l}\t{$src2, $dst|$dst, $src2}",
2068 [(set GR32:$dst, EFLAGS, (X86add_flag GR32:$src1,
2069 (load addr:$src2)))]>;
2071 // Register-Integer Addition
2072 def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2073 "add{b}\t{$src2, $dst|$dst, $src2}",
2074 [(set GR8:$dst, EFLAGS,
2075 (X86add_flag GR8:$src1, imm:$src2))]>;
2077 let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
2078 // Register-Integer Addition
2079 def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
2080 (ins GR16:$src1, i16imm:$src2),
2081 "add{w}\t{$src2, $dst|$dst, $src2}",
2082 [(set GR16:$dst, EFLAGS,
2083 (X86add_flag GR16:$src1, imm:$src2))]>, OpSize;
2084 def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
2085 (ins GR32:$src1, i32imm:$src2),
2086 "add{l}\t{$src2, $dst|$dst, $src2}",
2087 [(set GR32:$dst, EFLAGS,
2088 (X86add_flag GR32:$src1, imm:$src2))]>;
2089 def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
2090 (ins GR16:$src1, i16i8imm:$src2),
2091 "add{w}\t{$src2, $dst|$dst, $src2}",
2092 [(set GR16:$dst, EFLAGS,
2093 (X86add_flag GR16:$src1, i16immSExt8:$src2))]>, OpSize;
2094 def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
2095 (ins GR32:$src1, i32i8imm:$src2),
2096 "add{l}\t{$src2, $dst|$dst, $src2}",
2097 [(set GR32:$dst, EFLAGS,
2098 (X86add_flag GR32:$src1, i32immSExt8:$src2))]>;
2101 let Constraints = "" in {
2102 // Memory-Register Addition
2103 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2104 "add{b}\t{$src2, $dst|$dst, $src2}",
2105 [(store (add (load addr:$dst), GR8:$src2), addr:$dst),
2106 (implicit EFLAGS)]>;
2107 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2108 "add{w}\t{$src2, $dst|$dst, $src2}",
2109 [(store (add (load addr:$dst), GR16:$src2), addr:$dst),
2110 (implicit EFLAGS)]>, OpSize;
2111 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2112 "add{l}\t{$src2, $dst|$dst, $src2}",
2113 [(store (add (load addr:$dst), GR32:$src2), addr:$dst),
2114 (implicit EFLAGS)]>;
2115 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
2116 "add{b}\t{$src2, $dst|$dst, $src2}",
2117 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst),
2118 (implicit EFLAGS)]>;
2119 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
2120 "add{w}\t{$src2, $dst|$dst, $src2}",
2121 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst),
2122 (implicit EFLAGS)]>, OpSize;
2123 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
2124 "add{l}\t{$src2, $dst|$dst, $src2}",
2125 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst),
2126 (implicit EFLAGS)]>;
2127 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2128 "add{w}\t{$src2, $dst|$dst, $src2}",
2129 [(store (add (load addr:$dst), i16immSExt8:$src2),
2131 (implicit EFLAGS)]>, OpSize;
2132 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2133 "add{l}\t{$src2, $dst|$dst, $src2}",
2134 [(store (add (load addr:$dst), i32immSExt8:$src2),
2136 (implicit EFLAGS)]>;
2139 def ADD8i8 : Ii8<0x04, RawFrm, (outs), (ins i8imm:$src),
2140 "add{b}\t{$src, %al|%al, $src}", []>;
2141 def ADD16i16 : Ii16<0x05, RawFrm, (outs), (ins i16imm:$src),
2142 "add{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2143 def ADD32i32 : Ii32<0x05, RawFrm, (outs), (ins i32imm:$src),
2144 "add{l}\t{$src, %eax|%eax, $src}", []>;
2145 } // Constraints = ""
2147 let Uses = [EFLAGS] in {
2148 let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
2149 def ADC8rr : I<0x10, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2150 "adc{b}\t{$src2, $dst|$dst, $src2}",
2151 [(set GR8:$dst, (adde GR8:$src1, GR8:$src2))]>;
2152 def ADC16rr : I<0x11, MRMDestReg, (outs GR16:$dst),
2153 (ins GR16:$src1, GR16:$src2),
2154 "adc{w}\t{$src2, $dst|$dst, $src2}",
2155 [(set GR16:$dst, (adde GR16:$src1, GR16:$src2))]>, OpSize;
2156 def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst),
2157 (ins GR32:$src1, GR32:$src2),
2158 "adc{l}\t{$src2, $dst|$dst, $src2}",
2159 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
2162 let isCodeGenOnly = 1 in {
2163 def ADC8rr_REV : I<0x12, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2164 "adc{b}\t{$src2, $dst|$dst, $src2}", []>;
2165 def ADC16rr_REV : I<0x13, MRMSrcReg, (outs GR16:$dst),
2166 (ins GR16:$src1, GR16:$src2),
2167 "adc{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
2168 def ADC32rr_REV : I<0x13, MRMSrcReg, (outs GR32:$dst),
2169 (ins GR32:$src1, GR32:$src2),
2170 "adc{l}\t{$src2, $dst|$dst, $src2}", []>;
2173 def ADC8rm : I<0x12, MRMSrcMem , (outs GR8:$dst),
2174 (ins GR8:$src1, i8mem:$src2),
2175 "adc{b}\t{$src2, $dst|$dst, $src2}",
2176 [(set GR8:$dst, (adde GR8:$src1, (load addr:$src2)))]>;
2177 def ADC16rm : I<0x13, MRMSrcMem , (outs GR16:$dst),
2178 (ins GR16:$src1, i16mem:$src2),
2179 "adc{w}\t{$src2, $dst|$dst, $src2}",
2180 [(set GR16:$dst, (adde GR16:$src1, (load addr:$src2)))]>,
2182 def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst),
2183 (ins GR32:$src1, i32mem:$src2),
2184 "adc{l}\t{$src2, $dst|$dst, $src2}",
2185 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
2186 def ADC8ri : Ii8<0x80, MRM2r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2187 "adc{b}\t{$src2, $dst|$dst, $src2}",
2188 [(set GR8:$dst, (adde GR8:$src1, imm:$src2))]>;
2189 def ADC16ri : Ii16<0x81, MRM2r, (outs GR16:$dst),
2190 (ins GR16:$src1, i16imm:$src2),
2191 "adc{w}\t{$src2, $dst|$dst, $src2}",
2192 [(set GR16:$dst, (adde GR16:$src1, imm:$src2))]>, OpSize;
2193 def ADC16ri8 : Ii8<0x83, MRM2r, (outs GR16:$dst),
2194 (ins GR16:$src1, i16i8imm:$src2),
2195 "adc{w}\t{$src2, $dst|$dst, $src2}",
2196 [(set GR16:$dst, (adde GR16:$src1, i16immSExt8:$src2))]>,
2198 def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst),
2199 (ins GR32:$src1, i32imm:$src2),
2200 "adc{l}\t{$src2, $dst|$dst, $src2}",
2201 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
2202 def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst),
2203 (ins GR32:$src1, i32i8imm:$src2),
2204 "adc{l}\t{$src2, $dst|$dst, $src2}",
2205 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
2207 let Constraints = "" in {
2208 def ADC8mr : I<0x10, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2209 "adc{b}\t{$src2, $dst|$dst, $src2}",
2210 [(store (adde (load addr:$dst), GR8:$src2), addr:$dst)]>;
2211 def ADC16mr : I<0x11, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2212 "adc{w}\t{$src2, $dst|$dst, $src2}",
2213 [(store (adde (load addr:$dst), GR16:$src2), addr:$dst)]>,
2215 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2216 "adc{l}\t{$src2, $dst|$dst, $src2}",
2217 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
2218 def ADC8mi : Ii8<0x80, MRM2m, (outs), (ins i8mem:$dst, i8imm:$src2),
2219 "adc{b}\t{$src2, $dst|$dst, $src2}",
2220 [(store (adde (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
2221 def ADC16mi : Ii16<0x81, MRM2m, (outs), (ins i16mem:$dst, i16imm:$src2),
2222 "adc{w}\t{$src2, $dst|$dst, $src2}",
2223 [(store (adde (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
2225 def ADC16mi8 : Ii8<0x83, MRM2m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2226 "adc{w}\t{$src2, $dst|$dst, $src2}",
2227 [(store (adde (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
2229 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
2230 "adc{l}\t{$src2, $dst|$dst, $src2}",
2231 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
2232 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2233 "adc{l}\t{$src2, $dst|$dst, $src2}",
2234 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2236 def ADC8i8 : Ii8<0x14, RawFrm, (outs), (ins i8imm:$src),
2237 "adc{b}\t{$src, %al|%al, $src}", []>;
2238 def ADC16i16 : Ii16<0x15, RawFrm, (outs), (ins i16imm:$src),
2239 "adc{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2240 def ADC32i32 : Ii32<0x15, RawFrm, (outs), (ins i32imm:$src),
2241 "adc{l}\t{$src, %eax|%eax, $src}", []>;
2242 } // Constraints = ""
2243 } // Uses = [EFLAGS]
2245 // Register-Register Subtraction
2246 def SUB8rr : I<0x28, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2247 "sub{b}\t{$src2, $dst|$dst, $src2}",
2248 [(set GR8:$dst, EFLAGS,
2249 (X86sub_flag GR8:$src1, GR8:$src2))]>;
2250 def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2),
2251 "sub{w}\t{$src2, $dst|$dst, $src2}",
2252 [(set GR16:$dst, EFLAGS,
2253 (X86sub_flag GR16:$src1, GR16:$src2))]>, OpSize;
2254 def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),
2255 "sub{l}\t{$src2, $dst|$dst, $src2}",
2256 [(set GR32:$dst, EFLAGS,
2257 (X86sub_flag GR32:$src1, GR32:$src2))]>;
2259 let isCodeGenOnly = 1 in {
2260 def SUB8rr_REV : I<0x2A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2261 "sub{b}\t{$src2, $dst|$dst, $src2}", []>;
2262 def SUB16rr_REV : I<0x2B, MRMSrcReg, (outs GR16:$dst),
2263 (ins GR16:$src1, GR16:$src2),
2264 "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
2265 def SUB32rr_REV : I<0x2B, MRMSrcReg, (outs GR32:$dst),
2266 (ins GR32:$src1, GR32:$src2),
2267 "sub{l}\t{$src2, $dst|$dst, $src2}", []>;
2270 // Register-Memory Subtraction
2271 def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst),
2272 (ins GR8 :$src1, i8mem :$src2),
2273 "sub{b}\t{$src2, $dst|$dst, $src2}",
2274 [(set GR8:$dst, EFLAGS,
2275 (X86sub_flag GR8:$src1, (load addr:$src2)))]>;
2276 def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst),
2277 (ins GR16:$src1, i16mem:$src2),
2278 "sub{w}\t{$src2, $dst|$dst, $src2}",
2279 [(set GR16:$dst, EFLAGS,
2280 (X86sub_flag GR16:$src1, (load addr:$src2)))]>, OpSize;
2281 def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst),
2282 (ins GR32:$src1, i32mem:$src2),
2283 "sub{l}\t{$src2, $dst|$dst, $src2}",
2284 [(set GR32:$dst, EFLAGS,
2285 (X86sub_flag GR32:$src1, (load addr:$src2)))]>;
2287 // Register-Integer Subtraction
2288 def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst),
2289 (ins GR8:$src1, i8imm:$src2),
2290 "sub{b}\t{$src2, $dst|$dst, $src2}",
2291 [(set GR8:$dst, EFLAGS,
2292 (X86sub_flag GR8:$src1, imm:$src2))]>;
2293 def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst),
2294 (ins GR16:$src1, i16imm:$src2),
2295 "sub{w}\t{$src2, $dst|$dst, $src2}",
2296 [(set GR16:$dst, EFLAGS,
2297 (X86sub_flag GR16:$src1, imm:$src2))]>, OpSize;
2298 def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst),
2299 (ins GR32:$src1, i32imm:$src2),
2300 "sub{l}\t{$src2, $dst|$dst, $src2}",
2301 [(set GR32:$dst, EFLAGS,
2302 (X86sub_flag GR32:$src1, imm:$src2))]>;
2303 def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst),
2304 (ins GR16:$src1, i16i8imm:$src2),
2305 "sub{w}\t{$src2, $dst|$dst, $src2}",
2306 [(set GR16:$dst, EFLAGS,
2307 (X86sub_flag GR16:$src1, i16immSExt8:$src2))]>, OpSize;
2308 def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst),
2309 (ins GR32:$src1, i32i8imm:$src2),
2310 "sub{l}\t{$src2, $dst|$dst, $src2}",
2311 [(set GR32:$dst, EFLAGS,
2312 (X86sub_flag GR32:$src1, i32immSExt8:$src2))]>;
2314 let Constraints = "" in {
2315 // Memory-Register Subtraction
2316 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
2317 "sub{b}\t{$src2, $dst|$dst, $src2}",
2318 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst),
2319 (implicit EFLAGS)]>;
2320 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2321 "sub{w}\t{$src2, $dst|$dst, $src2}",
2322 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst),
2323 (implicit EFLAGS)]>, OpSize;
2324 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2325 "sub{l}\t{$src2, $dst|$dst, $src2}",
2326 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst),
2327 (implicit EFLAGS)]>;
2329 // Memory-Integer Subtraction
2330 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
2331 "sub{b}\t{$src2, $dst|$dst, $src2}",
2332 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst),
2333 (implicit EFLAGS)]>;
2334 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
2335 "sub{w}\t{$src2, $dst|$dst, $src2}",
2336 [(store (sub (loadi16 addr:$dst), imm:$src2),addr:$dst),
2337 (implicit EFLAGS)]>, OpSize;
2338 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
2339 "sub{l}\t{$src2, $dst|$dst, $src2}",
2340 [(store (sub (loadi32 addr:$dst), imm:$src2),addr:$dst),
2341 (implicit EFLAGS)]>;
2342 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2343 "sub{w}\t{$src2, $dst|$dst, $src2}",
2344 [(store (sub (load addr:$dst), i16immSExt8:$src2),
2346 (implicit EFLAGS)]>, OpSize;
2347 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2348 "sub{l}\t{$src2, $dst|$dst, $src2}",
2349 [(store (sub (load addr:$dst), i32immSExt8:$src2),
2351 (implicit EFLAGS)]>;
2353 def SUB8i8 : Ii8<0x2C, RawFrm, (outs), (ins i8imm:$src),
2354 "sub{b}\t{$src, %al|%al, $src}", []>;
2355 def SUB16i16 : Ii16<0x2D, RawFrm, (outs), (ins i16imm:$src),
2356 "sub{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2357 def SUB32i32 : Ii32<0x2D, RawFrm, (outs), (ins i32imm:$src),
2358 "sub{l}\t{$src, %eax|%eax, $src}", []>;
2359 } // Constraints = ""
2361 let Uses = [EFLAGS] in {
2362 def SBB8rr : I<0x18, MRMDestReg, (outs GR8:$dst),
2363 (ins GR8:$src1, GR8:$src2),
2364 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2365 [(set GR8:$dst, (sube GR8:$src1, GR8:$src2))]>;
2366 def SBB16rr : I<0x19, MRMDestReg, (outs GR16:$dst),
2367 (ins GR16:$src1, GR16:$src2),
2368 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2369 [(set GR16:$dst, (sube GR16:$src1, GR16:$src2))]>, OpSize;
2370 def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst),
2371 (ins GR32:$src1, GR32:$src2),
2372 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2373 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
2375 let Constraints = "" in {
2376 def SBB8mr : I<0x18, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2),
2377 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2378 [(store (sube (load addr:$dst), GR8:$src2), addr:$dst)]>;
2379 def SBB16mr : I<0x19, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
2380 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2381 [(store (sube (load addr:$dst), GR16:$src2), addr:$dst)]>,
2383 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
2384 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2385 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
2386 def SBB8mi : Ii8<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
2387 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2388 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
2389 def SBB16mi : Ii16<0x81, MRM3m, (outs), (ins i16mem:$dst, i16imm:$src2),
2390 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2391 [(store (sube (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
2393 def SBB16mi8 : Ii8<0x83, MRM3m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
2394 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2395 [(store (sube (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
2397 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
2398 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2399 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
2400 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
2401 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2402 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
2404 def SBB8i8 : Ii8<0x1C, RawFrm, (outs), (ins i8imm:$src),
2405 "sbb{b}\t{$src, %al|%al, $src}", []>;
2406 def SBB16i16 : Ii16<0x1D, RawFrm, (outs), (ins i16imm:$src),
2407 "sbb{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2408 def SBB32i32 : Ii32<0x1D, RawFrm, (outs), (ins i32imm:$src),
2409 "sbb{l}\t{$src, %eax|%eax, $src}", []>;
2410 } // Constraints = ""
2412 let isCodeGenOnly = 1 in {
2413 def SBB8rr_REV : I<0x1A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
2414 "sbb{b}\t{$src2, $dst|$dst, $src2}", []>;
2415 def SBB16rr_REV : I<0x1B, MRMSrcReg, (outs GR16:$dst),
2416 (ins GR16:$src1, GR16:$src2),
2417 "sbb{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize;
2418 def SBB32rr_REV : I<0x1B, MRMSrcReg, (outs GR32:$dst),
2419 (ins GR32:$src1, GR32:$src2),
2420 "sbb{l}\t{$src2, $dst|$dst, $src2}", []>;
2423 def SBB8rm : I<0x1A, MRMSrcMem, (outs GR8:$dst), (ins GR8:$src1, i8mem:$src2),
2424 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2425 [(set GR8:$dst, (sube GR8:$src1, (load addr:$src2)))]>;
2426 def SBB16rm : I<0x1B, MRMSrcMem, (outs GR16:$dst),
2427 (ins GR16:$src1, i16mem:$src2),
2428 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2429 [(set GR16:$dst, (sube GR16:$src1, (load addr:$src2)))]>,
2431 def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst),
2432 (ins GR32:$src1, i32mem:$src2),
2433 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2434 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
2435 def SBB8ri : Ii8<0x80, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
2436 "sbb{b}\t{$src2, $dst|$dst, $src2}",
2437 [(set GR8:$dst, (sube GR8:$src1, imm:$src2))]>;
2438 def SBB16ri : Ii16<0x81, MRM3r, (outs GR16:$dst),
2439 (ins GR16:$src1, i16imm:$src2),
2440 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2441 [(set GR16:$dst, (sube GR16:$src1, imm:$src2))]>, OpSize;
2442 def SBB16ri8 : Ii8<0x83, MRM3r, (outs GR16:$dst),
2443 (ins GR16:$src1, i16i8imm:$src2),
2444 "sbb{w}\t{$src2, $dst|$dst, $src2}",
2445 [(set GR16:$dst, (sube GR16:$src1, i16immSExt8:$src2))]>,
2447 def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst),
2448 (ins GR32:$src1, i32imm:$src2),
2449 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2450 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
2451 def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst),
2452 (ins GR32:$src1, i32i8imm:$src2),
2453 "sbb{l}\t{$src2, $dst|$dst, $src2}",
2454 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
2455 } // Uses = [EFLAGS]
2456 } // Defs = [EFLAGS]
2458 let Defs = [EFLAGS] in {
2459 let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
2460 // Register-Register Signed Integer Multiply
2461 def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2),
2462 "imul{w}\t{$src2, $dst|$dst, $src2}",
2463 [(set GR16:$dst, EFLAGS,
2464 (X86smul_flag GR16:$src1, GR16:$src2))]>, TB, OpSize;
2465 def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),
2466 "imul{l}\t{$src2, $dst|$dst, $src2}",
2467 [(set GR32:$dst, EFLAGS,
2468 (X86smul_flag GR32:$src1, GR32:$src2))]>, TB;
2471 // Register-Memory Signed Integer Multiply
2472 def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst),
2473 (ins GR16:$src1, i16mem:$src2),
2474 "imul{w}\t{$src2, $dst|$dst, $src2}",
2475 [(set GR16:$dst, EFLAGS,
2476 (X86smul_flag GR16:$src1, (load addr:$src2)))]>,
2478 def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst),
2479 (ins GR32:$src1, i32mem:$src2),
2480 "imul{l}\t{$src2, $dst|$dst, $src2}",
2481 [(set GR32:$dst, EFLAGS,
2482 (X86smul_flag GR32:$src1, (load addr:$src2)))]>, TB;
2483 } // Defs = [EFLAGS]
2484 } // end Two Address instructions
2486 // Suprisingly enough, these are not two address instructions!
2487 let Defs = [EFLAGS] in {
2488 // Register-Integer Signed Integer Multiply
2489 def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
2490 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
2491 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2492 [(set GR16:$dst, EFLAGS,
2493 (X86smul_flag GR16:$src1, imm:$src2))]>, OpSize;
2494 def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
2495 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
2496 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2497 [(set GR32:$dst, EFLAGS,
2498 (X86smul_flag GR32:$src1, imm:$src2))]>;
2499 def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
2500 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
2501 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2502 [(set GR16:$dst, EFLAGS,
2503 (X86smul_flag GR16:$src1, i16immSExt8:$src2))]>,
2505 def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
2506 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
2507 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2508 [(set GR32:$dst, EFLAGS,
2509 (X86smul_flag GR32:$src1, i32immSExt8:$src2))]>;
2511 // Memory-Integer Signed Integer Multiply
2512 def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
2513 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
2514 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2515 [(set GR16:$dst, EFLAGS,
2516 (X86smul_flag (load addr:$src1), imm:$src2))]>,
2518 def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
2519 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
2520 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2521 [(set GR32:$dst, EFLAGS,
2522 (X86smul_flag (load addr:$src1), imm:$src2))]>;
2523 def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
2524 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
2525 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2526 [(set GR16:$dst, EFLAGS,
2527 (X86smul_flag (load addr:$src1),
2528 i16immSExt8:$src2))]>, OpSize;
2529 def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
2530 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
2531 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
2532 [(set GR32:$dst, EFLAGS,
2533 (X86smul_flag (load addr:$src1),
2534 i32immSExt8:$src2))]>;
2535 } // Defs = [EFLAGS]
2537 //===----------------------------------------------------------------------===//
2538 // Test instructions are just like AND, except they don't generate a result.
2540 let Defs = [EFLAGS] in {
2541 let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
2542 def TEST8rr : I<0x84, MRMSrcReg, (outs), (ins GR8:$src1, GR8:$src2),
2543 "test{b}\t{$src2, $src1|$src1, $src2}",
2544 [(set EFLAGS, (X86cmp (and_su GR8:$src1, GR8:$src2), 0))]>;
2545 def TEST16rr : I<0x85, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2),
2546 "test{w}\t{$src2, $src1|$src1, $src2}",
2547 [(set EFLAGS, (X86cmp (and_su GR16:$src1, GR16:$src2),
2550 def TEST32rr : I<0x85, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2),
2551 "test{l}\t{$src2, $src1|$src1, $src2}",
2552 [(set EFLAGS, (X86cmp (and_su GR32:$src1, GR32:$src2),
2556 def TEST8i8 : Ii8<0xA8, RawFrm, (outs), (ins i8imm:$src),
2557 "test{b}\t{$src, %al|%al, $src}", []>;
2558 def TEST16i16 : Ii16<0xA9, RawFrm, (outs), (ins i16imm:$src),
2559 "test{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2560 def TEST32i32 : Ii32<0xA9, RawFrm, (outs), (ins i32imm:$src),
2561 "test{l}\t{$src, %eax|%eax, $src}", []>;
2563 def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
2564 "test{b}\t{$src2, $src1|$src1, $src2}",
2565 [(set EFLAGS, (X86cmp (and GR8:$src1, (loadi8 addr:$src2)),
2567 def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
2568 "test{w}\t{$src2, $src1|$src1, $src2}",
2569 [(set EFLAGS, (X86cmp (and GR16:$src1,
2570 (loadi16 addr:$src2)), 0))]>, OpSize;
2571 def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
2572 "test{l}\t{$src2, $src1|$src1, $src2}",
2573 [(set EFLAGS, (X86cmp (and GR32:$src1,
2574 (loadi32 addr:$src2)), 0))]>;
2576 def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
2577 (outs), (ins GR8:$src1, i8imm:$src2),
2578 "test{b}\t{$src2, $src1|$src1, $src2}",
2579 [(set EFLAGS, (X86cmp (and_su GR8:$src1, imm:$src2), 0))]>;
2580 def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2581 (outs), (ins GR16:$src1, i16imm:$src2),
2582 "test{w}\t{$src2, $src1|$src1, $src2}",
2583 [(set EFLAGS, (X86cmp (and_su GR16:$src1, imm:$src2), 0))]>,
2585 def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2586 (outs), (ins GR32:$src1, i32imm:$src2),
2587 "test{l}\t{$src2, $src1|$src1, $src2}",
2588 [(set EFLAGS, (X86cmp (and_su GR32:$src1, imm:$src2), 0))]>;
2590 def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
2591 (outs), (ins i8mem:$src1, i8imm:$src2),
2592 "test{b}\t{$src2, $src1|$src1, $src2}",
2593 [(set EFLAGS, (X86cmp (and (loadi8 addr:$src1), imm:$src2),
2595 def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2596 (outs), (ins i16mem:$src1, i16imm:$src2),
2597 "test{w}\t{$src2, $src1|$src1, $src2}",
2598 [(set EFLAGS, (X86cmp (and (loadi16 addr:$src1), imm:$src2),
2600 def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2601 (outs), (ins i32mem:$src1, i32imm:$src2),
2602 "test{l}\t{$src2, $src1|$src1, $src2}",
2603 [(set EFLAGS, (X86cmp (and (loadi32 addr:$src1), imm:$src2),
2605 } // Defs = [EFLAGS]
2608 // Condition code ops, incl. set if equal/not equal/...
2609 let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in
2610 def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
2611 let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in
2612 def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
2614 // Integer comparisons
2615 let Defs = [EFLAGS] in {
2616 def CMP8i8 : Ii8<0x3C, RawFrm, (outs), (ins i8imm:$src),
2617 "cmp{b}\t{$src, %al|%al, $src}", []>;
2618 def CMP16i16 : Ii16<0x3D, RawFrm, (outs), (ins i16imm:$src),
2619 "cmp{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2620 def CMP32i32 : Ii32<0x3D, RawFrm, (outs), (ins i32imm:$src),
2621 "cmp{l}\t{$src, %eax|%eax, $src}", []>;
2623 def CMP8rr : I<0x38, MRMDestReg,
2624 (outs), (ins GR8 :$src1, GR8 :$src2),
2625 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2626 [(set EFLAGS, (X86cmp GR8:$src1, GR8:$src2))]>;
2627 def CMP16rr : I<0x39, MRMDestReg,
2628 (outs), (ins GR16:$src1, GR16:$src2),
2629 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2630 [(set EFLAGS, (X86cmp GR16:$src1, GR16:$src2))]>, OpSize;
2631 def CMP32rr : I<0x39, MRMDestReg,
2632 (outs), (ins GR32:$src1, GR32:$src2),
2633 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2634 [(set EFLAGS, (X86cmp GR32:$src1, GR32:$src2))]>;
2635 def CMP8mr : I<0x38, MRMDestMem,
2636 (outs), (ins i8mem :$src1, GR8 :$src2),
2637 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2638 [(set EFLAGS, (X86cmp (loadi8 addr:$src1), GR8:$src2))]>;
2639 def CMP16mr : I<0x39, MRMDestMem,
2640 (outs), (ins i16mem:$src1, GR16:$src2),
2641 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2642 [(set EFLAGS, (X86cmp (loadi16 addr:$src1), GR16:$src2))]>,
2644 def CMP32mr : I<0x39, MRMDestMem,
2645 (outs), (ins i32mem:$src1, GR32:$src2),
2646 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2647 [(set EFLAGS, (X86cmp (loadi32 addr:$src1), GR32:$src2))]>;
2648 def CMP8rm : I<0x3A, MRMSrcMem,
2649 (outs), (ins GR8 :$src1, i8mem :$src2),
2650 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2651 [(set EFLAGS, (X86cmp GR8:$src1, (loadi8 addr:$src2)))]>;
2652 def CMP16rm : I<0x3B, MRMSrcMem,
2653 (outs), (ins GR16:$src1, i16mem:$src2),
2654 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2655 [(set EFLAGS, (X86cmp GR16:$src1, (loadi16 addr:$src2)))]>,
2657 def CMP32rm : I<0x3B, MRMSrcMem,
2658 (outs), (ins GR32:$src1, i32mem:$src2),
2659 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2660 [(set EFLAGS, (X86cmp GR32:$src1, (loadi32 addr:$src2)))]>;
2662 // These are alternate spellings for use by the disassembler, we mark them as
2663 // code gen only to ensure they aren't matched by the assembler.
2664 let isCodeGenOnly = 1 in {
2665 def CMP8rr_alt : I<0x3A, MRMSrcReg, (outs), (ins GR8:$src1, GR8:$src2),
2666 "cmp{b}\t{$src2, $src1|$src1, $src2}", []>;
2667 def CMP16rr_alt : I<0x3B, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2),
2668 "cmp{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize;
2669 def CMP32rr_alt : I<0x3B, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2),
2670 "cmp{l}\t{$src2, $src1|$src1, $src2}", []>;
2673 def CMP8ri : Ii8<0x80, MRM7r,
2674 (outs), (ins GR8:$src1, i8imm:$src2),
2675 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2676 [(set EFLAGS, (X86cmp GR8:$src1, imm:$src2))]>;
2677 def CMP16ri : Ii16<0x81, MRM7r,
2678 (outs), (ins GR16:$src1, i16imm:$src2),
2679 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2680 [(set EFLAGS, (X86cmp GR16:$src1, imm:$src2))]>, OpSize;
2681 def CMP32ri : Ii32<0x81, MRM7r,
2682 (outs), (ins GR32:$src1, i32imm:$src2),
2683 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2684 [(set EFLAGS, (X86cmp GR32:$src1, imm:$src2))]>;
2685 def CMP8mi : Ii8 <0x80, MRM7m,
2686 (outs), (ins i8mem :$src1, i8imm :$src2),
2687 "cmp{b}\t{$src2, $src1|$src1, $src2}",
2688 [(set EFLAGS, (X86cmp (loadi8 addr:$src1), imm:$src2))]>;
2689 def CMP16mi : Ii16<0x81, MRM7m,
2690 (outs), (ins i16mem:$src1, i16imm:$src2),
2691 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2692 [(set EFLAGS, (X86cmp (loadi16 addr:$src1), imm:$src2))]>,
2694 def CMP32mi : Ii32<0x81, MRM7m,
2695 (outs), (ins i32mem:$src1, i32imm:$src2),
2696 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2697 [(set EFLAGS, (X86cmp (loadi32 addr:$src1), imm:$src2))]>;
2698 def CMP16ri8 : Ii8<0x83, MRM7r,
2699 (outs), (ins GR16:$src1, i16i8imm:$src2),
2700 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2701 [(set EFLAGS, (X86cmp GR16:$src1, i16immSExt8:$src2))]>,
2703 def CMP16mi8 : Ii8<0x83, MRM7m,
2704 (outs), (ins i16mem:$src1, i16i8imm:$src2),
2705 "cmp{w}\t{$src2, $src1|$src1, $src2}",
2706 [(set EFLAGS, (X86cmp (loadi16 addr:$src1),
2707 i16immSExt8:$src2))]>, OpSize;
2708 def CMP32mi8 : Ii8<0x83, MRM7m,
2709 (outs), (ins i32mem:$src1, i32i8imm:$src2),
2710 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2711 [(set EFLAGS, (X86cmp (loadi32 addr:$src1),
2712 i32immSExt8:$src2))]>;
2713 def CMP32ri8 : Ii8<0x83, MRM7r,
2714 (outs), (ins GR32:$src1, i32i8imm:$src2),
2715 "cmp{l}\t{$src2, $src1|$src1, $src2}",
2716 [(set EFLAGS, (X86cmp GR32:$src1, i32immSExt8:$src2))]>;
2717 } // Defs = [EFLAGS]
2720 // TODO: BTC, BTR, and BTS
2721 let Defs = [EFLAGS] in {
2722 def BT16rr : I<0xA3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2723 "bt{w}\t{$src2, $src1|$src1, $src2}",
2724 [(set EFLAGS, (X86bt GR16:$src1, GR16:$src2))]>, OpSize, TB;
2725 def BT32rr : I<0xA3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2726 "bt{l}\t{$src2, $src1|$src1, $src2}",
2727 [(set EFLAGS, (X86bt GR32:$src1, GR32:$src2))]>, TB;
2729 // Unlike with the register+register form, the memory+register form of the
2730 // bt instruction does not ignore the high bits of the index. From ISel's
2731 // perspective, this is pretty bizarre. Make these instructions disassembly
2734 def BT16mr : I<0xA3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2),
2735 "bt{w}\t{$src2, $src1|$src1, $src2}",
2736 // [(X86bt (loadi16 addr:$src1), GR16:$src2),
2737 // (implicit EFLAGS)]
2739 >, OpSize, TB, Requires<[FastBTMem]>;
2740 def BT32mr : I<0xA3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2),
2741 "bt{l}\t{$src2, $src1|$src1, $src2}",
2742 // [(X86bt (loadi32 addr:$src1), GR32:$src2),
2743 // (implicit EFLAGS)]
2745 >, TB, Requires<[FastBTMem]>;
2747 def BT16ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR16:$src1, i16i8imm:$src2),
2748 "bt{w}\t{$src2, $src1|$src1, $src2}",
2749 [(set EFLAGS, (X86bt GR16:$src1, i16immSExt8:$src2))]>,
2751 def BT32ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR32:$src1, i32i8imm:$src2),
2752 "bt{l}\t{$src2, $src1|$src1, $src2}",
2753 [(set EFLAGS, (X86bt GR32:$src1, i32immSExt8:$src2))]>, TB;
2754 // Note that these instructions don't need FastBTMem because that
2755 // only applies when the other operand is in a register. When it's
2756 // an immediate, bt is still fast.
2757 def BT16mi8 : Ii8<0xBA, MRM4m, (outs), (ins i16mem:$src1, i16i8imm:$src2),
2758 "bt{w}\t{$src2, $src1|$src1, $src2}",
2759 [(set EFLAGS, (X86bt (loadi16 addr:$src1), i16immSExt8:$src2))
2761 def BT32mi8 : Ii8<0xBA, MRM4m, (outs), (ins i32mem:$src1, i32i8imm:$src2),
2762 "bt{l}\t{$src2, $src1|$src1, $src2}",
2763 [(set EFLAGS, (X86bt (loadi32 addr:$src1), i32immSExt8:$src2))
2766 def BTC16rr : I<0xBB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2767 "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2768 def BTC32rr : I<0xBB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2769 "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2770 def BTC16mr : I<0xBB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2),
2771 "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2772 def BTC32mr : I<0xBB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2),
2773 "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2774 def BTC16ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR16:$src1, i16i8imm:$src2),
2775 "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2776 def BTC32ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR32:$src1, i32i8imm:$src2),
2777 "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2778 def BTC16mi8 : Ii8<0xBA, MRM7m, (outs), (ins i16mem:$src1, i16i8imm:$src2),
2779 "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2780 def BTC32mi8 : Ii8<0xBA, MRM7m, (outs), (ins i32mem:$src1, i32i8imm:$src2),
2781 "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2783 def BTR16rr : I<0xB3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2784 "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2785 def BTR32rr : I<0xB3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2786 "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2787 def BTR16mr : I<0xB3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2),
2788 "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2789 def BTR32mr : I<0xB3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2),
2790 "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2791 def BTR16ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR16:$src1, i16i8imm:$src2),
2792 "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2793 def BTR32ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR32:$src1, i32i8imm:$src2),
2794 "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2795 def BTR16mi8 : Ii8<0xBA, MRM6m, (outs), (ins i16mem:$src1, i16i8imm:$src2),
2796 "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2797 def BTR32mi8 : Ii8<0xBA, MRM6m, (outs), (ins i32mem:$src1, i32i8imm:$src2),
2798 "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2800 def BTS16rr : I<0xAB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
2801 "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2802 def BTS32rr : I<0xAB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
2803 "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2804 def BTS16mr : I<0xAB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2),
2805 "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2806 def BTS32mr : I<0xAB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2),
2807 "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2808 def BTS16ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR16:$src1, i16i8imm:$src2),
2809 "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2810 def BTS32ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR32:$src1, i32i8imm:$src2),
2811 "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2812 def BTS16mi8 : Ii8<0xBA, MRM5m, (outs), (ins i16mem:$src1, i16i8imm:$src2),
2813 "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB;
2814 def BTS32mi8 : Ii8<0xBA, MRM5m, (outs), (ins i32mem:$src1, i32i8imm:$src2),
2815 "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB;
2816 } // Defs = [EFLAGS]
2818 // Sign/Zero extenders
2819 // Use movsbl intead of movsbw; we don't care about the high 16 bits
2820 // of the register here. This has a smaller encoding and avoids a
2821 // partial-register update. Actual movsbw included for the disassembler.
2822 def MOVSX16rr8W : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src),
2823 "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2824 def MOVSX16rm8W : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src),
2825 "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2826 def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
2827 "", [(set GR16:$dst, (sext GR8:$src))]>, TB;
2828 def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
2829 "", [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB;
2830 def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
2831 "movs{bl|x}\t{$src, $dst|$dst, $src}",
2832 [(set GR32:$dst, (sext GR8:$src))]>, TB;
2833 def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
2834 "movs{bl|x}\t{$src, $dst|$dst, $src}",
2835 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
2836 def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
2837 "movs{wl|x}\t{$src, $dst|$dst, $src}",
2838 [(set GR32:$dst, (sext GR16:$src))]>, TB;
2839 def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
2840 "movs{wl|x}\t{$src, $dst|$dst, $src}",
2841 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
2843 // Use movzbl intead of movzbw; we don't care about the high 16 bits
2844 // of the register here. This has a smaller encoding and avoids a
2845 // partial-register update. Actual movzbw included for the disassembler.
2846 def MOVZX16rr8W : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src),
2847 "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2848 def MOVZX16rm8W : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src),
2849 "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2850 def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
2851 "", [(set GR16:$dst, (zext GR8:$src))]>, TB;
2852 def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
2853 "", [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB;
2854 def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
2855 "movz{bl|x}\t{$src, $dst|$dst, $src}",
2856 [(set GR32:$dst, (zext GR8:$src))]>, TB;
2857 def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
2858 "movz{bl|x}\t{$src, $dst|$dst, $src}",
2859 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
2860 def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
2861 "movz{wl|x}\t{$src, $dst|$dst, $src}",
2862 [(set GR32:$dst, (zext GR16:$src))]>, TB;
2863 def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
2864 "movz{wl|x}\t{$src, $dst|$dst, $src}",
2865 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
2867 // These are the same as the regular MOVZX32rr8 and MOVZX32rm8
2868 // except that they use GR32_NOREX for the output operand register class
2869 // instead of GR32. This allows them to operate on h registers on x86-64.
2870 def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg,
2871 (outs GR32_NOREX:$dst), (ins GR8:$src),
2872 "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX",
2875 def MOVZX32_NOREXrm8 : I<0xB6, MRMSrcMem,
2876 (outs GR32_NOREX:$dst), (ins i8mem:$src),
2877 "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX",
2880 let neverHasSideEffects = 1 in {
2881 let Defs = [AX], Uses = [AL] in
2882 def CBW : I<0x98, RawFrm, (outs), (ins),
2883 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
2884 let Defs = [EAX], Uses = [AX] in
2885 def CWDE : I<0x98, RawFrm, (outs), (ins),
2886 "{cwtl|cwde}", []>; // EAX = signext(AX)
2888 let Defs = [AX,DX], Uses = [AX] in
2889 def CWD : I<0x99, RawFrm, (outs), (ins),
2890 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
2891 let Defs = [EAX,EDX], Uses = [EAX] in
2892 def CDQ : I<0x99, RawFrm, (outs), (ins),
2893 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
2898 //===----------------------------------------------------------------------===//
2903 // Atomic swap. These are just normal xchg instructions. But since a memory
2904 // operand is referenced, the atomicity is ensured.
2905 let Constraints = "$val = $dst" in {
2906 def XCHG8rm : I<0x86, MRMSrcMem, (outs GR8:$dst), (ins GR8:$val, i8mem:$ptr),
2907 "xchg{b}\t{$val, $ptr|$ptr, $val}",
2908 [(set GR8:$dst, (atomic_swap_8 addr:$ptr, GR8:$val))]>;
2909 def XCHG16rm : I<0x87, MRMSrcMem, (outs GR16:$dst),
2910 (ins GR16:$val, i16mem:$ptr),
2911 "xchg{w}\t{$val, $ptr|$ptr, $val}",
2912 [(set GR16:$dst, (atomic_swap_16 addr:$ptr, GR16:$val))]>,
2914 def XCHG32rm : I<0x87, MRMSrcMem, (outs GR32:$dst),
2915 (ins GR32:$val, i32mem:$ptr),
2916 "xchg{l}\t{$val, $ptr|$ptr, $val}",
2917 [(set GR32:$dst, (atomic_swap_32 addr:$ptr, GR32:$val))]>;
2918 def XCHG64rm : RI<0x87, MRMSrcMem, (outs GR64:$dst),
2919 (ins GR64:$val,i64mem:$ptr),
2920 "xchg{q}\t{$val, $ptr|$ptr, $val}",
2921 [(set GR64:$dst, (atomic_swap_64 addr:$ptr, GR64:$val))]>;
2923 def XCHG8rr : I<0x86, MRMSrcReg, (outs GR8:$dst), (ins GR8:$val, GR8:$src),
2924 "xchg{b}\t{$val, $src|$src, $val}", []>;
2925 def XCHG16rr : I<0x87, MRMSrcReg, (outs GR16:$dst), (ins GR16:$val, GR16:$src),
2926 "xchg{w}\t{$val, $src|$src, $val}", []>, OpSize;
2927 def XCHG32rr : I<0x87, MRMSrcReg, (outs GR32:$dst), (ins GR32:$val, GR32:$src),
2928 "xchg{l}\t{$val, $src|$src, $val}", []>;
2929 def XCHG64rr : RI<0x87, MRMSrcReg, (outs GR64:$dst), (ins GR64:$val,GR64:$src),
2930 "xchg{q}\t{$val, $src|$src, $val}", []>;
2933 def XCHG16ar : I<0x90, AddRegFrm, (outs), (ins GR16:$src),
2934 "xchg{w}\t{$src, %ax|%ax, $src}", []>, OpSize;
2935 def XCHG32ar : I<0x90, AddRegFrm, (outs), (ins GR32:$src),
2936 "xchg{l}\t{$src, %eax|%eax, $src}", []>;
2937 def XCHG64ar : RI<0x90, AddRegFrm, (outs), (ins GR64:$src),
2938 "xchg{q}\t{$src, %rax|%rax, $src}", []>;
2942 def XADD8rr : I<0xC0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src),
2943 "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB;
2944 def XADD16rr : I<0xC1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
2945 "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2946 def XADD32rr : I<0xC1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
2947 "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB;
2948 def XADD64rr : RI<0xC1, MRMDestReg, (outs GR64:$dst), (ins GR64:$src),
2949 "xadd{q}\t{$src, $dst|$dst, $src}", []>, TB;
2951 let mayLoad = 1, mayStore = 1 in {
2952 def XADD8rm : I<0xC0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
2953 "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB;
2954 def XADD16rm : I<0xC1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
2955 "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2956 def XADD32rm : I<0xC1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
2957 "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB;
2958 def XADD64rm : RI<0xC1, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
2959 "xadd{q}\t{$src, $dst|$dst, $src}", []>, TB;
2963 def CMPXCHG8rr : I<0xB0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src),
2964 "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB;
2965 def CMPXCHG16rr : I<0xB1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
2966 "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2967 def CMPXCHG32rr : I<0xB1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
2968 "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB;
2969 def CMPXCHG64rr : RI<0xB1, MRMDestReg, (outs GR64:$dst), (ins GR64:$src),
2970 "cmpxchg{q}\t{$src, $dst|$dst, $src}", []>, TB;
2972 let mayLoad = 1, mayStore = 1 in {
2973 def CMPXCHG8rm : I<0xB0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
2974 "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB;
2975 def CMPXCHG16rm : I<0xB1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
2976 "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize;
2977 def CMPXCHG32rm : I<0xB1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
2978 "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB;
2979 def CMPXCHG64rm : RI<0xB1, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
2980 "cmpxchg{q}\t{$src, $dst|$dst, $src}", []>, TB;
2983 let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in
2984 def CMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i64mem:$dst),
2985 "cmpxchg8b\t$dst", []>, TB;
2987 let Defs = [RAX, RDX, EFLAGS], Uses = [RAX, RBX, RCX, RDX] in
2988 def CMPXCHG16B : RI<0xC7, MRM1m, (outs), (ins i128mem:$dst),
2989 "cmpxchg16b\t$dst", []>, TB;
2993 // Lock instruction prefix
2994 def LOCK_PREFIX : I<0xF0, RawFrm, (outs), (ins), "lock", []>;
2996 // Repeat string operation instruction prefixes
2997 // These uses the DF flag in the EFLAGS register to inc or dec ECX
2998 let Defs = [ECX], Uses = [ECX,EFLAGS] in {
2999 // Repeat (used with INS, OUTS, MOVS, LODS and STOS)
3000 def REP_PREFIX : I<0xF3, RawFrm, (outs), (ins), "rep", []>;
3001 // Repeat while not equal (used with CMPS and SCAS)
3002 def REPNE_PREFIX : I<0xF2, RawFrm, (outs), (ins), "repne", []>;
3006 // String manipulation instructions
3008 def LODSB : I<0xAC, RawFrm, (outs), (ins), "lodsb", []>;
3009 def LODSW : I<0xAD, RawFrm, (outs), (ins), "lodsw", []>, OpSize;
3010 def LODSD : I<0xAD, RawFrm, (outs), (ins), "lods{l|d}", []>;
3011 def LODSQ : RI<0xAD, RawFrm, (outs), (ins), "lodsq", []>;
3013 def OUTSB : I<0x6E, RawFrm, (outs), (ins), "outsb", []>;
3014 def OUTSW : I<0x6F, RawFrm, (outs), (ins), "outsw", []>, OpSize;
3015 def OUTSD : I<0x6F, RawFrm, (outs), (ins), "outs{l|d}", []>;
3018 // Flag instructions
3019 def CLC : I<0xF8, RawFrm, (outs), (ins), "clc", []>;
3020 def STC : I<0xF9, RawFrm, (outs), (ins), "stc", []>;
3021 def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", []>;
3022 def STI : I<0xFB, RawFrm, (outs), (ins), "sti", []>;
3023 def CLD : I<0xFC, RawFrm, (outs), (ins), "cld", []>;
3024 def STD : I<0xFD, RawFrm, (outs), (ins), "std", []>;
3025 def CMC : I<0xF5, RawFrm, (outs), (ins), "cmc", []>;
3027 def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", []>, TB;
3029 // Table lookup instructions
3030 def XLAT : I<0xD7, RawFrm, (outs), (ins), "xlatb", []>;
3034 //===----------------------------------------------------------------------===//
3036 //===----------------------------------------------------------------------===//
3038 // Floating Point Stack Support
3039 include "X86InstrFPStack.td"
3042 include "X86Instr64bit.td"
3044 include "X86InstrCMovSetCC.td"
3045 include "X86InstrControl.td"
3047 // SIMD support (SSE, MMX and AVX)
3048 include "X86InstrFragmentsSIMD.td"
3050 // FMA - Fused Multiply-Add support (requires FMA)
3051 include "X86InstrFMA.td"
3053 // SSE, MMX and 3DNow! vector support.
3054 include "X86InstrSSE.td"
3055 include "X86InstrMMX.td"
3056 include "X86Instr3DNow.td"
3058 include "X86InstrVMX.td"
3060 // System instructions.
3061 include "X86InstrSystem.td"
3063 // Compiler Pseudo Instructions and Pat Patterns
3064 include "X86InstrCompiler.td"