blob: a3effedd37984085d7cd465f13b9ca687c573d3c [file] [log] [blame]
Arnold Schwaighofer48abc5c2007-10-12 21:30:57 +00001//===- X86InstrInfo.td - Describe the X86 Instruction Set --*- tablegen -*-===//
John Criswell856ba762003-10-21 15:17:13 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
John Criswell856ba762003-10-21 15:17:13 +00007//
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 Chenge5f62042007-09-29 00:00:36 +000026def SDTX86Cmov : SDTypeProfile<1, 4,
Evan Cheng0488db92007-09-25 01:57:46 +000027 [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
28 SDTCisVT<3, i8>, SDTCisVT<4, i32>]>;
Evan Chengaed7c722005-12-17 01:24:02 +000029
Evan Chenge5f62042007-09-29 00:00:36 +000030def SDTX86BrCond : SDTypeProfile<0, 3,
Evan Cheng0488db92007-09-25 01:57:46 +000031 [SDTCisVT<0, OtherVT>,
32 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Evan Chengaed7c722005-12-17 01:24:02 +000033
Evan Chenge5f62042007-09-29 00:00:36 +000034def SDTX86SetCC : SDTypeProfile<1, 2,
Evan Cheng0488db92007-09-25 01:57:46 +000035 [SDTCisVT<0, i8>,
36 SDTCisVT<1, i8>, SDTCisVT<2, i32>]>;
Evan Chengd5781fc2005-12-21 20:21:51 +000037
Evan Chengd9558e02006-01-06 00:43:03 +000038def SDTX86Ret : SDTypeProfile<0, 1, [SDTCisVT<0, i16>]>;
Evan Cheng898101c2005-12-19 23:12:38 +000039
Bill Wendlingc69107c2007-11-13 09:19:02 +000040def SDT_X86CallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>;
41def SDT_X86CallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>,
42 SDTCisVT<1, i32> ]>;
Evan Chenge3413162006-01-09 18:33:28 +000043
Evan Cheng25ab6902006-09-08 06:48:29 +000044def SDT_X86Call : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>;
Evan Chenge3413162006-01-09 18:33:28 +000045
Evan Cheng67f92a72006-01-11 22:15:48 +000046def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>;
47
Evan Chenge3413162006-01-09 18:33:28 +000048def SDTX86RdTsc : SDTypeProfile<0, 0, []>;
Evan Chengd90eb7f2006-01-05 00:27:02 +000049
Evan Cheng71fb8342006-02-25 10:02:21 +000050def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
51
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +000052def SDT_X86TLSADDR : SDTypeProfile<1, 1, [SDTCisPtrTy<0>, SDTCisInt<1>]>;
53
54def SDT_X86TLSTP : SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;
55
Anton Korobeynikov2365f512007-07-14 14:06:15 +000056def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
57
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +000058def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>;
59
Evan Cheng18efe262007-12-14 02:13:44 +000060def X86bsf : SDNode<"X86ISD::BSF", SDTIntUnaryOp>;
61def X86bsr : SDNode<"X86ISD::BSR", SDTIntUnaryOp>;
Evan Chenge3413162006-01-09 18:33:28 +000062def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>;
63def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>;
Evan Chengb077b842005-12-21 02:39:21 +000064
Evan Chenge5f62042007-09-29 00:00:36 +000065def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>;
Evan Chengb077b842005-12-21 02:39:21 +000066
Evan Chenge5f62042007-09-29 00:00:36 +000067def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>;
Evan Chenge3413162006-01-09 18:33:28 +000068def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond,
Evan Cheng0488db92007-09-25 01:57:46 +000069 [SDNPHasChain]>;
Evan Chenge5f62042007-09-29 00:00:36 +000070def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>;
Evan Chengb077b842005-12-21 02:39:21 +000071
Evan Chenge3413162006-01-09 18:33:28 +000072def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret,
73 [SDNPHasChain, SDNPOptInFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000074
Evan Chenge3413162006-01-09 18:33:28 +000075def X86callseq_start :
76 SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
Evan Chengbb7b8442006-08-11 09:03:33 +000077 [SDNPHasChain, SDNPOutFlag]>;
Evan Chenge3413162006-01-09 18:33:28 +000078def X86callseq_end :
79 SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd,
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +000080 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
Evan Chengb077b842005-12-21 02:39:21 +000081
Evan Chenge3413162006-01-09 18:33:28 +000082def X86call : SDNode<"X86ISD::CALL", SDT_X86Call,
83 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
Evan Chengaed7c722005-12-17 01:24:02 +000084
Evan Chengfb914c42006-05-20 01:40:16 +000085def X86tailcall: SDNode<"X86ISD::TAILCALL", SDT_X86Call,
Evan Chengfea89c12006-04-27 08:40:39 +000086 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
87
Evan Cheng67f92a72006-01-11 22:15:48 +000088def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
Chris Lattner9b37aaf2008-01-10 05:12:37 +000089 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>;
Evan Cheng67f92a72006-01-11 22:15:48 +000090def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
Chris Lattner9b37aaf2008-01-10 05:12:37 +000091 [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore,
92 SDNPMayLoad]>;
Evan Cheng67f92a72006-01-11 22:15:48 +000093
Evan Chenge3413162006-01-09 18:33:28 +000094def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc,
Chris Lattnerba7e7562008-01-10 07:59:24 +000095 [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>;
Evan Chengd90eb7f2006-01-05 00:27:02 +000096
Evan Cheng0085a282006-11-30 21:55:46 +000097def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>;
98def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>;
Evan Cheng71fb8342006-02-25 10:02:21 +000099
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +0000100def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
101 [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>;
102def X86TLStp : SDNode<"X86ISD::THREAD_POINTER", SDT_X86TLSTP, []>;
103
Anton Korobeynikov2365f512007-07-14 14:06:15 +0000104def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
105 [SDNPHasChain]>;
106
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +0000107def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET,
108 [SDNPHasChain, SDNPOptInFlag]>;
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +0000109
Evan Chengaed7c722005-12-17 01:24:02 +0000110//===----------------------------------------------------------------------===//
111// X86 Operand Definitions.
112//
113
Chris Lattner66fa1dc2004-08-11 02:25:00 +0000114// *mem - Operand definitions for the funky X86 addressing mode operands.
115//
Evan Chengaf78ef52006-05-17 21:21:41 +0000116class X86MemOperand<string printMethod> : Operand<iPTR> {
Nate Begeman391c5d22005-11-30 18:54:35 +0000117 let PrintMethod = printMethod;
Evan Cheng25ab6902006-09-08 06:48:29 +0000118 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc, i32imm);
Chris Lattner66fa1dc2004-08-11 02:25:00 +0000119}
Nate Begeman391c5d22005-11-30 18:54:35 +0000120
Chris Lattner45432512005-12-17 19:47:05 +0000121def i8mem : X86MemOperand<"printi8mem">;
122def i16mem : X86MemOperand<"printi16mem">;
123def i32mem : X86MemOperand<"printi32mem">;
124def i64mem : X86MemOperand<"printi64mem">;
Evan Cheng470a6ad2006-02-22 02:26:30 +0000125def i128mem : X86MemOperand<"printi128mem">;
Chris Lattner45432512005-12-17 19:47:05 +0000126def f32mem : X86MemOperand<"printf32mem">;
127def f64mem : X86MemOperand<"printf64mem">;
Dale Johannesen59a58732007-08-05 18:49:15 +0000128def f80mem : X86MemOperand<"printf80mem">;
Evan Cheng223547a2006-01-31 22:28:30 +0000129def f128mem : X86MemOperand<"printf128mem">;
Nate Begeman391c5d22005-11-30 18:54:35 +0000130
Evan Cheng25ab6902006-09-08 06:48:29 +0000131def lea32mem : Operand<i32> {
132 let PrintMethod = "printi32mem";
Evan Cheng25ab6902006-09-08 06:48:29 +0000133 let MIOperandInfo = (ops GR32, i8imm, GR32, i32imm);
134}
135
Nate Begeman16b04f32005-07-15 00:38:55 +0000136def SSECC : Operand<i8> {
137 let PrintMethod = "printSSECC";
138}
Chris Lattner66fa1dc2004-08-11 02:25:00 +0000139
Evan Cheng7ccced62006-02-18 00:15:05 +0000140def piclabel: Operand<i32> {
141 let PrintMethod = "printPICLabel";
142}
143
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000144// A couple of more descriptive operand definitions.
145// 16-bits but only 8 bits are significant.
146def i16i8imm : Operand<i16>;
147// 32-bits but only 8 bits are significant.
148def i32i8imm : Operand<i32>;
149
Evan Chengd35b8c12005-12-04 08:19:43 +0000150// Branch targets have OtherVT type.
151def brtarget : Operand<OtherVT>;
152
Evan Chengaed7c722005-12-17 01:24:02 +0000153//===----------------------------------------------------------------------===//
154// X86 Complex Pattern Definitions.
155//
156
Evan Chengec693f72005-12-08 02:01:35 +0000157// Define X86 specific addressing mode.
Evan Chengaf9db752006-10-11 21:03:53 +0000158def addr : ComplexPattern<iPTR, 4, "SelectAddr", [], []>;
Evan Cheng25ab6902006-09-08 06:48:29 +0000159def lea32addr : ComplexPattern<i32, 4, "SelectLEAAddr",
Evan Chengaf9db752006-10-11 21:03:53 +0000160 [add, mul, shl, or, frameindex], []>;
Evan Chengec693f72005-12-08 02:01:35 +0000161
Evan Chengaed7c722005-12-17 01:24:02 +0000162//===----------------------------------------------------------------------===//
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000163// X86 Instruction Predicate Definitions.
Evan Cheng28b514392006-12-05 19:50:18 +0000164def HasMMX : Predicate<"Subtarget->hasMMX()">;
165def HasSSE1 : Predicate<"Subtarget->hasSSE1()">;
166def HasSSE2 : Predicate<"Subtarget->hasSSE2()">;
167def HasSSE3 : Predicate<"Subtarget->hasSSE3()">;
Bill Wendlingbb1ee052007-04-10 22:10:25 +0000168def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">;
Dale Johannesenf1fc3a82007-09-23 14:52:20 +0000169def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">;
170def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">;
Evan Cheng28b514392006-12-05 19:50:18 +0000171def In32BitMode : Predicate<"!Subtarget->is64Bit()">;
172def In64BitMode : Predicate<"Subtarget->is64Bit()">;
Evan Chengf6844ca2007-08-01 23:45:51 +0000173def HasLow4G : Predicate<"Subtarget->hasLow4GUserSpaceAddress()">;
Evan Cheng28b514392006-12-05 19:50:18 +0000174def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">;
175def NotSmallCode : Predicate<"TM.getCodeModel() != CodeModel::Small">;
176def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">;
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000177
178//===----------------------------------------------------------------------===//
Evan Chengc64a1a92007-07-31 08:04:03 +0000179// X86 Instruction Format Definitions.
Evan Chengaed7c722005-12-17 01:24:02 +0000180//
181
Evan Chengc64a1a92007-07-31 08:04:03 +0000182include "X86InstrFormats.td"
Chris Lattner1cca5e32003-08-03 21:54:21 +0000183
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000184//===----------------------------------------------------------------------===//
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000185// Pattern fragments...
186//
Evan Chengd9558e02006-01-06 00:43:03 +0000187
188// X86 specific condition code. These correspond to CondCode in
Nate Begeman9a225302007-05-06 04:00:55 +0000189// X86InstrInfo.h. They must be kept in synch.
Evan Chengd9558e02006-01-06 00:43:03 +0000190def X86_COND_A : PatLeaf<(i8 0)>;
191def X86_COND_AE : PatLeaf<(i8 1)>;
192def X86_COND_B : PatLeaf<(i8 2)>;
193def X86_COND_BE : PatLeaf<(i8 3)>;
194def X86_COND_E : PatLeaf<(i8 4)>;
195def X86_COND_G : PatLeaf<(i8 5)>;
196def X86_COND_GE : PatLeaf<(i8 6)>;
197def X86_COND_L : PatLeaf<(i8 7)>;
198def X86_COND_LE : PatLeaf<(i8 8)>;
199def X86_COND_NE : PatLeaf<(i8 9)>;
200def X86_COND_NO : PatLeaf<(i8 10)>;
201def X86_COND_NP : PatLeaf<(i8 11)>;
202def X86_COND_NS : PatLeaf<(i8 12)>;
203def X86_COND_O : PatLeaf<(i8 13)>;
204def X86_COND_P : PatLeaf<(i8 14)>;
205def X86_COND_S : PatLeaf<(i8 15)>;
206
Evan Cheng9b6b6422005-12-13 00:14:11 +0000207def i16immSExt8 : PatLeaf<(i16 imm), [{
208 // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
Evan Chengb3558542005-12-13 00:01:09 +0000209 // sign extended field.
Evan Cheng09e3c802006-05-19 18:40:54 +0000210 return (int16_t)N->getValue() == (int8_t)N->getValue();
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000211}]>;
212
Evan Cheng9b6b6422005-12-13 00:14:11 +0000213def i32immSExt8 : PatLeaf<(i32 imm), [{
214 // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
Evan Chengb3558542005-12-13 00:01:09 +0000215 // sign extended field.
Evan Cheng09e3c802006-05-19 18:40:54 +0000216 return (int32_t)N->getValue() == (int8_t)N->getValue();
Evan Chengb3558542005-12-13 00:01:09 +0000217}]>;
218
Evan Cheng605c4152005-12-13 01:57:51 +0000219// Helper fragments for loads.
Evan Cheng7a7e8372005-12-14 02:22:27 +0000220def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>;
221def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>;
222def loadi32 : PatFrag<(ops node:$ptr), (i32 (load node:$ptr))>;
Evan Cheng11e15b32006-04-03 20:53:28 +0000223def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr))>;
Evan Cheng06a8aa12006-03-17 19:55:52 +0000224
Evan Chengbbc8ddb2005-12-20 22:59:51 +0000225def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>;
226def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>;
Dale Johannesen59a58732007-08-05 18:49:15 +0000227def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr))>;
Evan Cheng7a7e8372005-12-14 02:22:27 +0000228
Evan Cheng466685d2006-10-09 20:57:25 +0000229def sextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (sextloadi1 node:$ptr))>;
230def sextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (sextloadi1 node:$ptr))>;
231def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
232def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
233def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>;
Evan Cheng7a7e8372005-12-14 02:22:27 +0000234
Evan Cheng466685d2006-10-09 20:57:25 +0000235def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>;
236def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>;
237def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>;
238def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
239def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>;
240def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>;
Evan Cheng7a7e8372005-12-14 02:22:27 +0000241
Evan Cheng466685d2006-10-09 20:57:25 +0000242def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>;
243def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>;
244def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>;
245def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>;
246def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>;
247def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
Evan Cheng747a90d2006-02-21 02:24:38 +0000248
Chris Lattnerf124d5e2005-11-18 01:04:42 +0000249//===----------------------------------------------------------------------===//
Chris Lattner1cca5e32003-08-03 21:54:21 +0000250// Instruction list...
251//
252
Chris Lattnerf18c0742006-10-12 17:42:56 +0000253// ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into
254// a stack adjustment and the codegen must know that they may modify the stack
255// pointer before prolog-epilog rewriting occurs.
Evan Chengfa00feb2007-09-28 01:35:02 +0000256// Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become sub / add
Evan Cheng8decf6b2007-09-28 01:19:48 +0000257// which can clobber EFLAGS.
258let Defs = [ESP, EFLAGS], Uses = [ESP] in {
Bill Wendling0f8d9c02007-11-13 00:44:25 +0000259def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt),
260 "#ADJCALLSTACKDOWN",
Evan Cheng071a2792007-09-11 19:55:27 +0000261 [(X86callseq_start imm:$amt)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000262def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2),
Evan Chengd90eb7f2006-01-05 00:27:02 +0000263 "#ADJCALLSTACKUP",
Evan Cheng071a2792007-09-11 19:55:27 +0000264 [(X86callseq_end imm:$amt1, imm:$amt2)]>;
265}
Evan Cheng6e141fd2007-12-12 23:12:09 +0000266let isImplicitDef = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000267def IMPLICIT_DEF_GR8 : I<0, Pseudo, (outs GR8:$dst), (ins),
Evan Cheng510e4782006-01-09 23:10:28 +0000268 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000269 [(set GR8:$dst, (undef))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000270def IMPLICIT_DEF_GR16 : I<0, Pseudo, (outs GR16:$dst), (ins),
Evan Cheng510e4782006-01-09 23:10:28 +0000271 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000272 [(set GR16:$dst, (undef))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000273def IMPLICIT_DEF_GR32 : I<0, Pseudo, (outs GR32:$dst), (ins),
Evan Cheng510e4782006-01-09 23:10:28 +0000274 "#IMPLICIT_DEF $dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000275 [(set GR32:$dst, (undef))]>;
Evan Cheng6e141fd2007-12-12 23:12:09 +0000276}
Evan Cheng4a460802006-01-11 00:33:36 +0000277
278// Nop
Chris Lattnerba7e7562008-01-10 07:59:24 +0000279let neverHasSideEffects = 1 in
280 def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>;
Evan Cheng4a460802006-01-11 00:33:36 +0000281
Evan Cheng0475ab52008-01-05 00:41:47 +0000282// PIC base
Chris Lattnerba7e7562008-01-10 07:59:24 +0000283let neverHasSideEffects = 1, isNotDuplicable = 1 in
284 def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins piclabel:$label),
285 "call\t$label\n\tpop{l}\t$reg", []>;
Evan Cheng8f7f7122006-05-05 05:40:20 +0000286
Chris Lattner1cca5e32003-08-03 21:54:21 +0000287//===----------------------------------------------------------------------===//
288// Control Flow Instructions...
289//
290
Chris Lattner1be48112005-05-13 17:56:48 +0000291// Return instructions.
Evan Cheng2b4ea792005-12-26 09:11:45 +0000292let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Chengffbacca2007-07-21 00:34:19 +0000293 hasCtrlDep = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000294 def RET : I<0xC3, RawFrm, (outs), (ins), "ret", [(X86retflag 0)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000295 def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt), "ret\t$amt",
Evan Chenge3413162006-01-09 18:33:28 +0000296 [(X86retflag imm:$amt)]>;
Evan Cheng171049d2005-12-23 22:14:32 +0000297}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000298
299// All branches are RawFrm, Void, Branch, and Terminators
Evan Chengffbacca2007-07-21 00:34:19 +0000300let isBranch = 1, isTerminator = 1 in
Evan Cheng64d80e32007-07-19 01:14:50 +0000301 class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> :
302 I<opcode, RawFrm, (outs), ins, asm, pattern>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000303
Evan Chengec3bc392006-09-07 19:03:48 +0000304let isBranch = 1, isBarrier = 1 in
Dan Gohmanb1576f52007-07-31 20:11:57 +0000305 def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>;
Evan Cheng898101c2005-12-19 23:12:38 +0000306
Owen Anderson20ab2902007-11-12 07:39:39 +0000307// Indirect branches
308let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
Dan Gohmanb1576f52007-07-31 20:11:57 +0000309 def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000310 [(brind GR32:$dst)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000311 def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
Evan Cheng25ab6902006-09-08 06:48:29 +0000312 [(brind (loadi32 addr:$dst))]>;
Nate Begeman37efe672006-04-22 18:53:45 +0000313}
314
315// Conditional branches
Evan Cheng0488db92007-09-25 01:57:46 +0000316let Uses = [EFLAGS] in {
Dan Gohmanb1576f52007-07-31 20:11:57 +0000317def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000318 [(X86brcond bb:$dst, X86_COND_E, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000319def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000320 [(X86brcond bb:$dst, X86_COND_NE, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000321def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000322 [(X86brcond bb:$dst, X86_COND_L, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000323def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000324 [(X86brcond bb:$dst, X86_COND_LE, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000325def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000326 [(X86brcond bb:$dst, X86_COND_G, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000327def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000328 [(X86brcond bb:$dst, X86_COND_GE, EFLAGS)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000329
Dan Gohmanb1576f52007-07-31 20:11:57 +0000330def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000331 [(X86brcond bb:$dst, X86_COND_B, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000332def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000333 [(X86brcond bb:$dst, X86_COND_BE, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000334def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000335 [(X86brcond bb:$dst, X86_COND_A, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000336def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000337 [(X86brcond bb:$dst, X86_COND_AE, EFLAGS)]>, TB;
Evan Cheng898101c2005-12-19 23:12:38 +0000338
Dan Gohmanb1576f52007-07-31 20:11:57 +0000339def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000340 [(X86brcond bb:$dst, X86_COND_S, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000341def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000342 [(X86brcond bb:$dst, X86_COND_NS, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000343def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000344 [(X86brcond bb:$dst, X86_COND_P, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000345def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000346 [(X86brcond bb:$dst, X86_COND_NP, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000347def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000348 [(X86brcond bb:$dst, X86_COND_O, EFLAGS)]>, TB;
Dan Gohmanb1576f52007-07-31 20:11:57 +0000349def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +0000350 [(X86brcond bb:$dst, X86_COND_NO, EFLAGS)]>, TB;
Evan Cheng0488db92007-09-25 01:57:46 +0000351} // Uses = [EFLAGS]
Chris Lattner1cca5e32003-08-03 21:54:21 +0000352
353//===----------------------------------------------------------------------===//
354// Call Instructions...
355//
Evan Chengffbacca2007-07-21 00:34:19 +0000356let isCall = 1 in
Chris Lattner1cca5e32003-08-03 21:54:21 +0000357 // All calls clobber the non-callee saved registers...
Nate Begemanf63be7d2005-07-06 18:59:04 +0000358 let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
Bill Wendling3f3a17d2007-04-25 21:31:48 +0000359 MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
Evan Cheng0488db92007-09-25 01:57:46 +0000360 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in {
Evan Chengf02ca692007-12-22 02:26:46 +0000361 def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops),
362 "call\t${dst:call}", []>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000363 def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000364 "call\t{*}$dst", [(X86call GR32:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000365 def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000366 "call\t{*}$dst", []>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000367 }
368
Chris Lattner1e9448b2005-05-15 03:10:37 +0000369// Tail call stuff.
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +0000370
371def TAILCALL : I<0, Pseudo, (outs), (ins ),
372 "#TAILCALL",
373 []>;
374
Evan Chengffbacca2007-07-21 00:34:19 +0000375let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +0000376def TCRETURNdi : I<0, Pseudo, (outs), (ins i32imm:$dst, i32imm:$offset),
377 "#TC_RETURN $dst $offset",
378 []>;
379
380let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
381def TCRETURNri : I<0, Pseudo, (outs), (ins GR32:$dst, i32imm:$offset),
382 "#TC_RETURN $dst $offset",
383 []>;
384
385let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
386 def TAILJMPd : IBr<0xE9, (ins i32imm:$dst), "jmp\t${dst:call} # TAILCALL",
Evan Chengf10c17f2006-09-22 21:43:59 +0000387 []>;
Evan Chengffbacca2007-07-21 00:34:19 +0000388let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +0000389 def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst # TAILCALL",
390 []>;
Evan Chengffbacca2007-07-21 00:34:19 +0000391let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
Evan Cheng64d80e32007-07-19 01:14:50 +0000392 def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst),
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +0000393 "jmp\t{*}$dst # TAILCALL", []>;
Chris Lattner1e9448b2005-05-15 03:10:37 +0000394
Chris Lattner1cca5e32003-08-03 21:54:21 +0000395//===----------------------------------------------------------------------===//
396// Miscellaneous Instructions...
397//
Chris Lattnerba7e7562008-01-10 07:59:24 +0000398let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in
Chris Lattner30bf2d82004-08-10 20:17:41 +0000399def LEAVE : I<0xC9, RawFrm,
Evan Cheng071a2792007-09-11 19:55:27 +0000400 (outs), (ins), "leave", []>;
401
Chris Lattnerba7e7562008-01-10 07:59:24 +0000402let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in {
403let mayLoad = 1 in
Evan Cheng2f245ba2007-09-26 01:29:06 +0000404def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000405
Chris Lattnerba7e7562008-01-10 07:59:24 +0000406let mayStore = 1 in
Evan Cheng2f245ba2007-09-26 01:29:06 +0000407def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>;
Evan Cheng071a2792007-09-11 19:55:27 +0000408}
Anton Korobeynikov57fc00d2007-04-17 09:20:00 +0000409
Chris Lattnerba7e7562008-01-10 07:59:24 +0000410let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in
Evan Chengbf4f89d2007-09-26 21:28:00 +0000411def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000412let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in
Evan Chengbf4f89d2007-09-26 21:28:00 +0000413def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
Evan Cheng2f245ba2007-09-26 01:29:06 +0000414
Evan Cheng069287d2006-05-16 07:21:53 +0000415let isTwoAddress = 1 in // GR32 = bswap GR32
Chris Lattner30bf2d82004-08-10 20:17:41 +0000416 def BSWAP32r : I<0xC8, AddRegFrm,
Evan Cheng64d80e32007-07-19 01:14:50 +0000417 (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000418 "bswap{l}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +0000419 [(set GR32:$dst, (bswap GR32:$src))]>, TB;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000420
Evan Cheng64d80e32007-07-19 01:14:50 +0000421// FIXME: Model xchg* as two address instructions?
Chris Lattnera731c9f2008-01-11 07:18:17 +0000422let neverHasSideEffects = 1 in {
Evan Cheng069287d2006-05-16 07:21:53 +0000423def XCHG8rr : I<0x86, MRMDestReg, // xchg GR8, GR8
Evan Cheng64d80e32007-07-19 01:14:50 +0000424 (outs), (ins GR8:$src1, GR8:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000425 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Evan Cheng069287d2006-05-16 07:21:53 +0000426def XCHG16rr : I<0x87, MRMDestReg, // xchg GR16, GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000427 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000428 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000429def XCHG32rr : I<0x87, MRMDestReg, // xchg GR32, GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000430 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000431 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Chris Lattnera731c9f2008-01-11 07:18:17 +0000432}
Chris Lattnerfc752712004-08-01 09:52:59 +0000433
Chris Lattnera731c9f2008-01-11 07:18:17 +0000434let mayLoad = 1, mayStore = 1 in {
Chris Lattner3a173df2004-10-03 20:35:00 +0000435def XCHG8mr : I<0x86, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000436 (outs), (ins i8mem:$src1, GR8:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000437 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000438def XCHG16mr : I<0x87, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000439 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000440 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000441def XCHG32mr : I<0x87, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000442 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000443 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000444def XCHG8rm : I<0x86, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000445 (outs), (ins GR8:$src1, i8mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000446 "xchg{b}\t{$src2|$src1}, {$src1|$src2}", []>;
Chris Lattner3a173df2004-10-03 20:35:00 +0000447def XCHG16rm : I<0x87, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000448 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000449 "xchg{w}\t{$src2|$src1}, {$src1|$src2}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000450def XCHG32rm : I<0x87, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000451 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000452 "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>;
Chris Lattnera731c9f2008-01-11 07:18:17 +0000453}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000454
Evan Cheng18efe262007-12-14 02:13:44 +0000455// Bit scan instructions.
456let Defs = [EFLAGS] in {
Evan Chengfd9e4732007-12-14 18:49:43 +0000457def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000458 "bsf{w}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000459 [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000460def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000461 "bsf{w}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000462 [(set GR16:$dst, (X86bsf (loadi16 addr:$src))),
463 (implicit EFLAGS)]>, TB;
Evan Chengfd9e4732007-12-14 18:49:43 +0000464def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000465 "bsf{l}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000466 [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000467def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000468 "bsf{l}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000469 [(set GR32:$dst, (X86bsf (loadi32 addr:$src))),
470 (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000471
Evan Chengfd9e4732007-12-14 18:49:43 +0000472def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000473 "bsr{w}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000474 [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000475def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000476 "bsr{w}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000477 [(set GR16:$dst, (X86bsr (loadi16 addr:$src))),
478 (implicit EFLAGS)]>, TB;
Evan Chengfd9e4732007-12-14 18:49:43 +0000479def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000480 "bsr{l}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000481 [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000482def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohman1a8001e2007-12-14 15:10:00 +0000483 "bsr{l}\t{$src, $dst|$dst, $src}",
Evan Cheng152804e2007-12-14 08:30:15 +0000484 [(set GR32:$dst, (X86bsr (loadi32 addr:$src))),
485 (implicit EFLAGS)]>, TB;
Evan Cheng18efe262007-12-14 02:13:44 +0000486} // Defs = [EFLAGS]
487
Chris Lattnerba7e7562008-01-10 07:59:24 +0000488let neverHasSideEffects = 1 in
Chris Lattner3a173df2004-10-03 20:35:00 +0000489def LEA16r : I<0x8D, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000490 (outs GR16:$dst), (ins i32mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000491 "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +0000492def LEA32r : I<0x8D, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +0000493 (outs GR32:$dst), (ins lea32mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000494 "lea{l}\t{$src|$dst}, {$dst|$src}",
Evan Cheng25ab6902006-09-08 06:48:29 +0000495 [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000496
Evan Cheng071a2792007-09-11 19:55:27 +0000497let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000498def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}",
Evan Cheng071a2792007-09-11 19:55:27 +0000499 [(X86rep_movs i8)]>, REP;
Evan Cheng64d80e32007-07-19 01:14:50 +0000500def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}",
Evan Cheng071a2792007-09-11 19:55:27 +0000501 [(X86rep_movs i16)]>, REP, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000502def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}",
Evan Cheng071a2792007-09-11 19:55:27 +0000503 [(X86rep_movs i32)]>, REP;
504}
Chris Lattner915e5e52004-02-12 17:53:22 +0000505
Evan Cheng071a2792007-09-11 19:55:27 +0000506let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000507def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}",
Evan Cheng071a2792007-09-11 19:55:27 +0000508 [(X86rep_stos i8)]>, REP;
509let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000510def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}",
Evan Cheng071a2792007-09-11 19:55:27 +0000511 [(X86rep_stos i16)]>, REP, OpSize;
512let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000513def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}",
Evan Cheng071a2792007-09-11 19:55:27 +0000514 [(X86rep_stos i32)]>, REP;
Chris Lattner30bf2d82004-08-10 20:17:41 +0000515
Evan Cheng071a2792007-09-11 19:55:27 +0000516let Defs = [RAX, RDX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000517def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>,
Evan Cheng071a2792007-09-11 19:55:27 +0000518 TB;
Chris Lattnerb89abef2004-02-14 04:45:37 +0000519
Chris Lattner1cca5e32003-08-03 21:54:21 +0000520//===----------------------------------------------------------------------===//
John Criswell4ffff9e2004-04-08 20:31:47 +0000521// Input/Output Instructions...
522//
Evan Cheng071a2792007-09-11 19:55:27 +0000523let Defs = [AL], Uses = [DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000524def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000525 "in{b}\t{%dx, %al|%AL, %DX}", []>;
526let Defs = [AX], Uses = [DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000527def IN16rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000528 "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize;
529let Defs = [EAX], Uses = [DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000530def IN32rr : I<0xED, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000531 "in{l}\t{%dx, %eax|%EAX, %DX}", []>;
John Criswell4ffff9e2004-04-08 20:31:47 +0000532
Evan Cheng071a2792007-09-11 19:55:27 +0000533let Defs = [AL] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000534def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000535 "in{b}\t{$port, %al|%AL, $port}", []>;
536let Defs = [AX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000537def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000538 "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize;
539let Defs = [EAX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000540def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000541 "in{l}\t{$port, %eax|%EAX, $port}", []>;
Chris Lattner440bbc22004-04-13 17:19:31 +0000542
Evan Cheng071a2792007-09-11 19:55:27 +0000543let Uses = [DX, AL] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000544def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000545 "out{b}\t{%al, %dx|%DX, %AL}", []>;
546let Uses = [DX, AX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000547def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000548 "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize;
549let Uses = [DX, EAX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000550def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Evan Cheng071a2792007-09-11 19:55:27 +0000551 "out{l}\t{%eax, %dx|%DX, %EAX}", []>;
Chris Lattnerffff7082004-08-01 07:44:35 +0000552
Evan Cheng071a2792007-09-11 19:55:27 +0000553let Uses = [AL] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000554def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000555 "out{b}\t{%al, $port|$port, %AL}", []>;
556let Uses = [AX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000557def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000558 "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize;
559let Uses = [EAX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000560def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port),
Evan Cheng071a2792007-09-11 19:55:27 +0000561 "out{l}\t{%eax, $port|$port, %EAX}", []>;
John Criswell4ffff9e2004-04-08 20:31:47 +0000562
563//===----------------------------------------------------------------------===//
Chris Lattner1cca5e32003-08-03 21:54:21 +0000564// Move Instructions...
565//
Chris Lattnerba7e7562008-01-10 07:59:24 +0000566let neverHasSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000567def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000568 "mov{b}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000569def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000570 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000571def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000572 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000573}
Chris Lattnerdd415272008-01-10 05:45:39 +0000574let isReMaterializable = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000575def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000576 "mov{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000577 [(set GR8:$dst, imm:$src)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000578def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000579 "mov{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000580 [(set GR16:$dst, imm:$src)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000581def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000582 "mov{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000583 [(set GR32:$dst, imm:$src)]>;
Dan Gohmand45eddd2007-06-26 00:48:07 +0000584}
Evan Cheng64d80e32007-07-19 01:14:50 +0000585def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000586 "mov{b}\t{$src, $dst|$dst, $src}",
Evan Chengb51a0592005-12-10 00:48:20 +0000587 [(store (i8 imm:$src), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000588def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000589 "mov{w}\t{$src, $dst|$dst, $src}",
Evan Chengb51a0592005-12-10 00:48:20 +0000590 [(store (i16 imm:$src), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000591def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000592 "mov{l}\t{$src, $dst|$dst, $src}",
Evan Chengb51a0592005-12-10 00:48:20 +0000593 [(store (i32 imm:$src), addr:$dst)]>;
Chris Lattner1cca5e32003-08-03 21:54:21 +0000594
Chris Lattner834f1ce2008-01-06 23:38:27 +0000595let isSimpleLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +0000596def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000597 "mov{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000598 [(set GR8:$dst, (load addr:$src))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000599def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000600 "mov{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000601 [(set GR16:$dst, (load addr:$src))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000602def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000603 "mov{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000604 [(set GR32:$dst, (load addr:$src))]>;
Evan Cheng2f394262007-08-30 05:49:43 +0000605}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000606
Evan Cheng64d80e32007-07-19 01:14:50 +0000607def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000608 "mov{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000609 [(store GR8:$src, addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +0000610def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000611 "mov{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000612 [(store GR16:$src, addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +0000613def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000614 "mov{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +0000615 [(store GR32:$src, addr:$dst)]>;
Nate Begemanf1702ac2005-06-27 21:20:31 +0000616
Chris Lattner1cca5e32003-08-03 21:54:21 +0000617//===----------------------------------------------------------------------===//
618// Fixed-Register Multiplication and Division Instructions...
619//
Chris Lattner1cca5e32003-08-03 21:54:21 +0000620
Chris Lattnerc8f45872003-08-04 04:59:56 +0000621// Extra precision multiplication
Evan Cheng24f2ea32007-09-14 21:48:26 +0000622let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Dan Gohmanb1576f52007-07-31 20:11:57 +0000623def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src",
Evan Chengcf74a7c2006-01-15 10:05:20 +0000624 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
625 // This probably ought to be moved to a def : Pat<> if the
626 // syntax can be accepted.
Evan Cheng071a2792007-09-11 19:55:27 +0000627 [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8
Chris Lattnera731c9f2008-01-11 07:18:17 +0000628let Defs = [AX,DX,EFLAGS], Uses = [AX], neverHasSideEffects = 1 in
Dan Gohmanb1576f52007-07-31 20:11:57 +0000629def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>,
Evan Cheng071a2792007-09-11 19:55:27 +0000630 OpSize; // AX,DX = AX*GR16
Chris Lattnera731c9f2008-01-11 07:18:17 +0000631let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], neverHasSideEffects = 1 in
Evan Cheng071a2792007-09-11 19:55:27 +0000632def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>;
633 // EAX,EDX = EAX*GR32
Evan Cheng24f2ea32007-09-14 21:48:26 +0000634let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000635def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000636 "mul{b}\t$src",
Evan Chengcf74a7c2006-01-15 10:05:20 +0000637 // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
638 // This probably ought to be moved to a def : Pat<> if the
639 // syntax can be accepted.
Evan Cheng071a2792007-09-11 19:55:27 +0000640 [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8]
Chris Lattnerba7e7562008-01-10 07:59:24 +0000641let mayLoad = 1, neverHasSideEffects = 1 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +0000642let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000643def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src),
Evan Cheng071a2792007-09-11 19:55:27 +0000644 "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
Evan Cheng24f2ea32007-09-14 21:48:26 +0000645let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000646def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
Evan Cheng071a2792007-09-11 19:55:27 +0000647 "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Chris Lattnerba7e7562008-01-10 07:59:24 +0000648}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000649
Chris Lattnerba7e7562008-01-10 07:59:24 +0000650let neverHasSideEffects = 1 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +0000651let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng071a2792007-09-11 19:55:27 +0000652def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>;
653 // AL,AH = AL*GR8
Evan Cheng24f2ea32007-09-14 21:48:26 +0000654let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Dan Gohmanb1576f52007-07-31 20:11:57 +0000655def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>,
Evan Cheng071a2792007-09-11 19:55:27 +0000656 OpSize; // AX,DX = AX*GR16
Evan Cheng24f2ea32007-09-14 21:48:26 +0000657let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
Evan Cheng071a2792007-09-11 19:55:27 +0000658def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>;
659 // EAX,EDX = EAX*GR32
Chris Lattnerba7e7562008-01-10 07:59:24 +0000660let mayLoad = 1 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +0000661let Defs = [AL,AH,EFLAGS], Uses = [AL] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000662def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
Evan Cheng071a2792007-09-11 19:55:27 +0000663 "imul{b}\t$src", []>; // AL,AH = AL*[mem8]
Evan Cheng24f2ea32007-09-14 21:48:26 +0000664let Defs = [AX,DX,EFLAGS], Uses = [AX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000665def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src),
Evan Cheng071a2792007-09-11 19:55:27 +0000666 "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16]
667let Defs = [EAX,EDX], Uses = [EAX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000668def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
Evan Cheng071a2792007-09-11 19:55:27 +0000669 "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32]
Chris Lattnerba7e7562008-01-10 07:59:24 +0000670}
Chris Lattner1e6a7152005-04-06 04:19:22 +0000671
Chris Lattnerc8f45872003-08-04 04:59:56 +0000672// unsigned division/remainder
Evan Cheng24f2ea32007-09-14 21:48:26 +0000673let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000674def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng071a2792007-09-11 19:55:27 +0000675 "div{b}\t$src", []>;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000676let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000677def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng071a2792007-09-11 19:55:27 +0000678 "div{w}\t$src", []>, OpSize;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000679let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000680def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng071a2792007-09-11 19:55:27 +0000681 "div{l}\t$src", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000682let mayLoad = 1 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +0000683let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000684def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng071a2792007-09-11 19:55:27 +0000685 "div{b}\t$src", []>;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000686let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000687def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng071a2792007-09-11 19:55:27 +0000688 "div{w}\t$src", []>, OpSize;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000689let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000690def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng071a2792007-09-11 19:55:27 +0000691 "div{l}\t$src", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000692}
Chris Lattner1cca5e32003-08-03 21:54:21 +0000693
Chris Lattnerfc752712004-08-01 09:52:59 +0000694// Signed division/remainder.
Evan Cheng24f2ea32007-09-14 21:48:26 +0000695let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000696def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH
Evan Cheng071a2792007-09-11 19:55:27 +0000697 "idiv{b}\t$src", []>;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000698let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000699def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX
Evan Cheng071a2792007-09-11 19:55:27 +0000700 "idiv{w}\t$src", []>, OpSize;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000701let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000702def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX
Evan Cheng071a2792007-09-11 19:55:27 +0000703 "idiv{l}\t$src", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000704let mayLoad = 1, mayLoad = 1 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +0000705let Defs = [AX,EFLAGS], Uses = [AL,AH] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000706def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH
Evan Cheng071a2792007-09-11 19:55:27 +0000707 "idiv{b}\t$src", []>;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000708let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000709def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX
Evan Cheng071a2792007-09-11 19:55:27 +0000710 "idiv{w}\t$src", []>, OpSize;
Evan Cheng24f2ea32007-09-14 21:48:26 +0000711let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
Evan Cheng64d80e32007-07-19 01:14:50 +0000712def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX
Evan Cheng071a2792007-09-11 19:55:27 +0000713 "idiv{l}\t$src", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +0000714}
715} // neverHasSideEffects
Chris Lattner1cca5e32003-08-03 21:54:21 +0000716
Chris Lattner1cca5e32003-08-03 21:54:21 +0000717//===----------------------------------------------------------------------===//
Chris Lattnerba7e7562008-01-10 07:59:24 +0000718// Two address Instructions.
Chris Lattner1cca5e32003-08-03 21:54:21 +0000719//
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +0000720let isTwoAddress = 1 in {
Chris Lattner1cca5e32003-08-03 21:54:21 +0000721
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000722// Conditional moves
Evan Cheng0488db92007-09-25 01:57:46 +0000723let Uses = [EFLAGS] in {
Evan Cheng7ad42d92007-10-05 23:13:21 +0000724let isCommutable = 1 in {
Evan Cheng069287d2006-05-16 07:21:53 +0000725def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000726 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000727 "cmovb\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000728 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000729 X86_COND_B, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000730 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000731def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000732 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000733 "cmovb\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000734 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000735 X86_COND_B, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000736 TB;
Alkis Evlogimenosa3f66842004-03-12 17:59:56 +0000737
Evan Cheng069287d2006-05-16 07:21:53 +0000738def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000739 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000740 "cmovae\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000741 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000742 X86_COND_AE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000743 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000744def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000745 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000746 "cmovae\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000747 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000748 X86_COND_AE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000749 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000750def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000751 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000752 "cmove\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000753 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000754 X86_COND_E, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000755 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000756def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000757 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000758 "cmove\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000759 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000760 X86_COND_E, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000761 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000762def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000763 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000764 "cmovne\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000765 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000766 X86_COND_NE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000767 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000768def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000769 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000770 "cmovne\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000771 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000772 X86_COND_NE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000773 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000774def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000775 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000776 "cmovbe\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000777 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000778 X86_COND_BE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000779 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000780def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000781 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000782 "cmovbe\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000783 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000784 X86_COND_BE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000785 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000786def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000787 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000788 "cmova\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000789 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000790 X86_COND_A, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000791 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000792def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000793 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000794 "cmova\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000795 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000796 X86_COND_A, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000797 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000798def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000799 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000800 "cmovl\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000801 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000802 X86_COND_L, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000803 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000804def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000805 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000806 "cmovl\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000807 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000808 X86_COND_L, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000809 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000810def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000811 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000812 "cmovge\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000813 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000814 X86_COND_GE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000815 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000816def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000817 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000818 "cmovge\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000819 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000820 X86_COND_GE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000821 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000822def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000823 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000824 "cmovle\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000825 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000826 X86_COND_LE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000827 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000828def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000829 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000830 "cmovle\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000831 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000832 X86_COND_LE, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000833 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000834def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000835 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000836 "cmovg\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000837 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000838 X86_COND_G, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000839 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000840def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000841 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000842 "cmovg\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000843 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000844 X86_COND_G, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000845 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000846def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000847 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000848 "cmovs\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000849 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000850 X86_COND_S, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000851 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000852def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000853 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000854 "cmovs\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000855 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000856 X86_COND_S, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000857 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000858def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000859 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000860 "cmovns\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000861 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000862 X86_COND_NS, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000863 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000864def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000865 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000866 "cmovns\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000867 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000868 X86_COND_NS, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000869 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000870def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000871 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000872 "cmovp\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000873 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000874 X86_COND_P, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000875 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000876def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000877 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000878 "cmovp\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000879 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000880 X86_COND_P, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000881 TB;
Evan Cheng069287d2006-05-16 07:21:53 +0000882def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16
Evan Cheng64d80e32007-07-19 01:14:50 +0000883 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000884 "cmovnp\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000885 [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000886 X86_COND_NP, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000887 TB, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +0000888def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32
Evan Cheng64d80e32007-07-19 01:14:50 +0000889 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000890 "cmovnp\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000891 [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2,
Evan Chenge5f62042007-09-29 00:00:36 +0000892 X86_COND_NP, EFLAGS))]>,
Evan Cheng71fb9ad2006-01-26 00:29:36 +0000893 TB;
Evan Cheng7ad42d92007-10-05 23:13:21 +0000894} // isCommutable = 1
895
Evan Cheng069287d2006-05-16 07:21:53 +0000896def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32]
Evan Cheng64d80e32007-07-19 01:14:50 +0000897 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +0000898 "cmovnp\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +0000899 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
Evan Cheng0488db92007-09-25 01:57:46 +0000900 X86_COND_NP, EFLAGS))]>,
901 TB;
Evan Cheng7ad42d92007-10-05 23:13:21 +0000902
903def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16]
904 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
905 "cmovb\t{$src2, $dst|$dst, $src2}",
906 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
907 X86_COND_B, EFLAGS))]>,
908 TB, OpSize;
909def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32]
910 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
911 "cmovb\t{$src2, $dst|$dst, $src2}",
912 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
913 X86_COND_B, EFLAGS))]>,
914 TB;
915def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16]
916 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
917 "cmovae\t{$src2, $dst|$dst, $src2}",
918 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
919 X86_COND_AE, EFLAGS))]>,
920 TB, OpSize;
921def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32]
922 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
923 "cmovae\t{$src2, $dst|$dst, $src2}",
924 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
925 X86_COND_AE, EFLAGS))]>,
926 TB;
927def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16]
928 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
929 "cmove\t{$src2, $dst|$dst, $src2}",
930 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
931 X86_COND_E, EFLAGS))]>,
932 TB, OpSize;
933def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32]
934 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
935 "cmove\t{$src2, $dst|$dst, $src2}",
936 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
937 X86_COND_E, EFLAGS))]>,
938 TB;
939def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16]
940 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
941 "cmovne\t{$src2, $dst|$dst, $src2}",
942 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
943 X86_COND_NE, EFLAGS))]>,
944 TB, OpSize;
945def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32]
946 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
947 "cmovne\t{$src2, $dst|$dst, $src2}",
948 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
949 X86_COND_NE, EFLAGS))]>,
950 TB;
951def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16]
952 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
953 "cmovbe\t{$src2, $dst|$dst, $src2}",
954 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
955 X86_COND_BE, EFLAGS))]>,
956 TB, OpSize;
957def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32]
958 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
959 "cmovbe\t{$src2, $dst|$dst, $src2}",
960 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
961 X86_COND_BE, EFLAGS))]>,
962 TB;
963def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16]
964 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
965 "cmova\t{$src2, $dst|$dst, $src2}",
966 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
967 X86_COND_A, EFLAGS))]>,
968 TB, OpSize;
969def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32]
970 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
971 "cmova\t{$src2, $dst|$dst, $src2}",
972 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
973 X86_COND_A, EFLAGS))]>,
974 TB;
975def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16]
976 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
977 "cmovl\t{$src2, $dst|$dst, $src2}",
978 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
979 X86_COND_L, EFLAGS))]>,
980 TB, OpSize;
981def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32]
982 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
983 "cmovl\t{$src2, $dst|$dst, $src2}",
984 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
985 X86_COND_L, EFLAGS))]>,
986 TB;
987def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16]
988 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
989 "cmovge\t{$src2, $dst|$dst, $src2}",
990 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
991 X86_COND_GE, EFLAGS))]>,
992 TB, OpSize;
993def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32]
994 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
995 "cmovge\t{$src2, $dst|$dst, $src2}",
996 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
997 X86_COND_GE, EFLAGS))]>,
998 TB;
999def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16]
1000 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1001 "cmovle\t{$src2, $dst|$dst, $src2}",
1002 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1003 X86_COND_LE, EFLAGS))]>,
1004 TB, OpSize;
1005def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32]
1006 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1007 "cmovle\t{$src2, $dst|$dst, $src2}",
1008 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1009 X86_COND_LE, EFLAGS))]>,
1010 TB;
1011def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16]
1012 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1013 "cmovg\t{$src2, $dst|$dst, $src2}",
1014 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1015 X86_COND_G, EFLAGS))]>,
1016 TB, OpSize;
1017def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32]
1018 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1019 "cmovg\t{$src2, $dst|$dst, $src2}",
1020 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1021 X86_COND_G, EFLAGS))]>,
1022 TB;
1023def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16]
1024 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1025 "cmovs\t{$src2, $dst|$dst, $src2}",
1026 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1027 X86_COND_S, EFLAGS))]>,
1028 TB, OpSize;
1029def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32]
1030 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1031 "cmovs\t{$src2, $dst|$dst, $src2}",
1032 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1033 X86_COND_S, EFLAGS))]>,
1034 TB;
1035def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16]
1036 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1037 "cmovns\t{$src2, $dst|$dst, $src2}",
1038 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1039 X86_COND_NS, EFLAGS))]>,
1040 TB, OpSize;
1041def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32]
1042 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1043 "cmovns\t{$src2, $dst|$dst, $src2}",
1044 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1045 X86_COND_NS, EFLAGS))]>,
1046 TB;
1047def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16]
1048 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1049 "cmovp\t{$src2, $dst|$dst, $src2}",
1050 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1051 X86_COND_P, EFLAGS))]>,
1052 TB, OpSize;
1053def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32]
1054 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
1055 "cmovp\t{$src2, $dst|$dst, $src2}",
1056 [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
1057 X86_COND_P, EFLAGS))]>,
1058 TB;
1059def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16]
1060 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
1061 "cmovnp\t{$src2, $dst|$dst, $src2}",
1062 [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
1063 X86_COND_NP, EFLAGS))]>,
1064 TB, OpSize;
Evan Cheng0488db92007-09-25 01:57:46 +00001065} // Uses = [EFLAGS]
1066
1067
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001068// unary instructions
Evan Cheng1693e482006-07-19 00:27:29 +00001069let CodeSize = 2 in {
Evan Cheng24f2ea32007-09-14 21:48:26 +00001070let Defs = [EFLAGS] in {
Dan Gohmanb1576f52007-07-31 20:11:57 +00001071def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001072 [(set GR8:$dst, (ineg GR8:$src))]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001073def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001074 [(set GR16:$dst, (ineg GR16:$src))]>, OpSize;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001075def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001076 [(set GR32:$dst, (ineg GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001077let isTwoAddress = 0 in {
Dan Gohmanb1576f52007-07-31 20:11:57 +00001078 def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001079 [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001080 def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001081 [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001082 def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001083 [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>;
1084
Chris Lattner57a02302004-08-11 04:31:00 +00001085}
Evan Cheng24f2ea32007-09-14 21:48:26 +00001086} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001087
Dan Gohmanb1576f52007-07-31 20:11:57 +00001088def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001089 [(set GR8:$dst, (not GR8:$src))]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001090def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001091 [(set GR16:$dst, (not GR16:$src))]>, OpSize;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001092def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001093 [(set GR32:$dst, (not GR32:$src))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001094let isTwoAddress = 0 in {
Dan Gohmanb1576f52007-07-31 20:11:57 +00001095 def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001096 [(store (not (loadi8 addr:$dst)), addr:$dst)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001097 def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001098 [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001099 def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001100 [(store (not (loadi32 addr:$dst)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001101}
Evan Cheng1693e482006-07-19 00:27:29 +00001102} // CodeSize
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001103
Evan Chengb51a0592005-12-10 00:48:20 +00001104// TODO: inc/dec is slow for P4, but fast for Pentium-M.
Evan Cheng24f2ea32007-09-14 21:48:26 +00001105let Defs = [EFLAGS] in {
Evan Cheng1693e482006-07-19 00:27:29 +00001106let CodeSize = 2 in
Dan Gohmanb1576f52007-07-31 20:11:57 +00001107def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001108 [(set GR8:$dst, (add GR8:$src, 1))]>;
Evan Cheng1693e482006-07-19 00:27:29 +00001109let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohmanb1576f52007-07-31 20:11:57 +00001110def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "inc{w}\t$dst",
Evan Cheng25ab6902006-09-08 06:48:29 +00001111 [(set GR16:$dst, (add GR16:$src, 1))]>,
1112 OpSize, Requires<[In32BitMode]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001113def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "inc{l}\t$dst",
Evan Cheng25ab6902006-09-08 06:48:29 +00001114 [(set GR32:$dst, (add GR32:$src, 1))]>, Requires<[In32BitMode]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001115}
Evan Cheng1693e482006-07-19 00:27:29 +00001116let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohmanb1576f52007-07-31 20:11:57 +00001117 def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001118 [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001119 def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst",
Evan Cheng66f71632007-10-19 21:23:22 +00001120 [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>,
1121 OpSize, Requires<[In32BitMode]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001122 def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst",
Evan Cheng66f71632007-10-19 21:23:22 +00001123 [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>,
1124 Requires<[In32BitMode]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001125}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001126
Evan Cheng1693e482006-07-19 00:27:29 +00001127let CodeSize = 2 in
Dan Gohmanb1576f52007-07-31 20:11:57 +00001128def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst",
Evan Cheng069287d2006-05-16 07:21:53 +00001129 [(set GR8:$dst, (add GR8:$src, -1))]>;
Evan Cheng1693e482006-07-19 00:27:29 +00001130let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA.
Dan Gohmanb1576f52007-07-31 20:11:57 +00001131def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "dec{w}\t$dst",
Evan Cheng25ab6902006-09-08 06:48:29 +00001132 [(set GR16:$dst, (add GR16:$src, -1))]>,
1133 OpSize, Requires<[In32BitMode]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001134def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "dec{l}\t$dst",
Evan Cheng25ab6902006-09-08 06:48:29 +00001135 [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In32BitMode]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001136}
Chris Lattner57a02302004-08-11 04:31:00 +00001137
Evan Cheng1693e482006-07-19 00:27:29 +00001138let isTwoAddress = 0, CodeSize = 2 in {
Dan Gohmanb1576f52007-07-31 20:11:57 +00001139 def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst",
Evan Cheng605c4152005-12-13 01:57:51 +00001140 [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001141 def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst",
Evan Cheng66f71632007-10-19 21:23:22 +00001142 [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>,
1143 OpSize, Requires<[In32BitMode]>;
Dan Gohmanb1576f52007-07-31 20:11:57 +00001144 def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst",
Evan Cheng66f71632007-10-19 21:23:22 +00001145 [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>,
1146 Requires<[In32BitMode]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001147}
Evan Cheng24f2ea32007-09-14 21:48:26 +00001148} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001149
1150// Logical operators...
Evan Cheng24f2ea32007-09-14 21:48:26 +00001151let Defs = [EFLAGS] in {
Chris Lattnercc65bee2005-01-02 02:35:46 +00001152let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001153def AND8rr : I<0x20, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001154 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001155 "and{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001156 [(set GR8:$dst, (and GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001157def AND16rr : I<0x21, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001158 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001159 "and{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001160 [(set GR16:$dst, (and GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001161def AND32rr : I<0x21, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001162 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001163 "and{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001164 [(set GR32:$dst, (and GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001165}
Chris Lattner57a02302004-08-11 04:31:00 +00001166
Chris Lattner3a173df2004-10-03 20:35:00 +00001167def AND8rm : I<0x22, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001168 (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001169 "and{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001170 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001171def AND16rm : I<0x23, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001172 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001173 "and{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001174 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001175def AND32rm : I<0x23, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001176 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001177 "and{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001178 [(set GR32:$dst, (and GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001179
Chris Lattner3a173df2004-10-03 20:35:00 +00001180def AND8ri : Ii8<0x80, MRM4r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001181 (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001182 "and{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001183 [(set GR8:$dst, (and GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001184def AND16ri : Ii16<0x81, MRM4r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001185 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001186 "and{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001187 [(set GR16:$dst, (and GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001188def AND32ri : Ii32<0x81, MRM4r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001189 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001190 "and{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001191 [(set GR32:$dst, (and GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001192def AND16ri8 : Ii8<0x83, MRM4r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001193 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001194 "and{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001195 [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001196 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001197def AND32ri8 : Ii8<0x83, MRM4r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001198 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001199 "and{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001200 [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001201
1202let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001203 def AND8mr : I<0x20, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001204 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001205 "and{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001206 [(store (and (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001207 def AND16mr : I<0x21, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001208 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001209 "and{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001210 [(store (and (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001211 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001212 def AND32mr : I<0x21, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001213 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001214 "and{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001215 [(store (and (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001216 def AND8mi : Ii8<0x80, MRM4m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001217 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001218 "and{b}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001219 [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001220 def AND16mi : Ii16<0x81, MRM4m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001221 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001222 "and{w}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001223 [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001224 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001225 def AND32mi : Ii32<0x81, MRM4m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001226 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001227 "and{l}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001228 [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001229 def AND16mi8 : Ii8<0x83, MRM4m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001230 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001231 "and{w}\t{$src, $dst|$dst, $src}",
Evan Cheng0ef3a772005-12-13 01:41:36 +00001232 [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1233 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001234 def AND32mi8 : Ii8<0x83, MRM4m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001235 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001236 "and{l}\t{$src, $dst|$dst, $src}",
Evan Chenge3703d42006-01-14 01:18:49 +00001237 [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001238}
1239
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001240
Chris Lattnercc65bee2005-01-02 02:35:46 +00001241let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y
Evan Cheng64d80e32007-07-19 01:14:50 +00001242def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001243 "or{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001244 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001245def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001246 "or{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001247 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001248def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001249 "or{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001250 [(set GR32:$dst, (or GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001251}
Evan Cheng64d80e32007-07-19 01:14:50 +00001252def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001253 "or{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001254 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001255def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001256 "or{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001257 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001258def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001259 "or{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001260 [(set GR32:$dst, (or GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001261
Evan Cheng64d80e32007-07-19 01:14:50 +00001262def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001263 "or{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001264 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001265def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001266 "or{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001267 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001268def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001269 "or{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001270 [(set GR32:$dst, (or GR32:$src1, imm:$src2))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001271
Evan Cheng64d80e32007-07-19 01:14:50 +00001272def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001273 "or{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001274 [(set GR16:$dst, (or GR16:$src1, i16immSExt8:$src2))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001275def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001276 "or{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001277 [(set GR32:$dst, (or GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001278let isTwoAddress = 0 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001279 def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001280 "or{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001281 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001282 def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001283 "or{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001284 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001285 def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001286 "or{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001287 [(store (or (load addr:$dst), GR32:$src), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001288 def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001289 "or{b}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001290 [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001291 def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001292 "or{w}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001293 [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001294 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001295 def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001296 "or{l}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001297 [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001298 def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001299 "or{w}\t{$src, $dst|$dst, $src}",
Evan Cheng0ef3a772005-12-13 01:41:36 +00001300 [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1301 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001302 def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001303 "or{l}\t{$src, $dst|$dst, $src}",
Evan Cheng0ef3a772005-12-13 01:41:36 +00001304 [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001305}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001306
1307
Chris Lattnercc65bee2005-01-02 02:35:46 +00001308let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y
Chris Lattner3a173df2004-10-03 20:35:00 +00001309def XOR8rr : I<0x30, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001310 (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001311 "xor{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001312 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001313def XOR16rr : I<0x31, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001314 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001315 "xor{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001316 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001317def XOR32rr : I<0x31, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001318 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001319 "xor{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001320 [(set GR32:$dst, (xor GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001321}
1322
Chris Lattner3a173df2004-10-03 20:35:00 +00001323def XOR8rm : I<0x32, MRMSrcMem ,
Evan Cheng64d80e32007-07-19 01:14:50 +00001324 (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001325 "xor{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001326 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2)))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001327def XOR16rm : I<0x33, MRMSrcMem ,
Evan Cheng64d80e32007-07-19 01:14:50 +00001328 (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001329 "xor{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001330 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2)))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001331def XOR32rm : I<0x33, MRMSrcMem ,
Evan Cheng64d80e32007-07-19 01:14:50 +00001332 (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001333 "xor{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001334 [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001335
Chris Lattner3a173df2004-10-03 20:35:00 +00001336def XOR8ri : Ii8<0x80, MRM6r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001337 (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001338 "xor{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001339 [(set GR8:$dst, (xor GR8:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001340def XOR16ri : Ii16<0x81, MRM6r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001341 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001342 "xor{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001343 [(set GR16:$dst, (xor GR16:$src1, imm:$src2))]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001344def XOR32ri : Ii32<0x81, MRM6r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001345 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001346 "xor{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001347 [(set GR32:$dst, (xor GR32:$src1, imm:$src2))]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001348def XOR16ri8 : Ii8<0x83, MRM6r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001349 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001350 "xor{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001351 [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00001352 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001353def XOR32ri8 : Ii8<0x83, MRM6r,
Evan Cheng64d80e32007-07-19 01:14:50 +00001354 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001355 "xor{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001356 [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001357let isTwoAddress = 0 in {
Chris Lattner3a173df2004-10-03 20:35:00 +00001358 def XOR8mr : I<0x30, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001359 (outs), (ins i8mem :$dst, GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001360 "xor{b}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001361 [(store (xor (load addr:$dst), GR8:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001362 def XOR16mr : I<0x31, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001363 (outs), (ins i16mem:$dst, GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001364 "xor{w}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001365 [(store (xor (load addr:$dst), GR16:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001366 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001367 def XOR32mr : I<0x31, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001368 (outs), (ins i32mem:$dst, GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001369 "xor{l}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00001370 [(store (xor (load addr:$dst), GR32:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001371 def XOR8mi : Ii8<0x80, MRM6m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001372 (outs), (ins i8mem :$dst, i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001373 "xor{b}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001374 [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001375 def XOR16mi : Ii16<0x81, MRM6m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001376 (outs), (ins i16mem:$dst, i16imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001377 "xor{w}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001378 [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>,
Evan Cheng0ef3a772005-12-13 01:41:36 +00001379 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001380 def XOR32mi : Ii32<0x81, MRM6m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001381 (outs), (ins i32mem:$dst, i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001382 "xor{l}\t{$src, $dst|$dst, $src}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001383 [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00001384 def XOR16mi8 : Ii8<0x83, MRM6m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001385 (outs), (ins i16mem:$dst, i16i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001386 "xor{w}\t{$src, $dst|$dst, $src}",
Evan Cheng0ef3a772005-12-13 01:41:36 +00001387 [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>,
1388 OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00001389 def XOR32mi8 : Ii8<0x83, MRM6m,
Evan Cheng64d80e32007-07-19 01:14:50 +00001390 (outs), (ins i32mem:$dst, i32i8imm :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001391 "xor{l}\t{$src, $dst|$dst, $src}",
Evan Cheng0ef3a772005-12-13 01:41:36 +00001392 [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001393}
Evan Cheng24f2ea32007-09-14 21:48:26 +00001394} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001395
1396// Shift instructions
Evan Cheng24f2ea32007-09-14 21:48:26 +00001397let Defs = [EFLAGS] in {
Evan Cheng071a2792007-09-11 19:55:27 +00001398let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001399def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001400 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001401 [(set GR8:$dst, (shl GR8:$src, CL))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001402def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001403 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001404 [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001405def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001406 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001407 [(set GR32:$dst, (shl GR32:$src, CL))]>;
1408}
Chris Lattnercc65bee2005-01-02 02:35:46 +00001409
Evan Cheng64d80e32007-07-19 01:14:50 +00001410def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001411 "shl{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001412 [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001413let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng64d80e32007-07-19 01:14:50 +00001414def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001415 "shl{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001416 [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001417def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001418 "shl{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001419 [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001420}
Chris Lattnerf29ed092004-08-11 05:07:25 +00001421
Evan Cheng09c54572006-06-29 00:36:51 +00001422// Shift left by one. Not used because (add x, x) is slightly cheaper.
Chris Lattnera731c9f2008-01-11 07:18:17 +00001423let neverHasSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001424def SHL8r1 : I<0xD0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001425 "shl{b}\t$dst", []>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001426def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001427 "shl{w}\t$dst", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001428def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001429 "shl{l}\t$dst", []>;
Chris Lattnera731c9f2008-01-11 07:18:17 +00001430}
Evan Cheng09c54572006-06-29 00:36:51 +00001431
Chris Lattnerf29ed092004-08-11 05:07:25 +00001432let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001433 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001434 def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001435 "shl{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001436 [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001437 def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001438 "shl{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001439 [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001440 def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001441 "shl{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001442 [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>;
1443 }
Evan Cheng64d80e32007-07-19 01:14:50 +00001444 def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001445 "shl{b}\t{$src, $dst|$dst, $src}",
Evan Cheng763b0292005-12-13 02:34:51 +00001446 [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001447 def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001448 "shl{w}\t{$src, $dst|$dst, $src}",
Evan Cheng763b0292005-12-13 02:34:51 +00001449 [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1450 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001451 def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001452 "shl{l}\t{$src, $dst|$dst, $src}",
Evan Cheng763b0292005-12-13 02:34:51 +00001453 [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001454
1455 // Shift by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001456 def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001457 "shl{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001458 [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001459 def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001460 "shl{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001461 [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1462 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001463 def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001464 "shl{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001465 [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001466}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001467
Evan Cheng071a2792007-09-11 19:55:27 +00001468let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001469def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001470 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001471 [(set GR8:$dst, (srl GR8:$src, CL))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001472def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001473 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001474 [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001475def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001476 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001477 [(set GR32:$dst, (srl GR32:$src, CL))]>;
1478}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001479
Evan Cheng64d80e32007-07-19 01:14:50 +00001480def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001481 "shr{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001482 [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001483def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001484 "shr{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001485 [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001486def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001487 "shr{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001488 [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001489
Evan Cheng09c54572006-06-29 00:36:51 +00001490// Shift by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001491def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001492 "shr{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001493 [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001494def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001495 "shr{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001496 [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001497def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001498 "shr{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001499 [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>;
1500
Chris Lattner57a02302004-08-11 04:31:00 +00001501let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001502 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001503 def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001504 "shr{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001505 [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001506 def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001507 "shr{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001508 [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>,
Evan Cheng071a2792007-09-11 19:55:27 +00001509 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001510 def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001511 "shr{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001512 [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>;
1513 }
Evan Cheng64d80e32007-07-19 01:14:50 +00001514 def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001515 "shr{b}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001516 [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001517 def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001518 "shr{w}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001519 [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1520 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001521 def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001522 "shr{l}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001523 [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001524
1525 // Shift by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001526 def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001527 "shr{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001528 [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001529 def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001530 "shr{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001531 [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001532 def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001533 "shr{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001534 [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001535}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001536
Evan Cheng071a2792007-09-11 19:55:27 +00001537let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001538def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001539 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001540 [(set GR8:$dst, (sra GR8:$src, CL))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001541def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001542 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001543 [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001544def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001545 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001546 [(set GR32:$dst, (sra GR32:$src, CL))]>;
1547}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001548
Evan Cheng64d80e32007-07-19 01:14:50 +00001549def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001550 "sar{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001551 [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001552def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001553 "sar{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001554 [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>,
Chris Lattner3d36a9f2005-12-05 02:40:25 +00001555 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001556def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001557 "sar{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001558 [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001559
1560// Shift by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001561def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001562 "sar{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001563 [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001564def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001565 "sar{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001566 [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001567def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001568 "sar{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001569 [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>;
1570
Chris Lattnerf29ed092004-08-11 05:07:25 +00001571let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001572 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001573 def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001574 "sar{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001575 [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001576 def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001577 "sar{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001578 [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001579 def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001580 "sar{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001581 [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>;
1582 }
Evan Cheng64d80e32007-07-19 01:14:50 +00001583 def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001584 "sar{b}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001585 [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001586 def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001587 "sar{w}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001588 [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1589 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001590 def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001591 "sar{l}\t{$src, $dst|$dst, $src}",
Evan Cheng85dd8892005-12-13 07:24:22 +00001592 [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001593
1594 // Shift by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001595 def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001596 "sar{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001597 [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001598 def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001599 "sar{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001600 [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1601 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001602 def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001603 "sar{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001604 [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
Chris Lattnerf29ed092004-08-11 05:07:25 +00001605}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001606
Chris Lattner40ff6332005-01-19 07:50:03 +00001607// Rotate instructions
1608// FIXME: provide shorter instructions when imm8 == 1
Evan Cheng071a2792007-09-11 19:55:27 +00001609let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001610def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001611 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001612 [(set GR8:$dst, (rotl GR8:$src, CL))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001613def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001614 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001615 [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001616def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001617 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001618 [(set GR32:$dst, (rotl GR32:$src, CL))]>;
1619}
Chris Lattner40ff6332005-01-19 07:50:03 +00001620
Evan Cheng64d80e32007-07-19 01:14:50 +00001621def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001622 "rol{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001623 [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001624def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001625 "rol{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001626 [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001627def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001628 "rol{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001629 [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001630
Evan Cheng09c54572006-06-29 00:36:51 +00001631// Rotate by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001632def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001633 "rol{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001634 [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001635def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001636 "rol{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001637 [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001638def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001639 "rol{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001640 [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>;
1641
Chris Lattner40ff6332005-01-19 07:50:03 +00001642let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001643 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001644 def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001645 "rol{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001646 [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001647 def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001648 "rol{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001649 [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001650 def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001651 "rol{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001652 [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>;
1653 }
Evan Cheng64d80e32007-07-19 01:14:50 +00001654 def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001655 "rol{b}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001656 [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001657 def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001658 "rol{w}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001659 [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1660 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001661 def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001662 "rol{l}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001663 [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001664
1665 // Rotate by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001666 def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001667 "rol{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001668 [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001669 def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001670 "rol{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001671 [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1672 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001673 def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001674 "rol{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001675 [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001676}
1677
Evan Cheng071a2792007-09-11 19:55:27 +00001678let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001679def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001680 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001681 [(set GR8:$dst, (rotr GR8:$src, CL))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001682def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001683 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001684 [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001685def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001686 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001687 [(set GR32:$dst, (rotr GR32:$src, CL))]>;
1688}
Chris Lattner40ff6332005-01-19 07:50:03 +00001689
Evan Cheng64d80e32007-07-19 01:14:50 +00001690def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001691 "ror{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001692 [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001693def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001694 "ror{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001695 [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001696def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001697 "ror{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001698 [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001699
1700// Rotate by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001701def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001702 "ror{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001703 [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001704def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001705 "ror{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001706 [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001707def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001708 "ror{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001709 [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>;
1710
Chris Lattner40ff6332005-01-19 07:50:03 +00001711let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001712 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001713 def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001714 "ror{b}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001715 [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001716 def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001717 "ror{w}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001718 [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001719 def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001720 "ror{l}\t{%cl, $dst|$dst, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001721 [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>;
1722 }
Evan Cheng64d80e32007-07-19 01:14:50 +00001723 def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001724 "ror{b}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001725 [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001726 def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001727 "ror{w}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001728 [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>,
1729 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001730 def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001731 "ror{l}\t{$src, $dst|$dst, $src}",
Evan Chengeb422a72006-01-11 23:20:05 +00001732 [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>;
Evan Cheng09c54572006-06-29 00:36:51 +00001733
1734 // Rotate by 1
Evan Cheng64d80e32007-07-19 01:14:50 +00001735 def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001736 "ror{b}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001737 [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001738 def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001739 "ror{w}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001740 [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,
1741 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001742 def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001743 "ror{l}\t$dst",
Evan Cheng09c54572006-06-29 00:36:51 +00001744 [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>;
Chris Lattner40ff6332005-01-19 07:50:03 +00001745}
1746
1747
1748
1749// Double shift instructions (generalizations of rotate)
Evan Cheng071a2792007-09-11 19:55:27 +00001750let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001751def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001752 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001753 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00001754def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001755 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng071a2792007-09-11 19:55:27 +00001756 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00001757def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001758 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001759 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng071a2792007-09-11 19:55:27 +00001760 TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001761def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001762 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001763 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>,
Evan Cheng071a2792007-09-11 19:55:27 +00001764 TB, OpSize;
1765}
Chris Lattner41e431b2005-01-19 07:11:01 +00001766
1767let isCommutable = 1 in { // These instructions commute to each other.
Chris Lattner3a173df2004-10-03 20:35:00 +00001768def SHLD32rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001769 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001770 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001771 [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001772 (i8 imm:$src3)))]>,
1773 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001774def SHRD32rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001775 (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001776 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001777 [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001778 (i8 imm:$src3)))]>,
1779 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001780def SHLD16rri8 : Ii8<0xA4, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001781 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001782 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001783 [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001784 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001785 TB, OpSize;
1786def SHRD16rri8 : Ii8<0xAC, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00001787 (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001788 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001789 [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001790 (i8 imm:$src3)))]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001791 TB, OpSize;
Chris Lattner41e431b2005-01-19 07:11:01 +00001792}
Chris Lattner0e967d42004-08-01 08:13:11 +00001793
Chris Lattner57a02302004-08-11 04:31:00 +00001794let isTwoAddress = 0 in {
Evan Cheng071a2792007-09-11 19:55:27 +00001795 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001796 def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001797 "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001798 [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng071a2792007-09-11 19:55:27 +00001799 addr:$dst)]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00001800 def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001801 "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001802 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL),
Evan Cheng071a2792007-09-11 19:55:27 +00001803 addr:$dst)]>, TB;
1804 }
Chris Lattner3a173df2004-10-03 20:35:00 +00001805 def SHLD32mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001806 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001807 "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001808 [(store (X86shld (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001809 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001810 TB;
Chris Lattner3a173df2004-10-03 20:35:00 +00001811 def SHRD32mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001812 (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001813 "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001814 [(store (X86shrd (loadi32 addr:$dst), GR32:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001815 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattnerf124d5e2005-11-18 01:04:42 +00001816 TB;
Chris Lattner0df53d22005-01-19 07:31:24 +00001817
Evan Cheng071a2792007-09-11 19:55:27 +00001818 let Uses = [CL] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001819 def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001820 "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001821 [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng071a2792007-09-11 19:55:27 +00001822 addr:$dst)]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001823 def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001824 "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}",
Evan Cheng069287d2006-05-16 07:21:53 +00001825 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL),
Evan Cheng071a2792007-09-11 19:55:27 +00001826 addr:$dst)]>, TB, OpSize;
1827 }
Chris Lattner0df53d22005-01-19 07:31:24 +00001828 def SHLD16mri8 : Ii8<0xA4, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001829 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001830 "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001831 [(store (X86shld (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001832 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001833 TB, OpSize;
1834 def SHRD16mri8 : Ii8<0xAC, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00001835 (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001836 "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}",
Evan Cheng069287d2006-05-16 07:21:53 +00001837 [(store (X86shrd (loadi16 addr:$dst), GR16:$src2,
Evan Chenge3413162006-01-09 18:33:28 +00001838 (i8 imm:$src3)), addr:$dst)]>,
Chris Lattner0df53d22005-01-19 07:31:24 +00001839 TB, OpSize;
Chris Lattner57a02302004-08-11 04:31:00 +00001840}
Evan Cheng24f2ea32007-09-14 21:48:26 +00001841} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001842
1843
Chris Lattnercc65bee2005-01-02 02:35:46 +00001844// Arithmetic.
Evan Cheng24f2ea32007-09-14 21:48:26 +00001845let Defs = [EFLAGS] in {
Chris Lattnercc65bee2005-01-02 02:35:46 +00001846let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y
Evan Cheng071a2792007-09-11 19:55:27 +00001847def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst),
1848 (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001849 "add{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001850 [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001851let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng071a2792007-09-11 19:55:27 +00001852def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst),
1853 (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001854 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001855 [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng071a2792007-09-11 19:55:27 +00001856def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst),
1857 (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001858 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001859 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001860} // end isConvertibleToThreeAddress
1861} // end isCommutable
Evan Cheng071a2792007-09-11 19:55:27 +00001862def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst),
1863 (ins GR8 :$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001864 "add{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001865 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>;
Evan Cheng071a2792007-09-11 19:55:27 +00001866def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst),
1867 (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001868 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng071a2792007-09-11 19:55:27 +00001869 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize;
1870def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst),
1871 (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001872 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001873 [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001874
Evan Cheng64d80e32007-07-19 01:14:50 +00001875def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001876 "add{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001877 [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00001878
1879let isConvertibleToThreeAddress = 1 in { // Can transform into LEA.
Evan Cheng071a2792007-09-11 19:55:27 +00001880def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst),
1881 (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001882 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001883 [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng071a2792007-09-11 19:55:27 +00001884def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst),
1885 (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001886 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001887 [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>;
Evan Cheng071a2792007-09-11 19:55:27 +00001888def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst),
1889 (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001890 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng071a2792007-09-11 19:55:27 +00001891 [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize;
1892def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst),
1893 (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001894 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng071a2792007-09-11 19:55:27 +00001895 [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng09e3c802006-05-19 18:40:54 +00001896}
Chris Lattner57a02302004-08-11 04:31:00 +00001897
1898let isTwoAddress = 0 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001899 def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001900 "add{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001901 [(store (add (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001902 def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001903 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001904 [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00001905 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001906 def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001907 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001908 [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001909 def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001910 "add{b}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001911 [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001912 def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001913 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001914 [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00001915 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001916 def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001917 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00001918 [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001919 def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001920 "add{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001921 [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00001922 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001923 def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001924 "add{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00001925 [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001926}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001927
Evan Cheng3154cb62007-10-05 17:59:57 +00001928let Uses = [EFLAGS] in {
Chris Lattner10197ff2005-01-03 01:27:59 +00001929let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y
Evan Cheng64d80e32007-07-19 01:14:50 +00001930def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001931 "adc{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001932 [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>;
Chris Lattner10197ff2005-01-03 01:27:59 +00001933}
Evan Cheng64d80e32007-07-19 01:14:50 +00001934def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001935 "adc{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001936 [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001937def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001938 "adc{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001939 [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001940def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001941 "adc{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001942 [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001943
1944let isTwoAddress = 0 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001945 def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001946 "adc{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001947 [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001948 def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001949 "adc{l}\t{$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001950 [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001951 def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001952 "adc{l}\t{$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00001953 [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001954}
Evan Cheng3154cb62007-10-05 17:59:57 +00001955} // Uses = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001956
Evan Cheng64d80e32007-07-19 01:14:50 +00001957def SUB8rr : I<0x28, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001958 "sub{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001959 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001960def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001961 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001962 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001963def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001964 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001965 [(set GR32:$dst, (sub GR32:$src1, GR32:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001966def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001967 "sub{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001968 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001969def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001970 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001971 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2)))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001972def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001973 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001974 [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2)))]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00001975
Evan Cheng64d80e32007-07-19 01:14:50 +00001976def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001977 "sub{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001978 [(set GR8:$dst, (sub GR8:$src1, imm:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001979def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001980 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001981 [(set GR16:$dst, (sub GR16:$src1, imm:$src2))]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001982def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001983 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001984 [(set GR32:$dst, (sub GR32:$src1, imm:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001985def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001986 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001987 [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00001988 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00001989def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001990 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001991 [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattner57a02302004-08-11 04:31:00 +00001992let isTwoAddress = 0 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00001993 def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001994 "sub{b}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001995 [(store (sub (load addr:$dst), GR8:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00001996 def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00001997 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00001998 [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00001999 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002000 def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002001 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002002 [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002003 def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002004 "sub{b}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00002005 [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002006 def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002007 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00002008 [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00002009 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002010 def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002011 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Chengc937ffa2005-12-13 02:40:18 +00002012 [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002013 def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002014 "sub{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00002015 [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>,
Evan Cheng24f2ea32007-09-14 21:48:26 +00002016 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002017 def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002018 "sub{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng9b6b6422005-12-13 00:14:11 +00002019 [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00002020}
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002021
Evan Cheng3154cb62007-10-05 17:59:57 +00002022let Uses = [EFLAGS] in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002023def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002024 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng24f2ea32007-09-14 21:48:26 +00002025 [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>;
Chris Lattnerd93d3b02004-10-06 04:01:02 +00002026
Chris Lattner57a02302004-08-11 04:31:00 +00002027let isTwoAddress = 0 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002028 def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002029 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002030 [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002031 def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002032 "sbb{b}\t{$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00002033 [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002034 def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002035 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Nate Begeman551bf3f2006-02-17 05:43:56 +00002036 [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002037 def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002038 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng24f2ea32007-09-14 21:48:26 +00002039 [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>;
Chris Lattner57a02302004-08-11 04:31:00 +00002040}
Evan Cheng64d80e32007-07-19 01:14:50 +00002041def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002042 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002043 [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002044def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002045 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002046 [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002047def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002048 "sbb{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002049 [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>;
Evan Cheng3154cb62007-10-05 17:59:57 +00002050} // Uses = [EFLAGS]
Evan Cheng24f2ea32007-09-14 21:48:26 +00002051} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002052
Evan Cheng24f2ea32007-09-14 21:48:26 +00002053let Defs = [EFLAGS] in {
Chris Lattner10197ff2005-01-03 01:27:59 +00002054let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y
Evan Cheng64d80e32007-07-19 01:14:50 +00002055def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002056 "imul{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002057 [(set GR16:$dst, (mul GR16:$src1, GR16:$src2))]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002058def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002059 "imul{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002060 [(set GR32:$dst, (mul GR32:$src1, GR32:$src2))]>, TB;
Chris Lattner10197ff2005-01-03 01:27:59 +00002061}
Evan Cheng64d80e32007-07-19 01:14:50 +00002062def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002063 "imul{w}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002064 [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2)))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00002065 TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002066def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002067 "imul{l}\t{$src2, $dst|$dst, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002068 [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB;
Evan Cheng24f2ea32007-09-14 21:48:26 +00002069} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002070} // end Two Address instructions
2071
Chris Lattnerf5d3a832004-08-11 05:31:07 +00002072// Suprisingly enough, these are not two address instructions!
Evan Cheng24f2ea32007-09-14 21:48:26 +00002073let Defs = [EFLAGS] in {
Evan Cheng069287d2006-05-16 07:21:53 +00002074def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16
Evan Cheng64d80e32007-07-19 01:14:50 +00002075 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002076 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002077 [(set GR16:$dst, (mul GR16:$src1, imm:$src2))]>, OpSize;
2078def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32
Evan Cheng64d80e32007-07-19 01:14:50 +00002079 (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002080 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002081 [(set GR32:$dst, (mul GR32:$src1, imm:$src2))]>;
2082def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8
Evan Cheng64d80e32007-07-19 01:14:50 +00002083 (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002084 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002085 [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00002086 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002087def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8
Evan Cheng64d80e32007-07-19 01:14:50 +00002088 (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002089 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002090 [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2))]>;
Chris Lattnerf5d3a832004-08-11 05:31:07 +00002091
Evan Cheng069287d2006-05-16 07:21:53 +00002092def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16
Evan Cheng64d80e32007-07-19 01:14:50 +00002093 (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002094 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002095 [(set GR16:$dst, (mul (load addr:$src1), imm:$src2))]>,
Evan Chengf281e022005-12-12 23:47:46 +00002096 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002097def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32
Evan Cheng64d80e32007-07-19 01:14:50 +00002098 (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002099 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002100 [(set GR32:$dst, (mul (load addr:$src1), imm:$src2))]>;
2101def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8
Evan Cheng64d80e32007-07-19 01:14:50 +00002102 (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002103 "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002104 [(set GR16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>,
Evan Cheng9b6b6422005-12-13 00:14:11 +00002105 OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002106def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8
Evan Cheng64d80e32007-07-19 01:14:50 +00002107 (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002108 "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
Evan Cheng069287d2006-05-16 07:21:53 +00002109 [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>;
Evan Cheng24f2ea32007-09-14 21:48:26 +00002110} // Defs = [EFLAGS]
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002111
2112//===----------------------------------------------------------------------===//
2113// Test instructions are just like AND, except they don't generate a result.
Chris Lattner3a173df2004-10-03 20:35:00 +00002114//
Evan Cheng0488db92007-09-25 01:57:46 +00002115let Defs = [EFLAGS] in {
Chris Lattnercc65bee2005-01-02 02:35:46 +00002116let isCommutable = 1 in { // TEST X, Y --> TEST Y, X
Evan Cheng64d80e32007-07-19 01:14:50 +00002117def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002118 "test{b}\t{$src2, $src1|$src1, $src2}",
2119 [(X86cmp (and GR8:$src1, GR8:$src2), 0),
2120 (implicit EFLAGS)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002121def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002122 "test{w}\t{$src2, $src1|$src1, $src2}",
2123 [(X86cmp (and GR16:$src1, GR16:$src2), 0),
2124 (implicit EFLAGS)]>,
2125 OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002126def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002127 "test{l}\t{$src2, $src1|$src1, $src2}",
2128 [(X86cmp (and GR32:$src1, GR32:$src2), 0),
2129 (implicit EFLAGS)]>;
Chris Lattnercc65bee2005-01-02 02:35:46 +00002130}
Evan Cheng734503b2006-09-11 02:19:56 +00002131
Evan Cheng64d80e32007-07-19 01:14:50 +00002132def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002133 "test{b}\t{$src2, $src1|$src1, $src2}",
2134 [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0),
2135 (implicit EFLAGS)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002136def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002137 "test{w}\t{$src2, $src1|$src1, $src2}",
2138 [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0),
2139 (implicit EFLAGS)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002140def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2),
Evan Chenge5f62042007-09-29 00:00:36 +00002141 "test{l}\t{$src2, $src1|$src1, $src2}",
2142 [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0),
2143 (implicit EFLAGS)]>;
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002144
Evan Cheng069287d2006-05-16 07:21:53 +00002145def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8
Evan Cheng64d80e32007-07-19 01:14:50 +00002146 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002147 "test{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002148 [(X86cmp (and GR8:$src1, imm:$src2), 0),
2149 (implicit EFLAGS)]>;
Evan Cheng069287d2006-05-16 07:21:53 +00002150def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16
Evan Cheng64d80e32007-07-19 01:14:50 +00002151 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002152 "test{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002153 [(X86cmp (and GR16:$src1, imm:$src2), 0),
2154 (implicit EFLAGS)]>, OpSize;
Evan Cheng069287d2006-05-16 07:21:53 +00002155def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32
Evan Cheng64d80e32007-07-19 01:14:50 +00002156 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002157 "test{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002158 [(X86cmp (and GR32:$src1, imm:$src2), 0),
2159 (implicit EFLAGS)]>;
Evan Cheng734503b2006-09-11 02:19:56 +00002160
Evan Chenge5f62042007-09-29 00:00:36 +00002161def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8
Evan Cheng64d80e32007-07-19 01:14:50 +00002162 (outs), (ins i8mem:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002163 "test{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002164 [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0),
2165 (implicit EFLAGS)]>;
2166def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16
Evan Cheng64d80e32007-07-19 01:14:50 +00002167 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002168 "test{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002169 [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0),
2170 (implicit EFLAGS)]>, OpSize;
2171def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32
Evan Cheng64d80e32007-07-19 01:14:50 +00002172 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002173 "test{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002174 [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0),
Evan Cheng0488db92007-09-25 01:57:46 +00002175 (implicit EFLAGS)]>;
2176} // Defs = [EFLAGS]
2177
2178
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002179// Condition code ops, incl. set if equal/not equal/...
Chris Lattnerba7e7562008-01-10 07:59:24 +00002180let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in
Evan Cheng071a2792007-09-11 19:55:27 +00002181def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH
Chris Lattnerba7e7562008-01-10 07:59:24 +00002182let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in
Evan Cheng071a2792007-09-11 19:55:27 +00002183def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags
Alkis Evlogimenos5ab29b52004-02-28 22:02:05 +00002184
Evan Cheng0488db92007-09-25 01:57:46 +00002185let Uses = [EFLAGS] in {
Chris Lattner3a173df2004-10-03 20:35:00 +00002186def SETEr : I<0x94, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002187 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002188 "sete\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002189 [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002190 TB; // GR8 = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002191def SETEm : I<0x94, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002192 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002193 "sete\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002194 [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002195 TB; // [mem8] = ==
Chris Lattner3a173df2004-10-03 20:35:00 +00002196def SETNEr : I<0x95, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002197 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002198 "setne\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002199 [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002200 TB; // GR8 = !=
Chris Lattner3a173df2004-10-03 20:35:00 +00002201def SETNEm : I<0x95, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002202 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002203 "setne\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002204 [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002205 TB; // [mem8] = !=
2206def SETLr : I<0x9C, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002207 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002208 "setl\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002209 [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002210 TB; // GR8 = < signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002211def SETLm : I<0x9C, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002212 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002213 "setl\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002214 [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002215 TB; // [mem8] = < signed
2216def SETGEr : I<0x9D, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002217 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002218 "setge\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002219 [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002220 TB; // GR8 = >= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002221def SETGEm : I<0x9D, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002222 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002223 "setge\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002224 [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002225 TB; // [mem8] = >= signed
2226def SETLEr : I<0x9E, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002227 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002228 "setle\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002229 [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002230 TB; // GR8 = <= signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002231def SETLEm : I<0x9E, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002232 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002233 "setle\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002234 [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002235 TB; // [mem8] = <= signed
2236def SETGr : I<0x9F, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002237 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002238 "setg\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002239 [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002240 TB; // GR8 = > signed
Evan Chengd5781fc2005-12-21 20:21:51 +00002241def SETGm : I<0x9F, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002242 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002243 "setg\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002244 [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002245 TB; // [mem8] = > signed
2246
2247def SETBr : I<0x92, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002248 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002249 "setb\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002250 [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002251 TB; // GR8 = < unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002252def SETBm : I<0x92, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002253 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002254 "setb\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002255 [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002256 TB; // [mem8] = < unsign
2257def SETAEr : I<0x93, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002258 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002259 "setae\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002260 [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002261 TB; // GR8 = >= unsign
Evan Chengd5781fc2005-12-21 20:21:51 +00002262def SETAEm : I<0x93, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002263 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002264 "setae\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002265 [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002266 TB; // [mem8] = >= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002267def SETBEr : I<0x96, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002268 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002269 "setbe\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002270 [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002271 TB; // GR8 = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002272def SETBEm : I<0x96, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002273 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002274 "setbe\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002275 [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002276 TB; // [mem8] = <= unsign
Chris Lattner3a173df2004-10-03 20:35:00 +00002277def SETAr : I<0x97, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002278 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002279 "seta\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002280 [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002281 TB; // GR8 = > signed
Chris Lattner3a173df2004-10-03 20:35:00 +00002282def SETAm : I<0x97, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002283 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002284 "seta\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002285 [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>,
Evan Chengd5781fc2005-12-21 20:21:51 +00002286 TB; // [mem8] = > signed
Evan Chengd9558e02006-01-06 00:43:03 +00002287
Chris Lattner3a173df2004-10-03 20:35:00 +00002288def SETSr : I<0x98, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002289 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002290 "sets\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002291 [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002292 TB; // GR8 = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002293def SETSm : I<0x98, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002294 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002295 "sets\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002296 [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002297 TB; // [mem8] = <sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002298def SETNSr : I<0x99, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002299 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002300 "setns\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002301 [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002302 TB; // GR8 = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002303def SETNSm : I<0x99, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002304 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002305 "setns\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002306 [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002307 TB; // [mem8] = !<sign bit>
Chris Lattner3a173df2004-10-03 20:35:00 +00002308def SETPr : I<0x9A, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002309 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002310 "setp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002311 [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002312 TB; // GR8 = parity
Chris Lattner3a173df2004-10-03 20:35:00 +00002313def SETPm : I<0x9A, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002314 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002315 "setp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002316 [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002317 TB; // [mem8] = parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002318def SETNPr : I<0x9B, MRM0r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002319 (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002320 "setnp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002321 [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>,
Evan Cheng069287d2006-05-16 07:21:53 +00002322 TB; // GR8 = not parity
Chris Lattnercc65bee2005-01-02 02:35:46 +00002323def SETNPm : I<0x9B, MRM0m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002324 (outs), (ins i8mem:$dst),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002325 "setnp\t$dst",
Evan Chenge5f62042007-09-29 00:00:36 +00002326 [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>,
Evan Chengd9558e02006-01-06 00:43:03 +00002327 TB; // [mem8] = not parity
Evan Cheng0488db92007-09-25 01:57:46 +00002328} // Uses = [EFLAGS]
2329
Chris Lattner1cca5e32003-08-03 21:54:21 +00002330
2331// Integer comparisons
Evan Cheng24f2ea32007-09-14 21:48:26 +00002332let Defs = [EFLAGS] in {
Chris Lattner3a173df2004-10-03 20:35:00 +00002333def CMP8rr : I<0x38, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00002334 (outs), (ins GR8 :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002335 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002336 [(X86cmp GR8:$src1, GR8:$src2), (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002337def CMP16rr : I<0x39, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00002338 (outs), (ins GR16:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002339 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002340 [(X86cmp GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002341def CMP32rr : I<0x39, MRMDestReg,
Evan Cheng64d80e32007-07-19 01:14:50 +00002342 (outs), (ins GR32:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002343 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002344 [(X86cmp GR32:$src1, GR32:$src2), (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002345def CMP8mr : I<0x38, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002346 (outs), (ins i8mem :$src1, GR8 :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002347 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002348 [(X86cmp (loadi8 addr:$src1), GR8:$src2),
2349 (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002350def CMP16mr : I<0x39, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002351 (outs), (ins i16mem:$src1, GR16:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002352 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002353 [(X86cmp (loadi16 addr:$src1), GR16:$src2),
2354 (implicit EFLAGS)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002355def CMP32mr : I<0x39, MRMDestMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002356 (outs), (ins i32mem:$src1, GR32:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002357 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002358 [(X86cmp (loadi32 addr:$src1), GR32:$src2),
2359 (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002360def CMP8rm : I<0x3A, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002361 (outs), (ins GR8 :$src1, i8mem :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002362 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002363 [(X86cmp GR8:$src1, (loadi8 addr:$src2)),
2364 (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002365def CMP16rm : I<0x3B, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002366 (outs), (ins GR16:$src1, i16mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002367 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002368 [(X86cmp GR16:$src1, (loadi16 addr:$src2)),
2369 (implicit EFLAGS)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002370def CMP32rm : I<0x3B, MRMSrcMem,
Evan Cheng64d80e32007-07-19 01:14:50 +00002371 (outs), (ins GR32:$src1, i32mem:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002372 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002373 [(X86cmp GR32:$src1, (loadi32 addr:$src2)),
2374 (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002375def CMP8ri : Ii8<0x80, MRM7r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002376 (outs), (ins GR8:$src1, i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002377 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002378 [(X86cmp GR8:$src1, imm:$src2), (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002379def CMP16ri : Ii16<0x81, MRM7r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002380 (outs), (ins GR16:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002381 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002382 [(X86cmp GR16:$src1, imm:$src2),
2383 (implicit EFLAGS)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002384def CMP32ri : Ii32<0x81, MRM7r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002385 (outs), (ins GR32:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002386 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002387 [(X86cmp GR32:$src1, imm:$src2), (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002388def CMP8mi : Ii8 <0x80, MRM7m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002389 (outs), (ins i8mem :$src1, i8imm :$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002390 "cmp{b}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002391 [(X86cmp (loadi8 addr:$src1), imm:$src2),
2392 (implicit EFLAGS)]>;
Chris Lattner3a173df2004-10-03 20:35:00 +00002393def CMP16mi : Ii16<0x81, MRM7m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002394 (outs), (ins i16mem:$src1, i16imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002395 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002396 [(X86cmp (loadi16 addr:$src1), imm:$src2),
2397 (implicit EFLAGS)]>, OpSize;
Chris Lattner3a173df2004-10-03 20:35:00 +00002398def CMP32mi : Ii32<0x81, MRM7m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002399 (outs), (ins i32mem:$src1, i32imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002400 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002401 [(X86cmp (loadi32 addr:$src1), imm:$src2),
2402 (implicit EFLAGS)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002403def CMP16ri8 : Ii8<0x83, MRM7r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002404 (outs), (ins GR16:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002405 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002406 [(X86cmp GR16:$src1, i16immSExt8:$src2),
2407 (implicit EFLAGS)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002408def CMP16mi8 : Ii8<0x83, MRM7m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002409 (outs), (ins i16mem:$src1, i16i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002410 "cmp{w}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002411 [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2),
2412 (implicit EFLAGS)]>, OpSize;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002413def CMP32mi8 : Ii8<0x83, MRM7m,
Evan Cheng64d80e32007-07-19 01:14:50 +00002414 (outs), (ins i32mem:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002415 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002416 [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2),
2417 (implicit EFLAGS)]>;
Chris Lattner29b4dd02006-03-23 16:13:50 +00002418def CMP32ri8 : Ii8<0x83, MRM7r,
Evan Cheng64d80e32007-07-19 01:14:50 +00002419 (outs), (ins GR32:$src1, i32i8imm:$src2),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002420 "cmp{l}\t{$src2, $src1|$src1, $src2}",
Evan Chenge5f62042007-09-29 00:00:36 +00002421 [(X86cmp GR32:$src1, i32immSExt8:$src2),
Evan Cheng0488db92007-09-25 01:57:46 +00002422 (implicit EFLAGS)]>;
2423} // Defs = [EFLAGS]
2424
Chris Lattner1cca5e32003-08-03 21:54:21 +00002425// Sign/Zero extenders
Evan Cheng64d80e32007-07-19 01:14:50 +00002426def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002427 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002428 [(set GR16:$dst, (sext GR8:$src))]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002429def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002430 "movs{bw|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002431 [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002432def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002433 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002434 [(set GR32:$dst, (sext GR8:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002435def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002436 "movs{bl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002437 [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002438def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002439 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002440 [(set GR32:$dst, (sext GR16:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002441def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002442 "movs{wl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002443 [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB;
Alkis Evlogimenosa7be9822004-02-17 09:14:23 +00002444
Evan Cheng64d80e32007-07-19 01:14:50 +00002445def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002446 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002447 [(set GR16:$dst, (zext GR8:$src))]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002448def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002449 "movz{bw|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002450 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002451def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002452 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002453 [(set GR32:$dst, (zext GR8:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002454def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002455 "movz{bl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002456 [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002457def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002458 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002459 [(set GR32:$dst, (zext GR16:$src))]>, TB;
Evan Cheng64d80e32007-07-19 01:14:50 +00002460def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002461 "movz{wl|x}\t{$src, $dst|$dst, $src}",
Evan Cheng069287d2006-05-16 07:21:53 +00002462 [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB;
Evan Cheng7a7e8372005-12-14 02:22:27 +00002463
Chris Lattnerba7e7562008-01-10 07:59:24 +00002464let neverHasSideEffects = 1 in {
2465 let Defs = [AX], Uses = [AL] in
2466 def CBW : I<0x98, RawFrm, (outs), (ins),
2467 "{cbtw|cbw}", []>, OpSize; // AX = signext(AL)
2468 let Defs = [EAX], Uses = [AX] in
2469 def CWDE : I<0x98, RawFrm, (outs), (ins),
2470 "{cwtl|cwde}", []>; // EAX = signext(AX)
Evan Chengf91c1012006-05-31 22:05:11 +00002471
Chris Lattnerba7e7562008-01-10 07:59:24 +00002472 let Defs = [AX,DX], Uses = [AX] in
2473 def CWD : I<0x99, RawFrm, (outs), (ins),
2474 "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX)
2475 let Defs = [EAX,EDX], Uses = [EAX] in
2476 def CDQ : I<0x99, RawFrm, (outs), (ins),
2477 "{cltd|cdq}", []>; // EDX:EAX = signext(EAX)
2478}
Evan Cheng747a90d2006-02-21 02:24:38 +00002479
Evan Cheng747a90d2006-02-21 02:24:38 +00002480//===----------------------------------------------------------------------===//
2481// Alias Instructions
2482//===----------------------------------------------------------------------===//
2483
2484// Alias instructions that map movr0 to xor.
2485// FIXME: remove when we can teach regalloc that xor reg, reg is ok.
Chris Lattnerdd415272008-01-10 05:45:39 +00002486let Defs = [EFLAGS], isReMaterializable = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002487def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002488 "xor{b}\t$dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002489 [(set GR8:$dst, 0)]>;
Evan Cheng64d80e32007-07-19 01:14:50 +00002490def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002491 "xor{w}\t$dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002492 [(set GR16:$dst, 0)]>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002493def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002494 "xor{l}\t$dst, $dst",
Evan Cheng069287d2006-05-16 07:21:53 +00002495 [(set GR32:$dst, 0)]>;
Dan Gohman1ab79892007-09-07 21:32:51 +00002496}
Evan Cheng747a90d2006-02-21 02:24:38 +00002497
Evan Cheng069287d2006-05-16 07:21:53 +00002498// Basic operations on GR16 / GR32 subclasses GR16_ and GR32_ which contains only
2499// those registers that have GR8 sub-registers (i.e. AX - DX, EAX - EDX).
Chris Lattnerba7e7562008-01-10 07:59:24 +00002500let neverHasSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002501def MOV16to16_ : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002502 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002503def MOV32to32_ : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002504 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +00002505
Evan Cheng64d80e32007-07-19 01:14:50 +00002506def MOV16_rr : I<0x89, MRMDestReg, (outs GR16_:$dst), (ins GR16_:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002507 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002508def MOV32_rr : I<0x89, MRMDestReg, (outs GR32_:$dst), (ins GR32_:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002509 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +00002510} // neverHasSideEffects
2511
2512let isSimpleLoad = 1, mayLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002513def MOV16_rm : I<0x8B, MRMSrcMem, (outs GR16_:$dst), (ins i16mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002514 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002515def MOV32_rm : I<0x8B, MRMSrcMem, (outs GR32_:$dst), (ins i32mem:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002516 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Evan Cheng2f394262007-08-30 05:49:43 +00002517}
Chris Lattnerba7e7562008-01-10 07:59:24 +00002518let mayStore = 1, neverHasSideEffects = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002519def MOV16_mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16_:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002520 "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize;
Evan Cheng64d80e32007-07-19 01:14:50 +00002521def MOV32_mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32_:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002522 "mov{l}\t{$src, $dst|$dst, $src}", []>;
Chris Lattnerba7e7562008-01-10 07:59:24 +00002523}
Evan Cheng403be7e2006-05-08 08:01:26 +00002524
Evan Cheng510e4782006-01-09 23:10:28 +00002525//===----------------------------------------------------------------------===//
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +00002526// Thread Local Storage Instructions
2527//
2528
Evan Cheng071a2792007-09-11 19:55:27 +00002529let Uses = [EBX] in
Evan Cheng64d80e32007-07-19 01:14:50 +00002530def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002531 "leal\t${sym:mem}(,%ebx,1), $dst",
Evan Cheng071a2792007-09-11 19:55:27 +00002532 [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>;
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +00002533
Lauro Ramos Venancio7d2cc2b2007-04-22 22:50:52 +00002534let AddedComplexity = 10 in
Evan Cheng64d80e32007-07-19 01:14:50 +00002535def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002536 "movl\t%gs:($src), $dst",
Lauro Ramos Venancioede1d782007-04-23 01:28:10 +00002537 [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
2538
2539let AddedComplexity = 15 in
Evan Cheng64d80e32007-07-19 01:14:50 +00002540def TLS_gs_ri : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$src),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002541 "movl\t%gs:${src:mem}, $dst",
Lauro Ramos Venancioede1d782007-04-23 01:28:10 +00002542 [(set GR32:$dst,
2543 (load (add X86TLStp, (X86Wrapper tglobaltlsaddr:$src))))]>;
Lauro Ramos Venancio7d2cc2b2007-04-22 22:50:52 +00002544
Evan Cheng64d80e32007-07-19 01:14:50 +00002545def TLS_tp : I<0, Pseudo, (outs GR32:$dst), (ins),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002546 "movl\t%gs:0, $dst",
Lauro Ramos Venanciob3a04172007-04-20 21:38:10 +00002547 [(set GR32:$dst, X86TLStp)]>;
2548
2549//===----------------------------------------------------------------------===//
Evan Cheng3c992d22006-03-07 02:02:57 +00002550// DWARF Pseudo Instructions
2551//
2552
Evan Cheng64d80e32007-07-19 01:14:50 +00002553def DWARF_LOC : I<0, Pseudo, (outs),
2554 (ins i32imm:$line, i32imm:$col, i32imm:$file),
Dan Gohman6b5766e2007-09-24 19:25:06 +00002555 ".loc\t${file:debug} ${line:debug} ${col:debug}",
Evan Cheng3c992d22006-03-07 02:02:57 +00002556 [(dwarf_loc (i32 imm:$line), (i32 imm:$col),
2557 (i32 imm:$file))]>;
2558
Evan Cheng3c992d22006-03-07 02:02:57 +00002559//===----------------------------------------------------------------------===//
Anton Korobeynikov2365f512007-07-14 14:06:15 +00002560// EH Pseudo Instructions
2561//
2562let isTerminator = 1, isReturn = 1, isBarrier = 1,
Evan Chengffbacca2007-07-21 00:34:19 +00002563 hasCtrlDep = 1 in {
Evan Cheng64d80e32007-07-19 01:14:50 +00002564def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr),
Dan Gohmanb1576f52007-07-31 20:11:57 +00002565 "ret\t#eh_return, addr: $addr",
Anton Korobeynikov2365f512007-07-14 14:06:15 +00002566 [(X86ehret GR32:$addr)]>;
2567
2568}
2569
2570//===----------------------------------------------------------------------===//
Evan Cheng510e4782006-01-09 23:10:28 +00002571// Non-Instruction Patterns
2572//===----------------------------------------------------------------------===//
2573
Evan Cheng25ab6902006-09-08 06:48:29 +00002574// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
Evan Cheng71fb8342006-02-25 10:02:21 +00002575def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>;
Nate Begeman37efe672006-04-22 18:53:45 +00002576def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>;
Lauro Ramos Venancioede1d782007-04-23 01:28:10 +00002577def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)), (MOV32ri tglobaltlsaddr:$dst)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002578def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
2579def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
2580
Evan Cheng069287d2006-05-16 07:21:53 +00002581def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
2582 (ADD32ri GR32:$src1, tconstpool:$src2)>;
2583def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)),
2584 (ADD32ri GR32:$src1, tjumptable:$src2)>;
2585def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)),
2586 (ADD32ri GR32:$src1, tglobaladdr:$src2)>;
2587def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
2588 (ADD32ri GR32:$src1, texternalsym:$src2)>;
Evan Cheng71fb8342006-02-25 10:02:21 +00002589
Evan Chengfc8feb12006-05-19 07:30:36 +00002590def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002591 (MOV32mi addr:$dst, tglobaladdr:$src)>;
Evan Chengfc8feb12006-05-19 07:30:36 +00002592def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
Evan Cheng71fb8342006-02-25 10:02:21 +00002593 (MOV32mi addr:$dst, texternalsym:$src)>;
2594
Evan Cheng510e4782006-01-09 23:10:28 +00002595// Calls
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +00002596// tailcall stuff
Evan Cheng069287d2006-05-16 07:21:53 +00002597def : Pat<(X86tailcall GR32:$dst),
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +00002598 (TAILCALL)>;
Evan Chengfea89c12006-04-27 08:40:39 +00002599
Evan Cheng25ab6902006-09-08 06:48:29 +00002600def : Pat<(X86tailcall (i32 tglobaladdr:$dst)),
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +00002601 (TAILCALL)>;
Evan Cheng25ab6902006-09-08 06:48:29 +00002602def : Pat<(X86tailcall (i32 texternalsym:$dst)),
Arnold Schwaighoferc85e1712007-10-11 19:40:01 +00002603 (TAILCALL)>;
2604
2605def : Pat<(X86tcret GR32:$dst, imm:$off),
2606 (TCRETURNri GR32:$dst, imm:$off)>;
2607
2608def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off),
2609 (TCRETURNdi texternalsym:$dst, imm:$off)>;
2610
2611def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off),
2612 (TCRETURNdi texternalsym:$dst, imm:$off)>;
Evan Chengfea89c12006-04-27 08:40:39 +00002613
Evan Cheng25ab6902006-09-08 06:48:29 +00002614def : Pat<(X86call (i32 tglobaladdr:$dst)),
Evan Cheng510e4782006-01-09 23:10:28 +00002615 (CALLpcrel32 tglobaladdr:$dst)>;
Evan Cheng25ab6902006-09-08 06:48:29 +00002616def : Pat<(X86call (i32 texternalsym:$dst)),
Evan Cheng8700e142006-01-11 06:09:51 +00002617 (CALLpcrel32 texternalsym:$dst)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002618
2619// X86 specific add which produces a flag.
Evan Cheng069287d2006-05-16 07:21:53 +00002620def : Pat<(addc GR32:$src1, GR32:$src2),
2621 (ADD32rr GR32:$src1, GR32:$src2)>;
2622def : Pat<(addc GR32:$src1, (load addr:$src2)),
2623 (ADD32rm GR32:$src1, addr:$src2)>;
2624def : Pat<(addc GR32:$src1, imm:$src2),
2625 (ADD32ri GR32:$src1, imm:$src2)>;
2626def : Pat<(addc GR32:$src1, i32immSExt8:$src2),
2627 (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002628
Evan Cheng069287d2006-05-16 07:21:53 +00002629def : Pat<(subc GR32:$src1, GR32:$src2),
2630 (SUB32rr GR32:$src1, GR32:$src2)>;
2631def : Pat<(subc GR32:$src1, (load addr:$src2)),
2632 (SUB32rm GR32:$src1, addr:$src2)>;
2633def : Pat<(subc GR32:$src1, imm:$src2),
2634 (SUB32ri GR32:$src1, imm:$src2)>;
2635def : Pat<(subc GR32:$src1, i32immSExt8:$src2),
2636 (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002637
Evan Cheng8b2794a2006-10-13 21:14:26 +00002638def : Pat<(truncstorei1 (i8 imm:$src), addr:$dst),
Evan Chengb8414332006-01-13 21:45:19 +00002639 (MOV8mi addr:$dst, imm:$src)>;
Evan Cheng8b2794a2006-10-13 21:14:26 +00002640def : Pat<(truncstorei1 GR8:$src, addr:$dst),
Evan Cheng069287d2006-05-16 07:21:53 +00002641 (MOV8mr addr:$dst, GR8:$src)>;
Evan Chengb8414332006-01-13 21:45:19 +00002642
Chris Lattnerffc0b262006-09-07 20:33:45 +00002643// Comparisons.
2644
2645// TEST R,R is smaller than CMP R,0
Evan Chenge5f62042007-09-29 00:00:36 +00002646def : Pat<(parallel (X86cmp GR8:$src1, 0), (implicit EFLAGS)),
Chris Lattnerffc0b262006-09-07 20:33:45 +00002647 (TEST8rr GR8:$src1, GR8:$src1)>;
Evan Chenge5f62042007-09-29 00:00:36 +00002648def : Pat<(parallel (X86cmp GR16:$src1, 0), (implicit EFLAGS)),
Chris Lattnerffc0b262006-09-07 20:33:45 +00002649 (TEST16rr GR16:$src1, GR16:$src1)>;
Evan Chenge5f62042007-09-29 00:00:36 +00002650def : Pat<(parallel (X86cmp GR32:$src1, 0), (implicit EFLAGS)),
Chris Lattnerffc0b262006-09-07 20:33:45 +00002651 (TEST32rr GR32:$src1, GR32:$src1)>;
2652
Evan Cheng510e4782006-01-09 23:10:28 +00002653// {s|z}extload bool -> {s|z}extload byte
2654def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>;
2655def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>;
Evan Chenge5d93432006-01-17 07:02:46 +00002656def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002657def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2658def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2659
2660// extload bool -> extload byte
Evan Cheng47137242006-05-05 08:23:07 +00002661def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>;
2662def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>;
2663def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>;
2664def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
2665def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>;
2666def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002667
2668// anyext -> zext
Evan Cheng069287d2006-05-16 07:21:53 +00002669def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>;
2670def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>;
2671def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
Evan Cheng6e16ee52006-03-25 09:45:48 +00002672def : Pat<(i16 (anyext (loadi8 addr:$src))), (MOVZX16rm8 addr:$src)>;
2673def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>;
2674def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>;
Evan Cheng510e4782006-01-09 23:10:28 +00002675
Evan Cheng1314b002007-12-13 00:43:27 +00002676// (and (i32 load), 255) -> (zextload i8)
2677def : Pat<(i32 (and (loadi32 addr:$src), (i32 255))), (MOVZX32rm8 addr:$src)>;
2678def : Pat<(i32 (and (loadi32 addr:$src), (i32 65535))),(MOVZX32rm16 addr:$src)>;
2679
Evan Chengcfa260b2006-01-06 02:31:59 +00002680//===----------------------------------------------------------------------===//
2681// Some peepholes
2682//===----------------------------------------------------------------------===//
2683
2684// (shl x, 1) ==> (add x, x)
Evan Cheng069287d2006-05-16 07:21:53 +00002685def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>;
2686def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
2687def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002688
Evan Cheng956044c2006-01-19 23:26:24 +00002689// (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002690def : Pat<(or (srl GR32:$src1, CL:$amt),
2691 (shl GR32:$src2, (sub 32, CL:$amt))),
2692 (SHRD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng68b951a2006-01-19 01:56:29 +00002693
Evan Cheng21d54432006-01-20 01:13:30 +00002694def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002695 (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2696 (SHRD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002697
Evan Cheng956044c2006-01-19 23:26:24 +00002698// (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002699def : Pat<(or (shl GR32:$src1, CL:$amt),
2700 (srl GR32:$src2, (sub 32, CL:$amt))),
2701 (SHLD32rrCL GR32:$src1, GR32:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002702
Evan Cheng21d54432006-01-20 01:13:30 +00002703def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002704 (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst),
2705 (SHLD32mrCL addr:$dst, GR32:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002706
Evan Cheng956044c2006-01-19 23:26:24 +00002707// (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002708def : Pat<(or (srl GR16:$src1, CL:$amt),
2709 (shl GR16:$src2, (sub 16, CL:$amt))),
2710 (SHRD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng956044c2006-01-19 23:26:24 +00002711
Evan Cheng21d54432006-01-20 01:13:30 +00002712def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002713 (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2714 (SHRD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002715
Evan Cheng956044c2006-01-19 23:26:24 +00002716// (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
Evan Cheng069287d2006-05-16 07:21:53 +00002717def : Pat<(or (shl GR16:$src1, CL:$amt),
2718 (srl GR16:$src2, (sub 16, CL:$amt))),
2719 (SHLD16rrCL GR16:$src1, GR16:$src2)>;
Evan Cheng21d54432006-01-20 01:13:30 +00002720
2721def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt),
Evan Cheng069287d2006-05-16 07:21:53 +00002722 (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst),
2723 (SHLD16mrCL addr:$dst, GR16:$src2)>;
Evan Cheng4e4c71e2006-02-21 20:00:20 +00002724
2725
2726//===----------------------------------------------------------------------===//
2727// Floating Point Stack Support
2728//===----------------------------------------------------------------------===//
2729
2730include "X86InstrFPStack.td"
2731
2732//===----------------------------------------------------------------------===//
Evan Chengc64a1a92007-07-31 08:04:03 +00002733// X86-64 Support
2734//===----------------------------------------------------------------------===//
2735
Chris Lattner36fe6d22008-01-10 05:50:42 +00002736include "X86Instr64bit.td"
Evan Chengc64a1a92007-07-31 08:04:03 +00002737
2738//===----------------------------------------------------------------------===//
Evan Cheng4e4c71e2006-02-21 20:00:20 +00002739// MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2)
2740//===----------------------------------------------------------------------===//
2741
2742include "X86InstrMMX.td"
2743
2744//===----------------------------------------------------------------------===//
2745// XMM Floating point support (requires SSE / SSE2)
2746//===----------------------------------------------------------------------===//
2747
2748include "X86InstrSSE.td"