blob: de1c3a1ff494e5eb97d49d0a10f7b8ae5ee9f154 [file] [log] [blame]
Chris Lattner1cca5e32003-08-03 21:54:21 +00001//===- X86InstrInfo.td - Describe the X86 Instruction Set -------*- C++ -*-===//
John Criswell856ba762003-10-21 15:17:13 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Chris Lattner1cca5e32003-08-03 21:54:21 +00009//
10// This file describes the X86 instruction set, defining the instructions, and
11// properties of the instructions which are needed for code generation, machine
12// code emission, and analysis.
13//
14//===----------------------------------------------------------------------===//
15
Evan Chengaed7c722005-12-17 01:24:02 +000016//===----------------------------------------------------------------------===//
17// X86 specific DAG Nodes.
18//
19
Evan Chenge3413162006-01-09 18:33:28 +000020def SDTIntShiftDOp: SDTypeProfile<1, 3,
21 [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>,
22 SDTCisInt<0>, SDTCisInt<3>]>;
23
Evan Cheng71fb9ad2006-01-26 00:29:36 +000024def SDTX86CmpTest : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
Evan Chengaed7c722005-12-17 01:24:02 +000025
Evan Cheng71fb9ad2006-01-26 00:29:36 +000026def SDTX86Cmov : SDTypeProfile<1, 3,
Evan Chengaed7c722005-12-17 01:24:02 +000027 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +000028 SDTCisVT<3, i8>]>;
Evan Chengaed7c722005-12-17 01:24:02 +000029
Evan Cheng71fb9ad2006-01-26 00:29:36 +000030def SDTX86BrCond : SDTypeProfile<0, 2,
31 [SDTCisVT<0, OtherVT>, SDTCisVT<1, i8>]>;
Evan Chengaed7c722005-12-17 01:24:02 +000032
Evan Cheng71fb9ad2006-01-26 00:29:36 +000033def SDTX86SetCC : SDTypeProfile<1, 1,
34 [SDTCisVT<0, i8>, SDTCisVT<1, i8>]>;
Evan Chengd5781fc2005-12-21 20:21:51 +000035
Evan Chengd9558e02006-01-06 00:43:03 +000036def SDTX86Ret : SDTypeProfile<0, 1, [SDTCisVT<0, i16>]>;
Evan Cheng898101c2005-12-19 23:12:38 +000037
Evan Chenge3413162006-01-09 18:33:28 +000038def SDT_X86CallSeqStart : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
39def SDT_X86CallSeqEnd : SDTypeProfile<0, 2, [ SDTCisVT<0, i32>,
40 SDTCisVT<1, i32> ]>;
41
42def SDT_X86Call : SDTypeProfile<0, 1, [SDTCisVT<0, i32>]>;
43
Evan Cheng67f92a72006-01-11 22:15:48 +000044def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
45
Evan Chenge3413162006-01-09 18:33:28 +000046def SDTX86RdTsc : SDTypeProfile<0, 0, []>;
Evan Chengd90eb7f2006-01-05 00:27:02 +000047
Evan Cheng71fb8342006-02-25 10:02:21 +000048def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
49
Evan Chenge3413162006-01-09 18:33:28 +000050def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
51def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
Evan Chengb077b842005-12-21 02:39:21 +000052
Evan Cheng71fb9ad2006-01-26 00:29:36 +000053def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest,
54 [SDNPOutFlag]>;
55def X86test : SDNode<"X86ISD::TEST", SDTX86CmpTest,
56 [SDNPOutFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000057
Evan Chenge3413162006-01-09 18:33:28 +000058def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov,
Evan Cheng71fb9ad2006-01-26 00:29:36 +000059 [SDNPInFlag, SDNPOutFlag]>;
Evan Chenge3413162006-01-09 18:33:28 +000060def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
Evan Cheng71fb9ad2006-01-26 00:29:36 +000061 [SDNPHasChain, SDNPInFlag]>;
Evan Cheng5ee4ccc2006-01-12 08:27:59 +000062def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC,
Evan Cheng71fb9ad2006-01-26 00:29:36 +000063 [SDNPInFlag, SDNPOutFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000064
Evan Chenge3413162006-01-09 18:33:28 +000065def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
66 [SDNPHasChain, SDNPOptInFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000067
Evan Chenge3413162006-01-09 18:33:28 +000068def X86callseq_start :
69 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
70 [SDNPHasChain]>;
71def X86callseq_end :
72 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
Chris Lattneraf63bb02006-01-24 05:17:12 +000073 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000074
Evan Chenge3413162006-01-09 18:33:28 +000075def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
76 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
Evan Chengaed7c722005-12-17 01:24:02 +000077
Evan Chengfb914c42006-05-20 01:40:16 +000078def X86tailcall: SDNode<"X86ISD::TAILCALL", SDT_X86Call,
Evan Chengfea89c12006-04-27 08:40:39 +000079 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
80
Evan Cheng67f92a72006-01-11 22:15:48 +000081def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
Evan Cheng99256422006-03-07 23:34:23 +000082 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
Evan Cheng67f92a72006-01-11 22:15:48 +000083def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
Evan Cheng99256422006-03-07 23:34:23 +000084 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
Evan Cheng67f92a72006-01-11 22:15:48 +000085
Evan Chenge3413162006-01-09 18:33:28 +000086def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc,
87 [SDNPHasChain, SDNPOutFlag]>;
Evan Chengd90eb7f2006-01-05 00:27:02 +000088
Evan Cheng71fb8342006-02-25 10:02:21 +000089def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
90
Evan Chengaed7c722005-12-17 01:24:02 +000091//===----------------------------------------------------------------------===//
92// X86 Operand Definitions.
93//
94
Chris Lattner66fa1dc2004-08-11 02:25:00 +000095// *mem - Operand definitions for the funky X86 addressing mode operands.
96//
Evan Chengaf78ef52006-05-17 21:21:41 +000097class X86MemOperand<string printMethod> : Operand<iPTR> {
Nate Begeman391c5d22005-11-30 18:54:35 +000098 let PrintMethod = printMethod;
Chris Lattner6adaf792005-11-19 07:01:30 +000099 let NumMIOperands = 4;
Evan Cheng069287d2006-05-16 07:21:53 +0000100 let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
Chris Lattner66fa1dc2004-08-11 02:25:00 +0000101}
Nate Begeman391c5d22005-11-30 18:54:35 +0000102
Chris Lattner45432512005-12-17 19:47:05 +0000103def i8mem : X86MemOperand<"printi8mem">;
104def i16mem : X86MemOperand<"printi16mem">;
105def i32mem : X86MemOperand<"printi32mem">;
106def i64mem : X86MemOperand<"printi64mem">;
Evan Cheng470a6ad2006-02-22 02:26:30 +0000107def i128mem : X86MemOperand<"printi128mem">;
Chris Lattner45432512005-12-17 19:47:05 +0000108def f32mem : X86MemOperand<"printf32mem">;
109def f64mem : X86MemOperand<"printf64mem">;
Evan Cheng223547a2006-01-31 22:28:30 +0000110def f128mem : X86MemOperand<"printf128mem">;
Nate Begeman391c5d22005-11-30 18:54:35 +0000111
Nate Begeman16b04f32005-07-15 00:38:55 +0000112def SSECC : Operand<i8> {
113 let PrintMethod = "printSSECC";
114}
Chris Lattner66fa1dc2004-08-11 02:25:00 +0000115
Evan Cheng7ccced62006-02-18 00:15:05 +0000116def piclabel: Operand<i32> {
117 let PrintMethod = "printPICLabel";
118}
119
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000120// A couple of more descriptive operand definitions.
121// 16-bits but only 8 bits are significant.
122def i16i8imm : Operand<i16>;
123// 32-bits but only 8 bits are significant.
124def i32i8imm : Operand<i32>;
125
Evan Chengd35b8c12005-12-04 08:19:43 +0000126// Branch targets have OtherVT type.
127def brtarget : Operand<OtherVT>;
128
Evan Chengaed7c722005-12-17 01:24:02 +0000129//===----------------------------------------------------------------------===//
130// X86 Complex Pattern Definitions.
131//
132
Evan Chengec693f72005-12-08 02:01:35 +0000133// Define X86 specific addressing mode.
Evan Chengaf78ef52006-05-17 21:21:41 +0000134def addr : ComplexPattern<iPTR, 4, "SelectAddr", []>;
135def leaaddr : ComplexPattern<iPTR, 4, "SelectLEAAddr",
Evan Cheng71fb8342006-02-25 10:02:21 +0000136 [add, mul, shl, frameindex]>;
Evan Chengec693f72005-12-08 02:01:35 +0000137
Evan Chengaed7c722005-12-17 01:24:02 +0000138//===----------------------------------------------------------------------===//
139// X86 Instruction Format Definitions.
140//
141
Chris Lattner1cca5e32003-08-03 21:54:21 +0000142// Format specifies the encoding used by the instruction. This is part of the
143// ad-hoc solution used to emit machine instruction encodings by our machine
144// code emitter.
Evan Cheng3c55c542006-02-01 06:13:50 +0000145class Format<bits<6> val> {
146 bits<6> Value = val;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000147}
148
149def Pseudo : Format<0>; def RawFrm : Format<1>;
150def AddRegFrm : Format<2>; def MRMDestReg : Format<3>;
151def MRMDestMem : Format<4>; def MRMSrcReg : Format<5>;
152def MRMSrcMem : Format<6>;
Alkis Evlogimenos169584e2004-02-27 18:55:12 +0000153def MRM0r : Format<16>; def MRM1r : Format<17>; def MRM2r : Format<18>;
154def MRM3r : Format<19>; def MRM4r : Format<20>; def MRM5r : Format<21>;
155def MRM6r : Format<22>; def MRM7r : Format<23>;
156def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>;
157def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>;
158def MRM6m : Format<30>; def MRM7m : Format<31>;
Evan Cheng3c55c542006-02-01 06:13:50 +0000159def MRMInitReg : Format<32>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000160
Evan Chengaed7c722005-12-17 01:24:02 +0000161//===----------------------------------------------------------------------===//
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000162// X86 Instruction Predicate Definitions.
Evan Chengffcb95b2006-02-21 19:13:53 +0000163def HasMMX : Predicate<"Subtarget->hasMMX()">;
Chris Lattner259e97c2006-01-31 19:43:35 +0000164def HasSSE1 : Predicate<"Subtarget->hasSSE1()">;
Evan Cheng559806f2006-01-27 08:10:46 +0000165def HasSSE2 : Predicate<"Subtarget->hasSSE2()">;
166def HasSSE3 : Predicate<"Subtarget->hasSSE3()">;
167def FPStack : Predicate<"!Subtarget->hasSSE2()">;
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000168
169//===----------------------------------------------------------------------===//
Evan Chengaed7c722005-12-17 01:24:02 +0000170// X86 specific pattern fragments.
171//
172
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000173// ImmType - This specifies the immediate type used by an instruction. This is
Chris Lattner1cca5e32003-08-03 21:54:21 +0000174// part of the ad-hoc solution used to emit machine instruction encodings by our
175// machine code emitter.
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000176class ImmType<bits<2> val> {
177 bits<2> Value = val;
178}
179def NoImm : ImmType<0>;
180def Imm8 : ImmType<1>;
181def Imm16 : ImmType<2>;
182def Imm32 : ImmType<3>;
183
Chris Lattner1cca5e32003-08-03 21:54:21 +0000184// FPFormat - This specifies what form this FP instruction has. This is used by
185// the Floating-Point stackifier pass.
186class FPFormat<bits<3> val> {
187 bits<3> Value = val;
188}
189def NotFP : FPFormat<0>;
190def ZeroArgFP : FPFormat<1>;
191def OneArgFP : FPFormat<2>;
192def OneArgFPRW : FPFormat<3>;
193def TwoArgFP : FPFormat<4>;
Chris Lattnerab8decc2004-06-11 04:41:24 +0000194def CompareFP : FPFormat<5>;
195def CondMovFP : FPFormat<6>;
196def SpecialFP : FPFormat<7>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000197
198
Chris Lattner3a173df2004-10-03 20:35:00 +0000199class X86Inst<bits<8> opcod, Format f, ImmType i, dag ops, string AsmStr>
200 : Instruction {
Chris Lattnerc8f45872003-08-04 04:59:56 +0000201 let Namespace = "X86";
Chris Lattner1cca5e32003-08-03 21:54:21 +0000202
Chris Lattner1cca5e32003-08-03 21:54:21 +0000203 bits<8> Opcode = opcod;
204 Format Form = f;
Evan Cheng3c55c542006-02-01 06:13:50 +0000205 bits<6> FormBits = Form.Value;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000206 ImmType ImmT = i;
207 bits<2> ImmTypeBits = ImmT.Value;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000208
Chris Lattnerc96bb812004-08-11 07:12:04 +0000209 dag OperandList = ops;
210 string AsmString = AsmStr;
211
John Criswell4ffff9e2004-04-08 20:31:47 +0000212 //
Chris Lattner1cca5e32003-08-03 21:54:21 +0000213 // Attributes specific to X86 instructions...
John Criswell4ffff9e2004-04-08 20:31:47 +0000214 //
Chris Lattner1cca5e32003-08-03 21:54:21 +0000215 bit hasOpSizePrefix = 0; // Does this inst have a 0x66 prefix?
John Criswell4ffff9e2004-04-08 20:31:47 +0000216
Chris Lattner1cca5e32003-08-03 21:54:21 +0000217 bits<4> Prefix = 0; // Which prefix byte does this inst have?
218 FPFormat FPForm; // What flavor of FP instruction is this?
219 bits<3> FPFormBits = 0;
220}
221
222class Imp<list<Register> uses, list<Register> defs> {
223 list<Register> Uses = uses;
224 list<Register> Defs = defs;
225}
226
227
228// Prefix byte classes which are used to indicate to the ad-hoc machine code
229// emitter that various prefix bytes are required.
230class OpSize { bit hasOpSizePrefix = 1; }
231class TB { bits<4> Prefix = 1; }
Chris Lattner915e5e52004-02-12 17:53:22 +0000232class REP { bits<4> Prefix = 2; }
233class D8 { bits<4> Prefix = 3; }
234class D9 { bits<4> Prefix = 4; }
235class DA { bits<4> Prefix = 5; }
236class DB { bits<4> Prefix = 6; }
237class DC { bits<4> Prefix = 7; }
238class DD { bits<4> Prefix = 8; }
239class DE { bits<4> Prefix = 9; }
240class DF { bits<4> Prefix = 10; }
Nate Begemanf1702ac2005-06-27 21:20:31 +0000241class XD { bits<4> Prefix = 11; }
242class XS { bits<4> Prefix = 12; }
Chris Lattner1cca5e32003-08-03 21:54:21 +0000243
244
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000245//===----------------------------------------------------------------------===//
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000246// Pattern fragments...
247//
Evan Chengd9558e02006-01-06 00:43:03 +0000248
249// X86 specific condition code. These correspond to CondCode in
250// X86ISelLowering.h. They must be kept in synch.
251def X86_COND_A : PatLeaf<(i8 0)>;
252def X86_COND_AE : PatLeaf<(i8 1)>;
253def X86_COND_B : PatLeaf<(i8 2)>;
254def X86_COND_BE : PatLeaf<(i8 3)>;
255def X86_COND_E : PatLeaf<(i8 4)>;
256def X86_COND_G : PatLeaf<(i8 5)>;
257def X86_COND_GE : PatLeaf<(i8 6)>;
258def X86_COND_L : PatLeaf<(i8 7)>;
259def X86_COND_LE : PatLeaf<(i8 8)>;
260def X86_COND_NE : PatLeaf<(i8 9)>;
261def X86_COND_NO : PatLeaf<(i8 10)>;
262def X86_COND_NP : PatLeaf<(i8 11)>;
263def X86_COND_NS : PatLeaf<(i8 12)>;
264def X86_COND_O : PatLeaf<(i8 13)>;
265def X86_COND_P : PatLeaf<(i8 14)>;
266def X86_COND_S : PatLeaf<(i8 15)>;
267
Evan Cheng9b6b6422005-12-13 00:14:11 +0000268def i16immSExt8 : PatLeaf<(i16 imm), [{
269 // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
Evan Chengb3558542005-12-13 00:01:09 +0000270 // sign extended field.
Evan Cheng09e3c802006-05-19 18:40:54 +0000271 return (int16_t)N->getValue() == (int8_t)N->getValue();
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000272}]>;
273
Evan Cheng9b6b6422005-12-13 00:14:11 +0000274def i32immSExt8 : PatLeaf<(i32 imm), [{
275 // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
Evan Chengb3558542005-12-13 00:01:09 +0000276 // sign extended field.
Evan Cheng09e3c802006-05-19 18:40:54 +0000277 return (int32_t)N->getValue() == (int8_t)N->getValue();
Evan Chengb3558542005-12-13 00:01:09 +0000278}]>;
279
Evan Cheng9b6b6422005-12-13 00:14:11 +0000280def i16immZExt8 : PatLeaf<(i16 imm), [{
281 // i16immZExt8 predicate - True if the 16-bit immediate fits in a 8-bit zero
Evan Chengb3558542005-12-13 00:01:09 +0000282 // extended field.
Evan Cheng09e3c802006-05-19 18:40:54 +0000283 return (uint16_t)N->getValue() == (uint8_t)N->getValue();
Chris Lattner3d36a9f2005-12-05 02:40:25 +0000284}]>;
285
Evan Cheng605c4152005-12-13 01:57:51 +0000286// Helper fragments for loads.
Evan Cheng09e3c802006-05-19 18:40:54 +0000287def loadiPTR : PatFrag<(ops node:$ptr), (iPTR (load node:$ptr))>;
288
Evan Cheng7a7e8372005-12-14 02:22:27 +0000289def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>;
290def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>;
291def loadi32 : PatFrag<(ops node:$ptr), (i32 (load node:$ptr))>;
Evan Cheng11e15b32006-04-03 20:53:28 +0000292def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>;
Evan Cheng06a8aa12006-03-17 19:55:52 +0000293
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000294def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>;
295def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>;
Evan Cheng7a7e8372005-12-14 02:22:27 +0000296
297def sextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (sextload node:$ptr, i1))>;
298def sextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i1))>;
299def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextload node:$ptr, i8))>;
300def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i8))>;
301def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i16))>;
302
Evan Chenge5d93432006-01-17 07:02:46 +0000303def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextload node:$ptr, i1))>;
Evan Cheng7a7e8372005-12-14 02:22:27 +0000304def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextload node:$ptr, i1))>;
305def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i1))>;
306def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextload node:$ptr, i8))>;
307def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i8))>;
308def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i16))>;
309
Evan Cheng38bcbaf2005-12-23 07:31:11 +0000310def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extload node:$ptr, i1))>;
Evan Cheng47137242006-05-05 08:23:07 +0000311def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extload node:$ptr, i1))>;
312def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extload node:$ptr, i1))>;
313def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extload node:$ptr, i8))>;
314def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extload node:$ptr, i8))>;
315def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extload node:$ptr, i16))>;
Evan Cheng747a90d2006-02-21 02:24:38 +0000316
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000317//===----------------------------------------------------------------------===//
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000318// Instruction templates...
319
Evan Chengf0701842005-11-29 19:38:52 +0000320class I<bits<8> o, Format f, dag ops, string asm, list<dag> pattern>
321 : X86Inst<o, f, NoImm, ops, asm> {
322 let Pattern = pattern;
323}
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000324class Ii8 <bits<8> o, Format f, dag ops, string asm, list<dag> pattern>
325 : X86Inst<o, f, Imm8 , ops, asm> {
326 let Pattern = pattern;
327}
Chris Lattner78432fe2005-11-17 02:01:55 +0000328class Ii16<bits<8> o, Format f, dag ops, string asm, list<dag> pattern>
329 : X86Inst<o, f, Imm16, ops, asm> {
330 let Pattern = pattern;
331}
Chris Lattner7a125372005-11-16 22:59:19 +0000332class Ii32<bits<8> o, Format f, dag ops, string asm, list<dag> pattern>
333 : X86Inst<o, f, Imm32, ops, asm> {
334 let Pattern = pattern;
335}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000336
Chris Lattner1cca5e32003-08-03 21:54:21 +0000337//===----------------------------------------------------------------------===//
338// Instruction list...
339//
340
Evan Chengd90eb7f2006-01-05 00:27:02 +0000341def ADJCALLSTACKDOWN : I<0, Pseudo, (ops i32imm:$amt), "#ADJCALLSTACKDOWN",
Evan Chenge3413162006-01-09 18:33:28 +0000342 [(X86callseq_start imm:$amt)]>;
Chris Lattner43ef1312005-09-14 21:10:24 +0000343def ADJCALLSTACKUP : I<0, Pseudo, (ops i32imm:$amt1, i32imm:$amt2),
Evan Chengd90eb7f2006-01-05 00:27:02 +0000344 "#ADJCALLSTACKUP",
Evan Chenge3413162006-01-09 18:33:28 +0000345 [(X86callseq_end imm:$amt1, imm:$amt2)]>;
Evan Chengf0701842005-11-29 19:38:52 +0000346def IMPLICIT_USE : I<0, Pseudo, (ops variable_ops), "#IMPLICIT_USE", []>;
347def IMPLICIT_DEF : I<0, Pseudo, (ops variable_ops), "#IMPLICIT_DEF", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000348def IMPLICIT_DEF_GR8 : I<0, Pseudo, (ops GR8:$dst),
Evan Cheng510e4782006-01-09 23:10:28 +0000349 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000350 [(set GR8:$dst, (undef))]>;
351def IMPLICIT_DEF_GR16 : I<0, Pseudo, (ops GR16:$dst),
Evan Cheng510e4782006-01-09 23:10:28 +0000352 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000353 [(set GR16:$dst, (undef))]>;
354def IMPLICIT_DEF_GR32 : I<0, Pseudo, (ops GR32:$dst),
Evan Cheng510e4782006-01-09 23:10:28 +0000355 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000356 [(set GR32:$dst, (undef))]>;
Evan Cheng4a460802006-01-11 00:33:36 +0000357
358// Nop
359def NOOP : I<0x90, RawFrm, (ops), "nop", []>;
360
Evan Cheng8f7f7122006-05-05 05:40:20 +0000361// Truncate
Evan Cheng069287d2006-05-16 07:21:53 +0000362def TRUNC_GR32_GR8 : I<0x88, MRMDestReg, (ops GR8:$dst, GR32_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +0000363 "mov{b} {${src:trunc8}, $dst|$dst, ${src:trunc8}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000364def TRUNC_GR16_GR8 : I<0x88, MRMDestReg, (ops GR8:$dst, GR16_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +0000365 "mov{b} {${src:trunc8}, $dst|$dst, ${src:trunc8}}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000366def TRUNC_GR32_GR16 : I<0x89, MRMDestReg, (ops GR16:$dst, GR32:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +0000367 "mov{w} {${src:trunc16}, $dst|$dst, ${src:trunc16}}",
Evan Cheng069287d2006-05-16 07:21:53 +0000368 [(set GR16:$dst, (trunc GR32:$src))]>;
Evan Cheng8f7f7122006-05-05 05:40:20 +0000369
Chris Lattner1cca5e32003-08-03 21:54:21 +0000370//===----------------------------------------------------------------------===//
371// Control Flow Instructions...
372//
373
Chris Lattner1be48112005-05-13 17:56:48 +0000374// Return instructions.
Evan Cheng2b4ea792005-12-26 09:11:45 +0000375let isTerminator = 1, isReturn = 1, isBarrier = 1,
376 hasCtrlDep = 1, noResults = 1 in {
Evan Chenge3413162006-01-09 18:33:28 +0000377 def RET : I<0xC3, RawFrm, (ops), "ret", [(X86retflag 0)]>;
378 def RETI : Ii16<0xC2, RawFrm, (ops i16imm:$amt), "ret $amt",
379 [(X86retflag imm:$amt)]>;
Evan Cheng171049d2005-12-23 22:14:32 +0000380}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000381
382// All branches are RawFrm, Void, Branch, and Terminators
Evan Cheng2b4ea792005-12-26 09:11:45 +0000383let isBranch = 1, isTerminator = 1, noResults = 1 in
Evan Chengd35b8c12005-12-04 08:19:43 +0000384 class IBr<bits<8> opcode, dag ops, string asm, list<dag> pattern> :
385 I<opcode, RawFrm, ops, asm, pattern>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000386
Nate Begeman37efe672006-04-22 18:53:45 +0000387// Indirect branches
Chris Lattner62cce392004-07-31 02:10:53 +0000388let isBarrier = 1 in
Evan Chengd35b8c12005-12-04 08:19:43 +0000389 def JMP : IBr<0xE9, (ops brtarget:$dst), "jmp $dst", [(br bb:$dst)]>;
Evan Cheng898101c2005-12-19 23:12:38 +0000390
Nate Begeman37efe672006-04-22 18:53:45 +0000391let isBranch = 1, isTerminator = 1, noResults = 1, isBarrier = 1 in {
Evan Cheng069287d2006-05-16 07:21:53 +0000392 def JMP32r : I<0xFF, MRM4r, (ops GR32:$dst), "jmp{l} {*}$dst",
393 [(brind GR32:$dst)]>;
Nate Begeman37efe672006-04-22 18:53:45 +0000394 def JMP32m : I<0xFF, MRM4m, (ops i32mem:$dst), "jmp{l} {*}$dst",
Evan Cheng09e3c802006-05-19 18:40:54 +0000395 [(brind (loadiPTR addr:$dst))]>;
Nate Begeman37efe672006-04-22 18:53:45 +0000396}
397
398// Conditional branches
Evan Cheng898101c2005-12-19 23:12:38 +0000399def JE : IBr<0x84, (ops brtarget:$dst), "je $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000400 [(X86brcond bb:$dst, X86_COND_E)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000401def JNE : IBr<0x85, (ops brtarget:$dst), "jne $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000402 [(X86brcond bb:$dst, X86_COND_NE)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000403def JL : IBr<0x8C, (ops brtarget:$dst), "jl $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000404 [(X86brcond bb:$dst, X86_COND_L)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000405def JLE : IBr<0x8E, (ops brtarget:$dst), "jle $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000406 [(X86brcond bb:$dst, X86_COND_LE)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000407def JG : IBr<0x8F, (ops brtarget:$dst), "jg $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000408 [(X86brcond bb:$dst, X86_COND_G)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000409def JGE : IBr<0x8D, (ops brtarget:$dst), "jge $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000410 [(X86brcond bb:$dst, X86_COND_GE)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000411
Evan Chengd35b8c12005-12-04 08:19:43 +0000412def JB : IBr<0x82, (ops brtarget:$dst), "jb $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000413 [(X86brcond bb:$dst, X86_COND_B)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000414def JBE : IBr<0x86, (ops brtarget:$dst), "jbe $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000415 [(X86brcond bb:$dst, X86_COND_BE)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000416def JA : IBr<0x87, (ops brtarget:$dst), "ja $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000417 [(X86brcond bb:$dst, X86_COND_A)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000418def JAE : IBr<0x83, (ops brtarget:$dst), "jae $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000419 [(X86brcond bb:$dst, X86_COND_AE)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000420
Evan Chengd9558e02006-01-06 00:43:03 +0000421def JS : IBr<0x88, (ops brtarget:$dst), "js $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000422 [(X86brcond bb:$dst, X86_COND_S)]>, TB;
Evan Chengd9558e02006-01-06 00:43:03 +0000423def JNS : IBr<0x89, (ops brtarget:$dst), "jns $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000424 [(X86brcond bb:$dst, X86_COND_NS)]>, TB;
Evan Chengd9558e02006-01-06 00:43:03 +0000425def JP : IBr<0x8A, (ops brtarget:$dst), "jp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000426 [(X86brcond bb:$dst, X86_COND_P)]>, TB;
Evan Chengd9558e02006-01-06 00:43:03 +0000427def JNP : IBr<0x8B, (ops brtarget:$dst), "jnp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000428 [(X86brcond bb:$dst, X86_COND_NP)]>, TB;
Evan Cheng4a460802006-01-11 00:33:36 +0000429def JO : IBr<0x80, (ops brtarget:$dst), "jo $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000430 [(X86brcond bb:$dst, X86_COND_O)]>, TB;
Evan Cheng4a460802006-01-11 00:33:36 +0000431def JNO : IBr<0x81, (ops brtarget:$dst), "jno $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000432 [(X86brcond bb:$dst, X86_COND_NO)]>, TB;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000433
434//===----------------------------------------------------------------------===//
435// Call Instructions...
436//
Evan Chenge3413162006-01-09 18:33:28 +0000437let isCall = 1, noResults = 1 in
Chris Lattner1cca5e32003-08-03 21:54:21 +0000438 // All calls clobber the non-callee saved registers...
Nate Begemanf63be7d2005-07-06 18:59:04 +0000439 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
Nate Begeman16b04f32005-07-15 00:38:55 +0000440 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7] in {
Chris Lattnera3b8c572006-02-06 23:41:19 +0000441 def CALLpcrel32 : I<0xE8, RawFrm, (ops i32imm:$dst), "call ${dst:call}",
Evan Chengd90eb7f2006-01-05 00:27:02 +0000442 []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000443 def CALL32r : I<0xFF, MRM2r, (ops GR32:$dst), "call {*}$dst",
444 [(X86call GR32:$dst)]>;
Evan Chengfb914c42006-05-20 01:40:16 +0000445 def CALL32m : I<0xFF, MRM2m, (ops i32mem:$dst), "call {*}$dst", []>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000446 }
447
Chris Lattner1e9448b2005-05-15 03:10:37 +0000448// Tail call stuff.
Evan Cheng2b4ea792005-12-26 09:11:45 +0000449let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in
Chris Lattnera3b8c572006-02-06 23:41:19 +0000450 def TAILJMPd : IBr<0xE9, (ops i32imm:$dst), "jmp ${dst:call} # TAIL CALL", []>;
Evan Cheng2b4ea792005-12-26 09:11:45 +0000451let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in
Evan Cheng069287d2006-05-16 07:21:53 +0000452 def TAILJMPr : I<0xFF, MRM4r, (ops GR32:$dst), "jmp {*}$dst # TAIL CALL", []>;
Evan Cheng2b4ea792005-12-26 09:11:45 +0000453let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in
Evan Chengf0701842005-11-29 19:38:52 +0000454 def TAILJMPm : I<0xFF, MRM4m, (ops i32mem:$dst),
455 "jmp {*}$dst # TAIL CALL", []>;
Chris Lattner1e9448b2005-05-15 03:10:37 +0000456
457// ADJSTACKPTRri - This is a standard ADD32ri instruction, identical in every
458// way, except that it is marked as being a terminator. This causes the epilog
459// inserter to insert reloads of callee saved registers BEFORE this. We need
460// this until we have a more accurate way of tracking where the stack pointer is
461// within a function.
462let isTerminator = 1, isTwoAddress = 1 in
Evan Cheng069287d2006-05-16 07:21:53 +0000463 def ADJSTACKPTRri : Ii32<0x81, MRM0r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +0000464 "add{l} {$src2, $dst|$dst, $src2}", []>;
Chris Lattner1e9448b2005-05-15 03:10:37 +0000465
Chris Lattner1cca5e32003-08-03 21:54:21 +0000466//===----------------------------------------------------------------------===//
467// Miscellaneous Instructions...
468//
Chris Lattner30bf2d82004-08-10 20:17:41 +0000469def LEAVE : I<0xC9, RawFrm,
Evan Chengf0701842005-11-29 19:38:52 +0000470 (ops), "leave", []>, Imp<[EBP,ESP],[EBP,ESP]>;
Chris Lattner30bf2d82004-08-10 20:17:41 +0000471def POP32r : I<0x58, AddRegFrm,
Evan Cheng069287d2006-05-16 07:21:53 +0000472 (ops GR32:$reg), "pop{l} $reg", []>, Imp<[ESP],[ESP]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000473
Evan Cheng7ccced62006-02-18 00:15:05 +0000474def MovePCtoStack : I<0, Pseudo, (ops piclabel:$label),
475 "call $label", []>;
476
Evan Cheng069287d2006-05-16 07:21:53 +0000477let isTwoAddress = 1 in // GR32 = bswap GR32
Chris Lattner30bf2d82004-08-10 20:17:41 +0000478 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Cheng069287d2006-05-16 07:21:53 +0000479 (ops GR32:$dst, GR32:$src),
Nate Begemand88fc032006-01-14 03:14:10 +0000480 "bswap{l} $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000481 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000482
Evan Cheng069287d2006-05-16 07:21:53 +0000483def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
484 (ops GR8:$src1, GR8:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000485 "xchg{b} {$src2|$src1}, {$src1|$src2}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000486def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
487 (ops GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000488 "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000489def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
490 (ops GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000491 "xchg{l} {$src2|$src1}, {$src1|$src2}", []>;
Chris Lattnerfc752712004-08-01 09:52:59 +0000492
Chris Lattner3a173df2004-10-03 20:35:00 +0000493def XCHG8mr : I<0x86, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000494 (ops i8mem:$src1, GR8:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000495 "xchg{b} {$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000496def XCHG16mr : I<0x87, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000497 (ops i16mem:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000498 "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000499def XCHG32mr : I<0x87, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000500 (ops i32mem:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000501 "xchg{l} {$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000502def XCHG8rm : I<0x86, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000503 (ops GR8:$src1, i8mem:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000504 "xchg{b} {$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000505def XCHG16rm : I<0x87, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000506 (ops GR16:$src1, i16mem:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000507 "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000508def XCHG32rm : I<0x87, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000509 (ops GR32:$src1, i32mem:$src2),
Evan Chengf0701842005-11-29 19:38:52 +0000510 "xchg{l} {$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000511
Chris Lattner3a173df2004-10-03 20:35:00 +0000512def LEA16r : I<0x8D, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000513 (ops GR16:$dst, i32mem:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000514 "lea{w} {$src|$dst}, {$dst|$src}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000515def LEA32r : I<0x8D, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +0000516 (ops GR32:$dst, i32mem:$src),
Evan Chengec693f72005-12-08 02:01:35 +0000517 "lea{l} {$src|$dst}, {$dst|$src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000518 [(set GR32:$dst, leaaddr:$src)]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000519
Evan Cheng67f92a72006-01-11 22:15:48 +0000520def REP_MOVSB : I<0xA4, RawFrm, (ops), "{rep;movsb|rep movsb}",
521 [(X86rep_movs i8)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000522 Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP;
Evan Cheng67f92a72006-01-11 22:15:48 +0000523def REP_MOVSW : I<0xA5, RawFrm, (ops), "{rep;movsw|rep movsw}",
524 [(X86rep_movs i16)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000525 Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP, OpSize;
Evan Cheng67f92a72006-01-11 22:15:48 +0000526def REP_MOVSD : I<0xA5, RawFrm, (ops), "{rep;movsd|rep movsd}",
527 [(X86rep_movs i32)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000528 Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP;
Chris Lattner915e5e52004-02-12 17:53:22 +0000529
Evan Cheng67f92a72006-01-11 22:15:48 +0000530def REP_STOSB : I<0xAA, RawFrm, (ops), "{rep;stosb|rep stosb}",
531 [(X86rep_stos i8)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000532 Imp<[AL,ECX,EDI], [ECX,EDI]>, REP;
Evan Cheng67f92a72006-01-11 22:15:48 +0000533def REP_STOSW : I<0xAB, RawFrm, (ops), "{rep;stosw|rep stosw}",
534 [(X86rep_stos i16)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000535 Imp<[AX,ECX,EDI], [ECX,EDI]>, REP, OpSize;
Evan Cheng67f92a72006-01-11 22:15:48 +0000536def REP_STOSD : I<0xAB, RawFrm, (ops), "{rep;stosl|rep stosd}",
537 [(X86rep_stos i32)]>,
Chris Lattner30bf2d82004-08-10 20:17:41 +0000538 Imp<[EAX,ECX,EDI], [ECX,EDI]>, REP;
539
Chris Lattnerb89abef2004-02-14 04:45:37 +0000540
Chris Lattner1cca5e32003-08-03 21:54:21 +0000541//===----------------------------------------------------------------------===//
John Criswell4ffff9e2004-04-08 20:31:47 +0000542// Input/Output Instructions...
543//
Chris Lattner30bf2d82004-08-10 20:17:41 +0000544def IN8rr : I<0xEC, RawFrm, (ops),
Evan Chenga5386b02005-12-20 07:38:38 +0000545 "in{b} {%dx, %al|%AL, %DX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000546 []>, Imp<[DX], [AL]>;
Chris Lattner30bf2d82004-08-10 20:17:41 +0000547def IN16rr : I<0xED, RawFrm, (ops),
Evan Chenga5386b02005-12-20 07:38:38 +0000548 "in{w} {%dx, %ax|%AX, %DX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000549 []>, Imp<[DX], [AX]>, OpSize;
Chris Lattner30bf2d82004-08-10 20:17:41 +0000550def IN32rr : I<0xED, RawFrm, (ops),
Evan Chenga5386b02005-12-20 07:38:38 +0000551 "in{l} {%dx, %eax|%EAX, %DX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000552 []>, Imp<[DX],[EAX]>;
John Criswell4ffff9e2004-04-08 20:31:47 +0000553
Evan Chenga5386b02005-12-20 07:38:38 +0000554def IN8ri : Ii8<0xE4, RawFrm, (ops i16i8imm:$port),
555 "in{b} {$port, %al|%AL, $port}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000556 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000557 Imp<[], [AL]>;
558def IN16ri : Ii8<0xE5, RawFrm, (ops i16i8imm:$port),
559 "in{w} {$port, %ax|%AX, $port}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000560 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000561 Imp<[], [AX]>, OpSize;
562def IN32ri : Ii8<0xE5, RawFrm, (ops i16i8imm:$port),
563 "in{l} {$port, %eax|%EAX, $port}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000564 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000565 Imp<[],[EAX]>;
Chris Lattner440bbc22004-04-13 17:19:31 +0000566
Evan Cheng8d202232005-12-05 23:09:43 +0000567def OUT8rr : I<0xEE, RawFrm, (ops),
568 "out{b} {%al, %dx|%DX, %AL}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000569 []>, Imp<[DX, AL], []>;
Evan Cheng8d202232005-12-05 23:09:43 +0000570def OUT16rr : I<0xEF, RawFrm, (ops),
571 "out{w} {%ax, %dx|%DX, %AX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000572 []>, Imp<[DX, AX], []>, OpSize;
Evan Cheng8d202232005-12-05 23:09:43 +0000573def OUT32rr : I<0xEF, RawFrm, (ops),
574 "out{l} {%eax, %dx|%DX, %EAX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000575 []>, Imp<[DX, EAX], []>;
Chris Lattnerffff7082004-08-01 07:44:35 +0000576
Evan Cheng8d202232005-12-05 23:09:43 +0000577def OUT8ir : Ii8<0xE6, RawFrm, (ops i16i8imm:$port),
578 "out{b} {%al, $port|$port, %AL}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000579 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000580 Imp<[AL], []>;
Evan Cheng8d202232005-12-05 23:09:43 +0000581def OUT16ir : Ii8<0xE7, RawFrm, (ops i16i8imm:$port),
582 "out{w} {%ax, $port|$port, %AX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000583 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000584 Imp<[AX], []>, OpSize;
Evan Cheng8d202232005-12-05 23:09:43 +0000585def OUT32ir : Ii8<0xE7, RawFrm, (ops i16i8imm:$port),
586 "out{l} {%eax, $port|$port, %EAX}",
Chris Lattner41edaa02006-03-03 00:19:58 +0000587 []>,
Evan Chenga5386b02005-12-20 07:38:38 +0000588 Imp<[EAX], []>;
John Criswell4ffff9e2004-04-08 20:31:47 +0000589
590//===----------------------------------------------------------------------===//
Chris Lattner1cca5e32003-08-03 21:54:21 +0000591// Move Instructions...
592//
Evan Cheng069287d2006-05-16 07:21:53 +0000593def MOV8rr : I<0x88, MRMDestReg, (ops GR8 :$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +0000594 "mov{b} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000595def MOV16rr : I<0x89, MRMDestReg, (ops GR16:$dst, GR16:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000596 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000597def MOV32rr : I<0x89, MRMDestReg, (ops GR32:$dst, GR32:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000598 "mov{l} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000599def MOV8ri : Ii8 <0xB0, AddRegFrm, (ops GR8 :$dst, i8imm :$src),
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000600 "mov{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000601 [(set GR8:$dst, imm:$src)]>;
602def MOV16ri : Ii16<0xB8, AddRegFrm, (ops GR16:$dst, i16imm:$src),
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000603 "mov{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000604 [(set GR16:$dst, imm:$src)]>, OpSize;
605def MOV32ri : Ii32<0xB8, AddRegFrm, (ops GR32:$dst, i32imm:$src),
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000606 "mov{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000607 [(set GR32:$dst, imm:$src)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000608def MOV8mi : Ii8 <0xC6, MRM0m, (ops i8mem :$dst, i8imm :$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000609 "mov{b} {$src, $dst|$dst, $src}",
610 [(store (i8 imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000611def MOV16mi : Ii16<0xC7, MRM0m, (ops i16mem:$dst, i16imm:$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000612 "mov{w} {$src, $dst|$dst, $src}",
613 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000614def MOV32mi : Ii32<0xC7, MRM0m, (ops i32mem:$dst, i32imm:$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000615 "mov{l} {$src, $dst|$dst, $src}",
616 [(store (i32 imm:$src), addr:$dst)]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000617
Evan Cheng069287d2006-05-16 07:21:53 +0000618def MOV8rm : I<0x8A, MRMSrcMem, (ops GR8 :$dst, i8mem :$src),
Evan Chengec693f72005-12-08 02:01:35 +0000619 "mov{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000620 [(set GR8:$dst, (load addr:$src))]>;
621def MOV16rm : I<0x8B, MRMSrcMem, (ops GR16:$dst, i16mem:$src),
Evan Chengec693f72005-12-08 02:01:35 +0000622 "mov{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000623 [(set GR16:$dst, (load addr:$src))]>, OpSize;
624def MOV32rm : I<0x8B, MRMSrcMem, (ops GR32:$dst, i32mem:$src),
Evan Chengec693f72005-12-08 02:01:35 +0000625 "mov{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000626 [(set GR32:$dst, (load addr:$src))]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000627
Evan Cheng069287d2006-05-16 07:21:53 +0000628def MOV8mr : I<0x88, MRMDestMem, (ops i8mem :$dst, GR8 :$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000629 "mov{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000630 [(store GR8:$src, addr:$dst)]>;
631def MOV16mr : I<0x89, MRMDestMem, (ops i16mem:$dst, GR16:$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000632 "mov{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000633 [(store GR16:$src, addr:$dst)]>, OpSize;
634def MOV32mr : I<0x89, MRMDestMem, (ops i32mem:$dst, GR32:$src),
Evan Chengb51a0592005-12-10 00:48:20 +0000635 "mov{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000636 [(store GR32:$src, addr:$dst)]>;
Nate Begemanf1702ac2005-06-27 21:20:31 +0000637
Chris Lattner1cca5e32003-08-03 21:54:21 +0000638//===----------------------------------------------------------------------===//
639// Fixed-Register Multiplication and Division Instructions...
640//
Chris Lattner1cca5e32003-08-03 21:54:21 +0000641
Chris Lattnerc8f45872003-08-04 04:59:56 +0000642// Extra precision multiplication
Evan Cheng069287d2006-05-16 07:21:53 +0000643def MUL8r : I<0xF6, MRM4r, (ops GR8:$src), "mul{b} $src",
Evan Chengcf74a7c2006-01-15 10:05:20 +0000644 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
645 // This probably ought to be moved to a def : Pat<> if the
646 // syntax can be accepted.
Evan Cheng069287d2006-05-16 07:21:53 +0000647 [(set AL, (mul AL, GR8:$src))]>,
648 Imp<[AL],[AX]>; // AL,AH = AL*GR8
649def MUL16r : I<0xF7, MRM4r, (ops GR16:$src), "mul{w} $src", []>,
650 Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*GR16
651def MUL32r : I<0xF7, MRM4r, (ops GR32:$src), "mul{l} $src", []>,
652 Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*GR32
Chris Lattner57a02302004-08-11 04:31:00 +0000653def MUL8m : I<0xF6, MRM4m, (ops i8mem :$src),
Evan Chengcf74a7c2006-01-15 10:05:20 +0000654 "mul{b} $src",
655 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
656 // This probably ought to be moved to a def : Pat<> if the
657 // syntax can be accepted.
658 [(set AL, (mul AL, (loadi8 addr:$src)))]>,
659 Imp<[AL],[AX]>; // AL,AH = AL*[mem8]
Chris Lattner57a02302004-08-11 04:31:00 +0000660def MUL16m : I<0xF7, MRM4m, (ops i16mem:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000661 "mul{w} $src", []>, Imp<[AX],[AX,DX]>,
662 OpSize; // AX,DX = AX*[mem16]
Chris Lattner57a02302004-08-11 04:31:00 +0000663def MUL32m : I<0xF7, MRM4m, (ops i32mem:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000664 "mul{l} $src", []>, Imp<[EAX],[EAX,EDX]>;// EAX,EDX = EAX*[mem32]
Chris Lattner1cca5e32003-08-03 21:54:21 +0000665
Evan Cheng069287d2006-05-16 07:21:53 +0000666def IMUL8r : I<0xF6, MRM5r, (ops GR8:$src), "imul{b} $src", []>,
667 Imp<[AL],[AX]>; // AL,AH = AL*GR8
668def IMUL16r : I<0xF7, MRM5r, (ops GR16:$src), "imul{w} $src", []>,
669 Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*GR16
670def IMUL32r : I<0xF7, MRM5r, (ops GR32:$src), "imul{l} $src", []>,
671 Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*GR32
Chris Lattner1e6a7152005-04-06 04:19:22 +0000672def IMUL8m : I<0xF6, MRM5m, (ops i8mem :$src),
Evan Chengf0701842005-11-29 19:38:52 +0000673 "imul{b} $src", []>, Imp<[AL],[AX]>; // AL,AH = AL*[mem8]
Chris Lattner1e6a7152005-04-06 04:19:22 +0000674def IMUL16m : I<0xF7, MRM5m, (ops i16mem:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000675 "imul{w} $src", []>, Imp<[AX],[AX,DX]>,
676 OpSize; // AX,DX = AX*[mem16]
Chris Lattner1e6a7152005-04-06 04:19:22 +0000677def IMUL32m : I<0xF7, MRM5m, (ops i32mem:$src),
Evan Chengf0701842005-11-29 19:38:52 +0000678 "imul{l} $src", []>,
679 Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*[mem32]
Chris Lattner1e6a7152005-04-06 04:19:22 +0000680
Chris Lattnerc8f45872003-08-04 04:59:56 +0000681// unsigned division/remainder
Evan Cheng069287d2006-05-16 07:21:53 +0000682def DIV8r : I<0xF6, MRM6r, (ops GR8:$src), // AX/r8 = AL,AH
Evan Chengf0701842005-11-29 19:38:52 +0000683 "div{b} $src", []>, Imp<[AX],[AX]>;
Evan Cheng069287d2006-05-16 07:21:53 +0000684def DIV16r : I<0xF7, MRM6r, (ops GR16:$src), // DX:AX/r16 = AX,DX
Evan Chengf0701842005-11-29 19:38:52 +0000685 "div{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000686def DIV32r : I<0xF7, MRM6r, (ops GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Chengf0701842005-11-29 19:38:52 +0000687 "div{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000688def DIV8m : I<0xF6, MRM6m, (ops i8mem:$src), // AX/[mem8] = AL,AH
Evan Chengf0701842005-11-29 19:38:52 +0000689 "div{b} $src", []>, Imp<[AX],[AX]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000690def DIV16m : I<0xF7, MRM6m, (ops i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Chengf0701842005-11-29 19:38:52 +0000691 "div{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000692def DIV32m : I<0xF7, MRM6m, (ops i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Chengf0701842005-11-29 19:38:52 +0000693 "div{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000694
Chris Lattnerfc752712004-08-01 09:52:59 +0000695// Signed division/remainder.
Evan Cheng069287d2006-05-16 07:21:53 +0000696def IDIV8r : I<0xF6, MRM7r, (ops GR8:$src), // AX/r8 = AL,AH
Evan Chengf0701842005-11-29 19:38:52 +0000697 "idiv{b} $src", []>, Imp<[AX],[AX]>;
Evan Cheng069287d2006-05-16 07:21:53 +0000698def IDIV16r: I<0xF7, MRM7r, (ops GR16:$src), // DX:AX/r16 = AX,DX
Evan Chengf0701842005-11-29 19:38:52 +0000699 "idiv{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000700def IDIV32r: I<0xF7, MRM7r, (ops GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Chengf0701842005-11-29 19:38:52 +0000701 "idiv{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000702def IDIV8m : I<0xF6, MRM7m, (ops i8mem:$src), // AX/[mem8] = AL,AH
Evan Chengf0701842005-11-29 19:38:52 +0000703 "idiv{b} $src", []>, Imp<[AX],[AX]>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000704def IDIV16m: I<0xF7, MRM7m, (ops i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Chengf0701842005-11-29 19:38:52 +0000705 "idiv{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000706def IDIV32m: I<0xF7, MRM7m, (ops i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Chengf0701842005-11-29 19:38:52 +0000707 "idiv{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>;
Chris Lattnerc8f45872003-08-04 04:59:56 +0000708
Chris Lattnerfc752712004-08-01 09:52:59 +0000709// Sign-extenders for division.
Chris Lattner3a173df2004-10-03 20:35:00 +0000710def CBW : I<0x98, RawFrm, (ops),
Evan Chengf0701842005-11-29 19:38:52 +0000711 "{cbtw|cbw}", []>, Imp<[AL],[AH]>; // AX = signext(AL)
Chris Lattner3a173df2004-10-03 20:35:00 +0000712def CWD : I<0x99, RawFrm, (ops),
Evan Chengf0701842005-11-29 19:38:52 +0000713 "{cwtd|cwd}", []>, Imp<[AX],[DX]>; // DX:AX = signext(AX)
Chris Lattner3a173df2004-10-03 20:35:00 +0000714def CDQ : I<0x99, RawFrm, (ops),
Evan Chengf0701842005-11-29 19:38:52 +0000715 "{cltd|cdq}", []>, Imp<[EAX],[EDX]>; // EDX:EAX = signext(EAX)
Chris Lattnerfc752712004-08-01 09:52:59 +0000716
Chris Lattner1cca5e32003-08-03 21:54:21 +0000717
Chris Lattner1cca5e32003-08-03 21:54:21 +0000718//===----------------------------------------------------------------------===//
719// Two address Instructions...
720//
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000721let isTwoAddress = 1 in {
Chris Lattner1cca5e32003-08-03 21:54:21 +0000722
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000723// Conditional moves
Evan Cheng069287d2006-05-16 07:21:53 +0000724def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
725 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000726 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000727 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000728 X86_COND_B))]>,
729 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000730def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
731 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000732 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000733 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000734 X86_COND_B))]>,
735 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000736def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
737 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000738 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000739 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000740 X86_COND_B))]>,
741 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000742def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
743 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000744 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000745 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000746 X86_COND_B))]>,
747 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000748
Evan Cheng069287d2006-05-16 07:21:53 +0000749def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
750 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000751 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000752 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000753 X86_COND_AE))]>,
754 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000755def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
756 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000757 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000758 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000759 X86_COND_AE))]>,
760 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000761def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
762 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000763 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000764 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000765 X86_COND_AE))]>,
766 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000767def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
768 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000769 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000770 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000771 X86_COND_AE))]>,
772 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000773
Evan Cheng069287d2006-05-16 07:21:53 +0000774def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
775 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000776 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000777 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000778 X86_COND_E))]>,
779 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000780def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
781 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000782 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000783 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000784 X86_COND_E))]>,
785 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000786def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
787 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000788 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000789 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000790 X86_COND_E))]>,
791 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000792def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
793 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000794 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000795 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000796 X86_COND_E))]>,
797 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000798
Evan Cheng069287d2006-05-16 07:21:53 +0000799def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
800 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000801 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000802 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000803 X86_COND_NE))]>,
804 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000805def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
806 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000807 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000808 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000809 X86_COND_NE))]>,
810 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000811def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
812 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000813 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000814 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000815 X86_COND_NE))]>,
816 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000817def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
818 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000819 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000820 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000821 X86_COND_NE))]>,
822 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000823
Evan Cheng069287d2006-05-16 07:21:53 +0000824def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
825 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000826 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000827 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000828 X86_COND_BE))]>,
829 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000830def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
831 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000832 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000833 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000834 X86_COND_BE))]>,
835 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000836def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
837 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000838 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000839 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000840 X86_COND_BE))]>,
841 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000842def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
843 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000844 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000845 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000846 X86_COND_BE))]>,
847 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000848
Evan Cheng069287d2006-05-16 07:21:53 +0000849def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
850 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000851 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000852 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000853 X86_COND_A))]>,
854 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000855def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
856 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000857 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000858 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000859 X86_COND_A))]>,
860 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000861def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
862 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000863 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000864 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000865 X86_COND_A))]>,
866 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000867def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
868 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000869 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000870 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000871 X86_COND_A))]>,
872 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000873
Evan Cheng069287d2006-05-16 07:21:53 +0000874def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
875 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000876 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000877 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000878 X86_COND_L))]>,
879 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000880def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
881 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000882 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000883 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000884 X86_COND_L))]>,
885 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000886def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
887 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000888 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000889 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000890 X86_COND_L))]>,
891 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000892def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
893 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000894 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000895 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000896 X86_COND_L))]>,
897 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000898
Evan Cheng069287d2006-05-16 07:21:53 +0000899def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
900 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000901 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000902 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000903 X86_COND_GE))]>,
904 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000905def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
906 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000907 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000908 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000909 X86_COND_GE))]>,
910 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000911def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
912 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000913 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000914 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000915 X86_COND_GE))]>,
916 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000917def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
918 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000919 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000920 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000921 X86_COND_GE))]>,
922 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000923
Evan Cheng069287d2006-05-16 07:21:53 +0000924def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
925 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000926 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000927 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000928 X86_COND_LE))]>,
929 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000930def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
931 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000932 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000933 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000934 X86_COND_LE))]>,
935 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000936def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
937 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000938 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000939 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000940 X86_COND_LE))]>,
941 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000942def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
943 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000944 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000945 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000946 X86_COND_LE))]>,
947 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000948
Evan Cheng069287d2006-05-16 07:21:53 +0000949def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
950 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000951 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000952 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000953 X86_COND_G))]>,
954 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000955def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
956 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000957 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000958 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000959 X86_COND_G))]>,
960 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000961def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
962 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000963 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000964 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000965 X86_COND_G))]>,
966 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000967def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
968 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000969 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000970 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000971 X86_COND_G))]>,
972 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000973
Evan Cheng069287d2006-05-16 07:21:53 +0000974def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
975 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000976 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000977 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000978 X86_COND_S))]>,
979 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000980def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
981 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000982 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000983 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000984 X86_COND_S))]>,
985 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000986def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
987 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000988 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000989 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000990 X86_COND_S))]>,
991 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000992def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
993 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000994 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000995 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000996 X86_COND_S))]>,
997 TB;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000998
Evan Cheng069287d2006-05-16 07:21:53 +0000999def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
1000 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001001 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001002 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001003 X86_COND_NS))]>,
1004 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001005def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1006 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001007 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001008 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001009 X86_COND_NS))]>,
1010 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001011def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1012 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001013 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001014 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001015 X86_COND_NS))]>,
1016 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001017def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1018 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001019 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001020 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001021 X86_COND_NS))]>,
1022 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +00001023
Evan Cheng069287d2006-05-16 07:21:53 +00001024def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1025 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001026 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001027 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001028 X86_COND_P))]>,
1029 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001030def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1031 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001032 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001033 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001034 X86_COND_P))]>,
1035 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001036def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1037 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001038 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001039 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001040 X86_COND_P))]>,
1041 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001042def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1043 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001044 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001045 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001046 X86_COND_P))]>,
1047 TB;
Chris Lattner57fbfb52005-01-10 22:09:33 +00001048
Evan Cheng069287d2006-05-16 07:21:53 +00001049def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1050 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001051 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001052 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001053 X86_COND_NP))]>,
1054 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001055def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1056 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001057 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001058 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001059 X86_COND_NP))]>,
1060 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001061def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1062 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001063 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001064 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001065 X86_COND_NP))]>,
1066 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001067def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1068 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001069 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001070 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001071 X86_COND_NP))]>,
1072 TB;
Chris Lattner57fbfb52005-01-10 22:09:33 +00001073
1074
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001075// unary instructions
Evan Cheng069287d2006-05-16 07:21:53 +00001076def NEG8r : I<0xF6, MRM3r, (ops GR8 :$dst, GR8 :$src), "neg{b} $dst",
1077 [(set GR8:$dst, (ineg GR8:$src))]>;
1078def NEG16r : I<0xF7, MRM3r, (ops GR16:$dst, GR16:$src), "neg{w} $dst",
1079 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
1080def NEG32r : I<0xF7, MRM3r, (ops GR32:$dst, GR32:$src), "neg{l} $dst",
1081 [(set GR32:$dst, (ineg GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001082let isTwoAddress = 0 in {
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001083 def NEG8m : I<0xF6, MRM3m, (ops i8mem :$dst), "neg{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001084 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001085 def NEG16m : I<0xF7, MRM3m, (ops i16mem:$dst), "neg{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001086 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001087 def NEG32m : I<0xF7, MRM3m, (ops i32mem:$dst), "neg{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001088 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1089
Chris Lattner57a02302004-08-11 04:31:00 +00001090}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001091
Evan Cheng069287d2006-05-16 07:21:53 +00001092def NOT8r : I<0xF6, MRM2r, (ops GR8 :$dst, GR8 :$src), "not{b} $dst",
1093 [(set GR8:$dst, (not GR8:$src))]>;
1094def NOT16r : I<0xF7, MRM2r, (ops GR16:$dst, GR16:$src), "not{w} $dst",
1095 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
1096def NOT32r : I<0xF7, MRM2r, (ops GR32:$dst, GR32:$src), "not{l} $dst",
1097 [(set GR32:$dst, (not GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001098let isTwoAddress = 0 in {
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001099 def NOT8m : I<0xF6, MRM2m, (ops i8mem :$dst), "not{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001100 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001101 def NOT16m : I<0xF7, MRM2m, (ops i16mem:$dst), "not{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001102 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001103 def NOT32m : I<0xF7, MRM2m, (ops i32mem:$dst), "not{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001104 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001105}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001106
Evan Chengb51a0592005-12-10 00:48:20 +00001107// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng069287d2006-05-16 07:21:53 +00001108def INC8r : I<0xFE, MRM0r, (ops GR8 :$dst, GR8 :$src), "inc{b} $dst",
1109 [(set GR8:$dst, (add GR8:$src, 1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001110let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001111def INC16r : I<0xFF, MRM0r, (ops GR16:$dst, GR16:$src), "inc{w} $dst",
1112 [(set GR16:$dst, (add GR16:$src, 1))]>, OpSize;
1113def INC32r : I<0xFF, MRM0r, (ops GR32:$dst, GR32:$src), "inc{l} $dst",
1114 [(set GR32:$dst, (add GR32:$src, 1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001115}
Chris Lattner57a02302004-08-11 04:31:00 +00001116let isTwoAddress = 0 in {
Evan Cheng6cad2762005-12-13 01:02:47 +00001117 def INC8m : I<0xFE, MRM0m, (ops i8mem :$dst), "inc{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001118 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Evan Cheng6cad2762005-12-13 01:02:47 +00001119 def INC16m : I<0xFF, MRM0m, (ops i16mem:$dst), "inc{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001120 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize;
Evan Cheng6cad2762005-12-13 01:02:47 +00001121 def INC32m : I<0xFF, MRM0m, (ops i32mem:$dst), "inc{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001122 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001123}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001124
Evan Cheng069287d2006-05-16 07:21:53 +00001125def DEC8r : I<0xFE, MRM1r, (ops GR8 :$dst, GR8 :$src), "dec{b} $dst",
1126 [(set GR8:$dst, (add GR8:$src, -1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001127let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001128def DEC16r : I<0xFF, MRM1r, (ops GR16:$dst, GR16:$src), "dec{w} $dst",
1129 [(set GR16:$dst, (add GR16:$src, -1))]>, OpSize;
1130def DEC32r : I<0xFF, MRM1r, (ops GR32:$dst, GR32:$src), "dec{l} $dst",
1131 [(set GR32:$dst, (add GR32:$src, -1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001132}
Chris Lattner57a02302004-08-11 04:31:00 +00001133
1134let isTwoAddress = 0 in {
Evan Cheng6cad2762005-12-13 01:02:47 +00001135 def DEC8m : I<0xFE, MRM1m, (ops i8mem :$dst), "dec{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001136 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Evan Cheng6cad2762005-12-13 01:02:47 +00001137 def DEC16m : I<0xFF, MRM1m, (ops i16mem:$dst), "dec{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001138 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize;
Evan Cheng6cad2762005-12-13 01:02:47 +00001139 def DEC32m : I<0xFF, MRM1m, (ops i32mem:$dst), "dec{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001140 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001141}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001142
1143// Logical operators...
Chris Lattnercc65bee2005-01-02 02:35:46 +00001144let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001145def AND8rr : I<0x20, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001146 (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001147 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001148 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001149def AND16rr : I<0x21, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001150 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001151 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001152 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001153def AND32rr : I<0x21, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001154 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001155 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001156 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001157}
Chris Lattner57a02302004-08-11 04:31:00 +00001158
Chris Lattner3a173df2004-10-03 20:35:00 +00001159def AND8rm : I<0x22, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001160 (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001161 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001162 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001163def AND16rm : I<0x23, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001164 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001165 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001166 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001167def AND32rm : I<0x23, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001168 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001169 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001170 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001171
Chris Lattner3a173df2004-10-03 20:35:00 +00001172def AND8ri : Ii8<0x80, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001173 (ops GR8 :$dst, GR8 :$src1, i8imm :$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001174 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001175 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001176def AND16ri : Ii16<0x81, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001177 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001178 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001179 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001180def AND32ri : Ii32<0x81, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001181 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001182 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001183 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001184def AND16ri8 : Ii8<0x83, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001185 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001186 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001187 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001188 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001189def AND32ri8 : Ii8<0x83, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001190 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001191 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001192 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001193
1194let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001195 def AND8mr : I<0x20, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001196 (ops i8mem :$dst, GR8 :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001197 "and{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001198 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001199 def AND16mr : I<0x21, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001200 (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001201 "and{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001202 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001203 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001204 def AND32mr : I<0x21, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001205 (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001206 "and{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001207 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001208 def AND8mi : Ii8<0x80, MRM4m,
1209 (ops i8mem :$dst, i8imm :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001210 "and{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001211 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001212 def AND16mi : Ii16<0x81, MRM4m,
1213 (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001214 "and{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001215 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001216 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001217 def AND32mi : Ii32<0x81, MRM4m,
1218 (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001219 "and{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001220 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001221 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001222 (ops i16mem:$dst, i16i8imm :$src),
1223 "and{w} {$src, $dst|$dst, $src}",
1224 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1225 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001226 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001227 (ops i32mem:$dst, i32i8imm :$src),
1228 "and{l} {$src, $dst|$dst, $src}",
Evan Chenge3703d42006-01-14 01:18:49 +00001229 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001230}
1231
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001232
Chris Lattnercc65bee2005-01-02 02:35:46 +00001233let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001234def OR8rr : I<0x08, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001235 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001236 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
1237def OR16rr : I<0x09, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001238 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001239 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
1240def OR32rr : I<0x09, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001241 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001242 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001243}
Evan Cheng069287d2006-05-16 07:21:53 +00001244def OR8rm : I<0x0A, MRMSrcMem , (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001245 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001246 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
1247def OR16rm : I<0x0B, MRMSrcMem , (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001248 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001249 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
1250def OR32rm : I<0x0B, MRMSrcMem , (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001251 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001252 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001253
Evan Cheng069287d2006-05-16 07:21:53 +00001254def OR8ri : Ii8 <0x80, MRM1r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001255 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001256 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
1257def OR16ri : Ii16<0x81, MRM1r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001258 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001259 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
1260def OR32ri : Ii32<0x81, MRM1r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001261 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001262 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001263
Evan Cheng069287d2006-05-16 07:21:53 +00001264def OR16ri8 : Ii8<0x83, MRM1r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001265 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001266 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
1267def OR32ri8 : Ii8<0x83, MRM1r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001268 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001269 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001270let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001271 def OR8mr : I<0x08, MRMDestMem, (ops i8mem:$dst, GR8:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001272 "or{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001273 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
1274 def OR16mr : I<0x09, MRMDestMem, (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001275 "or{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001276 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
1277 def OR32mr : I<0x09, MRMDestMem, (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001278 "or{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001279 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001280 def OR8mi : Ii8<0x80, MRM1m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001281 "or{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001282 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001283 def OR16mi : Ii16<0x81, MRM1m, (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001284 "or{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001285 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001286 OpSize;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001287 def OR32mi : Ii32<0x81, MRM1m, (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001288 "or{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001289 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Cheng0ef3a772005-12-13 01:41:36 +00001290 def OR16mi8 : Ii8<0x83, MRM1m, (ops i16mem:$dst, i16i8imm:$src),
1291 "or{w} {$src, $dst|$dst, $src}",
1292 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1293 OpSize;
1294 def OR32mi8 : Ii8<0x83, MRM1m, (ops i32mem:$dst, i32i8imm:$src),
1295 "or{l} {$src, $dst|$dst, $src}",
1296 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001297}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001298
1299
Chris Lattnercc65bee2005-01-02 02:35:46 +00001300let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001301def XOR8rr : I<0x30, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001302 (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001303 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001304 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001305def XOR16rr : I<0x31, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001306 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001307 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001308 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001309def XOR32rr : I<0x31, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001310 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001311 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001312 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001313}
1314
Chris Lattner3a173df2004-10-03 20:35:00 +00001315def XOR8rm : I<0x32, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001316 (ops GR8 :$dst, GR8:$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001317 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001318 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001319def XOR16rm : I<0x33, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001320 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001321 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001322 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001323def XOR32rm : I<0x33, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001324 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001325 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001326 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001327
Chris Lattner3a173df2004-10-03 20:35:00 +00001328def XOR8ri : Ii8<0x80, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001329 (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001330 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001331 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001332def XOR16ri : Ii16<0x81, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001333 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001334 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001335 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001336def XOR32ri : Ii32<0x81, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001337 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001338 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001339 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001340def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001341 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001342 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001343 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001344 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001345def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001346 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001347 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001348 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001349let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001350 def XOR8mr : I<0x30, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001351 (ops i8mem :$dst, GR8 :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001352 "xor{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001353 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001354 def XOR16mr : I<0x31, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001355 (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001356 "xor{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001357 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001358 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001359 def XOR32mr : I<0x31, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001360 (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001361 "xor{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001362 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001363 def XOR8mi : Ii8<0x80, MRM6m,
1364 (ops i8mem :$dst, i8imm :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001365 "xor{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001366 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001367 def XOR16mi : Ii16<0x81, MRM6m,
1368 (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001369 "xor{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001370 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001371 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001372 def XOR32mi : Ii32<0x81, MRM6m,
1373 (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001374 "xor{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001375 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001376 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001377 (ops i16mem:$dst, i16i8imm :$src),
1378 "xor{w} {$src, $dst|$dst, $src}",
1379 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1380 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001381 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001382 (ops i32mem:$dst, i32i8imm :$src),
1383 "xor{l} {$src, $dst|$dst, $src}",
1384 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001385}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001386
1387// Shift instructions
Evan Cheng069287d2006-05-16 07:21:53 +00001388def SHL8rCL : I<0xD2, MRM4r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001389 "shl{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001390 [(set GR8:$dst, (shl GR8:$src, CL))]>, Imp<[CL],[]>;
1391def SHL16rCL : I<0xD3, MRM4r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001392 "shl{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001393 [(set GR16:$dst, (shl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1394def SHL32rCL : I<0xD3, MRM4r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001395 "shl{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001396 [(set GR32:$dst, (shl GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001397
Evan Cheng069287d2006-05-16 07:21:53 +00001398def SHL8ri : Ii8<0xC0, MRM4r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001399 "shl{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001400 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001401let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001402def SHL16ri : Ii8<0xC1, MRM4r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001403 "shl{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001404 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1405def SHL32ri : Ii8<0xC1, MRM4r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001406 "shl{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001407 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001408}
Chris Lattnerf29ed092004-08-11 05:07:25 +00001409
1410let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001411 def SHL8mCL : I<0xD2, MRM4m, (ops i8mem :$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001412 "shl{b} {%cl, $dst|$dst, %CL}",
1413 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>,
1414 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001415 def SHL16mCL : I<0xD3, MRM4m, (ops i16mem:$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001416 "shl{w} {%cl, $dst|$dst, %CL}",
1417 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>,
1418 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001419 def SHL32mCL : I<0xD3, MRM4m, (ops i32mem:$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001420 "shl{l} {%cl, $dst|$dst, %CL}",
1421 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>,
1422 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001423 def SHL8mi : Ii8<0xC0, MRM4m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001424 "shl{b} {$src, $dst|$dst, $src}",
1425 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001426 def SHL16mi : Ii8<0xC1, MRM4m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001427 "shl{w} {$src, $dst|$dst, $src}",
1428 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1429 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001430 def SHL32mi : Ii8<0xC1, MRM4m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001431 "shl{l} {$src, $dst|$dst, $src}",
1432 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001433}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001434
Evan Cheng069287d2006-05-16 07:21:53 +00001435def SHR8rCL : I<0xD2, MRM5r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001436 "shr{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001437 [(set GR8:$dst, (srl GR8:$src, CL))]>, Imp<[CL],[]>;
1438def SHR16rCL : I<0xD3, MRM5r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001439 "shr{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001440 [(set GR16:$dst, (srl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1441def SHR32rCL : I<0xD3, MRM5r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001442 "shr{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001443 [(set GR32:$dst, (srl GR32:$src, CL))]>, Imp<[CL],[]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001444
Evan Cheng069287d2006-05-16 07:21:53 +00001445def SHR8ri : Ii8<0xC0, MRM5r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001446 "shr{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001447 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
1448def SHR16ri : Ii8<0xC1, MRM5r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001449 "shr{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001450 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1451def SHR32ri : Ii8<0xC1, MRM5r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001452 "shr{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001453 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001454
Chris Lattner57a02302004-08-11 04:31:00 +00001455let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001456 def SHR8mCL : I<0xD2, MRM5m, (ops i8mem :$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001457 "shr{b} {%cl, $dst|$dst, %CL}",
1458 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>,
1459 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001460 def SHR16mCL : I<0xD3, MRM5m, (ops i16mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001461 "shr{w} {%cl, $dst|$dst, %CL}",
1462 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
1463 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001464 def SHR32mCL : I<0xD3, MRM5m, (ops i32mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001465 "shr{l} {%cl, $dst|$dst, %CL}",
1466 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>,
1467 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001468 def SHR8mi : Ii8<0xC0, MRM5m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001469 "shr{b} {$src, $dst|$dst, $src}",
1470 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001471 def SHR16mi : Ii8<0xC1, MRM5m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001472 "shr{w} {$src, $dst|$dst, $src}",
1473 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1474 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001475 def SHR32mi : Ii8<0xC1, MRM5m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001476 "shr{l} {$src, $dst|$dst, $src}",
1477 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001478}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001479
Evan Cheng069287d2006-05-16 07:21:53 +00001480def SAR8rCL : I<0xD2, MRM7r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001481 "sar{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001482 [(set GR8:$dst, (sra GR8:$src, CL))]>, Imp<[CL],[]>;
1483def SAR16rCL : I<0xD3, MRM7r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001484 "sar{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001485 [(set GR16:$dst, (sra GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1486def SAR32rCL : I<0xD3, MRM7r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001487 "sar{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001488 [(set GR32:$dst, (sra GR32:$src, CL))]>, Imp<[CL],[]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001489
Evan Cheng069287d2006-05-16 07:21:53 +00001490def SAR8ri : Ii8<0xC0, MRM7r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001491 "sar{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001492 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
1493def SAR16ri : Ii8<0xC1, MRM7r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001494 "sar{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001495 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
Chris Lattner3d36a9f2005-12-05 02:40:25 +00001496 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001497def SAR32ri : Ii8<0xC1, MRM7r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001498 "sar{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001499 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001500let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001501 def SAR8mCL : I<0xD2, MRM7m, (ops i8mem :$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001502 "sar{b} {%cl, $dst|$dst, %CL}",
1503 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>,
1504 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001505 def SAR16mCL : I<0xD3, MRM7m, (ops i16mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001506 "sar{w} {%cl, $dst|$dst, %CL}",
1507 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>,
1508 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001509 def SAR32mCL : I<0xD3, MRM7m, (ops i32mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001510 "sar{l} {%cl, $dst|$dst, %CL}",
1511 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>,
1512 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001513 def SAR8mi : Ii8<0xC0, MRM7m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001514 "sar{b} {$src, $dst|$dst, $src}",
1515 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001516 def SAR16mi : Ii8<0xC1, MRM7m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001517 "sar{w} {$src, $dst|$dst, $src}",
1518 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1519 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001520 def SAR32mi : Ii8<0xC1, MRM7m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001521 "sar{l} {$src, $dst|$dst, $src}",
1522 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001523}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001524
Chris Lattner40ff6332005-01-19 07:50:03 +00001525// Rotate instructions
1526// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng069287d2006-05-16 07:21:53 +00001527def ROL8rCL : I<0xD2, MRM0r, (ops GR8 :$dst, GR8 :$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001528 "rol{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001529 [(set GR8:$dst, (rotl GR8:$src, CL))]>, Imp<[CL],[]>;
1530def ROL16rCL : I<0xD3, MRM0r, (ops GR16:$dst, GR16:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001531 "rol{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001532 [(set GR16:$dst, (rotl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1533def ROL32rCL : I<0xD3, MRM0r, (ops GR32:$dst, GR32:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001534 "rol{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001535 [(set GR32:$dst, (rotl GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001536
Evan Cheng069287d2006-05-16 07:21:53 +00001537def ROL8ri : Ii8<0xC0, MRM0r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001538 "rol{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001539 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
1540def ROL16ri : Ii8<0xC1, MRM0r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001541 "rol{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001542 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1543def ROL32ri : Ii8<0xC1, MRM0r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001544 "rol{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001545 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001546
1547let isTwoAddress = 0 in {
1548 def ROL8mCL : I<0xD2, MRM0m, (ops i8mem :$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001549 "rol{b} {%cl, $dst|$dst, %CL}",
1550 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>,
1551 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001552 def ROL16mCL : I<0xD3, MRM0m, (ops i16mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001553 "rol{w} {%cl, $dst|$dst, %CL}",
1554 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>,
1555 Imp<[CL],[]>, OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001556 def ROL32mCL : I<0xD3, MRM0m, (ops i32mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001557 "rol{l} {%cl, $dst|$dst, %CL}",
1558 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>,
1559 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001560 def ROL8mi : Ii8<0xC0, MRM0m, (ops i8mem :$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001561 "rol{b} {$src, $dst|$dst, $src}",
1562 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001563 def ROL16mi : Ii8<0xC1, MRM0m, (ops i16mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001564 "rol{w} {$src, $dst|$dst, $src}",
1565 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1566 OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001567 def ROL32mi : Ii8<0xC1, MRM0m, (ops i32mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001568 "rol{l} {$src, $dst|$dst, $src}",
1569 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001570}
1571
Evan Cheng069287d2006-05-16 07:21:53 +00001572def ROR8rCL : I<0xD2, MRM1r, (ops GR8 :$dst, GR8 :$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001573 "ror{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001574 [(set GR8:$dst, (rotr GR8:$src, CL))]>, Imp<[CL],[]>;
1575def ROR16rCL : I<0xD3, MRM1r, (ops GR16:$dst, GR16:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001576 "ror{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001577 [(set GR16:$dst, (rotr GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1578def ROR32rCL : I<0xD3, MRM1r, (ops GR32:$dst, GR32:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001579 "ror{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001580 [(set GR32:$dst, (rotr GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001581
Evan Cheng069287d2006-05-16 07:21:53 +00001582def ROR8ri : Ii8<0xC0, MRM1r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001583 "ror{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001584 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
1585def ROR16ri : Ii8<0xC1, MRM1r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001586 "ror{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001587 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1588def ROR32ri : Ii8<0xC1, MRM1r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001589 "ror{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001590 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001591let isTwoAddress = 0 in {
1592 def ROR8mCL : I<0xD2, MRM1m, (ops i8mem :$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001593 "ror{b} {%cl, $dst|$dst, %CL}",
1594 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>,
1595 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001596 def ROR16mCL : I<0xD3, MRM1m, (ops i16mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001597 "ror{w} {%cl, $dst|$dst, %CL}",
1598 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>,
1599 Imp<[CL],[]>, OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001600 def ROR32mCL : I<0xD3, MRM1m, (ops i32mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001601 "ror{l} {%cl, $dst|$dst, %CL}",
1602 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>,
1603 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001604 def ROR8mi : Ii8<0xC0, MRM1m, (ops i8mem :$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001605 "ror{b} {$src, $dst|$dst, $src}",
1606 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001607 def ROR16mi : Ii8<0xC1, MRM1m, (ops i16mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001608 "ror{w} {$src, $dst|$dst, $src}",
1609 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1610 OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001611 def ROR32mi : Ii8<0xC1, MRM1m, (ops i32mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001612 "ror{l} {$src, $dst|$dst, $src}",
1613 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001614}
1615
1616
1617
1618// Double shift instructions (generalizations of rotate)
Evan Cheng069287d2006-05-16 07:21:53 +00001619def SHLD32rrCL : I<0xA5, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001620 "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001621 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001622 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001623def SHRD32rrCL : I<0xAD, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001624 "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001625 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001626 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001627def SHLD16rrCL : I<0xA5, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001628 "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001629 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001630 Imp<[CL],[]>, TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001631def SHRD16rrCL : I<0xAD, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001632 "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001633 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001634 Imp<[CL],[]>, TB, OpSize;
Chris Lattner41e431b2005-01-19 07:11:01 +00001635
1636let isCommutable = 1 in { // These instructions commute to each other.
Chris Lattner3a173df2004-10-03 20:35:00 +00001637def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001638 (ops GR32:$dst, GR32:$src1, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001639 "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001640 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001641 (i8 imm:$src3)))]>,
1642 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001643def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001644 (ops GR32:$dst, GR32:$src1, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001645 "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001646 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001647 (i8 imm:$src3)))]>,
1648 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001649def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001650 (ops GR16:$dst, GR16:$src1, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001651 "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001652 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001653 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001654 TB, OpSize;
1655def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001656 (ops GR16:$dst, GR16:$src1, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001657 "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001658 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001659 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001660 TB, OpSize;
Chris Lattner41e431b2005-01-19 07:11:01 +00001661}
Chris Lattner0e967d42004-08-01 08:13:11 +00001662
Chris Lattner57a02302004-08-11 04:31:00 +00001663let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001664 def SHLD32mrCL : I<0xA5, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001665 "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001666 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001667 addr:$dst)]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001668 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001669 def SHRD32mrCL : I<0xAD, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001670 "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001671 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001672 addr:$dst)]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001673 Imp<[CL],[]>, TB;
1674 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001675 (ops i32mem:$dst, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001676 "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001677 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001678 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001679 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001680 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001681 (ops i32mem:$dst, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001682 "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001683 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001684 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001685 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001686
Evan Cheng069287d2006-05-16 07:21:53 +00001687 def SHLD16mrCL : I<0xA5, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001688 "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001689 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001690 addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001691 Imp<[CL],[]>, TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001692 def SHRD16mrCL : I<0xAD, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001693 "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001694 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001695 addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001696 Imp<[CL],[]>, TB, OpSize;
1697 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001698 (ops i16mem:$dst, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001699 "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001700 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001701 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001702 TB, OpSize;
1703 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001704 (ops i16mem:$dst, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001705 "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001706 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001707 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001708 TB, OpSize;
Chris Lattner57a02302004-08-11 04:31:00 +00001709}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001710
1711
Chris Lattnercc65bee2005-01-02 02:35:46 +00001712// Arithmetic.
1713let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001714def ADD8rr : I<0x00, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001715 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001716 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001717let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001718def ADD16rr : I<0x01, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001719 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001720 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
1721def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001722 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001723 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001724} // end isConvertibleToThreeAddress
1725} // end isCommutable
Evan Cheng069287d2006-05-16 07:21:53 +00001726def ADD8rm : I<0x02, MRMSrcMem, (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001727 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001728 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
1729def ADD16rm : I<0x03, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001730 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001731 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>, OpSize;
1732def ADD32rm : I<0x03, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001733 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001734 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001735
Evan Cheng069287d2006-05-16 07:21:53 +00001736def ADD8ri : Ii8<0x80, MRM0r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001737 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001738 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001739
1740let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001741def ADD16ri : Ii16<0x81, MRM0r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001742 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001743 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
1744def ADD32ri : Ii32<0x81, MRM0r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001745 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001746 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng069287d2006-05-16 07:21:53 +00001747def ADD16ri8 : Ii8<0x83, MRM0r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001748 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001749 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001750 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001751def ADD32ri8 : Ii8<0x83, MRM0r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001752 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001753 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng09e3c802006-05-19 18:40:54 +00001754}
Chris Lattner57a02302004-08-11 04:31:00 +00001755
1756let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001757 def ADD8mr : I<0x00, MRMDestMem, (ops i8mem :$dst, GR8 :$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001758 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001759 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
1760 def ADD16mr : I<0x01, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001761 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001762 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001763 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001764 def ADD32mr : I<0x01, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001765 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001766 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001767 def ADD8mi : Ii8<0x80, MRM0m, (ops i8mem :$dst, i8imm :$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001768 "add{b} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001769 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001770 def ADD16mi : Ii16<0x81, MRM0m, (ops i16mem:$dst, i16imm:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001771 "add{w} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001772 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001773 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001774 def ADD32mi : Ii32<0x81, MRM0m, (ops i32mem:$dst, i32imm:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001775 "add{l} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001776 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengee93f9d2005-12-12 19:45:23 +00001777 def ADD16mi8 : Ii8<0x83, MRM0m, (ops i16mem:$dst, i16i8imm :$src2),
1778 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001779 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
1780 OpSize;
Evan Chengee93f9d2005-12-12 19:45:23 +00001781 def ADD32mi8 : Ii8<0x83, MRM0m, (ops i32mem:$dst, i32i8imm :$src2),
1782 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001783 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001784}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001785
Chris Lattner10197ff2005-01-03 01:27:59 +00001786let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001787def ADC32rr : I<0x11, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001788 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001789 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
Chris Lattner10197ff2005-01-03 01:27:59 +00001790}
Evan Cheng069287d2006-05-16 07:21:53 +00001791def ADC32rm : I<0x13, MRMSrcMem , (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001792 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001793 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
1794def ADC32ri : Ii32<0x81, MRM2r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001795 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001796 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
1797def ADC32ri8 : Ii8<0x83, MRM2r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001798 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001799 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001800
1801let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001802 def ADC32mr : I<0x11, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001803 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001804 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001805 def ADC32mi : Ii32<0x81, MRM2m, (ops i32mem:$dst, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001806 "adc{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001807 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chenge3413162006-01-09 18:33:28 +00001808 def ADC32mi8 : Ii8<0x83, MRM2m, (ops i32mem:$dst, i32i8imm :$src2),
1809 "adc{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001810 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001811}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001812
Evan Cheng069287d2006-05-16 07:21:53 +00001813def SUB8rr : I<0x28, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001814 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001815 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
1816def SUB16rr : I<0x29, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001817 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001818 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
1819def SUB32rr : I<0x29, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001820 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001821 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
1822def SUB8rm : I<0x2A, MRMSrcMem, (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001823 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001824 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
1825def SUB16rm : I<0x2B, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001826 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001827 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
1828def SUB32rm : I<0x2B, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001829 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001830 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001831
Evan Cheng069287d2006-05-16 07:21:53 +00001832def SUB8ri : Ii8 <0x80, MRM5r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001833 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001834 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
1835def SUB16ri : Ii16<0x81, MRM5r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001836 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001837 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
1838def SUB32ri : Ii32<0x81, MRM5r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001839 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001840 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
1841def SUB16ri8 : Ii8<0x83, MRM5r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001842 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001843 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001844 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001845def SUB32ri8 : Ii8<0x83, MRM5r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001846 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001847 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001848let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001849 def SUB8mr : I<0x28, MRMDestMem, (ops i8mem :$dst, GR8 :$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001850 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001851 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
1852 def SUB16mr : I<0x29, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001853 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001854 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001855 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001856 def SUB32mr : I<0x29, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001857 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001858 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001859 def SUB8mi : Ii8<0x80, MRM5m, (ops i8mem :$dst, i8imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001860 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001861 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001862 def SUB16mi : Ii16<0x81, MRM5m, (ops i16mem:$dst, i16imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001863 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001864 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001865 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001866 def SUB32mi : Ii32<0x81, MRM5m, (ops i32mem:$dst, i32imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001867 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001868 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengd160d482005-12-12 21:54:05 +00001869 def SUB16mi8 : Ii8<0x83, MRM5m, (ops i16mem:$dst, i16i8imm :$src2),
1870 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001871 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
1872 OpSize;
Evan Chengd160d482005-12-12 21:54:05 +00001873 def SUB32mi8 : Ii8<0x83, MRM5m, (ops i32mem:$dst, i32i8imm :$src2),
1874 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001875 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001876}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001877
Evan Cheng069287d2006-05-16 07:21:53 +00001878def SBB32rr : I<0x19, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001879 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001880 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Chris Lattnerd93d3b02004-10-06 04:01:02 +00001881
Chris Lattner57a02302004-08-11 04:31:00 +00001882let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001883 def SBB32mr : I<0x19, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001884 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001885 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattnerd93d3b02004-10-06 04:01:02 +00001886 def SBB8mi : Ii32<0x80, MRM3m, (ops i8mem:$dst, i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001887 "sbb{b} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001888 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001889 def SBB32mi : Ii32<0x81, MRM3m, (ops i32mem:$dst, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001890 "sbb{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001891 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chenge3413162006-01-09 18:33:28 +00001892 def SBB32mi8 : Ii8<0x83, MRM3m, (ops i32mem:$dst, i32i8imm :$src2),
1893 "sbb{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001894 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001895}
Evan Cheng069287d2006-05-16 07:21:53 +00001896def SBB32rm : I<0x1B, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001897 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001898 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
1899def SBB32ri : Ii32<0x81, MRM3r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001900 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001901 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
1902def SBB32ri8 : Ii8<0x83, MRM3r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001903 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001904 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001905
Chris Lattner10197ff2005-01-03 01:27:59 +00001906let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001907def IMUL16rr : I<0xAF, MRMSrcReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001908 "imul{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001909 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
1910def IMUL32rr : I<0xAF, MRMSrcReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001911 "imul{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001912 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
Chris Lattner10197ff2005-01-03 01:27:59 +00001913}
Evan Cheng069287d2006-05-16 07:21:53 +00001914def IMUL16rm : I<0xAF, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001915 "imul{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001916 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001917 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001918def IMUL32rm : I<0xAF, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001919 "imul{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001920 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001921
1922} // end Two Address instructions
1923
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001924// Suprisingly enough, these are not two address instructions!
Evan Cheng069287d2006-05-16 07:21:53 +00001925def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
1926 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001927 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001928 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
1929def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
1930 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001931 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001932 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
1933def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
1934 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001935 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001936 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001937 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001938def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
1939 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001940 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001941 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001942
Evan Cheng069287d2006-05-16 07:21:53 +00001943def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
1944 (ops GR16:$dst, i16mem:$src1, i16imm:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001945 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001946 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
Evan Chengf281e022005-12-12 23:47:46 +00001947 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001948def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
1949 (ops GR32:$dst, i32mem:$src1, i32imm:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001950 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001951 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
1952def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
1953 (ops GR16:$dst, i16mem:$src1, i16i8imm :$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001954 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001955 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001956 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001957def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
1958 (ops GR32:$dst, i32mem:$src1, i32i8imm: $src2),
Evan Chengf281e022005-12-12 23:47:46 +00001959 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001960 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001961
1962//===----------------------------------------------------------------------===//
1963// Test instructions are just like AND, except they don't generate a result.
Chris Lattner3a173df2004-10-03 20:35:00 +00001964//
Chris Lattnercc65bee2005-01-02 02:35:46 +00001965let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Cheng069287d2006-05-16 07:21:53 +00001966def TEST8rr : I<0x84, MRMDestReg, (ops GR8:$src1, GR8:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001967 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001968 [(X86test GR8:$src1, GR8:$src2)]>;
1969def TEST16rr : I<0x85, MRMDestReg, (ops GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001970 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001971 [(X86test GR16:$src1, GR16:$src2)]>, OpSize;
1972def TEST32rr : I<0x85, MRMDestReg, (ops GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001973 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001974 [(X86test GR32:$src1, GR32:$src2)]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001975}
Evan Cheng069287d2006-05-16 07:21:53 +00001976def TEST8mr : I<0x84, MRMDestMem, (ops i8mem :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001977 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001978 [(X86test (loadi8 addr:$src1), GR8:$src2)]>;
1979def TEST16mr : I<0x85, MRMDestMem, (ops i16mem:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001980 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001981 [(X86test (loadi16 addr:$src1), GR16:$src2)]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001982 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001983def TEST32mr : I<0x85, MRMDestMem, (ops i32mem:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001984 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001985 [(X86test (loadi32 addr:$src1), GR32:$src2)]>;
1986def TEST8rm : I<0x84, MRMSrcMem, (ops GR8 :$src1, i8mem :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001987 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001988 [(X86test GR8:$src1, (loadi8 addr:$src2))]>;
1989def TEST16rm : I<0x85, MRMSrcMem, (ops GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001990 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001991 [(X86test GR16:$src1, (loadi16 addr:$src2))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001992 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001993def TEST32rm : I<0x85, MRMSrcMem, (ops GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001994 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001995 [(X86test GR32:$src1, (loadi32 addr:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001996
Evan Cheng069287d2006-05-16 07:21:53 +00001997def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
1998 (ops GR8:$src1, i8imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001999 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002000 [(X86test GR8:$src1, imm:$src2)]>;
2001def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
2002 (ops GR16:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002003 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002004 [(X86test GR16:$src1, imm:$src2)]>, OpSize;
2005def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
2006 (ops GR32:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002007 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002008 [(X86test GR32:$src1, imm:$src2)]>;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002009def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengaed7c722005-12-17 01:24:02 +00002010 (ops i8mem:$src1, i8imm:$src2),
2011 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002012 [(X86test (loadi8 addr:$src1), imm:$src2)]>;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002013def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2014 (ops i16mem:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002015 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002016 [(X86test (loadi16 addr:$src1), imm:$src2)]>,
2017 OpSize;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002018def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2019 (ops i32mem:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002020 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002021 [(X86test (loadi32 addr:$src1), imm:$src2)]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002022
2023
2024// Condition code ops, incl. set if equal/not equal/...
Evan Chengf0701842005-11-29 19:38:52 +00002025def SAHF : I<0x9E, RawFrm, (ops), "sahf", []>, Imp<[AH],[]>; // flags = AH
2026def LAHF : I<0x9F, RawFrm, (ops), "lahf", []>, Imp<[],[AH]>; // AH = flags
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002027
Chris Lattner3a173df2004-10-03 20:35:00 +00002028def SETEr : I<0x94, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002029 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002030 "sete $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002031 [(set GR8:$dst, (X86setcc X86_COND_E))]>,
2032 TB; // GR8 = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002033def SETEm : I<0x94, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002034 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002035 "sete $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002036 [(store (X86setcc X86_COND_E), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002037 TB; // [mem8] = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002038def SETNEr : I<0x95, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002039 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002040 "setne $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002041 [(set GR8:$dst, (X86setcc X86_COND_NE))]>,
2042 TB; // GR8 = !=
Chris Lattner3a173df2004-10-03 20:35:00 +00002043def SETNEm : I<0x95, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002044 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002045 "setne $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002046 [(store (X86setcc X86_COND_NE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002047 TB; // [mem8] = !=
2048def SETLr : I<0x9C, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002049 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002050 "setl $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002051 [(set GR8:$dst, (X86setcc X86_COND_L))]>,
2052 TB; // GR8 = < signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002053def SETLm : I<0x9C, MRM0m,
2054 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002055 "setl $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002056 [(store (X86setcc X86_COND_L), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002057 TB; // [mem8] = < signed
2058def SETGEr : I<0x9D, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002059 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002060 "setge $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002061 [(set GR8:$dst, (X86setcc X86_COND_GE))]>,
2062 TB; // GR8 = >= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002063def SETGEm : I<0x9D, MRM0m,
2064 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002065 "setge $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002066 [(store (X86setcc X86_COND_GE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002067 TB; // [mem8] = >= signed
2068def SETLEr : I<0x9E, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002069 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002070 "setle $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002071 [(set GR8:$dst, (X86setcc X86_COND_LE))]>,
2072 TB; // GR8 = <= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002073def SETLEm : I<0x9E, MRM0m,
2074 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002075 "setle $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002076 [(store (X86setcc X86_COND_LE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002077 TB; // [mem8] = <= signed
2078def SETGr : I<0x9F, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002079 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002080 "setg $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002081 [(set GR8:$dst, (X86setcc X86_COND_G))]>,
2082 TB; // GR8 = > signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002083def SETGm : I<0x9F, MRM0m,
2084 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002085 "setg $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002086 [(store (X86setcc X86_COND_G), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002087 TB; // [mem8] = > signed
2088
2089def SETBr : I<0x92, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002090 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002091 "setb $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002092 [(set GR8:$dst, (X86setcc X86_COND_B))]>,
2093 TB; // GR8 = < unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002094def SETBm : I<0x92, MRM0m,
2095 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002096 "setb $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002097 [(store (X86setcc X86_COND_B), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002098 TB; // [mem8] = < unsign
2099def SETAEr : I<0x93, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002100 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002101 "setae $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002102 [(set GR8:$dst, (X86setcc X86_COND_AE))]>,
2103 TB; // GR8 = >= unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002104def SETAEm : I<0x93, MRM0m,
2105 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002106 "setae $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002107 [(store (X86setcc X86_COND_AE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002108 TB; // [mem8] = >= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002109def SETBEr : I<0x96, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002110 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002111 "setbe $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002112 [(set GR8:$dst, (X86setcc X86_COND_BE))]>,
2113 TB; // GR8 = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002114def SETBEm : I<0x96, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002115 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002116 "setbe $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002117 [(store (X86setcc X86_COND_BE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002118 TB; // [mem8] = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002119def SETAr : I<0x97, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002120 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002121 "seta $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002122 [(set GR8:$dst, (X86setcc X86_COND_A))]>,
2123 TB; // GR8 = > signed
Chris Lattner3a173df2004-10-03 20:35:00 +00002124def SETAm : I<0x97, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002125 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002126 "seta $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002127 [(store (X86setcc X86_COND_A), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002128 TB; // [mem8] = > signed
Evan Chengd9558e02006-01-06 00:43:03 +00002129
Chris Lattner3a173df2004-10-03 20:35:00 +00002130def SETSr : I<0x98, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002131 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002132 "sets $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002133 [(set GR8:$dst, (X86setcc X86_COND_S))]>,
2134 TB; // GR8 = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002135def SETSm : I<0x98, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002136 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002137 "sets $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002138 [(store (X86setcc X86_COND_S), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002139 TB; // [mem8] = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002140def SETNSr : I<0x99, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002141 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002142 "setns $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002143 [(set GR8:$dst, (X86setcc X86_COND_NS))]>,
2144 TB; // GR8 = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002145def SETNSm : I<0x99, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002146 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002147 "setns $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002148 [(store (X86setcc X86_COND_NS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002149 TB; // [mem8] = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002150def SETPr : I<0x9A, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002151 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002152 "setp $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002153 [(set GR8:$dst, (X86setcc X86_COND_P))]>,
2154 TB; // GR8 = parity
Chris Lattner3a173df2004-10-03 20:35:00 +00002155def SETPm : I<0x9A, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002156 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002157 "setp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002158 [(store (X86setcc X86_COND_P), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002159 TB; // [mem8] = parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002160def SETNPr : I<0x9B, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002161 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002162 "setnp $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002163 [(set GR8:$dst, (X86setcc X86_COND_NP))]>,
2164 TB; // GR8 = not parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002165def SETNPm : I<0x9B, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002166 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002167 "setnp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002168 [(store (X86setcc X86_COND_NP), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002169 TB; // [mem8] = not parity
Chris Lattner1cca5e32003-08-03 21:54:21 +00002170
2171// Integer comparisons
Chris Lattner3a173df2004-10-03 20:35:00 +00002172def CMP8rr : I<0x38, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002173 (ops GR8 :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002174 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002175 [(X86cmp GR8:$src1, GR8:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002176def CMP16rr : I<0x39, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002177 (ops GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002178 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002179 [(X86cmp GR16:$src1, GR16:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002180def CMP32rr : I<0x39, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002181 (ops GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002182 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002183 [(X86cmp GR32:$src1, GR32:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002184def CMP8mr : I<0x38, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002185 (ops i8mem :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002186 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002187 [(X86cmp (loadi8 addr:$src1), GR8:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002188def CMP16mr : I<0x39, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002189 (ops i16mem:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002190 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002191 [(X86cmp (loadi16 addr:$src1), GR16:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002192def CMP32mr : I<0x39, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002193 (ops i32mem:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002194 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002195 [(X86cmp (loadi32 addr:$src1), GR32:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002196def CMP8rm : I<0x3A, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002197 (ops GR8 :$src1, i8mem :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002198 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002199 [(X86cmp GR8:$src1, (loadi8 addr:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002200def CMP16rm : I<0x3B, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002201 (ops GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002202 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002203 [(X86cmp GR16:$src1, (loadi16 addr:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002204def CMP32rm : I<0x3B, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002205 (ops GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002206 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002207 [(X86cmp GR32:$src1, (loadi32 addr:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002208def CMP8ri : Ii8<0x80, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002209 (ops GR8:$src1, i8imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002210 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002211 [(X86cmp GR8:$src1, imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002212def CMP16ri : Ii16<0x81, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002213 (ops GR16:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002214 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002215 [(X86cmp GR16:$src1, imm:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002216def CMP32ri : Ii32<0x81, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002217 (ops GR32:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002218 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002219 [(X86cmp GR32:$src1, imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002220def CMP8mi : Ii8 <0x80, MRM7m,
2221 (ops i8mem :$src1, i8imm :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002222 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002223 [(X86cmp (loadi8 addr:$src1), imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002224def CMP16mi : Ii16<0x81, MRM7m,
2225 (ops i16mem:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002226 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002227 [(X86cmp (loadi16 addr:$src1), imm:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002228def CMP32mi : Ii32<0x81, MRM7m,
2229 (ops i32mem:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002230 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002231 [(X86cmp (loadi32 addr:$src1), imm:$src2)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002232def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002233 (ops GR16:$src1, i16i8imm:$src2),
Nate Begemance944822006-03-23 01:29:48 +00002234 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002235 [(X86cmp GR16:$src1, i16immSExt8:$src2)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002236def CMP16mi8 : Ii8<0x83, MRM7m,
Nate Begemance944822006-03-23 01:29:48 +00002237 (ops i16mem:$src1, i16i8imm:$src2),
2238 "cmp{w} {$src2, $src1|$src1, $src2}",
2239 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002240def CMP32mi8 : Ii8<0x83, MRM7m,
Nate Begemance944822006-03-23 01:29:48 +00002241 (ops i32mem:$src1, i32i8imm:$src2),
2242 "cmp{l} {$src2, $src1|$src1, $src2}",
2243 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002244def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002245 (ops GR32:$src1, i32i8imm:$src2),
Nate Begemance944822006-03-23 01:29:48 +00002246 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002247 [(X86cmp GR32:$src1, i32immSExt8:$src2)]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +00002248
2249// Sign/Zero extenders
Evan Cheng069287d2006-05-16 07:21:53 +00002250def MOVSX16rr8 : I<0xBE, MRMSrcReg, (ops GR16:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002251 "movs{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002252 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
2253def MOVSX16rm8 : I<0xBE, MRMSrcMem, (ops GR16:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002254 "movs{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002255 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
2256def MOVSX32rr8 : I<0xBE, MRMSrcReg, (ops GR32:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002257 "movs{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002258 [(set GR32:$dst, (sext GR8:$src))]>, TB;
2259def MOVSX32rm8 : I<0xBE, MRMSrcMem, (ops GR32:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002260 "movs{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002261 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
2262def MOVSX32rr16: I<0xBF, MRMSrcReg, (ops GR32:$dst, GR16:$src),
Evan Chengf0701842005-11-29 19:38:52 +00002263 "movs{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002264 [(set GR32:$dst, (sext GR16:$src))]>, TB;
2265def MOVSX32rm16: I<0xBF, MRMSrcMem, (ops GR32:$dst, i16mem:$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002266 "movs{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002267 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
Alkis Evlogimenosa7be9822004-02-17 09:14:23 +00002268
Evan Cheng069287d2006-05-16 07:21:53 +00002269def MOVZX16rr8 : I<0xB6, MRMSrcReg, (ops GR16:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002270 "movz{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002271 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
2272def MOVZX16rm8 : I<0xB6, MRMSrcMem, (ops GR16:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002273 "movz{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002274 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
2275def MOVZX32rr8 : I<0xB6, MRMSrcReg, (ops GR32:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002276 "movz{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002277 [(set GR32:$dst, (zext GR8:$src))]>, TB;
2278def MOVZX32rm8 : I<0xB6, MRMSrcMem, (ops GR32:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002279 "movz{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002280 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
2281def MOVZX32rr16: I<0xB7, MRMSrcReg, (ops GR32:$dst, GR16:$src),
Evan Chengf0701842005-11-29 19:38:52 +00002282 "movz{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002283 [(set GR32:$dst, (zext GR16:$src))]>, TB;
2284def MOVZX32rm16: I<0xB7, MRMSrcMem, (ops GR32:$dst, i16mem:$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002285 "movz{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002286 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
Evan Cheng7a7e8372005-12-14 02:22:27 +00002287
Nate Begemanf1702ac2005-06-27 21:20:31 +00002288//===----------------------------------------------------------------------===//
Evan Cheng747a90d2006-02-21 02:24:38 +00002289// Miscellaneous Instructions
2290//===----------------------------------------------------------------------===//
2291
2292def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", [(X86rdtsc)]>,
2293 TB, Imp<[],[EAX,EDX]>;
2294
Evan Cheng747a90d2006-02-21 02:24:38 +00002295//===----------------------------------------------------------------------===//
2296// Alias Instructions
2297//===----------------------------------------------------------------------===//
2298
2299// Alias instructions that map movr0 to xor.
2300// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Evan Cheng069287d2006-05-16 07:21:53 +00002301def MOV8r0 : I<0x30, MRMInitReg, (ops GR8 :$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002302 "xor{b} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002303 [(set GR8:$dst, 0)]>;
2304def MOV16r0 : I<0x31, MRMInitReg, (ops GR16:$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002305 "xor{w} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002306 [(set GR16:$dst, 0)]>, OpSize;
2307def MOV32r0 : I<0x31, MRMInitReg, (ops GR32:$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002308 "xor{l} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002309 [(set GR32:$dst, 0)]>;
Evan Cheng747a90d2006-02-21 02:24:38 +00002310
Evan Cheng069287d2006-05-16 07:21:53 +00002311// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
2312// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
2313def MOV16to16_ : I<0x89, MRMDestReg, (ops GR16_:$dst, GR16:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002314 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002315def MOV32to32_ : I<0x89, MRMDestReg, (ops GR32_:$dst, GR32:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002316 "mov{l} {$src, $dst|$dst, $src}", []>;
2317
Evan Cheng069287d2006-05-16 07:21:53 +00002318def MOV16_rr : I<0x89, MRMDestReg, (ops GR16_:$dst, GR16_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002319 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002320def MOV32_rr : I<0x89, MRMDestReg, (ops GR32_:$dst, GR32_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002321 "mov{l} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +00002322def MOV16_rm : I<0x8B, MRMSrcMem, (ops GR16_:$dst, i16mem:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002323 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002324def MOV32_rm : I<0x8B, MRMSrcMem, (ops GR32_:$dst, i32mem:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002325 "mov{l} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +00002326def MOV16_mr : I<0x89, MRMDestMem, (ops i16mem:$dst, GR16_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002327 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002328def MOV32_mr : I<0x89, MRMDestMem, (ops i32mem:$dst, GR32_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002329 "mov{l} {$src, $dst|$dst, $src}", []>;
2330
Evan Cheng510e4782006-01-09 23:10:28 +00002331//===----------------------------------------------------------------------===//
Evan Cheng3c992d22006-03-07 02:02:57 +00002332// DWARF Pseudo Instructions
2333//
2334
2335def DWARF_LOC : I<0, Pseudo, (ops i32imm:$line, i32imm:$col, i32imm:$file),
2336 "; .loc $file, $line, $col",
2337 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
2338 (i32 imm:$file))]>;
2339
2340def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id),
2341 "\nLdebug_loc${id:debug}:",
2342 [(dwarf_label (i32 imm:$id))]>;
2343
2344//===----------------------------------------------------------------------===//
Evan Cheng510e4782006-01-09 23:10:28 +00002345// Non-Instruction Patterns
2346//===----------------------------------------------------------------------===//
2347
Evan Cheng71fb8342006-02-25 10:02:21 +00002348// ConstantPool GlobalAddress, ExternalSymbol
2349def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
Nate Begeman37efe672006-04-22 18:53:45 +00002350def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002351def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
2352def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
2353
Evan Cheng069287d2006-05-16 07:21:53 +00002354def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
2355 (ADD32ri GR32:$src1, tconstpool:$src2)>;
2356def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
2357 (ADD32ri GR32:$src1, tjumptable:$src2)>;
2358def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
2359 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
2360def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
2361 (ADD32ri GR32:$src1, texternalsym:$src2)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002362
Evan Chengfc8feb12006-05-19 07:30:36 +00002363def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002364 (MOV32mi addr:$dst, tglobaladdr:$src)>;
Evan Chengfc8feb12006-05-19 07:30:36 +00002365def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002366 (MOV32mi addr:$dst, texternalsym:$src)>;
2367
Evan Cheng510e4782006-01-09 23:10:28 +00002368// Calls
Evan Cheng069287d2006-05-16 07:21:53 +00002369def : Pat<(X86tailcall GR32:$dst),
2370 (CALL32r GR32:$dst)>;
Evan Chengfea89c12006-04-27 08:40:39 +00002371
Evan Chengfea89c12006-04-27 08:40:39 +00002372def : Pat<(X86tailcall tglobaladdr:$dst),
2373 (CALLpcrel32 tglobaladdr:$dst)>;
2374def : Pat<(X86tailcall texternalsym:$dst),
2375 (CALLpcrel32 texternalsym:$dst)>;
2376
2377
2378
Evan Cheng510e4782006-01-09 23:10:28 +00002379def : Pat<(X86call tglobaladdr:$dst),
2380 (CALLpcrel32 tglobaladdr:$dst)>;
Evan Cheng8700e142006-01-11 06:09:51 +00002381def : Pat<(X86call texternalsym:$dst),
2382 (CALLpcrel32 texternalsym:$dst)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002383
2384// X86 specific add which produces a flag.
Evan Cheng069287d2006-05-16 07:21:53 +00002385def : Pat<(addc GR32:$src1, GR32:$src2),
2386 (ADD32rr GR32:$src1, GR32:$src2)>;
2387def : Pat<(addc GR32:$src1, (load addr:$src2)),
2388 (ADD32rm GR32:$src1, addr:$src2)>;
2389def : Pat<(addc GR32:$src1, imm:$src2),
2390 (ADD32ri GR32:$src1, imm:$src2)>;
2391def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
2392 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002393
Evan Cheng069287d2006-05-16 07:21:53 +00002394def : Pat<(subc GR32:$src1, GR32:$src2),
2395 (SUB32rr GR32:$src1, GR32:$src2)>;
2396def : Pat<(subc GR32:$src1, (load addr:$src2)),
2397 (SUB32rm GR32:$src1, addr:$src2)>;
2398def : Pat<(subc GR32:$src1, imm:$src2),
2399 (SUB32ri GR32:$src1, imm:$src2)>;
2400def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
2401 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002402
Evan Chengb8414332006-01-13 21:45:19 +00002403def : Pat<(truncstore (i8 imm:$src), addr:$dst, i1),
2404 (MOV8mi addr:$dst, imm:$src)>;
Evan Cheng069287d2006-05-16 07:21:53 +00002405def : Pat<(truncstore GR8:$src, addr:$dst, i1),
2406 (MOV8mr addr:$dst, GR8:$src)>;
Evan Chengb8414332006-01-13 21:45:19 +00002407
Evan Cheng510e4782006-01-09 23:10:28 +00002408// {s|z}extload bool -> {s|z}extload byte
2409def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
2410def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
Evan Chenge5d93432006-01-17 07:02:46 +00002411def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002412def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2413def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2414
2415// extload bool -> extload byte
Evan Cheng47137242006-05-05 08:23:07 +00002416def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
2417def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2418def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2419def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
2420def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
2421def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002422
2423// anyext -> zext
Evan Cheng069287d2006-05-16 07:21:53 +00002424def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
2425def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
2426def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
Evan Cheng6e16ee52006-03-25 09:45:48 +00002427def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
2428def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
2429def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002430
Evan Chengcfa260b2006-01-06 02:31:59 +00002431//===----------------------------------------------------------------------===//
2432// Some peepholes
2433//===----------------------------------------------------------------------===//
2434
2435// (shl x, 1) ==> (add x, x)
Evan Cheng069287d2006-05-16 07:21:53 +00002436def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
2437def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
2438def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002439
Evan Cheng956044c2006-01-19 23:26:24 +00002440// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002441def : Pat<(or (srl GR32:$src1, CL:$amt),
2442 (shl GR32:$src2, (sub 32, CL:$amt))),
2443 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002444
Evan Cheng21d54432006-01-20 01:13:30 +00002445def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002446 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2447 (SHRD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002448
Evan Cheng956044c2006-01-19 23:26:24 +00002449// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002450def : Pat<(or (shl GR32:$src1, CL:$amt),
2451 (srl GR32:$src2, (sub 32, CL:$amt))),
2452 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002453
Evan Cheng21d54432006-01-20 01:13:30 +00002454def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002455 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2456 (SHLD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002457
Evan Cheng956044c2006-01-19 23:26:24 +00002458// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002459def : Pat<(or (srl GR16:$src1, CL:$amt),
2460 (shl GR16:$src2, (sub 16, CL:$amt))),
2461 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002462
Evan Cheng21d54432006-01-20 01:13:30 +00002463def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002464 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2465 (SHRD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002466
Evan Cheng956044c2006-01-19 23:26:24 +00002467// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002468def : Pat<(or (shl GR16:$src1, CL:$amt),
2469 (srl GR16:$src2, (sub 16, CL:$amt))),
2470 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002471
2472def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002473 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2474 (SHLD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng4e4c71e2006-02-21 20:00:20 +00002475
2476
2477//===----------------------------------------------------------------------===//
2478// Floating Point Stack Support
2479//===----------------------------------------------------------------------===//
2480
2481include "X86InstrFPStack.td"
2482
2483//===----------------------------------------------------------------------===//
2484// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
2485//===----------------------------------------------------------------------===//
2486
2487include "X86InstrMMX.td"
2488
2489//===----------------------------------------------------------------------===//
2490// XMM Floating point support (requires SSE / SSE2)
2491//===----------------------------------------------------------------------===//
2492
2493include "X86InstrSSE.td"