blob: 97f6d9ff8be8260a267288daa9843af8a5efdc66 [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 Chenge6ad27e2006-05-30 06:59:36 +0000136 [add, mul, shl, or, 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 Chengcbe70e12006-05-31 22:34:26 +0000363 "mov{b} {${src:subreg8}, $dst|$dst, ${src:subreg8}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000364def TRUNC_GR16_GR8 : I<0x88, MRMDestReg, (ops GR8:$dst, GR16_:$src),
Evan Chengcbe70e12006-05-31 22:34:26 +0000365 "mov{b} {${src:subreg8}, $dst|$dst, ${src:subreg8}}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000366def TRUNC_GR32_GR16 : I<0x89, MRMDestReg, (ops GR16:$dst, GR32:$src),
Evan Chengcbe70e12006-05-31 22:34:26 +0000367 "mov{w} {${src:subreg16}, $dst|$dst, ${src:subreg16}}",
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 Cheng94b14532006-06-02 21:09:10 +0000526def REP_MOVSD : I<0xA5, RawFrm, (ops), "{rep;movsl|rep movsd}",
Evan Cheng67f92a72006-01-11 22:15:48 +0000527 [(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 Lattner1cca5e32003-08-03 21:54:21 +0000709
Chris Lattner1cca5e32003-08-03 21:54:21 +0000710//===----------------------------------------------------------------------===//
711// Two address Instructions...
712//
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000713let isTwoAddress = 1 in {
Chris Lattner1cca5e32003-08-03 21:54:21 +0000714
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000715// Conditional moves
Evan Cheng069287d2006-05-16 07:21:53 +0000716def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
717 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000718 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000719 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000720 X86_COND_B))]>,
721 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000722def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
723 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000724 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000725 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000726 X86_COND_B))]>,
727 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000728def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
729 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000730 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000731 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000732 X86_COND_B))]>,
733 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000734def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
735 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000736 "cmovb {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000737 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000738 X86_COND_B))]>,
739 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000740
Evan Cheng069287d2006-05-16 07:21:53 +0000741def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
742 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000743 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000744 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000745 X86_COND_AE))]>,
746 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000747def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
748 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000749 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000750 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000751 X86_COND_AE))]>,
752 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000753def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
754 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000755 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000756 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000757 X86_COND_AE))]>,
758 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000759def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
760 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000761 "cmovae {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000762 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000763 X86_COND_AE))]>,
764 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000765
Evan Cheng069287d2006-05-16 07:21:53 +0000766def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
767 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000768 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000769 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000770 X86_COND_E))]>,
771 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000772def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
773 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000774 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000775 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000776 X86_COND_E))]>,
777 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000778def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
779 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000780 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000781 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000782 X86_COND_E))]>,
783 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000784def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
785 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000786 "cmove {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000787 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000788 X86_COND_E))]>,
789 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000790
Evan Cheng069287d2006-05-16 07:21:53 +0000791def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
792 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000793 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000794 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000795 X86_COND_NE))]>,
796 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000797def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
798 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000799 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000800 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000801 X86_COND_NE))]>,
802 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000803def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
804 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000805 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000806 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000807 X86_COND_NE))]>,
808 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000809def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
810 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000811 "cmovne {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000812 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000813 X86_COND_NE))]>,
814 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000815
Evan Cheng069287d2006-05-16 07:21:53 +0000816def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
817 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000818 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000819 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000820 X86_COND_BE))]>,
821 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000822def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
823 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000824 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000825 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000826 X86_COND_BE))]>,
827 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000828def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
829 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000830 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000831 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000832 X86_COND_BE))]>,
833 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000834def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
835 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000836 "cmovbe {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000837 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000838 X86_COND_BE))]>,
839 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000840
Evan Cheng069287d2006-05-16 07:21:53 +0000841def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
842 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000843 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000844 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000845 X86_COND_A))]>,
846 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000847def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
848 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000849 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000850 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000851 X86_COND_A))]>,
852 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000853def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
854 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000855 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000856 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000857 X86_COND_A))]>,
858 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000859def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
860 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000861 "cmova {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000862 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000863 X86_COND_A))]>,
864 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000865
Evan Cheng069287d2006-05-16 07:21:53 +0000866def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
867 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000868 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000869 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000870 X86_COND_L))]>,
871 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000872def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
873 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000874 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000875 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000876 X86_COND_L))]>,
877 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000878def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
879 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000880 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000881 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000882 X86_COND_L))]>,
883 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000884def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
885 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000886 "cmovl {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000887 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000888 X86_COND_L))]>,
889 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000890
Evan Cheng069287d2006-05-16 07:21:53 +0000891def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
892 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000893 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000894 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000895 X86_COND_GE))]>,
896 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000897def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
898 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000899 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000900 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000901 X86_COND_GE))]>,
902 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000903def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
904 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000905 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000906 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000907 X86_COND_GE))]>,
908 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000909def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
910 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000911 "cmovge {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000912 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000913 X86_COND_GE))]>,
914 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000915
Evan Cheng069287d2006-05-16 07:21:53 +0000916def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
917 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000918 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000919 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000920 X86_COND_LE))]>,
921 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000922def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
923 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000924 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000925 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000926 X86_COND_LE))]>,
927 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000928def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
929 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000930 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000931 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000932 X86_COND_LE))]>,
933 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000934def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
935 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000936 "cmovle {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000937 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000938 X86_COND_LE))]>,
939 TB;
Evan Chengaed7c722005-12-17 01:24:02 +0000940
Evan Cheng069287d2006-05-16 07:21:53 +0000941def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
942 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000943 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000944 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000945 X86_COND_G))]>,
946 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000947def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
948 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000949 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000950 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000951 X86_COND_G))]>,
952 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000953def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
954 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000955 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000956 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000957 X86_COND_G))]>,
958 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000959def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
960 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +0000961 "cmovg {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000962 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000963 X86_COND_G))]>,
964 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000965
Evan Cheng069287d2006-05-16 07:21:53 +0000966def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
967 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000968 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000969 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000970 X86_COND_S))]>,
971 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000972def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
973 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000974 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000975 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000976 X86_COND_S))]>,
977 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000978def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
979 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000980 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000981 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000982 X86_COND_S))]>,
983 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000984def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
985 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000986 "cmovs {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000987 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000988 X86_COND_S))]>,
989 TB;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000990
Evan Cheng069287d2006-05-16 07:21:53 +0000991def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
992 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000993 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000994 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000995 X86_COND_NS))]>,
996 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000997def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
998 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +0000999 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001000 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001001 X86_COND_NS))]>,
1002 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001003def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
1004 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001005 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001006 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001007 X86_COND_NS))]>,
1008 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001009def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1010 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001011 "cmovns {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001012 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001013 X86_COND_NS))]>,
1014 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +00001015
Evan Cheng069287d2006-05-16 07:21:53 +00001016def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
1017 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001018 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001019 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001020 X86_COND_P))]>,
1021 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001022def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1023 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001024 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001025 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001026 X86_COND_P))]>,
1027 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001028def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
1029 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001030 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001031 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001032 X86_COND_P))]>,
1033 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001034def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1035 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001036 "cmovp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001037 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001038 X86_COND_P))]>,
1039 TB;
Chris Lattner57fbfb52005-01-10 22:09:33 +00001040
Evan Cheng069287d2006-05-16 07:21:53 +00001041def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
1042 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001043 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001044 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001045 X86_COND_NP))]>,
1046 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001047def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1048 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001049 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001050 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001051 X86_COND_NP))]>,
1052 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001053def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
1054 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001055 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001056 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001057 X86_COND_NP))]>,
1058 TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001059def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
1060 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd9558e02006-01-06 00:43:03 +00001061 "cmovnp {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001062 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001063 X86_COND_NP))]>,
1064 TB;
Chris Lattner57fbfb52005-01-10 22:09:33 +00001065
1066
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001067// unary instructions
Evan Cheng069287d2006-05-16 07:21:53 +00001068def NEG8r : I<0xF6, MRM3r, (ops GR8 :$dst, GR8 :$src), "neg{b} $dst",
1069 [(set GR8:$dst, (ineg GR8:$src))]>;
1070def NEG16r : I<0xF7, MRM3r, (ops GR16:$dst, GR16:$src), "neg{w} $dst",
1071 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
1072def NEG32r : I<0xF7, MRM3r, (ops GR32:$dst, GR32:$src), "neg{l} $dst",
1073 [(set GR32:$dst, (ineg GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001074let isTwoAddress = 0 in {
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001075 def NEG8m : I<0xF6, MRM3m, (ops i8mem :$dst), "neg{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001076 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001077 def NEG16m : I<0xF7, MRM3m, (ops i16mem:$dst), "neg{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001078 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001079 def NEG32m : I<0xF7, MRM3m, (ops i32mem:$dst), "neg{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001080 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1081
Chris Lattner57a02302004-08-11 04:31:00 +00001082}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001083
Evan Cheng069287d2006-05-16 07:21:53 +00001084def NOT8r : I<0xF6, MRM2r, (ops GR8 :$dst, GR8 :$src), "not{b} $dst",
1085 [(set GR8:$dst, (not GR8:$src))]>;
1086def NOT16r : I<0xF7, MRM2r, (ops GR16:$dst, GR16:$src), "not{w} $dst",
1087 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
1088def NOT32r : I<0xF7, MRM2r, (ops GR32:$dst, GR32:$src), "not{l} $dst",
1089 [(set GR32:$dst, (not GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001090let isTwoAddress = 0 in {
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001091 def NOT8m : I<0xF6, MRM2m, (ops i8mem :$dst), "not{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001092 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001093 def NOT16m : I<0xF7, MRM2m, (ops i16mem:$dst), "not{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001094 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Evan Cheng5ce4edb2005-12-13 00:54:44 +00001095 def NOT32m : I<0xF7, MRM2m, (ops i32mem:$dst), "not{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001096 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001097}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001098
Evan Chengb51a0592005-12-10 00:48:20 +00001099// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng069287d2006-05-16 07:21:53 +00001100def INC8r : I<0xFE, MRM0r, (ops GR8 :$dst, GR8 :$src), "inc{b} $dst",
1101 [(set GR8:$dst, (add GR8:$src, 1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001102let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001103def INC16r : I<0xFF, MRM0r, (ops GR16:$dst, GR16:$src), "inc{w} $dst",
1104 [(set GR16:$dst, (add GR16:$src, 1))]>, OpSize;
1105def INC32r : I<0xFF, MRM0r, (ops GR32:$dst, GR32:$src), "inc{l} $dst",
1106 [(set GR32:$dst, (add GR32:$src, 1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001107}
Chris Lattner57a02302004-08-11 04:31:00 +00001108let isTwoAddress = 0 in {
Evan Cheng6cad2762005-12-13 01:02:47 +00001109 def INC8m : I<0xFE, MRM0m, (ops i8mem :$dst), "inc{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001110 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Evan Cheng6cad2762005-12-13 01:02:47 +00001111 def INC16m : I<0xFF, MRM0m, (ops i16mem:$dst), "inc{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001112 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize;
Evan Cheng6cad2762005-12-13 01:02:47 +00001113 def INC32m : I<0xFF, MRM0m, (ops i32mem:$dst), "inc{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001114 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001115}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001116
Evan Cheng069287d2006-05-16 07:21:53 +00001117def DEC8r : I<0xFE, MRM1r, (ops GR8 :$dst, GR8 :$src), "dec{b} $dst",
1118 [(set GR8:$dst, (add GR8:$src, -1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001119let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001120def DEC16r : I<0xFF, MRM1r, (ops GR16:$dst, GR16:$src), "dec{w} $dst",
1121 [(set GR16:$dst, (add GR16:$src, -1))]>, OpSize;
1122def DEC32r : I<0xFF, MRM1r, (ops GR32:$dst, GR32:$src), "dec{l} $dst",
1123 [(set GR32:$dst, (add GR32:$src, -1))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001124}
Chris Lattner57a02302004-08-11 04:31:00 +00001125
1126let isTwoAddress = 0 in {
Evan Cheng6cad2762005-12-13 01:02:47 +00001127 def DEC8m : I<0xFE, MRM1m, (ops i8mem :$dst), "dec{b} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001128 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Evan Cheng6cad2762005-12-13 01:02:47 +00001129 def DEC16m : I<0xFF, MRM1m, (ops i16mem:$dst), "dec{w} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001130 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize;
Evan Cheng6cad2762005-12-13 01:02:47 +00001131 def DEC32m : I<0xFF, MRM1m, (ops i32mem:$dst), "dec{l} $dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001132 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001133}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001134
1135// Logical operators...
Chris Lattnercc65bee2005-01-02 02:35:46 +00001136let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001137def AND8rr : I<0x20, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001138 (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001139 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001140 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001141def AND16rr : I<0x21, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001142 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001143 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001144 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001145def AND32rr : I<0x21, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001146 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001147 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001148 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001149}
Chris Lattner57a02302004-08-11 04:31:00 +00001150
Chris Lattner3a173df2004-10-03 20:35:00 +00001151def AND8rm : I<0x22, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001152 (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001153 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001154 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001155def AND16rm : I<0x23, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001156 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001157 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001158 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001159def AND32rm : I<0x23, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001160 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001161 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001162 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001163
Chris Lattner3a173df2004-10-03 20:35:00 +00001164def AND8ri : Ii8<0x80, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001165 (ops GR8 :$dst, GR8 :$src1, i8imm :$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001166 "and{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001167 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001168def AND16ri : Ii16<0x81, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001169 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001170 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001171 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001172def AND32ri : Ii32<0x81, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001173 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001174 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001175 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001176def AND16ri8 : Ii8<0x83, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001177 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001178 "and{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001179 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001180 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001181def AND32ri8 : Ii8<0x83, MRM4r,
Evan Cheng069287d2006-05-16 07:21:53 +00001182 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001183 "and{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001184 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001185
1186let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001187 def AND8mr : I<0x20, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001188 (ops i8mem :$dst, GR8 :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001189 "and{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001190 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001191 def AND16mr : I<0x21, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001192 (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001193 "and{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001194 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001195 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001196 def AND32mr : I<0x21, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001197 (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001198 "and{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001199 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001200 def AND8mi : Ii8<0x80, MRM4m,
1201 (ops i8mem :$dst, i8imm :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001202 "and{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001203 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001204 def AND16mi : Ii16<0x81, MRM4m,
1205 (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001206 "and{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001207 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001208 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001209 def AND32mi : Ii32<0x81, MRM4m,
1210 (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001211 "and{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001212 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001213 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001214 (ops i16mem:$dst, i16i8imm :$src),
1215 "and{w} {$src, $dst|$dst, $src}",
1216 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1217 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001218 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001219 (ops i32mem:$dst, i32i8imm :$src),
1220 "and{l} {$src, $dst|$dst, $src}",
Evan Chenge3703d42006-01-14 01:18:49 +00001221 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001222}
1223
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001224
Chris Lattnercc65bee2005-01-02 02:35:46 +00001225let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001226def OR8rr : I<0x08, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001227 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001228 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
1229def OR16rr : I<0x09, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001230 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001231 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
1232def OR32rr : I<0x09, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001233 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001234 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001235}
Evan Cheng069287d2006-05-16 07:21:53 +00001236def OR8rm : I<0x0A, MRMSrcMem , (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001237 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001238 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
1239def OR16rm : I<0x0B, MRMSrcMem , (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001240 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001241 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
1242def OR32rm : I<0x0B, MRMSrcMem , (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001243 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001244 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001245
Evan Cheng069287d2006-05-16 07:21:53 +00001246def OR8ri : Ii8 <0x80, MRM1r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001247 "or{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001248 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
1249def OR16ri : Ii16<0x81, MRM1r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001250 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001251 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
1252def OR32ri : Ii32<0x81, MRM1r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001253 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001254 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001255
Evan Cheng069287d2006-05-16 07:21:53 +00001256def OR16ri8 : Ii8<0x83, MRM1r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001257 "or{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001258 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
1259def OR32ri8 : Ii8<0x83, MRM1r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001260 "or{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001261 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001262let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001263 def OR8mr : I<0x08, MRMDestMem, (ops i8mem:$dst, GR8:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001264 "or{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001265 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
1266 def OR16mr : I<0x09, MRMDestMem, (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001267 "or{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001268 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
1269 def OR32mr : I<0x09, MRMDestMem, (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001270 "or{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001271 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001272 def OR8mi : Ii8<0x80, MRM1m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001273 "or{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001274 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001275 def OR16mi : Ii16<0x81, MRM1m, (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001276 "or{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001277 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001278 OpSize;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001279 def OR32mi : Ii32<0x81, MRM1m, (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001280 "or{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001281 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Cheng0ef3a772005-12-13 01:41:36 +00001282 def OR16mi8 : Ii8<0x83, MRM1m, (ops i16mem:$dst, i16i8imm:$src),
1283 "or{w} {$src, $dst|$dst, $src}",
1284 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1285 OpSize;
1286 def OR32mi8 : Ii8<0x83, MRM1m, (ops i32mem:$dst, i32i8imm:$src),
1287 "or{l} {$src, $dst|$dst, $src}",
1288 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001289}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001290
1291
Chris Lattnercc65bee2005-01-02 02:35:46 +00001292let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001293def XOR8rr : I<0x30, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001294 (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001295 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001296 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001297def XOR16rr : I<0x31, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001298 (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001299 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001300 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001301def XOR32rr : I<0x31, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001302 (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001303 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001304 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001305}
1306
Chris Lattner3a173df2004-10-03 20:35:00 +00001307def XOR8rm : I<0x32, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001308 (ops GR8 :$dst, GR8:$src1, i8mem :$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001309 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001310 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001311def XOR16rm : I<0x33, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001312 (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001313 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001314 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001315def XOR32rm : I<0x33, MRMSrcMem ,
Evan Cheng069287d2006-05-16 07:21:53 +00001316 (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001317 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001318 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001319
Chris Lattner3a173df2004-10-03 20:35:00 +00001320def XOR8ri : Ii8<0x80, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001321 (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001322 "xor{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001323 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001324def XOR16ri : Ii16<0x81, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001325 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001326 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001327 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001328def XOR32ri : Ii32<0x81, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001329 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001330 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001331 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001332def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001333 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001334 "xor{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001335 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001336 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001337def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Cheng069287d2006-05-16 07:21:53 +00001338 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001339 "xor{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001340 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001341let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001342 def XOR8mr : I<0x30, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001343 (ops i8mem :$dst, GR8 :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001344 "xor{b} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001345 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001346 def XOR16mr : I<0x31, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001347 (ops i16mem:$dst, GR16:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001348 "xor{w} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001349 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001350 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001351 def XOR32mr : I<0x31, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001352 (ops i32mem:$dst, GR32:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001353 "xor{l} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001354 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001355 def XOR8mi : Ii8<0x80, MRM6m,
1356 (ops i8mem :$dst, i8imm :$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001357 "xor{b} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001358 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001359 def XOR16mi : Ii16<0x81, MRM6m,
1360 (ops i16mem:$dst, i16imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001361 "xor{w} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001362 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001363 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001364 def XOR32mi : Ii32<0x81, MRM6m,
1365 (ops i32mem:$dst, i32imm:$src),
Evan Cheng0ef3a772005-12-13 01:41:36 +00001366 "xor{l} {$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001367 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001368 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001369 (ops i16mem:$dst, i16i8imm :$src),
1370 "xor{w} {$src, $dst|$dst, $src}",
1371 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1372 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001373 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001374 (ops i32mem:$dst, i32i8imm :$src),
1375 "xor{l} {$src, $dst|$dst, $src}",
1376 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001377}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001378
1379// Shift instructions
Evan Cheng069287d2006-05-16 07:21:53 +00001380def SHL8rCL : I<0xD2, MRM4r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001381 "shl{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001382 [(set GR8:$dst, (shl GR8:$src, CL))]>, Imp<[CL],[]>;
1383def SHL16rCL : I<0xD3, MRM4r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001384 "shl{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001385 [(set GR16:$dst, (shl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1386def SHL32rCL : I<0xD3, MRM4r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001387 "shl{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001388 [(set GR32:$dst, (shl GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001389
Evan Cheng069287d2006-05-16 07:21:53 +00001390def SHL8ri : Ii8<0xC0, MRM4r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001391 "shl{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001392 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001393let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001394def SHL16ri : Ii8<0xC1, MRM4r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001395 "shl{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001396 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1397def SHL32ri : Ii8<0xC1, MRM4r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001398 "shl{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001399 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001400}
Chris Lattnerf29ed092004-08-11 05:07:25 +00001401
1402let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001403 def SHL8mCL : I<0xD2, MRM4m, (ops i8mem :$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001404 "shl{b} {%cl, $dst|$dst, %CL}",
1405 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>,
1406 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001407 def SHL16mCL : I<0xD3, MRM4m, (ops i16mem:$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001408 "shl{w} {%cl, $dst|$dst, %CL}",
1409 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>,
1410 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001411 def SHL32mCL : I<0xD3, MRM4m, (ops i32mem:$dst),
Evan Cheng763b0292005-12-13 02:34:51 +00001412 "shl{l} {%cl, $dst|$dst, %CL}",
1413 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>,
1414 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001415 def SHL8mi : Ii8<0xC0, MRM4m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001416 "shl{b} {$src, $dst|$dst, $src}",
1417 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001418 def SHL16mi : Ii8<0xC1, MRM4m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001419 "shl{w} {$src, $dst|$dst, $src}",
1420 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1421 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001422 def SHL32mi : Ii8<0xC1, MRM4m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng763b0292005-12-13 02:34:51 +00001423 "shl{l} {$src, $dst|$dst, $src}",
1424 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001425}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001426
Evan Cheng069287d2006-05-16 07:21:53 +00001427def SHR8rCL : I<0xD2, MRM5r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001428 "shr{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001429 [(set GR8:$dst, (srl GR8:$src, CL))]>, Imp<[CL],[]>;
1430def SHR16rCL : I<0xD3, MRM5r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001431 "shr{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001432 [(set GR16:$dst, (srl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1433def SHR32rCL : I<0xD3, MRM5r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001434 "shr{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001435 [(set GR32:$dst, (srl GR32:$src, CL))]>, Imp<[CL],[]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001436
Evan Cheng069287d2006-05-16 07:21:53 +00001437def SHR8ri : Ii8<0xC0, MRM5r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001438 "shr{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001439 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
1440def SHR16ri : Ii8<0xC1, MRM5r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001441 "shr{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001442 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1443def SHR32ri : Ii8<0xC1, MRM5r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001444 "shr{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001445 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001446
Chris Lattner57a02302004-08-11 04:31:00 +00001447let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001448 def SHR8mCL : I<0xD2, MRM5m, (ops i8mem :$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001449 "shr{b} {%cl, $dst|$dst, %CL}",
1450 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>,
1451 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001452 def SHR16mCL : I<0xD3, MRM5m, (ops i16mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001453 "shr{w} {%cl, $dst|$dst, %CL}",
1454 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
1455 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001456 def SHR32mCL : I<0xD3, MRM5m, (ops i32mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001457 "shr{l} {%cl, $dst|$dst, %CL}",
1458 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>,
1459 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001460 def SHR8mi : Ii8<0xC0, MRM5m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001461 "shr{b} {$src, $dst|$dst, $src}",
1462 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001463 def SHR16mi : Ii8<0xC1, MRM5m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001464 "shr{w} {$src, $dst|$dst, $src}",
1465 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1466 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001467 def SHR32mi : Ii8<0xC1, MRM5m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001468 "shr{l} {$src, $dst|$dst, $src}",
1469 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001470}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001471
Evan Cheng069287d2006-05-16 07:21:53 +00001472def SAR8rCL : I<0xD2, MRM7r, (ops GR8 :$dst, GR8 :$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001473 "sar{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001474 [(set GR8:$dst, (sra GR8:$src, CL))]>, Imp<[CL],[]>;
1475def SAR16rCL : I<0xD3, MRM7r, (ops GR16:$dst, GR16:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001476 "sar{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001477 [(set GR16:$dst, (sra GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1478def SAR32rCL : I<0xD3, MRM7r, (ops GR32:$dst, GR32:$src),
Evan Cheng640f2992005-12-01 00:43:55 +00001479 "sar{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001480 [(set GR32:$dst, (sra GR32:$src, CL))]>, Imp<[CL],[]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001481
Evan Cheng069287d2006-05-16 07:21:53 +00001482def SAR8ri : Ii8<0xC0, MRM7r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001483 "sar{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001484 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
1485def SAR16ri : Ii8<0xC1, MRM7r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001486 "sar{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001487 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
Chris Lattner3d36a9f2005-12-05 02:40:25 +00001488 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001489def SAR32ri : Ii8<0xC1, MRM7r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001490 "sar{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001491 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001492let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001493 def SAR8mCL : I<0xD2, MRM7m, (ops i8mem :$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001494 "sar{b} {%cl, $dst|$dst, %CL}",
1495 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>,
1496 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001497 def SAR16mCL : I<0xD3, MRM7m, (ops i16mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001498 "sar{w} {%cl, $dst|$dst, %CL}",
1499 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>,
1500 Imp<[CL],[]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001501 def SAR32mCL : I<0xD3, MRM7m, (ops i32mem:$dst),
Evan Cheng85dd8892005-12-13 07:24:22 +00001502 "sar{l} {%cl, $dst|$dst, %CL}",
1503 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>,
1504 Imp<[CL],[]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001505 def SAR8mi : Ii8<0xC0, MRM7m, (ops i8mem :$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001506 "sar{b} {$src, $dst|$dst, $src}",
1507 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001508 def SAR16mi : Ii8<0xC1, MRM7m, (ops i16mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001509 "sar{w} {$src, $dst|$dst, $src}",
1510 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1511 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001512 def SAR32mi : Ii8<0xC1, MRM7m, (ops i32mem:$dst, i8imm:$src),
Evan Cheng85dd8892005-12-13 07:24:22 +00001513 "sar{l} {$src, $dst|$dst, $src}",
1514 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001515}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001516
Chris Lattner40ff6332005-01-19 07:50:03 +00001517// Rotate instructions
1518// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng069287d2006-05-16 07:21:53 +00001519def ROL8rCL : I<0xD2, MRM0r, (ops GR8 :$dst, GR8 :$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001520 "rol{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001521 [(set GR8:$dst, (rotl GR8:$src, CL))]>, Imp<[CL],[]>;
1522def ROL16rCL : I<0xD3, MRM0r, (ops GR16:$dst, GR16:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001523 "rol{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001524 [(set GR16:$dst, (rotl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1525def ROL32rCL : I<0xD3, MRM0r, (ops GR32:$dst, GR32:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001526 "rol{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001527 [(set GR32:$dst, (rotl GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001528
Evan Cheng069287d2006-05-16 07:21:53 +00001529def ROL8ri : Ii8<0xC0, MRM0r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001530 "rol{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001531 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
1532def ROL16ri : Ii8<0xC1, MRM0r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001533 "rol{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001534 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1535def ROL32ri : Ii8<0xC1, MRM0r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001536 "rol{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001537 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001538
1539let isTwoAddress = 0 in {
1540 def ROL8mCL : I<0xD2, MRM0m, (ops i8mem :$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001541 "rol{b} {%cl, $dst|$dst, %CL}",
1542 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>,
1543 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001544 def ROL16mCL : I<0xD3, MRM0m, (ops i16mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001545 "rol{w} {%cl, $dst|$dst, %CL}",
1546 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>,
1547 Imp<[CL],[]>, OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001548 def ROL32mCL : I<0xD3, MRM0m, (ops i32mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001549 "rol{l} {%cl, $dst|$dst, %CL}",
1550 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>,
1551 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001552 def ROL8mi : Ii8<0xC0, MRM0m, (ops i8mem :$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001553 "rol{b} {$src, $dst|$dst, $src}",
1554 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001555 def ROL16mi : Ii8<0xC1, MRM0m, (ops i16mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001556 "rol{w} {$src, $dst|$dst, $src}",
1557 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1558 OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001559 def ROL32mi : Ii8<0xC1, MRM0m, (ops i32mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001560 "rol{l} {$src, $dst|$dst, $src}",
1561 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001562}
1563
Evan Cheng069287d2006-05-16 07:21:53 +00001564def ROR8rCL : I<0xD2, MRM1r, (ops GR8 :$dst, GR8 :$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001565 "ror{b} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001566 [(set GR8:$dst, (rotr GR8:$src, CL))]>, Imp<[CL],[]>;
1567def ROR16rCL : I<0xD3, MRM1r, (ops GR16:$dst, GR16:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001568 "ror{w} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001569 [(set GR16:$dst, (rotr GR16:$src, CL))]>, Imp<[CL],[]>, OpSize;
1570def ROR32rCL : I<0xD3, MRM1r, (ops GR32:$dst, GR32:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001571 "ror{l} {%cl, $dst|$dst, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001572 [(set GR32:$dst, (rotr GR32:$src, CL))]>, Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001573
Evan Cheng069287d2006-05-16 07:21:53 +00001574def ROR8ri : Ii8<0xC0, MRM1r, (ops GR8 :$dst, GR8 :$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001575 "ror{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001576 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
1577def ROR16ri : Ii8<0xC1, MRM1r, (ops GR16:$dst, GR16:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001578 "ror{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001579 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
1580def ROR32ri : Ii8<0xC1, MRM1r, (ops GR32:$dst, GR32:$src1, i8imm:$src2),
Evan Chengeb422a72006-01-11 23:20:05 +00001581 "ror{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001582 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001583let isTwoAddress = 0 in {
1584 def ROR8mCL : I<0xD2, MRM1m, (ops i8mem :$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001585 "ror{b} {%cl, $dst|$dst, %CL}",
1586 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>,
1587 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001588 def ROR16mCL : I<0xD3, MRM1m, (ops i16mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001589 "ror{w} {%cl, $dst|$dst, %CL}",
1590 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>,
1591 Imp<[CL],[]>, OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001592 def ROR32mCL : I<0xD3, MRM1m, (ops i32mem:$dst),
Evan Chengeb422a72006-01-11 23:20:05 +00001593 "ror{l} {%cl, $dst|$dst, %CL}",
1594 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>,
1595 Imp<[CL],[]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001596 def ROR8mi : Ii8<0xC0, MRM1m, (ops i8mem :$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001597 "ror{b} {$src, $dst|$dst, $src}",
1598 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001599 def ROR16mi : Ii8<0xC1, MRM1m, (ops i16mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001600 "ror{w} {$src, $dst|$dst, $src}",
1601 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1602 OpSize;
Chris Lattner40ff6332005-01-19 07:50:03 +00001603 def ROR32mi : Ii8<0xC1, MRM1m, (ops i32mem:$dst, i8imm:$src),
Evan Chengeb422a72006-01-11 23:20:05 +00001604 "ror{l} {$src, $dst|$dst, $src}",
1605 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001606}
1607
1608
1609
1610// Double shift instructions (generalizations of rotate)
Evan Cheng069287d2006-05-16 07:21:53 +00001611def SHLD32rrCL : I<0xA5, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001612 "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001613 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001614 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001615def SHRD32rrCL : I<0xAD, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001616 "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001617 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001618 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001619def SHLD16rrCL : I<0xA5, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001620 "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001621 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001622 Imp<[CL],[]>, TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001623def SHRD16rrCL : I<0xAD, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001624 "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001625 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001626 Imp<[CL],[]>, TB, OpSize;
Chris Lattner41e431b2005-01-19 07:11:01 +00001627
1628let isCommutable = 1 in { // These instructions commute to each other.
Chris Lattner3a173df2004-10-03 20:35:00 +00001629def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001630 (ops GR32:$dst, GR32:$src1, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001631 "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001632 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001633 (i8 imm:$src3)))]>,
1634 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001635def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001636 (ops GR32:$dst, GR32:$src1, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001637 "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001638 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001639 (i8 imm:$src3)))]>,
1640 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001641def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001642 (ops GR16:$dst, GR16:$src1, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001643 "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001644 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001645 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001646 TB, OpSize;
1647def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00001648 (ops GR16:$dst, GR16:$src1, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001649 "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001650 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001651 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001652 TB, OpSize;
Chris Lattner41e431b2005-01-19 07:11:01 +00001653}
Chris Lattner0e967d42004-08-01 08:13:11 +00001654
Chris Lattner57a02302004-08-11 04:31:00 +00001655let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001656 def SHLD32mrCL : I<0xA5, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001657 "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001658 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001659 addr:$dst)]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001660 Imp<[CL],[]>, TB;
Evan Cheng069287d2006-05-16 07:21:53 +00001661 def SHRD32mrCL : I<0xAD, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001662 "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001663 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001664 addr:$dst)]>,
Chris Lattner3a173df2004-10-03 20:35:00 +00001665 Imp<[CL],[]>, TB;
1666 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001667 (ops i32mem:$dst, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001668 "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001669 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001670 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001671 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001672 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001673 (ops i32mem:$dst, GR32:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001674 "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001675 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001676 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001677 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001678
Evan Cheng069287d2006-05-16 07:21:53 +00001679 def SHLD16mrCL : I<0xA5, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001680 "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001681 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001682 addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001683 Imp<[CL],[]>, TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001684 def SHRD16mrCL : I<0xAD, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001685 "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001686 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Chenge3413162006-01-09 18:33:28 +00001687 addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001688 Imp<[CL],[]>, TB, OpSize;
1689 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001690 (ops i16mem:$dst, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001691 "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001692 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001693 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001694 TB, OpSize;
1695 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00001696 (ops i16mem:$dst, GR16:$src2, i8imm:$src3),
Evan Chenge3413162006-01-09 18:33:28 +00001697 "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001698 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001699 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001700 TB, OpSize;
Chris Lattner57a02302004-08-11 04:31:00 +00001701}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001702
1703
Chris Lattnercc65bee2005-01-02 02:35:46 +00001704// Arithmetic.
1705let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001706def ADD8rr : I<0x00, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001707 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001708 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001709let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001710def ADD16rr : I<0x01, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001711 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001712 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
1713def ADD32rr : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001714 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001715 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001716} // end isConvertibleToThreeAddress
1717} // end isCommutable
Evan Cheng069287d2006-05-16 07:21:53 +00001718def ADD8rm : I<0x02, MRMSrcMem, (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001719 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001720 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
1721def ADD16rm : I<0x03, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001722 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001723 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>, OpSize;
1724def ADD32rm : I<0x03, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengab24ed22005-12-09 22:48:48 +00001725 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001726 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001727
Evan Cheng069287d2006-05-16 07:21:53 +00001728def ADD8ri : Ii8<0x80, MRM0r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001729 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001730 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001731
1732let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng069287d2006-05-16 07:21:53 +00001733def ADD16ri : Ii16<0x81, MRM0r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001734 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001735 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
1736def ADD32ri : Ii32<0x81, MRM0r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001737 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001738 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng069287d2006-05-16 07:21:53 +00001739def ADD16ri8 : Ii8<0x83, MRM0r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001740 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001741 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001742 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001743def ADD32ri8 : Ii8<0x83, MRM0r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001744 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001745 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng09e3c802006-05-19 18:40:54 +00001746}
Chris Lattner57a02302004-08-11 04:31:00 +00001747
1748let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001749 def ADD8mr : I<0x00, MRMDestMem, (ops i8mem :$dst, GR8 :$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001750 "add{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001751 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
1752 def ADD16mr : I<0x01, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001753 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001754 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001755 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001756 def ADD32mr : I<0x01, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001757 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001758 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001759 def ADD8mi : Ii8<0x80, MRM0m, (ops i8mem :$dst, i8imm :$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001760 "add{b} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001761 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001762 def ADD16mi : Ii16<0x81, MRM0m, (ops i16mem:$dst, i16imm:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001763 "add{w} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001764 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001765 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001766 def ADD32mi : Ii32<0x81, MRM0m, (ops i32mem:$dst, i32imm:$src2),
Evan Chengee93f9d2005-12-12 19:45:23 +00001767 "add{l} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001768 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengee93f9d2005-12-12 19:45:23 +00001769 def ADD16mi8 : Ii8<0x83, MRM0m, (ops i16mem:$dst, i16i8imm :$src2),
1770 "add{w} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001771 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
1772 OpSize;
Evan Chengee93f9d2005-12-12 19:45:23 +00001773 def ADD32mi8 : Ii8<0x83, MRM0m, (ops i32mem:$dst, i32i8imm :$src2),
1774 "add{l} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001775 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001776}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001777
Chris Lattner10197ff2005-01-03 01:27:59 +00001778let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001779def ADC32rr : I<0x11, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001780 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001781 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
Chris Lattner10197ff2005-01-03 01:27:59 +00001782}
Evan Cheng069287d2006-05-16 07:21:53 +00001783def ADC32rm : I<0x13, MRMSrcMem , (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001784 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001785 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
1786def ADC32ri : Ii32<0x81, MRM2r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001787 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001788 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
1789def ADC32ri8 : Ii8<0x83, MRM2r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001790 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001791 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001792
1793let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001794 def ADC32mr : I<0x11, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001795 "adc{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001796 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001797 def ADC32mi : Ii32<0x81, MRM2m, (ops i32mem:$dst, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001798 "adc{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001799 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chenge3413162006-01-09 18:33:28 +00001800 def ADC32mi8 : Ii8<0x83, MRM2m, (ops i32mem:$dst, i32i8imm :$src2),
1801 "adc{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001802 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001803}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001804
Evan Cheng069287d2006-05-16 07:21:53 +00001805def SUB8rr : I<0x28, MRMDestReg, (ops GR8 :$dst, GR8 :$src1, GR8 :$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001806 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001807 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
1808def SUB16rr : I<0x29, MRMDestReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001809 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001810 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
1811def SUB32rr : I<0x29, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001812 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001813 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
1814def SUB8rm : I<0x2A, MRMSrcMem, (ops GR8 :$dst, GR8 :$src1, i8mem :$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001815 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001816 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
1817def SUB16rm : I<0x2B, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001818 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001819 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
1820def SUB32rm : I<0x2B, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001821 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001822 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001823
Evan Cheng069287d2006-05-16 07:21:53 +00001824def SUB8ri : Ii8 <0x80, MRM5r, (ops GR8:$dst, GR8:$src1, i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001825 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001826 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
1827def SUB16ri : Ii16<0x81, MRM5r, (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001828 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001829 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
1830def SUB32ri : Ii32<0x81, MRM5r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001831 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001832 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
1833def SUB16ri8 : Ii8<0x83, MRM5r, (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001834 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001835 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001836 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001837def SUB32ri8 : Ii8<0x83, MRM5r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001838 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001839 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001840let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001841 def SUB8mr : I<0x28, MRMDestMem, (ops i8mem :$dst, GR8 :$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001842 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001843 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
1844 def SUB16mr : I<0x29, MRMDestMem, (ops i16mem:$dst, GR16:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001845 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001846 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001847 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001848 def SUB32mr : I<0x29, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001849 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001850 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001851 def SUB8mi : Ii8<0x80, MRM5m, (ops i8mem :$dst, i8imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001852 "sub{b} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001853 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001854 def SUB16mi : Ii16<0x81, MRM5m, (ops i16mem:$dst, i16imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001855 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001856 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001857 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001858 def SUB32mi : Ii32<0x81, MRM5m, (ops i32mem:$dst, i32imm:$src2),
Evan Chengd160d482005-12-12 21:54:05 +00001859 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001860 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chengd160d482005-12-12 21:54:05 +00001861 def SUB16mi8 : Ii8<0x83, MRM5m, (ops i16mem:$dst, i16i8imm :$src2),
1862 "sub{w} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001863 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
1864 OpSize;
Evan Chengd160d482005-12-12 21:54:05 +00001865 def SUB32mi8 : Ii8<0x83, MRM5m, (ops i32mem:$dst, i32i8imm :$src2),
1866 "sub{l} {$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001867 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001868}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001869
Evan Cheng069287d2006-05-16 07:21:53 +00001870def SBB32rr : I<0x19, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001871 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001872 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Chris Lattnerd93d3b02004-10-06 04:01:02 +00001873
Chris Lattner57a02302004-08-11 04:31:00 +00001874let isTwoAddress = 0 in {
Evan Cheng069287d2006-05-16 07:21:53 +00001875 def SBB32mr : I<0x19, MRMDestMem, (ops i32mem:$dst, GR32:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001876 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001877 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Chris Lattnerd93d3b02004-10-06 04:01:02 +00001878 def SBB8mi : Ii32<0x80, MRM3m, (ops i8mem:$dst, i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001879 "sbb{b} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001880 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001881 def SBB32mi : Ii32<0x81, MRM3m, (ops i32mem:$dst, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001882 "sbb{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001883 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Chenge3413162006-01-09 18:33:28 +00001884 def SBB32mi8 : Ii8<0x83, MRM3m, (ops i32mem:$dst, i32i8imm :$src2),
1885 "sbb{l} {$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001886 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001887}
Evan Cheng069287d2006-05-16 07:21:53 +00001888def SBB32rm : I<0x1B, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001889 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001890 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
1891def SBB32ri : Ii32<0x81, MRM3r, (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001892 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001893 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
1894def SBB32ri8 : Ii8<0x83, MRM3r, (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Evan Chenge3413162006-01-09 18:33:28 +00001895 "sbb{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001896 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001897
Chris Lattner10197ff2005-01-03 01:27:59 +00001898let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Cheng069287d2006-05-16 07:21:53 +00001899def IMUL16rr : I<0xAF, MRMSrcReg, (ops GR16:$dst, GR16:$src1, GR16:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001900 "imul{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001901 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
1902def IMUL32rr : I<0xAF, MRMSrcReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
Evan Chengf0701842005-11-29 19:38:52 +00001903 "imul{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001904 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
Chris Lattner10197ff2005-01-03 01:27:59 +00001905}
Evan Cheng069287d2006-05-16 07:21:53 +00001906def IMUL16rm : I<0xAF, MRMSrcMem, (ops GR16:$dst, GR16:$src1, i16mem:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001907 "imul{w} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001908 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001909 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001910def IMUL32rm : I<0xAF, MRMSrcMem, (ops GR32:$dst, GR32:$src1, i32mem:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001911 "imul{l} {$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001912 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001913
1914} // end Two Address instructions
1915
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001916// Suprisingly enough, these are not two address instructions!
Evan Cheng069287d2006-05-16 07:21:53 +00001917def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
1918 (ops GR16:$dst, GR16:$src1, i16imm:$src2),
Chris Lattner78432fe2005-11-17 02:01:55 +00001919 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001920 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
1921def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
1922 (ops GR32:$dst, GR32:$src1, i32imm:$src2),
Chris Lattner7a125372005-11-16 22:59:19 +00001923 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001924 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
1925def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
1926 (ops GR16:$dst, GR16:$src1, i16i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001927 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001928 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001929 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001930def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
1931 (ops GR32:$dst, GR32:$src1, i32i8imm:$src2),
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001932 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001933 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00001934
Evan Cheng069287d2006-05-16 07:21:53 +00001935def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
1936 (ops GR16:$dst, i16mem:$src1, i16imm:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001937 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001938 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
Evan Chengf281e022005-12-12 23:47:46 +00001939 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001940def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
1941 (ops GR32:$dst, i32mem:$src1, i32imm:$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001942 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001943 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
1944def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
1945 (ops GR16:$dst, i16mem:$src1, i16i8imm :$src2),
Evan Chengf281e022005-12-12 23:47:46 +00001946 "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001947 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001948 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001949def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
1950 (ops GR32:$dst, i32mem:$src1, i32i8imm: $src2),
Evan Chengf281e022005-12-12 23:47:46 +00001951 "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001952 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001953
1954//===----------------------------------------------------------------------===//
1955// Test instructions are just like AND, except they don't generate a result.
Chris Lattner3a173df2004-10-03 20:35:00 +00001956//
Chris Lattnercc65bee2005-01-02 02:35:46 +00001957let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Cheng069287d2006-05-16 07:21:53 +00001958def TEST8rr : I<0x84, MRMDestReg, (ops GR8:$src1, GR8:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001959 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001960 [(X86test GR8:$src1, GR8:$src2)]>;
1961def TEST16rr : I<0x85, MRMDestReg, (ops GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001962 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001963 [(X86test GR16:$src1, GR16:$src2)]>, OpSize;
1964def TEST32rr : I<0x85, MRMDestReg, (ops GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001965 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001966 [(X86test GR32:$src1, GR32:$src2)]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001967}
Evan Cheng069287d2006-05-16 07:21:53 +00001968def TEST8mr : I<0x84, MRMDestMem, (ops i8mem :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001969 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001970 [(X86test (loadi8 addr:$src1), GR8:$src2)]>;
1971def TEST16mr : I<0x85, MRMDestMem, (ops i16mem:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001972 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001973 [(X86test (loadi16 addr:$src1), GR16:$src2)]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001974 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001975def TEST32mr : I<0x85, MRMDestMem, (ops i32mem:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001976 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001977 [(X86test (loadi32 addr:$src1), GR32:$src2)]>;
1978def TEST8rm : I<0x84, MRMSrcMem, (ops GR8 :$src1, i8mem :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001979 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001980 [(X86test GR8:$src1, (loadi8 addr:$src2))]>;
1981def TEST16rm : I<0x85, MRMSrcMem, (ops GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001982 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001983 [(X86test GR16:$src1, (loadi16 addr:$src2))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +00001984 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00001985def TEST32rm : I<0x85, MRMSrcMem, (ops GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001986 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001987 [(X86test GR32:$src1, (loadi32 addr:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001988
Evan Cheng069287d2006-05-16 07:21:53 +00001989def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
1990 (ops GR8:$src1, i8imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001991 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001992 [(X86test GR8:$src1, imm:$src2)]>;
1993def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
1994 (ops GR16:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001995 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001996 [(X86test GR16:$src1, imm:$src2)]>, OpSize;
1997def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
1998 (ops GR32:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00001999 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002000 [(X86test GR32:$src1, imm:$src2)]>;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002001def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Chengaed7c722005-12-17 01:24:02 +00002002 (ops i8mem:$src1, i8imm:$src2),
2003 "test{b} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002004 [(X86test (loadi8 addr:$src1), imm:$src2)]>;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002005def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
2006 (ops i16mem:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002007 "test{w} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002008 [(X86test (loadi16 addr:$src1), imm:$src2)]>,
2009 OpSize;
Chris Lattner707c6fe2004-10-04 01:38:10 +00002010def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
2011 (ops i32mem:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002012 "test{l} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002013 [(X86test (loadi32 addr:$src1), imm:$src2)]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002014
2015
2016// Condition code ops, incl. set if equal/not equal/...
Evan Chengf0701842005-11-29 19:38:52 +00002017def SAHF : I<0x9E, RawFrm, (ops), "sahf", []>, Imp<[AH],[]>; // flags = AH
2018def LAHF : I<0x9F, RawFrm, (ops), "lahf", []>, Imp<[],[AH]>; // AH = flags
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002019
Chris Lattner3a173df2004-10-03 20:35:00 +00002020def SETEr : I<0x94, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002021 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002022 "sete $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002023 [(set GR8:$dst, (X86setcc X86_COND_E))]>,
2024 TB; // GR8 = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002025def SETEm : I<0x94, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002026 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002027 "sete $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002028 [(store (X86setcc X86_COND_E), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002029 TB; // [mem8] = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002030def SETNEr : I<0x95, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002031 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002032 "setne $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002033 [(set GR8:$dst, (X86setcc X86_COND_NE))]>,
2034 TB; // GR8 = !=
Chris Lattner3a173df2004-10-03 20:35:00 +00002035def SETNEm : I<0x95, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002036 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002037 "setne $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002038 [(store (X86setcc X86_COND_NE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002039 TB; // [mem8] = !=
2040def SETLr : I<0x9C, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002041 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002042 "setl $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002043 [(set GR8:$dst, (X86setcc X86_COND_L))]>,
2044 TB; // GR8 = < signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002045def SETLm : I<0x9C, MRM0m,
2046 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002047 "setl $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002048 [(store (X86setcc X86_COND_L), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002049 TB; // [mem8] = < signed
2050def SETGEr : I<0x9D, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002051 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002052 "setge $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002053 [(set GR8:$dst, (X86setcc X86_COND_GE))]>,
2054 TB; // GR8 = >= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002055def SETGEm : I<0x9D, MRM0m,
2056 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002057 "setge $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002058 [(store (X86setcc X86_COND_GE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002059 TB; // [mem8] = >= signed
2060def SETLEr : I<0x9E, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002061 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002062 "setle $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002063 [(set GR8:$dst, (X86setcc X86_COND_LE))]>,
2064 TB; // GR8 = <= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002065def SETLEm : I<0x9E, MRM0m,
2066 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002067 "setle $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002068 [(store (X86setcc X86_COND_LE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002069 TB; // [mem8] = <= signed
2070def SETGr : I<0x9F, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002071 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002072 "setg $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002073 [(set GR8:$dst, (X86setcc X86_COND_G))]>,
2074 TB; // GR8 = > signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002075def SETGm : I<0x9F, MRM0m,
2076 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002077 "setg $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002078 [(store (X86setcc X86_COND_G), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002079 TB; // [mem8] = > signed
2080
2081def SETBr : I<0x92, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002082 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002083 "setb $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002084 [(set GR8:$dst, (X86setcc X86_COND_B))]>,
2085 TB; // GR8 = < unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002086def SETBm : I<0x92, MRM0m,
2087 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002088 "setb $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002089 [(store (X86setcc X86_COND_B), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002090 TB; // [mem8] = < unsign
2091def SETAEr : I<0x93, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002092 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002093 "setae $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002094 [(set GR8:$dst, (X86setcc X86_COND_AE))]>,
2095 TB; // GR8 = >= unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002096def SETAEm : I<0x93, MRM0m,
2097 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002098 "setae $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002099 [(store (X86setcc X86_COND_AE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002100 TB; // [mem8] = >= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002101def SETBEr : I<0x96, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002102 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002103 "setbe $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002104 [(set GR8:$dst, (X86setcc X86_COND_BE))]>,
2105 TB; // GR8 = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002106def SETBEm : I<0x96, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002107 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002108 "setbe $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002109 [(store (X86setcc X86_COND_BE), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002110 TB; // [mem8] = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002111def SETAr : I<0x97, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002112 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002113 "seta $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002114 [(set GR8:$dst, (X86setcc X86_COND_A))]>,
2115 TB; // GR8 = > signed
Chris Lattner3a173df2004-10-03 20:35:00 +00002116def SETAm : I<0x97, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002117 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002118 "seta $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002119 [(store (X86setcc X86_COND_A), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002120 TB; // [mem8] = > signed
Evan Chengd9558e02006-01-06 00:43:03 +00002121
Chris Lattner3a173df2004-10-03 20:35:00 +00002122def SETSr : I<0x98, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002123 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002124 "sets $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002125 [(set GR8:$dst, (X86setcc X86_COND_S))]>,
2126 TB; // GR8 = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002127def SETSm : I<0x98, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002128 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002129 "sets $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002130 [(store (X86setcc X86_COND_S), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002131 TB; // [mem8] = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002132def SETNSr : I<0x99, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002133 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002134 "setns $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002135 [(set GR8:$dst, (X86setcc X86_COND_NS))]>,
2136 TB; // GR8 = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002137def SETNSm : I<0x99, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002138 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002139 "setns $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002140 [(store (X86setcc X86_COND_NS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002141 TB; // [mem8] = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002142def SETPr : I<0x9A, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002143 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002144 "setp $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002145 [(set GR8:$dst, (X86setcc X86_COND_P))]>,
2146 TB; // GR8 = parity
Chris Lattner3a173df2004-10-03 20:35:00 +00002147def SETPm : I<0x9A, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002148 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002149 "setp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002150 [(store (X86setcc X86_COND_P), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002151 TB; // [mem8] = parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002152def SETNPr : I<0x9B, MRM0r,
Evan Cheng069287d2006-05-16 07:21:53 +00002153 (ops GR8 :$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002154 "setnp $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002155 [(set GR8:$dst, (X86setcc X86_COND_NP))]>,
2156 TB; // GR8 = not parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002157def SETNPm : I<0x9B, MRM0m,
Chris Lattner9fb24222005-12-21 05:34:58 +00002158 (ops i8mem:$dst),
Evan Chengd9558e02006-01-06 00:43:03 +00002159 "setnp $dst",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002160 [(store (X86setcc X86_COND_NP), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002161 TB; // [mem8] = not parity
Chris Lattner1cca5e32003-08-03 21:54:21 +00002162
2163// Integer comparisons
Chris Lattner3a173df2004-10-03 20:35:00 +00002164def CMP8rr : I<0x38, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002165 (ops GR8 :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002166 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002167 [(X86cmp GR8:$src1, GR8:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002168def CMP16rr : I<0x39, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002169 (ops GR16:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002170 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002171 [(X86cmp GR16:$src1, GR16:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002172def CMP32rr : I<0x39, MRMDestReg,
Evan Cheng069287d2006-05-16 07:21:53 +00002173 (ops GR32:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002174 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002175 [(X86cmp GR32:$src1, GR32:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002176def CMP8mr : I<0x38, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002177 (ops i8mem :$src1, GR8 :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002178 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002179 [(X86cmp (loadi8 addr:$src1), GR8:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002180def CMP16mr : I<0x39, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002181 (ops i16mem:$src1, GR16:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002182 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002183 [(X86cmp (loadi16 addr:$src1), GR16:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002184def CMP32mr : I<0x39, MRMDestMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002185 (ops i32mem:$src1, GR32:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002186 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002187 [(X86cmp (loadi32 addr:$src1), GR32:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002188def CMP8rm : I<0x3A, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002189 (ops GR8 :$src1, i8mem :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002190 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002191 [(X86cmp GR8:$src1, (loadi8 addr:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002192def CMP16rm : I<0x3B, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002193 (ops GR16:$src1, i16mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002194 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002195 [(X86cmp GR16:$src1, (loadi16 addr:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002196def CMP32rm : I<0x3B, MRMSrcMem,
Evan Cheng069287d2006-05-16 07:21:53 +00002197 (ops GR32:$src1, i32mem:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002198 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002199 [(X86cmp GR32:$src1, (loadi32 addr:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002200def CMP8ri : Ii8<0x80, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002201 (ops GR8:$src1, i8imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002202 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002203 [(X86cmp GR8:$src1, imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002204def CMP16ri : Ii16<0x81, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002205 (ops GR16:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002206 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002207 [(X86cmp GR16:$src1, imm:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002208def CMP32ri : Ii32<0x81, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002209 (ops GR32:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002210 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002211 [(X86cmp GR32:$src1, imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002212def CMP8mi : Ii8 <0x80, MRM7m,
2213 (ops i8mem :$src1, i8imm :$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002214 "cmp{b} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002215 [(X86cmp (loadi8 addr:$src1), imm:$src2)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002216def CMP16mi : Ii16<0x81, MRM7m,
2217 (ops i16mem:$src1, i16imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002218 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002219 [(X86cmp (loadi16 addr:$src1), imm:$src2)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002220def CMP32mi : Ii32<0x81, MRM7m,
2221 (ops i32mem:$src1, i32imm:$src2),
Evan Chengaed7c722005-12-17 01:24:02 +00002222 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng71fb9ad2006-01-26 00:29:36 +00002223 [(X86cmp (loadi32 addr:$src1), imm:$src2)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002224def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002225 (ops GR16:$src1, i16i8imm:$src2),
Nate Begemance944822006-03-23 01:29:48 +00002226 "cmp{w} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002227 [(X86cmp GR16:$src1, i16immSExt8:$src2)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002228def CMP16mi8 : Ii8<0x83, MRM7m,
Nate Begemance944822006-03-23 01:29:48 +00002229 (ops i16mem:$src1, i16i8imm:$src2),
2230 "cmp{w} {$src2, $src1|$src1, $src2}",
2231 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002232def CMP32mi8 : Ii8<0x83, MRM7m,
Nate Begemance944822006-03-23 01:29:48 +00002233 (ops i32mem:$src1, i32i8imm:$src2),
2234 "cmp{l} {$src2, $src1|$src1, $src2}",
2235 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002236def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Cheng069287d2006-05-16 07:21:53 +00002237 (ops GR32:$src1, i32i8imm:$src2),
Nate Begemance944822006-03-23 01:29:48 +00002238 "cmp{l} {$src2, $src1|$src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002239 [(X86cmp GR32:$src1, i32immSExt8:$src2)]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +00002240
2241// Sign/Zero extenders
Evan Cheng069287d2006-05-16 07:21:53 +00002242def MOVSX16rr8 : I<0xBE, MRMSrcReg, (ops GR16:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002243 "movs{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002244 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
2245def MOVSX16rm8 : I<0xBE, MRMSrcMem, (ops GR16:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002246 "movs{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002247 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
2248def MOVSX32rr8 : I<0xBE, MRMSrcReg, (ops GR32:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002249 "movs{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002250 [(set GR32:$dst, (sext GR8:$src))]>, TB;
2251def MOVSX32rm8 : I<0xBE, MRMSrcMem, (ops GR32:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002252 "movs{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002253 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
2254def MOVSX32rr16: I<0xBF, MRMSrcReg, (ops GR32:$dst, GR16:$src),
Evan Chengf0701842005-11-29 19:38:52 +00002255 "movs{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002256 [(set GR32:$dst, (sext GR16:$src))]>, TB;
2257def MOVSX32rm16: I<0xBF, MRMSrcMem, (ops GR32:$dst, i16mem:$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002258 "movs{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002259 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
Alkis Evlogimenosa7be9822004-02-17 09:14:23 +00002260
Evan Cheng069287d2006-05-16 07:21:53 +00002261def MOVZX16rr8 : I<0xB6, MRMSrcReg, (ops GR16:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002262 "movz{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002263 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
2264def MOVZX16rm8 : I<0xB6, MRMSrcMem, (ops GR16:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002265 "movz{bw|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002266 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
2267def MOVZX32rr8 : I<0xB6, MRMSrcReg, (ops GR32:$dst, GR8 :$src),
Evan Chengf0701842005-11-29 19:38:52 +00002268 "movz{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002269 [(set GR32:$dst, (zext GR8:$src))]>, TB;
2270def MOVZX32rm8 : I<0xB6, MRMSrcMem, (ops GR32:$dst, i8mem :$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002271 "movz{bl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002272 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
2273def MOVZX32rr16: I<0xB7, MRMSrcReg, (ops GR32:$dst, GR16:$src),
Evan Chengf0701842005-11-29 19:38:52 +00002274 "movz{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002275 [(set GR32:$dst, (zext GR16:$src))]>, TB;
2276def MOVZX32rm16: I<0xB7, MRMSrcMem, (ops GR32:$dst, i16mem:$src),
Evan Cheng7a7e8372005-12-14 02:22:27 +00002277 "movz{wl|x} {$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002278 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
Evan Cheng7a7e8372005-12-14 02:22:27 +00002279
Evan Chengf91c1012006-05-31 22:05:11 +00002280def CBW : I<0x98, RawFrm, (ops),
2281 "{cbtw|cbw}", []>, Imp<[AL],[AX]>; // AX = signext(AL)
2282def CWDE : I<0x98, RawFrm, (ops),
2283 "{cwtl|cwde}", []>, Imp<[AX],[EAX]>; // EAX = signext(AX)
2284
2285def CWD : I<0x99, RawFrm, (ops),
2286 "{cwtd|cwd}", []>, Imp<[AX],[AX,DX]>; // DX:AX = signext(AX)
2287def CDQ : I<0x99, RawFrm, (ops),
2288 "{cltd|cdq}", []>, Imp<[EAX],[EAX,EDX]>; // EDX:EAX = signext(EAX)
2289
Nate Begemanf1702ac2005-06-27 21:20:31 +00002290//===----------------------------------------------------------------------===//
Evan Cheng747a90d2006-02-21 02:24:38 +00002291// Miscellaneous Instructions
2292//===----------------------------------------------------------------------===//
2293
2294def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", [(X86rdtsc)]>,
2295 TB, Imp<[],[EAX,EDX]>;
2296
Evan Cheng747a90d2006-02-21 02:24:38 +00002297//===----------------------------------------------------------------------===//
2298// Alias Instructions
2299//===----------------------------------------------------------------------===//
2300
2301// Alias instructions that map movr0 to xor.
2302// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Evan Cheng069287d2006-05-16 07:21:53 +00002303def MOV8r0 : I<0x30, MRMInitReg, (ops GR8 :$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002304 "xor{b} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002305 [(set GR8:$dst, 0)]>;
2306def MOV16r0 : I<0x31, MRMInitReg, (ops GR16:$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002307 "xor{w} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002308 [(set GR16:$dst, 0)]>, OpSize;
2309def MOV32r0 : I<0x31, MRMInitReg, (ops GR32:$dst),
Evan Cheng747a90d2006-02-21 02:24:38 +00002310 "xor{l} $dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002311 [(set GR32:$dst, 0)]>;
Evan Cheng747a90d2006-02-21 02:24:38 +00002312
Evan Cheng069287d2006-05-16 07:21:53 +00002313// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
2314// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
2315def MOV16to16_ : I<0x89, MRMDestReg, (ops GR16_:$dst, GR16:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002316 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002317def MOV32to32_ : I<0x89, MRMDestReg, (ops GR32_:$dst, GR32:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002318 "mov{l} {$src, $dst|$dst, $src}", []>;
2319
Evan Cheng069287d2006-05-16 07:21:53 +00002320def MOV16_rr : I<0x89, MRMDestReg, (ops GR16_:$dst, GR16_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002321 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002322def MOV32_rr : I<0x89, MRMDestReg, (ops GR32_:$dst, GR32_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002323 "mov{l} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +00002324def MOV16_rm : I<0x8B, MRMSrcMem, (ops GR16_:$dst, i16mem:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002325 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002326def MOV32_rm : I<0x8B, MRMSrcMem, (ops GR32_:$dst, i32mem:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002327 "mov{l} {$src, $dst|$dst, $src}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +00002328def MOV16_mr : I<0x89, MRMDestMem, (ops i16mem:$dst, GR16_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002329 "mov{w} {$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002330def MOV32_mr : I<0x89, MRMDestMem, (ops i32mem:$dst, GR32_:$src),
Evan Cheng403be7e2006-05-08 08:01:26 +00002331 "mov{l} {$src, $dst|$dst, $src}", []>;
2332
Evan Cheng510e4782006-01-09 23:10:28 +00002333//===----------------------------------------------------------------------===//
Evan Cheng3c992d22006-03-07 02:02:57 +00002334// DWARF Pseudo Instructions
2335//
2336
2337def DWARF_LOC : I<0, Pseudo, (ops i32imm:$line, i32imm:$col, i32imm:$file),
2338 "; .loc $file, $line, $col",
2339 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
2340 (i32 imm:$file))]>;
2341
2342def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id),
2343 "\nLdebug_loc${id:debug}:",
2344 [(dwarf_label (i32 imm:$id))]>;
2345
2346//===----------------------------------------------------------------------===//
Evan Cheng510e4782006-01-09 23:10:28 +00002347// Non-Instruction Patterns
2348//===----------------------------------------------------------------------===//
2349
Evan Cheng71fb8342006-02-25 10:02:21 +00002350// ConstantPool GlobalAddress, ExternalSymbol
2351def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
Nate Begeman37efe672006-04-22 18:53:45 +00002352def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002353def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
2354def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
2355
Evan Cheng069287d2006-05-16 07:21:53 +00002356def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
2357 (ADD32ri GR32:$src1, tconstpool:$src2)>;
2358def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
2359 (ADD32ri GR32:$src1, tjumptable:$src2)>;
2360def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
2361 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
2362def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
2363 (ADD32ri GR32:$src1, texternalsym:$src2)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002364
Evan Chengfc8feb12006-05-19 07:30:36 +00002365def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002366 (MOV32mi addr:$dst, tglobaladdr:$src)>;
Evan Chengfc8feb12006-05-19 07:30:36 +00002367def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002368 (MOV32mi addr:$dst, texternalsym:$src)>;
2369
Evan Cheng510e4782006-01-09 23:10:28 +00002370// Calls
Evan Cheng069287d2006-05-16 07:21:53 +00002371def : Pat<(X86tailcall GR32:$dst),
2372 (CALL32r GR32:$dst)>;
Evan Chengfea89c12006-04-27 08:40:39 +00002373
Evan Chengfea89c12006-04-27 08:40:39 +00002374def : Pat<(X86tailcall tglobaladdr:$dst),
2375 (CALLpcrel32 tglobaladdr:$dst)>;
2376def : Pat<(X86tailcall texternalsym:$dst),
2377 (CALLpcrel32 texternalsym:$dst)>;
2378
2379
2380
Evan Cheng510e4782006-01-09 23:10:28 +00002381def : Pat<(X86call tglobaladdr:$dst),
2382 (CALLpcrel32 tglobaladdr:$dst)>;
Evan Cheng8700e142006-01-11 06:09:51 +00002383def : Pat<(X86call texternalsym:$dst),
2384 (CALLpcrel32 texternalsym:$dst)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002385
2386// X86 specific add which produces a flag.
Evan Cheng069287d2006-05-16 07:21:53 +00002387def : Pat<(addc GR32:$src1, GR32:$src2),
2388 (ADD32rr GR32:$src1, GR32:$src2)>;
2389def : Pat<(addc GR32:$src1, (load addr:$src2)),
2390 (ADD32rm GR32:$src1, addr:$src2)>;
2391def : Pat<(addc GR32:$src1, imm:$src2),
2392 (ADD32ri GR32:$src1, imm:$src2)>;
2393def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
2394 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002395
Evan Cheng069287d2006-05-16 07:21:53 +00002396def : Pat<(subc GR32:$src1, GR32:$src2),
2397 (SUB32rr GR32:$src1, GR32:$src2)>;
2398def : Pat<(subc GR32:$src1, (load addr:$src2)),
2399 (SUB32rm GR32:$src1, addr:$src2)>;
2400def : Pat<(subc GR32:$src1, imm:$src2),
2401 (SUB32ri GR32:$src1, imm:$src2)>;
2402def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
2403 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002404
Evan Chengb8414332006-01-13 21:45:19 +00002405def : Pat<(truncstore (i8 imm:$src), addr:$dst, i1),
2406 (MOV8mi addr:$dst, imm:$src)>;
Evan Cheng069287d2006-05-16 07:21:53 +00002407def : Pat<(truncstore GR8:$src, addr:$dst, i1),
2408 (MOV8mr addr:$dst, GR8:$src)>;
Evan Chengb8414332006-01-13 21:45:19 +00002409
Evan Cheng510e4782006-01-09 23:10:28 +00002410// {s|z}extload bool -> {s|z}extload byte
2411def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
2412def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
Evan Chenge5d93432006-01-17 07:02:46 +00002413def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002414def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2415def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2416
2417// extload bool -> extload byte
Evan Cheng47137242006-05-05 08:23:07 +00002418def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
2419def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2420def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2421def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
2422def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
2423def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002424
2425// anyext -> zext
Evan Cheng069287d2006-05-16 07:21:53 +00002426def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
2427def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
2428def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
Evan Cheng6e16ee52006-03-25 09:45:48 +00002429def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
2430def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
2431def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002432
Evan Chengcfa260b2006-01-06 02:31:59 +00002433//===----------------------------------------------------------------------===//
2434// Some peepholes
2435//===----------------------------------------------------------------------===//
2436
2437// (shl x, 1) ==> (add x, x)
Evan Cheng069287d2006-05-16 07:21:53 +00002438def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
2439def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
2440def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002441
Evan Cheng956044c2006-01-19 23:26:24 +00002442// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002443def : Pat<(or (srl GR32:$src1, CL:$amt),
2444 (shl GR32:$src2, (sub 32, CL:$amt))),
2445 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002446
Evan Cheng21d54432006-01-20 01:13:30 +00002447def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002448 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2449 (SHRD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002450
Evan Cheng956044c2006-01-19 23:26:24 +00002451// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002452def : Pat<(or (shl GR32:$src1, CL:$amt),
2453 (srl GR32:$src2, (sub 32, CL:$amt))),
2454 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002455
Evan Cheng21d54432006-01-20 01:13:30 +00002456def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002457 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2458 (SHLD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002459
Evan Cheng956044c2006-01-19 23:26:24 +00002460// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002461def : Pat<(or (srl GR16:$src1, CL:$amt),
2462 (shl GR16:$src2, (sub 16, CL:$amt))),
2463 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002464
Evan Cheng21d54432006-01-20 01:13:30 +00002465def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002466 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2467 (SHRD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002468
Evan Cheng956044c2006-01-19 23:26:24 +00002469// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002470def : Pat<(or (shl GR16:$src1, CL:$amt),
2471 (srl GR16:$src2, (sub 16, CL:$amt))),
2472 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002473
2474def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002475 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2476 (SHLD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng4e4c71e2006-02-21 20:00:20 +00002477
2478
2479//===----------------------------------------------------------------------===//
2480// Floating Point Stack Support
2481//===----------------------------------------------------------------------===//
2482
2483include "X86InstrFPStack.td"
2484
2485//===----------------------------------------------------------------------===//
2486// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
2487//===----------------------------------------------------------------------===//
2488
2489include "X86InstrMMX.td"
2490
2491//===----------------------------------------------------------------------===//
2492// XMM Floating point support (requires SSE / SSE2)
2493//===----------------------------------------------------------------------===//
2494
2495include "X86InstrSSE.td"