Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1 | //===- X86InstrInfo.td - Describe the X86 Instruction Set -------*- C++ -*-===// |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 9 | // |
| 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 Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 16 | //===----------------------------------------------------------------------===// |
| 17 | // X86 specific DAG Nodes. |
| 18 | // |
| 19 | |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 20 | def SDTX86CmpTest : SDTypeProfile<1, 2, [SDTCisVT<0, FlagVT>, SDTCisSameAs<1, 2>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 21 | |
| 22 | def SDTX86Cmov : SDTypeProfile<1, 4, |
| 23 | [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 24 | SDTCisVT<3, i8>, SDTCisVT<4, FlagVT>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 25 | |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 26 | def SDTX86BrCond : SDTypeProfile<0, 3, |
| 27 | [SDTCisVT<0, OtherVT>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 28 | SDTCisVT<1, i8>, SDTCisVT<2, FlagVT>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 29 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 30 | def SDTX86SetCC : SDTypeProfile<1, 2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 31 | [SDTCisVT<0, i8>, SDTCisVT<1, i8>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 32 | SDTCisVT<2, FlagVT>]>; |
| 33 | |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 34 | def SDTX86Ret : SDTypeProfile<0, 1, [SDTCisVT<0, i16>]>; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 35 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 36 | def SDTX86Fld : SDTypeProfile<1, 2, [SDTCisVT<0, f64>, |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 37 | SDTCisPtrTy<1>, SDTCisVT<2, OtherVT>]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 38 | def SDTX86Fst : SDTypeProfile<0, 3, [SDTCisFP<0>, |
| 39 | SDTCisPtrTy<1>, SDTCisVT<2, OtherVT>]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 40 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 41 | |
| 42 | def SDTX86FpGet : SDTypeProfile<1, 0, [SDTCisVT<0, f64>]>; |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 43 | def SDTX86FpSet : SDTypeProfile<0, 1, [SDTCisFP<0>]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 44 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 45 | def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest, []>; |
| 46 | def X86test : SDNode<"X86ISD::TEST", SDTX86CmpTest, []>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 47 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 48 | def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov, []>; |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 49 | def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond, [SDNPHasChain]>; |
| 50 | def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC, []>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 51 | |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 52 | def X86ret : SDNode<"X86ISD::RET", SDTX86Ret, [SDNPHasChain]>; |
| 53 | def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, [SDNPHasChain]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 54 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 55 | def X86fld : SDNode<"X86ISD::FLD", SDTX86Fld, [SDNPHasChain]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 56 | def X86fst : SDNode<"X86ISD::FST", SDTX86Fst, [SDNPHasChain]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 57 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 58 | def X86fpget : SDNode<"X86ISD::FP_GET_RESULT", |
| 59 | SDTX86FpGet, [SDNPHasChain]>; |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 60 | def X86fpset : SDNode<"X86ISD::FP_SET_RESULT", |
| 61 | SDTX86FpSet, [SDNPHasChain]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 62 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 63 | def SDT_X86CallSeqStart : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>; |
| 64 | def SDT_X86CallSeqEnd : SDTypeProfile<0, 2, [ SDTCisVT<0, i32>, |
| 65 | SDTCisVT<1, i32> ]>; |
| 66 | def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart, |
| 67 | [SDNPHasChain]>; |
| 68 | def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd, |
| 69 | [SDNPHasChain]>; |
| 70 | |
| 71 | def SDT_X86Call : SDTypeProfile<0, 1, [SDTCisVT<0, i32>]>; |
| 72 | def call : SDNode<"X86ISD::CALL", SDT_X86Call, [SDNPHasChain]>; |
| 73 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 74 | //===----------------------------------------------------------------------===// |
| 75 | // X86 Operand Definitions. |
| 76 | // |
| 77 | |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 78 | // *mem - Operand definitions for the funky X86 addressing mode operands. |
| 79 | // |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 80 | class X86MemOperand<string printMethod> : Operand<i32> { |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 81 | let PrintMethod = printMethod; |
Chris Lattner | 6adaf79 | 2005-11-19 07:01:30 +0000 | [diff] [blame] | 82 | let NumMIOperands = 4; |
| 83 | let MIOperandInfo = (ops R32, i8imm, R32, i32imm); |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 84 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 85 | |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 86 | def i8mem : X86MemOperand<"printi8mem">; |
| 87 | def i16mem : X86MemOperand<"printi16mem">; |
| 88 | def i32mem : X86MemOperand<"printi32mem">; |
| 89 | def i64mem : X86MemOperand<"printi64mem">; |
| 90 | def f32mem : X86MemOperand<"printf32mem">; |
| 91 | def f64mem : X86MemOperand<"printf64mem">; |
| 92 | def f80mem : X86MemOperand<"printf80mem">; |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 93 | |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 94 | def SSECC : Operand<i8> { |
| 95 | let PrintMethod = "printSSECC"; |
| 96 | } |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 97 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 98 | // A couple of more descriptive operand definitions. |
| 99 | // 16-bits but only 8 bits are significant. |
| 100 | def i16i8imm : Operand<i16>; |
| 101 | // 32-bits but only 8 bits are significant. |
| 102 | def i32i8imm : Operand<i32>; |
| 103 | |
Chris Lattner | e4ead0c | 2004-08-11 06:59:12 +0000 | [diff] [blame] | 104 | // PCRelative calls need special operand formatting. |
| 105 | let PrintMethod = "printCallOperand" in |
| 106 | def calltarget : Operand<i32>; |
| 107 | |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 108 | // Branch targets have OtherVT type. |
| 109 | def brtarget : Operand<OtherVT>; |
| 110 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 111 | //===----------------------------------------------------------------------===// |
| 112 | // X86 Complex Pattern Definitions. |
| 113 | // |
| 114 | |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 115 | // Define X86 specific addressing mode. |
Evan Cheng | 670fd8f | 2005-12-08 02:15:07 +0000 | [diff] [blame] | 116 | def addr : ComplexPattern<i32, 4, "SelectAddr", []>; |
Evan Cheng | 502c5bb | 2005-12-15 08:31:04 +0000 | [diff] [blame] | 117 | def leaaddr : ComplexPattern<i32, 4, "SelectLEAAddr", |
Evan Cheng | 3a03ebb | 2005-12-21 23:05:39 +0000 | [diff] [blame] | 118 | [add, frameindex, constpool, |
| 119 | globaladdr, tglobaladdr, externalsym]>; |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 120 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 121 | //===----------------------------------------------------------------------===// |
| 122 | // X86 Instruction Format Definitions. |
| 123 | // |
| 124 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 125 | // Format specifies the encoding used by the instruction. This is part of the |
| 126 | // ad-hoc solution used to emit machine instruction encodings by our machine |
| 127 | // code emitter. |
| 128 | class Format<bits<5> val> { |
| 129 | bits<5> Value = val; |
| 130 | } |
| 131 | |
| 132 | def Pseudo : Format<0>; def RawFrm : Format<1>; |
| 133 | def AddRegFrm : Format<2>; def MRMDestReg : Format<3>; |
| 134 | def MRMDestMem : Format<4>; def MRMSrcReg : Format<5>; |
| 135 | def MRMSrcMem : Format<6>; |
Alkis Evlogimenos | 169584e | 2004-02-27 18:55:12 +0000 | [diff] [blame] | 136 | def MRM0r : Format<16>; def MRM1r : Format<17>; def MRM2r : Format<18>; |
| 137 | def MRM3r : Format<19>; def MRM4r : Format<20>; def MRM5r : Format<21>; |
| 138 | def MRM6r : Format<22>; def MRM7r : Format<23>; |
| 139 | def MRM0m : Format<24>; def MRM1m : Format<25>; def MRM2m : Format<26>; |
| 140 | def MRM3m : Format<27>; def MRM4m : Format<28>; def MRM5m : Format<29>; |
| 141 | def MRM6m : Format<30>; def MRM7m : Format<31>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 142 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 143 | //===----------------------------------------------------------------------===// |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 144 | // X86 Instruction Predicate Definitions. |
| 145 | def HasSSE1 : Predicate<"X86Vector >= SSE">; |
| 146 | def HasSSE2 : Predicate<"X86Vector >= SSE2">; |
| 147 | def HasSSE3 : Predicate<"X86Vector >= SSE3">; |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 148 | def FPStack : Predicate<"X86Vector < SSE2">; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 149 | |
| 150 | //===----------------------------------------------------------------------===// |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 151 | // X86 specific pattern fragments. |
| 152 | // |
| 153 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 154 | // ImmType - This specifies the immediate type used by an instruction. This is |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 155 | // part of the ad-hoc solution used to emit machine instruction encodings by our |
| 156 | // machine code emitter. |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 157 | class ImmType<bits<2> val> { |
| 158 | bits<2> Value = val; |
| 159 | } |
| 160 | def NoImm : ImmType<0>; |
| 161 | def Imm8 : ImmType<1>; |
| 162 | def Imm16 : ImmType<2>; |
| 163 | def Imm32 : ImmType<3>; |
| 164 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 165 | // FPFormat - This specifies what form this FP instruction has. This is used by |
| 166 | // the Floating-Point stackifier pass. |
| 167 | class FPFormat<bits<3> val> { |
| 168 | bits<3> Value = val; |
| 169 | } |
| 170 | def NotFP : FPFormat<0>; |
| 171 | def ZeroArgFP : FPFormat<1>; |
| 172 | def OneArgFP : FPFormat<2>; |
| 173 | def OneArgFPRW : FPFormat<3>; |
| 174 | def TwoArgFP : FPFormat<4>; |
Chris Lattner | ab8decc | 2004-06-11 04:41:24 +0000 | [diff] [blame] | 175 | def CompareFP : FPFormat<5>; |
| 176 | def CondMovFP : FPFormat<6>; |
| 177 | def SpecialFP : FPFormat<7>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 178 | |
| 179 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 180 | class X86Inst<bits<8> opcod, Format f, ImmType i, dag ops, string AsmStr> |
| 181 | : Instruction { |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 182 | let Namespace = "X86"; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 183 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 184 | bits<8> Opcode = opcod; |
| 185 | Format Form = f; |
| 186 | bits<5> FormBits = Form.Value; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 187 | ImmType ImmT = i; |
| 188 | bits<2> ImmTypeBits = ImmT.Value; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 189 | |
Chris Lattner | c96bb81 | 2004-08-11 07:12:04 +0000 | [diff] [blame] | 190 | dag OperandList = ops; |
| 191 | string AsmString = AsmStr; |
| 192 | |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 193 | // |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 194 | // Attributes specific to X86 instructions... |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 195 | // |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 196 | bit hasOpSizePrefix = 0; // Does this inst have a 0x66 prefix? |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 197 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 198 | bits<4> Prefix = 0; // Which prefix byte does this inst have? |
| 199 | FPFormat FPForm; // What flavor of FP instruction is this? |
| 200 | bits<3> FPFormBits = 0; |
| 201 | } |
| 202 | |
| 203 | class Imp<list<Register> uses, list<Register> defs> { |
| 204 | list<Register> Uses = uses; |
| 205 | list<Register> Defs = defs; |
| 206 | } |
| 207 | |
| 208 | |
| 209 | // Prefix byte classes which are used to indicate to the ad-hoc machine code |
| 210 | // emitter that various prefix bytes are required. |
| 211 | class OpSize { bit hasOpSizePrefix = 1; } |
| 212 | class TB { bits<4> Prefix = 1; } |
Chris Lattner | 915e5e5 | 2004-02-12 17:53:22 +0000 | [diff] [blame] | 213 | class REP { bits<4> Prefix = 2; } |
| 214 | class D8 { bits<4> Prefix = 3; } |
| 215 | class D9 { bits<4> Prefix = 4; } |
| 216 | class DA { bits<4> Prefix = 5; } |
| 217 | class DB { bits<4> Prefix = 6; } |
| 218 | class DC { bits<4> Prefix = 7; } |
| 219 | class DD { bits<4> Prefix = 8; } |
| 220 | class DE { bits<4> Prefix = 9; } |
| 221 | class DF { bits<4> Prefix = 10; } |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 222 | class XD { bits<4> Prefix = 11; } |
| 223 | class XS { bits<4> Prefix = 12; } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 224 | |
| 225 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 226 | //===----------------------------------------------------------------------===// |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 227 | // Pattern fragments... |
| 228 | // |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 229 | |
| 230 | // X86 specific condition code. These correspond to CondCode in |
| 231 | // X86ISelLowering.h. They must be kept in synch. |
| 232 | def X86_COND_A : PatLeaf<(i8 0)>; |
| 233 | def X86_COND_AE : PatLeaf<(i8 1)>; |
| 234 | def X86_COND_B : PatLeaf<(i8 2)>; |
| 235 | def X86_COND_BE : PatLeaf<(i8 3)>; |
| 236 | def X86_COND_E : PatLeaf<(i8 4)>; |
| 237 | def X86_COND_G : PatLeaf<(i8 5)>; |
| 238 | def X86_COND_GE : PatLeaf<(i8 6)>; |
| 239 | def X86_COND_L : PatLeaf<(i8 7)>; |
| 240 | def X86_COND_LE : PatLeaf<(i8 8)>; |
| 241 | def X86_COND_NE : PatLeaf<(i8 9)>; |
| 242 | def X86_COND_NO : PatLeaf<(i8 10)>; |
| 243 | def X86_COND_NP : PatLeaf<(i8 11)>; |
| 244 | def X86_COND_NS : PatLeaf<(i8 12)>; |
| 245 | def X86_COND_O : PatLeaf<(i8 13)>; |
| 246 | def X86_COND_P : PatLeaf<(i8 14)>; |
| 247 | def X86_COND_S : PatLeaf<(i8 15)>; |
| 248 | |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 249 | def i16immSExt8 : PatLeaf<(i16 imm), [{ |
| 250 | // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit |
Evan Cheng | b355854 | 2005-12-13 00:01:09 +0000 | [diff] [blame] | 251 | // sign extended field. |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 252 | return (int)N->getValue() == (signed char)N->getValue(); |
| 253 | }]>; |
| 254 | |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 255 | def i32immSExt8 : PatLeaf<(i32 imm), [{ |
| 256 | // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit |
Evan Cheng | b355854 | 2005-12-13 00:01:09 +0000 | [diff] [blame] | 257 | // sign extended field. |
| 258 | return (int)N->getValue() == (signed char)N->getValue(); |
| 259 | }]>; |
| 260 | |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 261 | def i16immZExt8 : PatLeaf<(i16 imm), [{ |
| 262 | // i16immZExt8 predicate - True if the 16-bit immediate fits in a 8-bit zero |
Evan Cheng | b355854 | 2005-12-13 00:01:09 +0000 | [diff] [blame] | 263 | // extended field. |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 264 | return (unsigned)N->getValue() == (unsigned char)N->getValue(); |
| 265 | }]>; |
| 266 | |
Evan Cheng | 650d688 | 2006-01-05 02:08:37 +0000 | [diff] [blame] | 267 | def fp32imm0 : PatLeaf<(f32 fpimm), [{ |
| 268 | return N->isExactlyValue(+0.0); |
| 269 | }]>; |
| 270 | |
| 271 | def fp64imm0 : PatLeaf<(f64 fpimm), [{ |
| 272 | return N->isExactlyValue(+0.0); |
| 273 | }]>; |
| 274 | |
| 275 | def fp64immneg0 : PatLeaf<(f64 fpimm), [{ |
| 276 | return N->isExactlyValue(-0.0); |
| 277 | }]>; |
| 278 | |
| 279 | def fp64imm1 : PatLeaf<(f64 fpimm), [{ |
| 280 | return N->isExactlyValue(+1.0); |
| 281 | }]>; |
| 282 | |
| 283 | def fp64immneg1 : PatLeaf<(f64 fpimm), [{ |
| 284 | return N->isExactlyValue(-1.0); |
| 285 | }]>; |
| 286 | |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 287 | // Helper fragments for loads. |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 288 | def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr))>; |
| 289 | def loadi16 : PatFrag<(ops node:$ptr), (i16 (load node:$ptr))>; |
| 290 | def loadi32 : PatFrag<(ops node:$ptr), (i32 (load node:$ptr))>; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 291 | def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr))>; |
| 292 | def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 293 | |
| 294 | def sextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (sextload node:$ptr, i1))>; |
| 295 | def sextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i1))>; |
| 296 | def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextload node:$ptr, i8))>; |
| 297 | def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i8))>; |
| 298 | def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextload node:$ptr, i16))>; |
| 299 | |
| 300 | def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextload node:$ptr, i1))>; |
| 301 | def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i1))>; |
| 302 | def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextload node:$ptr, i8))>; |
| 303 | def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i8))>; |
| 304 | def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextload node:$ptr, i16))>; |
| 305 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 306 | def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extload node:$ptr, i1))>; |
| 307 | def extloadf64f32 : PatFrag<(ops node:$ptr), (f64 (extload node:$ptr, f32))>; |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 308 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 309 | //===----------------------------------------------------------------------===// |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 310 | // Instruction templates... |
| 311 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 312 | class I<bits<8> o, Format f, dag ops, string asm, list<dag> pattern> |
| 313 | : X86Inst<o, f, NoImm, ops, asm> { |
| 314 | let Pattern = pattern; |
| 315 | } |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 316 | class Ii8 <bits<8> o, Format f, dag ops, string asm, list<dag> pattern> |
| 317 | : X86Inst<o, f, Imm8 , ops, asm> { |
| 318 | let Pattern = pattern; |
| 319 | } |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 320 | class Ii16<bits<8> o, Format f, dag ops, string asm, list<dag> pattern> |
| 321 | : X86Inst<o, f, Imm16, ops, asm> { |
| 322 | let Pattern = pattern; |
| 323 | } |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 324 | class Ii32<bits<8> o, Format f, dag ops, string asm, list<dag> pattern> |
| 325 | : X86Inst<o, f, Imm32, ops, asm> { |
| 326 | let Pattern = pattern; |
| 327 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 328 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 329 | //===----------------------------------------------------------------------===// |
| 330 | // Instruction list... |
| 331 | // |
| 332 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 333 | def PHI : I<0, Pseudo, (ops variable_ops), "PHINODE", []>; // PHI node. |
| 334 | def NOOP : I<0x90, RawFrm, (ops), "nop", []>; // nop |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 335 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 336 | def ADJCALLSTACKDOWN : I<0, Pseudo, (ops i32imm:$amt), "#ADJCALLSTACKDOWN", |
| 337 | [(callseq_start imm:$amt)]>; |
Chris Lattner | 43ef131 | 2005-09-14 21:10:24 +0000 | [diff] [blame] | 338 | def ADJCALLSTACKUP : I<0, Pseudo, (ops i32imm:$amt1, i32imm:$amt2), |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 339 | "#ADJCALLSTACKUP", |
| 340 | [(callseq_end imm:$amt1, imm:$amt2)]>; |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 341 | def IMPLICIT_USE : I<0, Pseudo, (ops variable_ops), "#IMPLICIT_USE", []>; |
| 342 | def IMPLICIT_DEF : I<0, Pseudo, (ops variable_ops), "#IMPLICIT_DEF", []>; |
Alkis Evlogimenos | e0bb3e7 | 2003-12-20 16:22:59 +0000 | [diff] [blame] | 343 | let isTerminator = 1 in |
| 344 | let Defs = [FP0, FP1, FP2, FP3, FP4, FP5, FP6] in |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 345 | def FP_REG_KILL : I<0, Pseudo, (ops), "#FP_REG_KILL", []>; |
Chris Lattner | 62cce39 | 2004-07-31 02:10:53 +0000 | [diff] [blame] | 346 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 347 | //===----------------------------------------------------------------------===// |
| 348 | // Control Flow Instructions... |
| 349 | // |
| 350 | |
Chris Lattner | 1be4811 | 2005-05-13 17:56:48 +0000 | [diff] [blame] | 351 | // Return instructions. |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 352 | let isTerminator = 1, isReturn = 1, isBarrier = 1, |
| 353 | hasCtrlDep = 1, noResults = 1 in { |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 354 | // FIXME: temporary workaround for return without an incoming flag. |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 355 | def RETVOID : I<0xC3, RawFrm, (ops), "ret", [(X86ret 0)]>; |
| 356 | def RETIVOID : Ii16<0xC2, RawFrm, (ops i16imm:$amt), "ret $amt", |
| 357 | [(X86ret imm:$amt)]>; |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 358 | let hasInFlag = 1 in { |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 359 | def RET : I<0xC3, RawFrm, (ops), "ret", [(X86retflag 0)]>; |
| 360 | def RETI : Ii16<0xC2, RawFrm, (ops i16imm:$amt), "ret $amt", |
| 361 | [(X86retflag imm:$amt)]>; |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 362 | } |
| 363 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 364 | |
| 365 | // All branches are RawFrm, Void, Branch, and Terminators |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 366 | let isBranch = 1, isTerminator = 1, noResults = 1 in |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 367 | class IBr<bits<8> opcode, dag ops, string asm, list<dag> pattern> : |
| 368 | I<opcode, RawFrm, ops, asm, pattern>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 369 | |
Chris Lattner | 62cce39 | 2004-07-31 02:10:53 +0000 | [diff] [blame] | 370 | let isBarrier = 1 in |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 371 | def JMP : IBr<0xE9, (ops brtarget:$dst), "jmp $dst", [(br bb:$dst)]>; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 372 | |
| 373 | def JE : IBr<0x84, (ops brtarget:$dst), "je $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 374 | [(X86brcond bb:$dst, X86_COND_E, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 375 | def JNE : IBr<0x85, (ops brtarget:$dst), "jne $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 376 | [(X86brcond bb:$dst, X86_COND_NE, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 377 | def JL : IBr<0x8C, (ops brtarget:$dst), "jl $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 378 | [(X86brcond bb:$dst, X86_COND_L, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 379 | def JLE : IBr<0x8E, (ops brtarget:$dst), "jle $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 380 | [(X86brcond bb:$dst, X86_COND_LE, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 381 | def JG : IBr<0x8F, (ops brtarget:$dst), "jg $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 382 | [(X86brcond bb:$dst, X86_COND_G, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 383 | def JGE : IBr<0x8D, (ops brtarget:$dst), "jge $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 384 | [(X86brcond bb:$dst, X86_COND_GE, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 385 | |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 386 | def JB : IBr<0x82, (ops brtarget:$dst), "jb $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 387 | [(X86brcond bb:$dst, X86_COND_B, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 388 | def JBE : IBr<0x86, (ops brtarget:$dst), "jbe $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 389 | [(X86brcond bb:$dst, X86_COND_BE, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 390 | def JA : IBr<0x87, (ops brtarget:$dst), "ja $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 391 | [(X86brcond bb:$dst, X86_COND_A, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 392 | def JAE : IBr<0x83, (ops brtarget:$dst), "jae $dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 393 | [(X86brcond bb:$dst, X86_COND_AE, STATUS)]>, Imp<[STATUS],[]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 394 | |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 395 | def JS : IBr<0x88, (ops brtarget:$dst), "js $dst", |
| 396 | [(X86brcond bb:$dst, X86_COND_S, STATUS)]>, Imp<[STATUS],[]>, TB; |
| 397 | def JNS : IBr<0x89, (ops brtarget:$dst), "jns $dst", |
| 398 | [(X86brcond bb:$dst, X86_COND_NS, STATUS)]>, Imp<[STATUS],[]>, TB; |
| 399 | def JP : IBr<0x8A, (ops brtarget:$dst), "jp $dst", |
| 400 | [(X86brcond bb:$dst, X86_COND_P, STATUS)]>, Imp<[STATUS],[]>, TB; |
| 401 | def JNP : IBr<0x8B, (ops brtarget:$dst), "jnp $dst", |
| 402 | [(X86brcond bb:$dst, X86_COND_NP, STATUS)]>, Imp<[STATUS],[]>, TB; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 403 | |
| 404 | //===----------------------------------------------------------------------===// |
| 405 | // Call Instructions... |
| 406 | // |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 407 | // FIXME: How about hasInFlag = 1? A fastcall would require an incoming flag |
| 408 | // to stick the CopyToRegs to the call. |
| 409 | let isCall = 1, noResults = 1, hasOutFlag = 1 in |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 410 | // All calls clobber the non-callee saved registers... |
Nate Begeman | f63be7d | 2005-07-06 18:59:04 +0000 | [diff] [blame] | 411 | let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 412 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7] in { |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 413 | def CALLpcrel32 : I<0xE8, RawFrm, (ops calltarget:$dst), "call $dst", |
| 414 | []>; |
| 415 | def CALL32r : I<0xFF, MRM2r, (ops R32:$dst), "call {*}$dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 416 | [(call R32:$dst)]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 417 | def CALL32m : I<0xFF, MRM2m, (ops i32mem:$dst), "call {*}$dst", |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 418 | [(call (loadi32 addr:$dst))]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 419 | } |
| 420 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 421 | def : Pat<(call tglobaladdr:$dst), |
| 422 | (CALLpcrel32 tglobaladdr:$dst)>; |
| 423 | def : Pat<(call externalsym:$dst), |
| 424 | (CALLpcrel32 externalsym:$dst)>; |
| 425 | |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 426 | // Tail call stuff. |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 427 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 428 | def TAILJMPd : IBr<0xE9, (ops calltarget:$dst), "jmp $dst # TAIL CALL", []>; |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 429 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 430 | def TAILJMPr : I<0xFF, MRM4r, (ops R32:$dst), "jmp {*}$dst # TAIL CALL", []>; |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 431 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 432 | def TAILJMPm : I<0xFF, MRM4m, (ops i32mem:$dst), |
| 433 | "jmp {*}$dst # TAIL CALL", []>; |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 434 | |
| 435 | // ADJSTACKPTRri - This is a standard ADD32ri instruction, identical in every |
| 436 | // way, except that it is marked as being a terminator. This causes the epilog |
| 437 | // inserter to insert reloads of callee saved registers BEFORE this. We need |
| 438 | // this until we have a more accurate way of tracking where the stack pointer is |
| 439 | // within a function. |
| 440 | let isTerminator = 1, isTwoAddress = 1 in |
| 441 | def ADJSTACKPTRri : Ii32<0x81, MRM0r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 442 | "add{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 443 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 444 | //===----------------------------------------------------------------------===// |
| 445 | // Miscellaneous Instructions... |
| 446 | // |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 447 | def LEAVE : I<0xC9, RawFrm, |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 448 | (ops), "leave", []>, Imp<[EBP,ESP],[EBP,ESP]>; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 449 | def POP32r : I<0x58, AddRegFrm, |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 450 | (ops R32:$reg), "pop{l} $reg", []>, Imp<[ESP],[ESP]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 451 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 452 | let isTwoAddress = 1 in // R32 = bswap R32 |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 453 | def BSWAP32r : I<0xC8, AddRegFrm, |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 454 | (ops R32:$dst, R32:$src), "bswap{l} $dst", []>, TB; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 455 | |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 456 | def XCHG8rr : I<0x86, MRMDestReg, // xchg R8, R8 |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 457 | (ops R8:$src1, R8:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 458 | "xchg{b} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 459 | def XCHG16rr : I<0x87, MRMDestReg, // xchg R16, R16 |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 460 | (ops R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 461 | "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 462 | def XCHG32rr : I<0x87, MRMDestReg, // xchg R32, R32 |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 463 | (ops R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 464 | "xchg{l} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 465 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 466 | def XCHG8mr : I<0x86, MRMDestMem, |
| 467 | (ops i8mem:$src1, R8:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 468 | "xchg{b} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 469 | def XCHG16mr : I<0x87, MRMDestMem, |
| 470 | (ops i16mem:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 471 | "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 472 | def XCHG32mr : I<0x87, MRMDestMem, |
| 473 | (ops i32mem:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 474 | "xchg{l} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 475 | def XCHG8rm : I<0x86, MRMSrcMem, |
| 476 | (ops R8:$src1, i8mem:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 477 | "xchg{b} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 478 | def XCHG16rm : I<0x87, MRMSrcMem, |
| 479 | (ops R16:$src1, i16mem:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 480 | "xchg{w} {$src2|$src1}, {$src1|$src2}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 481 | def XCHG32rm : I<0x87, MRMSrcMem, |
| 482 | (ops R32:$src1, i32mem:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 483 | "xchg{l} {$src2|$src1}, {$src1|$src2}", []>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 484 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 485 | def LEA16r : I<0x8D, MRMSrcMem, |
| 486 | (ops R16:$dst, i32mem:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 487 | "lea{w} {$src|$dst}, {$dst|$src}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 488 | def LEA32r : I<0x8D, MRMSrcMem, |
| 489 | (ops R32:$dst, i32mem:$src), |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 490 | "lea{l} {$src|$dst}, {$dst|$src}", |
| 491 | [(set R32:$dst, leaaddr:$src)]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 492 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 493 | def REP_MOVSB : I<0xA4, RawFrm, (ops), "{rep;movsb|rep movsb}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 494 | Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP; |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 495 | def REP_MOVSW : I<0xA5, RawFrm, (ops), "{rep;movsw|rep movsw}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 496 | Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP, OpSize; |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 497 | def REP_MOVSD : I<0xA5, RawFrm, (ops), "{rep;movsd|rep movsd}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 498 | Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP; |
Chris Lattner | 915e5e5 | 2004-02-12 17:53:22 +0000 | [diff] [blame] | 499 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 500 | def REP_STOSB : I<0xAA, RawFrm, (ops), "{rep;stosb|rep stosb}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 501 | Imp<[AL,ECX,EDI], [ECX,EDI]>, REP; |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 502 | def REP_STOSW : I<0xAB, RawFrm, (ops), "{rep;stosw|rep stosw}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 503 | Imp<[AX,ECX,EDI], [ECX,EDI]>, REP, OpSize; |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 504 | def REP_STOSD : I<0xAB, RawFrm, (ops), "{rep;stosl|rep stosd}", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 505 | Imp<[EAX,ECX,EDI], [ECX,EDI]>, REP; |
| 506 | |
Chris Lattner | b89abef | 2004-02-14 04:45:37 +0000 | [diff] [blame] | 507 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 508 | //===----------------------------------------------------------------------===// |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 509 | // Input/Output Instructions... |
| 510 | // |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 511 | def IN8rr : I<0xEC, RawFrm, (ops), |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 512 | "in{b} {%dx, %al|%AL, %DX}", |
| 513 | [(set AL, (readport DX))]>, Imp<[DX], [AL]>; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 514 | def IN16rr : I<0xED, RawFrm, (ops), |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 515 | "in{w} {%dx, %ax|%AX, %DX}", |
| 516 | [(set AX, (readport DX))]>, Imp<[DX], [AX]>, OpSize; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 517 | def IN32rr : I<0xED, RawFrm, (ops), |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 518 | "in{l} {%dx, %eax|%EAX, %DX}", |
| 519 | [(set EAX, (readport DX))]>, Imp<[DX],[EAX]>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 520 | |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 521 | def IN8ri : Ii8<0xE4, RawFrm, (ops i16i8imm:$port), |
| 522 | "in{b} {$port, %al|%AL, $port}", |
| 523 | [(set AL, (readport i16immZExt8:$port))]>, |
| 524 | Imp<[], [AL]>; |
| 525 | def IN16ri : Ii8<0xE5, RawFrm, (ops i16i8imm:$port), |
| 526 | "in{w} {$port, %ax|%AX, $port}", |
| 527 | [(set AX, (readport i16immZExt8:$port))]>, |
| 528 | Imp<[], [AX]>, OpSize; |
| 529 | def IN32ri : Ii8<0xE5, RawFrm, (ops i16i8imm:$port), |
| 530 | "in{l} {$port, %eax|%EAX, $port}", |
| 531 | [(set EAX, (readport i16immZExt8:$port))]>, |
| 532 | Imp<[],[EAX]>; |
Chris Lattner | 440bbc2 | 2004-04-13 17:19:31 +0000 | [diff] [blame] | 533 | |
Evan Cheng | 8d20223 | 2005-12-05 23:09:43 +0000 | [diff] [blame] | 534 | def OUT8rr : I<0xEE, RawFrm, (ops), |
| 535 | "out{b} {%al, %dx|%DX, %AL}", |
| 536 | [(writeport AL, DX)]>, Imp<[DX, AL], []>; |
| 537 | def OUT16rr : I<0xEF, RawFrm, (ops), |
| 538 | "out{w} {%ax, %dx|%DX, %AX}", |
| 539 | [(writeport AX, DX)]>, Imp<[DX, AX], []>, OpSize; |
| 540 | def OUT32rr : I<0xEF, RawFrm, (ops), |
| 541 | "out{l} {%eax, %dx|%DX, %EAX}", |
| 542 | [(writeport EAX, DX)]>, Imp<[DX, EAX], []>; |
Chris Lattner | ffff708 | 2004-08-01 07:44:35 +0000 | [diff] [blame] | 543 | |
Evan Cheng | 8d20223 | 2005-12-05 23:09:43 +0000 | [diff] [blame] | 544 | def OUT8ir : Ii8<0xE6, RawFrm, (ops i16i8imm:$port), |
| 545 | "out{b} {%al, $port|$port, %AL}", |
Evan Cheng | 5a38e02 | 2005-12-13 00:25:07 +0000 | [diff] [blame] | 546 | [(writeport AL, i16immZExt8:$port)]>, |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 547 | Imp<[AL], []>; |
Evan Cheng | 8d20223 | 2005-12-05 23:09:43 +0000 | [diff] [blame] | 548 | def OUT16ir : Ii8<0xE7, RawFrm, (ops i16i8imm:$port), |
| 549 | "out{w} {%ax, $port|$port, %AX}", |
Evan Cheng | 5a38e02 | 2005-12-13 00:25:07 +0000 | [diff] [blame] | 550 | [(writeport AX, i16immZExt8:$port)]>, |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 551 | Imp<[AX], []>, OpSize; |
Evan Cheng | 8d20223 | 2005-12-05 23:09:43 +0000 | [diff] [blame] | 552 | def OUT32ir : Ii8<0xE7, RawFrm, (ops i16i8imm:$port), |
| 553 | "out{l} {%eax, $port|$port, %EAX}", |
Evan Cheng | 5a38e02 | 2005-12-13 00:25:07 +0000 | [diff] [blame] | 554 | [(writeport EAX, i16immZExt8:$port)]>, |
Evan Cheng | a5386b0 | 2005-12-20 07:38:38 +0000 | [diff] [blame] | 555 | Imp<[EAX], []>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 556 | |
| 557 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 558 | // Move Instructions... |
| 559 | // |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 560 | def MOV8rr : I<0x88, MRMDestReg, (ops R8 :$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 561 | "mov{b} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 562 | def MOV16rr : I<0x89, MRMDestReg, (ops R16:$dst, R16:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 563 | "mov{w} {$src, $dst|$dst, $src}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 564 | def MOV32rr : I<0x89, MRMDestReg, (ops R32:$dst, R32:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 565 | "mov{l} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 566 | def MOV8ri : Ii8 <0xB0, AddRegFrm, (ops R8 :$dst, i8imm :$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 567 | "mov{b} {$src, $dst|$dst, $src}", |
| 568 | [(set R8:$dst, imm:$src)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 569 | def MOV16ri : Ii16<0xB8, AddRegFrm, (ops R16:$dst, i16imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 570 | "mov{w} {$src, $dst|$dst, $src}", |
| 571 | [(set R16:$dst, imm:$src)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 572 | def MOV32ri : Ii32<0xB8, AddRegFrm, (ops R32:$dst, i32imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 573 | "mov{l} {$src, $dst|$dst, $src}", |
| 574 | [(set R32:$dst, imm:$src)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 575 | def MOV8mi : Ii8 <0xC6, MRM0m, (ops i8mem :$dst, i8imm :$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 576 | "mov{b} {$src, $dst|$dst, $src}", |
| 577 | [(store (i8 imm:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 578 | def MOV16mi : Ii16<0xC7, MRM0m, (ops i16mem:$dst, i16imm:$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 579 | "mov{w} {$src, $dst|$dst, $src}", |
| 580 | [(store (i16 imm:$src), addr:$dst)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 581 | def MOV32mi : Ii32<0xC7, MRM0m, (ops i32mem:$dst, i32imm:$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 582 | "mov{l} {$src, $dst|$dst, $src}", |
| 583 | [(store (i32 imm:$src), addr:$dst)]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 584 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 585 | def MOV8rm : I<0x8A, MRMSrcMem, (ops R8 :$dst, i8mem :$src), |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 586 | "mov{b} {$src, $dst|$dst, $src}", |
| 587 | [(set R8:$dst, (load addr:$src))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 588 | def MOV16rm : I<0x8B, MRMSrcMem, (ops R16:$dst, i16mem:$src), |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 589 | "mov{w} {$src, $dst|$dst, $src}", |
| 590 | [(set R16:$dst, (load addr:$src))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 591 | def MOV32rm : I<0x8B, MRMSrcMem, (ops R32:$dst, i32mem:$src), |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 592 | "mov{l} {$src, $dst|$dst, $src}", |
| 593 | [(set R32:$dst, (load addr:$src))]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 594 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 595 | def MOV8mr : I<0x88, MRMDestMem, (ops i8mem :$dst, R8 :$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 596 | "mov{b} {$src, $dst|$dst, $src}", |
| 597 | [(store R8:$src, addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 598 | def MOV16mr : I<0x89, MRMDestMem, (ops i16mem:$dst, R16:$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 599 | "mov{w} {$src, $dst|$dst, $src}", |
| 600 | [(store R16:$src, addr:$dst)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 601 | def MOV32mr : I<0x89, MRMDestMem, (ops i32mem:$dst, R32:$src), |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 602 | "mov{l} {$src, $dst|$dst, $src}", |
| 603 | [(store R32:$src, addr:$dst)]>; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 604 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 605 | //===----------------------------------------------------------------------===// |
| 606 | // Fixed-Register Multiplication and Division Instructions... |
| 607 | // |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 608 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 609 | // Extra precision multiplication |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 610 | def MUL8r : I<0xF6, MRM4r, (ops R8:$src), "mul{b} $src", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 611 | Imp<[AL],[AX]>; // AL,AH = AL*R8 |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 612 | def MUL16r : I<0xF7, MRM4r, (ops R16:$src), "mul{w} $src", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 613 | Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*R16 |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 614 | def MUL32r : I<0xF7, MRM4r, (ops R32:$src), "mul{l} $src", []>, |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 615 | Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*R32 |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 616 | def MUL8m : I<0xF6, MRM4m, (ops i8mem :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 617 | "mul{b} $src", []>, Imp<[AL],[AX]>; // AL,AH = AL*[mem8] |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 618 | def MUL16m : I<0xF7, MRM4m, (ops i16mem:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 619 | "mul{w} $src", []>, Imp<[AX],[AX,DX]>, |
| 620 | OpSize; // AX,DX = AX*[mem16] |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 621 | def MUL32m : I<0xF7, MRM4m, (ops i32mem:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 622 | "mul{l} $src", []>, Imp<[EAX],[EAX,EDX]>;// EAX,EDX = EAX*[mem32] |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 623 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 624 | def IMUL8r : I<0xF6, MRM5r, (ops R8:$src), "imul{b} $src", []>, |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 625 | Imp<[AL],[AX]>; // AL,AH = AL*R8 |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 626 | def IMUL16r : I<0xF7, MRM5r, (ops R16:$src), "imul{w} $src", []>, |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 627 | Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*R16 |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 628 | def IMUL32r : I<0xF7, MRM5r, (ops R32:$src), "imul{l} $src", []>, |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 629 | Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*R32 |
| 630 | def IMUL8m : I<0xF6, MRM5m, (ops i8mem :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 631 | "imul{b} $src", []>, Imp<[AL],[AX]>; // AL,AH = AL*[mem8] |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 632 | def IMUL16m : I<0xF7, MRM5m, (ops i16mem:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 633 | "imul{w} $src", []>, Imp<[AX],[AX,DX]>, |
| 634 | OpSize; // AX,DX = AX*[mem16] |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 635 | def IMUL32m : I<0xF7, MRM5m, (ops i32mem:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 636 | "imul{l} $src", []>, |
| 637 | Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*[mem32] |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 638 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 639 | // unsigned division/remainder |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 640 | def DIV8r : I<0xF6, MRM6r, (ops R8:$src), // AX/r8 = AL,AH |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 641 | "div{b} $src", []>, Imp<[AX],[AX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 642 | def DIV16r : I<0xF7, MRM6r, (ops R16:$src), // DX:AX/r16 = AX,DX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 643 | "div{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 644 | def DIV32r : I<0xF7, MRM6r, (ops R32:$src), // EDX:EAX/r32 = EAX,EDX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 645 | "div{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 646 | def DIV8m : I<0xF6, MRM6m, (ops i8mem:$src), // AX/[mem8] = AL,AH |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 647 | "div{b} $src", []>, Imp<[AX],[AX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 648 | def DIV16m : I<0xF7, MRM6m, (ops i16mem:$src), // DX:AX/[mem16] = AX,DX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 649 | "div{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 650 | def DIV32m : I<0xF7, MRM6m, (ops i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 651 | "div{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 652 | |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 653 | // Signed division/remainder. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 654 | def IDIV8r : I<0xF6, MRM7r, (ops R8:$src), // AX/r8 = AL,AH |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 655 | "idiv{b} $src", []>, Imp<[AX],[AX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 656 | def IDIV16r: I<0xF7, MRM7r, (ops R16:$src), // DX:AX/r16 = AX,DX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 657 | "idiv{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 658 | def IDIV32r: I<0xF7, MRM7r, (ops R32:$src), // EDX:EAX/r32 = EAX,EDX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 659 | "idiv{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 660 | def IDIV8m : I<0xF6, MRM7m, (ops i8mem:$src), // AX/[mem8] = AL,AH |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 661 | "idiv{b} $src", []>, Imp<[AX],[AX]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 662 | def IDIV16m: I<0xF7, MRM7m, (ops i16mem:$src), // DX:AX/[mem16] = AX,DX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 663 | "idiv{w} $src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 664 | def IDIV32m: I<0xF7, MRM7m, (ops i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 665 | "idiv{l} $src", []>, Imp<[EAX,EDX],[EAX,EDX]>; |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 666 | |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 667 | // Sign-extenders for division. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 668 | def CBW : I<0x98, RawFrm, (ops), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 669 | "{cbtw|cbw}", []>, Imp<[AL],[AH]>; // AX = signext(AL) |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 670 | def CWD : I<0x99, RawFrm, (ops), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 671 | "{cwtd|cwd}", []>, Imp<[AX],[DX]>; // DX:AX = signext(AX) |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 672 | def CDQ : I<0x99, RawFrm, (ops), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 673 | "{cltd|cdq}", []>, Imp<[EAX],[EDX]>; // EDX:EAX = signext(EAX) |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 674 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 675 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 676 | //===----------------------------------------------------------------------===// |
| 677 | // Two address Instructions... |
| 678 | // |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 679 | let isTwoAddress = 1 in { |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 680 | |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 681 | // Conditional moves |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 682 | def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, R16 = R16 |
| 683 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 684 | "cmovb {$src2, $dst|$dst, $src2}", |
| 685 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 686 | X86_COND_B, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 687 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 688 | def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, R16 = [mem16] |
| 689 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 690 | "cmovb {$src2, $dst|$dst, $src2}", |
| 691 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 692 | X86_COND_B, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 693 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 694 | def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, R32 = R32 |
| 695 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 696 | "cmovb {$src2, $dst|$dst, $src2}", |
| 697 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 698 | X86_COND_B, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 699 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 700 | def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, R32 = [mem32] |
| 701 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 702 | "cmovb {$src2, $dst|$dst, $src2}", |
| 703 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 704 | X86_COND_B, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 705 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 706 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 707 | def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, R16 = R16 |
| 708 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 709 | "cmovae {$src2, $dst|$dst, $src2}", |
| 710 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 711 | X86_COND_AE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 712 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 713 | def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, R16 = [mem16] |
| 714 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 715 | "cmovae {$src2, $dst|$dst, $src2}", |
| 716 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 717 | X86_COND_AE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 718 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 719 | def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, R32 = R32 |
| 720 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 721 | "cmovae {$src2, $dst|$dst, $src2}", |
| 722 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 723 | X86_COND_AE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 724 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 725 | def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, R32 = [mem32] |
| 726 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 727 | "cmovae {$src2, $dst|$dst, $src2}", |
| 728 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 729 | X86_COND_AE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 730 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 731 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 732 | def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, R16 = R16 |
| 733 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 734 | "cmove {$src2, $dst|$dst, $src2}", |
| 735 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 736 | X86_COND_E, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 737 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 738 | def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, R16 = [mem16] |
| 739 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 740 | "cmove {$src2, $dst|$dst, $src2}", |
| 741 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 742 | X86_COND_E, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 743 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 744 | def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, R32 = R32 |
| 745 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 746 | "cmove {$src2, $dst|$dst, $src2}", |
| 747 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 748 | X86_COND_E, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 749 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 750 | def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, R32 = [mem32] |
| 751 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 752 | "cmove {$src2, $dst|$dst, $src2}", |
| 753 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 754 | X86_COND_E, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 755 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 756 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 757 | def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, R16 = R16 |
| 758 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 759 | "cmovne {$src2, $dst|$dst, $src2}", |
| 760 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 761 | X86_COND_NE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 762 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 763 | def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, R16 = [mem16] |
| 764 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 765 | "cmovne {$src2, $dst|$dst, $src2}", |
| 766 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 767 | X86_COND_NE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 768 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 769 | def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, R32 = R32 |
| 770 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 771 | "cmovne {$src2, $dst|$dst, $src2}", |
| 772 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 773 | X86_COND_NE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 774 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 775 | def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, R32 = [mem32] |
| 776 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 777 | "cmovne {$src2, $dst|$dst, $src2}", |
| 778 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 779 | X86_COND_NE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 780 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 781 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 782 | def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, R16 = R16 |
| 783 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 784 | "cmovbe {$src2, $dst|$dst, $src2}", |
| 785 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 786 | X86_COND_BE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 787 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 788 | def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, R16 = [mem16] |
| 789 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 790 | "cmovbe {$src2, $dst|$dst, $src2}", |
| 791 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 792 | X86_COND_BE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 793 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 794 | def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, R32 = R32 |
| 795 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 796 | "cmovbe {$src2, $dst|$dst, $src2}", |
| 797 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 798 | X86_COND_BE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 799 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 800 | def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, R32 = [mem32] |
| 801 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 802 | "cmovbe {$src2, $dst|$dst, $src2}", |
| 803 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 804 | X86_COND_BE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 805 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 806 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 807 | def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, R16 = R16 |
| 808 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 809 | "cmova {$src2, $dst|$dst, $src2}", |
| 810 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 811 | X86_COND_A, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 812 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 813 | def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, R16 = [mem16] |
| 814 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 815 | "cmova {$src2, $dst|$dst, $src2}", |
| 816 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 817 | X86_COND_A, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 818 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 819 | def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, R32 = R32 |
| 820 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 821 | "cmova {$src2, $dst|$dst, $src2}", |
| 822 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 823 | X86_COND_A, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 824 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 825 | def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, R32 = [mem32] |
| 826 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 827 | "cmova {$src2, $dst|$dst, $src2}", |
| 828 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 829 | X86_COND_A, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 830 | Imp<[STATUS],[]>, TB; |
| 831 | |
| 832 | def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, R16 = R16 |
| 833 | (ops R16:$dst, R16:$src1, R16:$src2), |
| 834 | "cmovl {$src2, $dst|$dst, $src2}", |
| 835 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 836 | X86_COND_L, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 837 | Imp<[STATUS],[]>, TB, OpSize; |
| 838 | def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, R16 = [mem16] |
| 839 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
| 840 | "cmovl {$src2, $dst|$dst, $src2}", |
| 841 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 842 | X86_COND_L, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 843 | Imp<[STATUS],[]>, TB, OpSize; |
| 844 | def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, R32 = R32 |
| 845 | (ops R32:$dst, R32:$src1, R32:$src2), |
| 846 | "cmovl {$src2, $dst|$dst, $src2}", |
| 847 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 848 | X86_COND_L, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 849 | Imp<[STATUS],[]>, TB; |
| 850 | def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, R32 = [mem32] |
| 851 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
| 852 | "cmovl {$src2, $dst|$dst, $src2}", |
| 853 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 854 | X86_COND_L, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 855 | Imp<[STATUS],[]>, TB; |
| 856 | |
| 857 | def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, R16 = R16 |
| 858 | (ops R16:$dst, R16:$src1, R16:$src2), |
| 859 | "cmovge {$src2, $dst|$dst, $src2}", |
| 860 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 861 | X86_COND_GE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 862 | Imp<[STATUS],[]>, TB, OpSize; |
| 863 | def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, R16 = [mem16] |
| 864 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
| 865 | "cmovge {$src2, $dst|$dst, $src2}", |
| 866 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 867 | X86_COND_GE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 868 | Imp<[STATUS],[]>, TB, OpSize; |
| 869 | def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, R32 = R32 |
| 870 | (ops R32:$dst, R32:$src1, R32:$src2), |
| 871 | "cmovge {$src2, $dst|$dst, $src2}", |
| 872 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 873 | X86_COND_GE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 874 | Imp<[STATUS],[]>, TB; |
| 875 | def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, R32 = [mem32] |
| 876 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
| 877 | "cmovge {$src2, $dst|$dst, $src2}", |
| 878 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 879 | X86_COND_GE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 880 | Imp<[STATUS],[]>, TB; |
| 881 | |
| 882 | def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, R16 = R16 |
| 883 | (ops R16:$dst, R16:$src1, R16:$src2), |
| 884 | "cmovle {$src2, $dst|$dst, $src2}", |
| 885 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 886 | X86_COND_LE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 887 | Imp<[STATUS],[]>, TB, OpSize; |
| 888 | def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, R16 = [mem16] |
| 889 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
| 890 | "cmovle {$src2, $dst|$dst, $src2}", |
| 891 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 892 | X86_COND_LE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 893 | Imp<[STATUS],[]>, TB, OpSize; |
| 894 | def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, R32 = R32 |
| 895 | (ops R32:$dst, R32:$src1, R32:$src2), |
| 896 | "cmovle {$src2, $dst|$dst, $src2}", |
| 897 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 898 | X86_COND_LE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 899 | Imp<[STATUS],[]>, TB; |
| 900 | def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, R32 = [mem32] |
| 901 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
| 902 | "cmovle {$src2, $dst|$dst, $src2}", |
| 903 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 904 | X86_COND_LE, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 905 | Imp<[STATUS],[]>, TB; |
| 906 | |
| 907 | def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, R16 = R16 |
| 908 | (ops R16:$dst, R16:$src1, R16:$src2), |
| 909 | "cmovg {$src2, $dst|$dst, $src2}", |
| 910 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 911 | X86_COND_G, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 912 | Imp<[STATUS],[]>, TB, OpSize; |
| 913 | def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, R16 = [mem16] |
| 914 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
| 915 | "cmovg {$src2, $dst|$dst, $src2}", |
| 916 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 917 | X86_COND_G, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 918 | Imp<[STATUS],[]>, TB, OpSize; |
| 919 | def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, R32 = R32 |
| 920 | (ops R32:$dst, R32:$src1, R32:$src2), |
| 921 | "cmovg {$src2, $dst|$dst, $src2}", |
| 922 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 923 | X86_COND_G, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 924 | Imp<[STATUS],[]>, TB; |
| 925 | def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, R32 = [mem32] |
| 926 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
| 927 | "cmovg {$src2, $dst|$dst, $src2}", |
| 928 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 929 | X86_COND_G, STATUS))]>, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 930 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 931 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 932 | def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, R16 = R16 |
| 933 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 934 | "cmovs {$src2, $dst|$dst, $src2}", |
| 935 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
| 936 | X86_COND_S, STATUS))]>, |
| 937 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 938 | def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, R16 = [mem16] |
| 939 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 940 | "cmovs {$src2, $dst|$dst, $src2}", |
| 941 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
| 942 | X86_COND_S, STATUS))]>, |
| 943 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 944 | def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, R32 = R32 |
| 945 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 946 | "cmovs {$src2, $dst|$dst, $src2}", |
| 947 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
| 948 | X86_COND_S, STATUS))]>, |
| 949 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 950 | def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, R32 = [mem32] |
| 951 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 952 | "cmovs {$src2, $dst|$dst, $src2}", |
| 953 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
| 954 | X86_COND_S, STATUS))]>, |
| 955 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 956 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 957 | def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, R16 = R16 |
| 958 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 959 | "cmovns {$src2, $dst|$dst, $src2}", |
| 960 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
| 961 | X86_COND_NS, STATUS))]>, |
| 962 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 963 | def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, R16 = [mem16] |
| 964 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 965 | "cmovns {$src2, $dst|$dst, $src2}", |
| 966 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
| 967 | X86_COND_NS, STATUS))]>, |
| 968 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 969 | def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, R32 = R32 |
| 970 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 971 | "cmovns {$src2, $dst|$dst, $src2}", |
| 972 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
| 973 | X86_COND_NS, STATUS))]>, |
| 974 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 975 | def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, R32 = [mem32] |
| 976 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 977 | "cmovns {$src2, $dst|$dst, $src2}", |
| 978 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
| 979 | X86_COND_NS, STATUS))]>, |
| 980 | Imp<[STATUS],[]>, TB; |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 981 | |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 982 | def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, R16 = R16 |
| 983 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 984 | "cmovp {$src2, $dst|$dst, $src2}", |
| 985 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
| 986 | X86_COND_P, STATUS))]>, |
| 987 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 988 | def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, R16 = [mem16] |
| 989 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 990 | "cmovp {$src2, $dst|$dst, $src2}", |
| 991 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
| 992 | X86_COND_P, STATUS))]>, |
| 993 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 994 | def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, R32 = R32 |
| 995 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 996 | "cmovp {$src2, $dst|$dst, $src2}", |
| 997 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
| 998 | X86_COND_P, STATUS))]>, |
| 999 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1000 | def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, R32 = [mem32] |
| 1001 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1002 | "cmovp {$src2, $dst|$dst, $src2}", |
| 1003 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
| 1004 | X86_COND_P, STATUS))]>, |
| 1005 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1006 | |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1007 | def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, R16 = R16 |
| 1008 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1009 | "cmovnp {$src2, $dst|$dst, $src2}", |
| 1010 | [(set R16:$dst, (X86cmov R16:$src1, R16:$src2, |
| 1011 | X86_COND_NP, STATUS))]>, |
| 1012 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1013 | def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, R16 = [mem16] |
| 1014 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1015 | "cmovnp {$src2, $dst|$dst, $src2}", |
| 1016 | [(set R16:$dst, (X86cmov R16:$src1, (loadi16 addr:$src2), |
| 1017 | X86_COND_NP, STATUS))]>, |
| 1018 | Imp<[STATUS],[]>, TB, OpSize; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1019 | def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, R32 = R32 |
| 1020 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1021 | "cmovnp {$src2, $dst|$dst, $src2}", |
| 1022 | [(set R32:$dst, (X86cmov R32:$src1, R32:$src2, |
| 1023 | X86_COND_NP, STATUS))]>, |
| 1024 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1025 | def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, R32 = [mem32] |
| 1026 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1027 | "cmovnp {$src2, $dst|$dst, $src2}", |
| 1028 | [(set R32:$dst, (X86cmov R32:$src1, (loadi32 addr:$src2), |
| 1029 | X86_COND_NP, STATUS))]>, |
| 1030 | Imp<[STATUS],[]>, TB; |
Chris Lattner | 57fbfb5 | 2005-01-10 22:09:33 +0000 | [diff] [blame] | 1031 | |
| 1032 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1033 | // unary instructions |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1034 | def NEG8r : I<0xF6, MRM3r, (ops R8 :$dst, R8 :$src), "neg{b} $dst", |
| 1035 | [(set R8:$dst, (ineg R8:$src))]>; |
| 1036 | def NEG16r : I<0xF7, MRM3r, (ops R16:$dst, R16:$src), "neg{w} $dst", |
| 1037 | [(set R16:$dst, (ineg R16:$src))]>, OpSize; |
| 1038 | def NEG32r : I<0xF7, MRM3r, (ops R32:$dst, R32:$src), "neg{l} $dst", |
| 1039 | [(set R32:$dst, (ineg R32:$src))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1040 | let isTwoAddress = 0 in { |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1041 | def NEG8m : I<0xF6, MRM3m, (ops i8mem :$dst), "neg{b} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1042 | [(store (ineg (loadi8 addr:$dst)), addr:$dst)]>; |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1043 | def NEG16m : I<0xF7, MRM3m, (ops i16mem:$dst), "neg{w} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1044 | [(store (ineg (loadi16 addr:$dst)), addr:$dst)]>, OpSize; |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1045 | def NEG32m : I<0xF7, MRM3m, (ops i32mem:$dst), "neg{l} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1046 | [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>; |
| 1047 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1048 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1049 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1050 | def NOT8r : I<0xF6, MRM2r, (ops R8 :$dst, R8 :$src), "not{b} $dst", |
| 1051 | [(set R8:$dst, (not R8:$src))]>; |
| 1052 | def NOT16r : I<0xF7, MRM2r, (ops R16:$dst, R16:$src), "not{w} $dst", |
| 1053 | [(set R16:$dst, (not R16:$src))]>, OpSize; |
| 1054 | def NOT32r : I<0xF7, MRM2r, (ops R32:$dst, R32:$src), "not{l} $dst", |
| 1055 | [(set R32:$dst, (not R32:$src))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1056 | let isTwoAddress = 0 in { |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1057 | def NOT8m : I<0xF6, MRM2m, (ops i8mem :$dst), "not{b} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1058 | [(store (not (loadi8 addr:$dst)), addr:$dst)]>; |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1059 | def NOT16m : I<0xF7, MRM2m, (ops i16mem:$dst), "not{w} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1060 | [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize; |
Evan Cheng | 5ce4edb | 2005-12-13 00:54:44 +0000 | [diff] [blame] | 1061 | def NOT32m : I<0xF7, MRM2m, (ops i32mem:$dst), "not{l} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1062 | [(store (not (loadi32 addr:$dst)), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1063 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1064 | |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1065 | // TODO: inc/dec is slow for P4, but fast for Pentium-M. |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1066 | def INC8r : I<0xFE, MRM0r, (ops R8 :$dst, R8 :$src), "inc{b} $dst", |
| 1067 | [(set R8:$dst, (add R8:$src, 1))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1068 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1069 | def INC16r : I<0xFF, MRM0r, (ops R16:$dst, R16:$src), "inc{w} $dst", |
| 1070 | [(set R16:$dst, (add R16:$src, 1))]>, OpSize; |
| 1071 | def INC32r : I<0xFF, MRM0r, (ops R32:$dst, R32:$src), "inc{l} $dst", |
| 1072 | [(set R32:$dst, (add R32:$src, 1))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1073 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1074 | let isTwoAddress = 0 in { |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1075 | def INC8m : I<0xFE, MRM0m, (ops i8mem :$dst), "inc{b} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1076 | [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>; |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1077 | def INC16m : I<0xFF, MRM0m, (ops i16mem:$dst), "inc{w} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1078 | [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize; |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1079 | def INC32m : I<0xFF, MRM0m, (ops i32mem:$dst), "inc{l} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1080 | [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1081 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1082 | |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1083 | def DEC8r : I<0xFE, MRM1r, (ops R8 :$dst, R8 :$src), "dec{b} $dst", |
| 1084 | [(set R8:$dst, (add R8:$src, -1))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1085 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1086 | def DEC16r : I<0xFF, MRM1r, (ops R16:$dst, R16:$src), "dec{w} $dst", |
| 1087 | [(set R16:$dst, (add R16:$src, -1))]>, OpSize; |
| 1088 | def DEC32r : I<0xFF, MRM1r, (ops R32:$dst, R32:$src), "dec{l} $dst", |
| 1089 | [(set R32:$dst, (add R32:$src, -1))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1090 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1091 | |
| 1092 | let isTwoAddress = 0 in { |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1093 | def DEC8m : I<0xFE, MRM1m, (ops i8mem :$dst), "dec{b} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1094 | [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>; |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1095 | def DEC16m : I<0xFF, MRM1m, (ops i16mem:$dst), "dec{w} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1096 | [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize; |
Evan Cheng | 6cad276 | 2005-12-13 01:02:47 +0000 | [diff] [blame] | 1097 | def DEC32m : I<0xFF, MRM1m, (ops i32mem:$dst), "dec{l} $dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1098 | [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1099 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1100 | |
| 1101 | // Logical operators... |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1102 | let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1103 | def AND8rr : I<0x20, MRMDestReg, |
| 1104 | (ops R8 :$dst, R8 :$src1, R8 :$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1105 | "and{b} {$src2, $dst|$dst, $src2}", |
| 1106 | [(set R8:$dst, (and R8:$src1, R8:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1107 | def AND16rr : I<0x21, MRMDestReg, |
| 1108 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1109 | "and{w} {$src2, $dst|$dst, $src2}", |
| 1110 | [(set R16:$dst, (and R16:$src1, R16:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1111 | def AND32rr : I<0x21, MRMDestReg, |
| 1112 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1113 | "and{l} {$src2, $dst|$dst, $src2}", |
| 1114 | [(set R32:$dst, (and R32:$src1, R32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1115 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1116 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1117 | def AND8rm : I<0x22, MRMSrcMem, |
| 1118 | (ops R8 :$dst, R8 :$src1, i8mem :$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1119 | "and{b} {$src2, $dst|$dst, $src2}", |
| 1120 | [(set R8:$dst, (and R8:$src1, (load addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1121 | def AND16rm : I<0x23, MRMSrcMem, |
| 1122 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1123 | "and{w} {$src2, $dst|$dst, $src2}", |
| 1124 | [(set R16:$dst, (and R16:$src1, (load addr:$src2)))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1125 | def AND32rm : I<0x23, MRMSrcMem, |
| 1126 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1127 | "and{l} {$src2, $dst|$dst, $src2}", |
| 1128 | [(set R32:$dst, (and R32:$src1, (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1129 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1130 | def AND8ri : Ii8<0x80, MRM4r, |
| 1131 | (ops R8 :$dst, R8 :$src1, i8imm :$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1132 | "and{b} {$src2, $dst|$dst, $src2}", |
| 1133 | [(set R8:$dst, (and R8:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1134 | def AND16ri : Ii16<0x81, MRM4r, |
| 1135 | (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1136 | "and{w} {$src2, $dst|$dst, $src2}", |
| 1137 | [(set R16:$dst, (and R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1138 | def AND32ri : Ii32<0x81, MRM4r, |
| 1139 | (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1140 | "and{l} {$src2, $dst|$dst, $src2}", |
| 1141 | [(set R32:$dst, (and R32:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1142 | def AND16ri8 : Ii8<0x83, MRM4r, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1143 | (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1144 | "and{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1145 | [(set R16:$dst, (and R16:$src1, i16immSExt8:$src2))]>, |
| 1146 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1147 | def AND32ri8 : Ii8<0x83, MRM4r, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1148 | (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1149 | "and{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1150 | [(set R32:$dst, (and R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1151 | |
| 1152 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1153 | def AND8mr : I<0x20, MRMDestMem, |
| 1154 | (ops i8mem :$dst, R8 :$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1155 | "and{b} {$src, $dst|$dst, $src}", |
| 1156 | [(store (and (load addr:$dst), R8:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1157 | def AND16mr : I<0x21, MRMDestMem, |
| 1158 | (ops i16mem:$dst, R16:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1159 | "and{w} {$src, $dst|$dst, $src}", |
| 1160 | [(store (and (load addr:$dst), R16:$src), addr:$dst)]>, |
| 1161 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1162 | def AND32mr : I<0x21, MRMDestMem, |
| 1163 | (ops i32mem:$dst, R32:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1164 | "and{l} {$src, $dst|$dst, $src}", |
| 1165 | [(store (and (load addr:$dst), R32:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1166 | def AND8mi : Ii8<0x80, MRM4m, |
| 1167 | (ops i8mem :$dst, i8imm :$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1168 | "and{b} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1169 | [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1170 | def AND16mi : Ii16<0x81, MRM4m, |
| 1171 | (ops i16mem:$dst, i16imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1172 | "and{w} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1173 | [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1174 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1175 | def AND32mi : Ii32<0x81, MRM4m, |
| 1176 | (ops i32mem:$dst, i32imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1177 | "and{l} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1178 | [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1179 | def AND16mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1180 | (ops i16mem:$dst, i16i8imm :$src), |
| 1181 | "and{w} {$src, $dst|$dst, $src}", |
| 1182 | [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, |
| 1183 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1184 | def AND32mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1185 | (ops i32mem:$dst, i32i8imm :$src), |
| 1186 | "and{l} {$src, $dst|$dst, $src}", |
| 1187 | [(store (add (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1188 | } |
| 1189 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1190 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1191 | let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1192 | def OR8rr : I<0x08, MRMDestReg, (ops R8 :$dst, R8 :$src1, R8 :$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1193 | "or{b} {$src2, $dst|$dst, $src2}", |
| 1194 | [(set R8:$dst, (or R8:$src1, R8:$src2))]>; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1195 | def OR16rr : I<0x09, MRMDestReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1196 | "or{w} {$src2, $dst|$dst, $src2}", |
| 1197 | [(set R16:$dst, (or R16:$src1, R16:$src2))]>, OpSize; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1198 | def OR32rr : I<0x09, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1199 | "or{l} {$src2, $dst|$dst, $src2}", |
| 1200 | [(set R32:$dst, (or R32:$src1, R32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1201 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1202 | def OR8rm : I<0x0A, MRMSrcMem , (ops R8 :$dst, R8 :$src1, i8mem :$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1203 | "or{b} {$src2, $dst|$dst, $src2}", |
| 1204 | [(set R8:$dst, (or R8:$src1, (load addr:$src2)))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1205 | def OR16rm : I<0x0B, MRMSrcMem , (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1206 | "or{w} {$src2, $dst|$dst, $src2}", |
| 1207 | [(set R16:$dst, (or R16:$src1, (load addr:$src2)))]>, OpSize; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1208 | def OR32rm : I<0x0B, MRMSrcMem , (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1209 | "or{l} {$src2, $dst|$dst, $src2}", |
| 1210 | [(set R32:$dst, (or R32:$src1, (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1211 | |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1212 | def OR8ri : Ii8 <0x80, MRM1r, (ops R8 :$dst, R8 :$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1213 | "or{b} {$src2, $dst|$dst, $src2}", |
| 1214 | [(set R8:$dst, (or R8:$src1, imm:$src2))]>; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1215 | def OR16ri : Ii16<0x81, MRM1r, (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1216 | "or{w} {$src2, $dst|$dst, $src2}", |
| 1217 | [(set R16:$dst, (or R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1218 | def OR32ri : Ii32<0x81, MRM1r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1219 | "or{l} {$src2, $dst|$dst, $src2}", |
| 1220 | [(set R32:$dst, (or R32:$src1, imm:$src2))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1221 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1222 | def OR16ri8 : Ii8<0x83, MRM1r, (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1223 | "or{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1224 | [(set R16:$dst, (or R16:$src1, i16immSExt8:$src2))]>, OpSize; |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1225 | def OR32ri8 : Ii8<0x83, MRM1r, (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1226 | "or{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1227 | [(set R32:$dst, (or R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1228 | let isTwoAddress = 0 in { |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1229 | def OR8mr : I<0x08, MRMDestMem, (ops i8mem:$dst, R8:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1230 | "or{b} {$src, $dst|$dst, $src}", |
| 1231 | [(store (or (load addr:$dst), R8:$src), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1232 | def OR16mr : I<0x09, MRMDestMem, (ops i16mem:$dst, R16:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1233 | "or{w} {$src, $dst|$dst, $src}", |
| 1234 | [(store (or (load addr:$dst), R16:$src), addr:$dst)]>, OpSize; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1235 | def OR32mr : I<0x09, MRMDestMem, (ops i32mem:$dst, R32:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1236 | "or{l} {$src, $dst|$dst, $src}", |
| 1237 | [(store (or (load addr:$dst), R32:$src), addr:$dst)]>; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 1238 | def OR8mi : Ii8<0x80, MRM1m, (ops i8mem :$dst, i8imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1239 | "or{b} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1240 | [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst)]>; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 1241 | def OR16mi : Ii16<0x81, MRM1m, (ops i16mem:$dst, i16imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1242 | "or{w} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1243 | [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1244 | OpSize; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 1245 | def OR32mi : Ii32<0x81, MRM1m, (ops i32mem:$dst, i32imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1246 | "or{l} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1247 | [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst)]>; |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1248 | def OR16mi8 : Ii8<0x83, MRM1m, (ops i16mem:$dst, i16i8imm:$src), |
| 1249 | "or{w} {$src, $dst|$dst, $src}", |
| 1250 | [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, |
| 1251 | OpSize; |
| 1252 | def OR32mi8 : Ii8<0x83, MRM1m, (ops i32mem:$dst, i32i8imm:$src), |
| 1253 | "or{l} {$src, $dst|$dst, $src}", |
| 1254 | [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1255 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1256 | |
| 1257 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1258 | let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1259 | def XOR8rr : I<0x30, MRMDestReg, |
| 1260 | (ops R8 :$dst, R8 :$src1, R8 :$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1261 | "xor{b} {$src2, $dst|$dst, $src2}", |
| 1262 | [(set R8:$dst, (xor R8:$src1, R8:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1263 | def XOR16rr : I<0x31, MRMDestReg, |
| 1264 | (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1265 | "xor{w} {$src2, $dst|$dst, $src2}", |
| 1266 | [(set R16:$dst, (xor R16:$src1, R16:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1267 | def XOR32rr : I<0x31, MRMDestReg, |
| 1268 | (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1269 | "xor{l} {$src2, $dst|$dst, $src2}", |
| 1270 | [(set R32:$dst, (xor R32:$src1, R32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1271 | } |
| 1272 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1273 | def XOR8rm : I<0x32, MRMSrcMem , |
| 1274 | (ops R8 :$dst, R8:$src1, i8mem :$src2), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1275 | "xor{b} {$src2, $dst|$dst, $src2}", |
| 1276 | [(set R8:$dst, (xor R8:$src1, (load addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1277 | def XOR16rm : I<0x33, MRMSrcMem , |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1278 | (ops R16:$dst, R16:$src1, i16mem:$src2), |
| 1279 | "xor{w} {$src2, $dst|$dst, $src2}", |
| 1280 | [(set R16:$dst, (xor R16:$src1, (load addr:$src2)))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1281 | def XOR32rm : I<0x33, MRMSrcMem , |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1282 | (ops R32:$dst, R32:$src1, i32mem:$src2), |
| 1283 | "xor{l} {$src2, $dst|$dst, $src2}", |
| 1284 | [(set R32:$dst, (xor R32:$src1, (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1285 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1286 | def XOR8ri : Ii8<0x80, MRM6r, |
| 1287 | (ops R8:$dst, R8:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1288 | "xor{b} {$src2, $dst|$dst, $src2}", |
| 1289 | [(set R8:$dst, (xor R8:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1290 | def XOR16ri : Ii16<0x81, MRM6r, |
| 1291 | (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1292 | "xor{w} {$src2, $dst|$dst, $src2}", |
| 1293 | [(set R16:$dst, (xor R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1294 | def XOR32ri : Ii32<0x81, MRM6r, |
| 1295 | (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1296 | "xor{l} {$src2, $dst|$dst, $src2}", |
| 1297 | [(set R32:$dst, (xor R32:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1298 | def XOR16ri8 : Ii8<0x83, MRM6r, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1299 | (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1300 | "xor{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1301 | [(set R16:$dst, (xor R16:$src1, i16immSExt8:$src2))]>, |
| 1302 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1303 | def XOR32ri8 : Ii8<0x83, MRM6r, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1304 | (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1305 | "xor{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1306 | [(set R32:$dst, (xor R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1307 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1308 | def XOR8mr : I<0x30, MRMDestMem, |
| 1309 | (ops i8mem :$dst, R8 :$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1310 | "xor{b} {$src, $dst|$dst, $src}", |
| 1311 | [(store (xor (load addr:$dst), R8:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1312 | def XOR16mr : I<0x31, MRMDestMem, |
| 1313 | (ops i16mem:$dst, R16:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1314 | "xor{w} {$src, $dst|$dst, $src}", |
| 1315 | [(store (xor (load addr:$dst), R16:$src), addr:$dst)]>, |
| 1316 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1317 | def XOR32mr : I<0x31, MRMDestMem, |
| 1318 | (ops i32mem:$dst, R32:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1319 | "xor{l} {$src, $dst|$dst, $src}", |
| 1320 | [(store (xor (load addr:$dst), R32:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1321 | def XOR8mi : Ii8<0x80, MRM6m, |
| 1322 | (ops i8mem :$dst, i8imm :$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1323 | "xor{b} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1324 | [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1325 | def XOR16mi : Ii16<0x81, MRM6m, |
| 1326 | (ops i16mem:$dst, i16imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1327 | "xor{w} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1328 | [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1329 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1330 | def XOR32mi : Ii32<0x81, MRM6m, |
| 1331 | (ops i32mem:$dst, i32imm:$src), |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1332 | "xor{l} {$src, $dst|$dst, $src}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1333 | [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1334 | def XOR16mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1335 | (ops i16mem:$dst, i16i8imm :$src), |
| 1336 | "xor{w} {$src, $dst|$dst, $src}", |
| 1337 | [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst)]>, |
| 1338 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1339 | def XOR32mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1340 | (ops i32mem:$dst, i32i8imm :$src), |
| 1341 | "xor{l} {$src, $dst|$dst, $src}", |
| 1342 | [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1343 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1344 | |
| 1345 | // Shift instructions |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1346 | def SHL8rCL : I<0xD2, MRM4r, (ops R8 :$dst, R8 :$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1347 | "shl{b} {%cl, $dst|$dst, %CL}", |
| 1348 | [(set R8:$dst, (shl R8:$src, CL))]>, Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1349 | def SHL16rCL : I<0xD3, MRM4r, (ops R16:$dst, R16:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1350 | "shl{w} {%cl, $dst|$dst, %CL}", |
| 1351 | [(set R16:$dst, (shl R16:$src, CL))]>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1352 | def SHL32rCL : I<0xD3, MRM4r, (ops R32:$dst, R32:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1353 | "shl{l} {%cl, $dst|$dst, %CL}", |
| 1354 | [(set R32:$dst, (shl R32:$src, CL))]>, Imp<[CL],[]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1355 | |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1356 | def SHL8ri : Ii8<0xC0, MRM4r, (ops R8 :$dst, R8 :$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1357 | "shl{b} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1358 | [(set R8:$dst, (shl R8:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1359 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1360 | def SHL16ri : Ii8<0xC1, MRM4r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1361 | "shl{w} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1362 | [(set R16:$dst, (shl R16:$src1, (i8 imm:$src2)))]>, OpSize; |
| 1363 | def SHL32ri : Ii8<0xC1, MRM4r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1364 | "shl{l} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1365 | [(set R32:$dst, (shl R32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1366 | } |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1367 | |
| 1368 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1369 | def SHL8mCL : I<0xD2, MRM4m, (ops i8mem :$dst), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1370 | "shl{b} {%cl, $dst|$dst, %CL}", |
| 1371 | [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>, |
| 1372 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1373 | def SHL16mCL : I<0xD3, MRM4m, (ops i16mem:$dst), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1374 | "shl{w} {%cl, $dst|$dst, %CL}", |
| 1375 | [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, |
| 1376 | Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1377 | def SHL32mCL : I<0xD3, MRM4m, (ops i32mem:$dst), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1378 | "shl{l} {%cl, $dst|$dst, %CL}", |
| 1379 | [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>, |
| 1380 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1381 | def SHL8mi : Ii8<0xC0, MRM4m, (ops i8mem :$dst, i8imm:$src), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1382 | "shl{b} {$src, $dst|$dst, $src}", |
| 1383 | [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1384 | def SHL16mi : Ii8<0xC1, MRM4m, (ops i16mem:$dst, i8imm:$src), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1385 | "shl{w} {$src, $dst|$dst, $src}", |
| 1386 | [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 1387 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1388 | def SHL32mi : Ii8<0xC1, MRM4m, (ops i32mem:$dst, i8imm:$src), |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 1389 | "shl{l} {$src, $dst|$dst, $src}", |
| 1390 | [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1391 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1392 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1393 | def SHR8rCL : I<0xD2, MRM5r, (ops R8 :$dst, R8 :$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1394 | "shr{b} {%cl, $dst|$dst, %CL}", |
| 1395 | [(set R8:$dst, (srl R8:$src, CL))]>, Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1396 | def SHR16rCL : I<0xD3, MRM5r, (ops R16:$dst, R16:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1397 | "shr{w} {%cl, $dst|$dst, %CL}", |
| 1398 | [(set R16:$dst, (srl R16:$src, CL))]>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1399 | def SHR32rCL : I<0xD3, MRM5r, (ops R32:$dst, R32:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1400 | "shr{l} {%cl, $dst|$dst, %CL}", |
| 1401 | [(set R32:$dst, (srl R32:$src, CL))]>, Imp<[CL],[]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1402 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1403 | def SHR8ri : Ii8<0xC0, MRM5r, (ops R8:$dst, R8:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1404 | "shr{b} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1405 | [(set R8:$dst, (srl R8:$src1, (i8 imm:$src2)))]>; |
| 1406 | def SHR16ri : Ii8<0xC1, MRM5r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1407 | "shr{w} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1408 | [(set R16:$dst, (srl R16:$src1, (i8 imm:$src2)))]>, OpSize; |
| 1409 | def SHR32ri : Ii8<0xC1, MRM5r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1410 | "shr{l} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1411 | [(set R32:$dst, (srl R32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1412 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1413 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1414 | def SHR8mCL : I<0xD2, MRM5m, (ops i8mem :$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1415 | "shr{b} {%cl, $dst|$dst, %CL}", |
| 1416 | [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>, |
| 1417 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1418 | def SHR16mCL : I<0xD3, MRM5m, (ops i16mem:$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1419 | "shr{w} {%cl, $dst|$dst, %CL}", |
| 1420 | [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>, |
| 1421 | Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1422 | def SHR32mCL : I<0xD3, MRM5m, (ops i32mem:$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1423 | "shr{l} {%cl, $dst|$dst, %CL}", |
| 1424 | [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>, |
| 1425 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1426 | def SHR8mi : Ii8<0xC0, MRM5m, (ops i8mem :$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1427 | "shr{b} {$src, $dst|$dst, $src}", |
| 1428 | [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1429 | def SHR16mi : Ii8<0xC1, MRM5m, (ops i16mem:$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1430 | "shr{w} {$src, $dst|$dst, $src}", |
| 1431 | [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 1432 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1433 | def SHR32mi : Ii8<0xC1, MRM5m, (ops i32mem:$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1434 | "shr{l} {$src, $dst|$dst, $src}", |
| 1435 | [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1436 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1437 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1438 | def SAR8rCL : I<0xD2, MRM7r, (ops R8 :$dst, R8 :$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1439 | "sar{b} {%cl, $dst|$dst, %CL}", |
| 1440 | [(set R8:$dst, (sra R8:$src, CL))]>, Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1441 | def SAR16rCL : I<0xD3, MRM7r, (ops R16:$dst, R16:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1442 | "sar{w} {%cl, $dst|$dst, %CL}", |
| 1443 | [(set R16:$dst, (sra R16:$src, CL))]>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1444 | def SAR32rCL : I<0xD3, MRM7r, (ops R32:$dst, R32:$src), |
Evan Cheng | 640f299 | 2005-12-01 00:43:55 +0000 | [diff] [blame] | 1445 | "sar{l} {%cl, $dst|$dst, %CL}", |
| 1446 | [(set R32:$dst, (sra R32:$src, CL))]>, Imp<[CL],[]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1447 | |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1448 | def SAR8ri : Ii8<0xC0, MRM7r, (ops R8 :$dst, R8 :$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1449 | "sar{b} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1450 | [(set R8:$dst, (sra R8:$src1, (i8 imm:$src2)))]>; |
| 1451 | def SAR16ri : Ii8<0xC1, MRM7r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1452 | "sar{w} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1453 | [(set R16:$dst, (sra R16:$src1, (i8 imm:$src2)))]>, |
| 1454 | OpSize; |
| 1455 | def SAR32ri : Ii8<0xC1, MRM7r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1456 | "sar{l} {$src2, $dst|$dst, $src2}", |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 1457 | [(set R32:$dst, (sra R32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1458 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1459 | def SAR8mCL : I<0xD2, MRM7m, (ops i8mem :$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1460 | "sar{b} {%cl, $dst|$dst, %CL}", |
| 1461 | [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>, |
| 1462 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1463 | def SAR16mCL : I<0xD3, MRM7m, (ops i16mem:$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1464 | "sar{w} {%cl, $dst|$dst, %CL}", |
| 1465 | [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, |
| 1466 | Imp<[CL],[]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1467 | def SAR32mCL : I<0xD3, MRM7m, (ops i32mem:$dst), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1468 | "sar{l} {%cl, $dst|$dst, %CL}", |
| 1469 | [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>, |
| 1470 | Imp<[CL],[]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1471 | def SAR8mi : Ii8<0xC0, MRM7m, (ops i8mem :$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1472 | "sar{b} {$src, $dst|$dst, $src}", |
| 1473 | [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1474 | def SAR16mi : Ii8<0xC1, MRM7m, (ops i16mem:$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1475 | "sar{w} {$src, $dst|$dst, $src}", |
| 1476 | [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 1477 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1478 | def SAR32mi : Ii8<0xC1, MRM7m, (ops i32mem:$dst, i8imm:$src), |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 1479 | "sar{l} {$src, $dst|$dst, $src}", |
| 1480 | [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1481 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1482 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1483 | // Rotate instructions |
| 1484 | // FIXME: provide shorter instructions when imm8 == 1 |
| 1485 | def ROL8rCL : I<0xD2, MRM0r, (ops R8 :$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1486 | "rol{b} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1487 | def ROL16rCL : I<0xD3, MRM0r, (ops R16:$dst, R16:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1488 | "rol{w} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1489 | def ROL32rCL : I<0xD3, MRM0r, (ops R32:$dst, R32:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1490 | "rol{l} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1491 | |
| 1492 | def ROL8ri : Ii8<0xC0, MRM0r, (ops R8 :$dst, R8 :$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1493 | "rol{b} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1494 | def ROL16ri : Ii8<0xC1, MRM0r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1495 | "rol{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1496 | def ROL32ri : Ii8<0xC1, MRM0r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1497 | "rol{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1498 | |
| 1499 | let isTwoAddress = 0 in { |
| 1500 | def ROL8mCL : I<0xD2, MRM0m, (ops i8mem :$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1501 | "rol{b} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1502 | def ROL16mCL : I<0xD3, MRM0m, (ops i16mem:$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1503 | "rol{w} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1504 | def ROL32mCL : I<0xD3, MRM0m, (ops i32mem:$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1505 | "rol{l} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1506 | def ROL8mi : Ii8<0xC0, MRM0m, (ops i8mem :$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1507 | "rol{b} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1508 | def ROL16mi : Ii8<0xC1, MRM0m, (ops i16mem:$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1509 | "rol{w} {$src, $dst|$dst, $src}", []>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1510 | def ROL32mi : Ii8<0xC1, MRM0m, (ops i32mem:$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1511 | "rol{l} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1512 | } |
| 1513 | |
| 1514 | def ROR8rCL : I<0xD2, MRM1r, (ops R8 :$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1515 | "ror{b} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1516 | def ROR16rCL : I<0xD3, MRM1r, (ops R16:$dst, R16:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1517 | "ror{w} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1518 | def ROR32rCL : I<0xD3, MRM1r, (ops R32:$dst, R32:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1519 | "ror{l} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1520 | |
| 1521 | def ROR8ri : Ii8<0xC0, MRM1r, (ops R8 :$dst, R8 :$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1522 | "ror{b} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1523 | def ROR16ri : Ii8<0xC1, MRM1r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1524 | "ror{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1525 | def ROR32ri : Ii8<0xC1, MRM1r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1526 | "ror{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1527 | let isTwoAddress = 0 in { |
| 1528 | def ROR8mCL : I<0xD2, MRM1m, (ops i8mem :$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1529 | "ror{b} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1530 | def ROR16mCL : I<0xD3, MRM1m, (ops i16mem:$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1531 | "ror{w} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1532 | def ROR32mCL : I<0xD3, MRM1m, (ops i32mem:$dst), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1533 | "ror{l} {%cl, $dst|$dst, %CL}", []>, Imp<[CL],[]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1534 | def ROR8mi : Ii8<0xC0, MRM1m, (ops i8mem :$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1535 | "ror{b} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1536 | def ROR16mi : Ii8<0xC1, MRM1m, (ops i16mem:$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1537 | "ror{w} {$src, $dst|$dst, $src}", []>, OpSize; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1538 | def ROR32mi : Ii8<0xC1, MRM1m, (ops i32mem:$dst, i8imm:$src), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1539 | "ror{l} {$src, $dst|$dst, $src}", []>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 1540 | } |
| 1541 | |
| 1542 | |
| 1543 | |
| 1544 | // Double shift instructions (generalizations of rotate) |
| 1545 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1546 | def SHLD32rrCL : I<0xA5, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1547 | "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1548 | Imp<[CL],[]>, TB; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1549 | def SHRD32rrCL : I<0xAD, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1550 | "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1551 | Imp<[CL],[]>, TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1552 | def SHLD16rrCL : I<0xA5, MRMDestReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1553 | "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1554 | Imp<[CL],[]>, TB, OpSize; |
| 1555 | def SHRD16rrCL : I<0xAD, MRMDestReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1556 | "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1557 | Imp<[CL],[]>, TB, OpSize; |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 1558 | |
| 1559 | let isCommutable = 1 in { // These instructions commute to each other. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1560 | def SHLD32rri8 : Ii8<0xA4, MRMDestReg, |
| 1561 | (ops R32:$dst, R32:$src1, R32:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1562 | "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1563 | def SHRD32rri8 : Ii8<0xAC, MRMDestReg, |
| 1564 | (ops R32:$dst, R32:$src1, R32:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1565 | "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1566 | def SHLD16rri8 : Ii8<0xA4, MRMDestReg, |
| 1567 | (ops R16:$dst, R16:$src1, R16:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1568 | "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1569 | TB, OpSize; |
| 1570 | def SHRD16rri8 : Ii8<0xAC, MRMDestReg, |
| 1571 | (ops R16:$dst, R16:$src1, R16:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1572 | "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1573 | TB, OpSize; |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 1574 | } |
Chris Lattner | 0e967d4 | 2004-08-01 08:13:11 +0000 | [diff] [blame] | 1575 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1576 | let isTwoAddress = 0 in { |
| 1577 | def SHLD32mrCL : I<0xA5, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1578 | "shld{l} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1579 | Imp<[CL],[]>, TB; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1580 | def SHRD32mrCL : I<0xAD, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1581 | "shrd{l} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1582 | Imp<[CL],[]>, TB; |
| 1583 | def SHLD32mri8 : Ii8<0xA4, MRMDestMem, |
| 1584 | (ops i32mem:$dst, R32:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1585 | "shld{l} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
| 1586 | TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1587 | def SHRD32mri8 : Ii8<0xAC, MRMDestMem, |
| 1588 | (ops i32mem:$dst, R32:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1589 | "shrd{l} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
| 1590 | TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1591 | |
| 1592 | def SHLD16mrCL : I<0xA5, MRMDestMem, (ops i16mem:$dst, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1593 | "shld{w} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1594 | Imp<[CL],[]>, TB, OpSize; |
| 1595 | def SHRD16mrCL : I<0xAD, MRMDestMem, (ops i16mem:$dst, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1596 | "shrd{w} {%cl, $src2, $dst|$dst, $src2, %CL}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1597 | Imp<[CL],[]>, TB, OpSize; |
| 1598 | def SHLD16mri8 : Ii8<0xA4, MRMDestMem, |
| 1599 | (ops i16mem:$dst, R16:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1600 | "shld{w} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1601 | TB, OpSize; |
| 1602 | def SHRD16mri8 : Ii8<0xAC, MRMDestMem, |
| 1603 | (ops i16mem:$dst, R16:$src2, i8imm:$src3), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1604 | "shrd{w} {$src3, $src2, $dst|$dst, $src2, $src3}", []>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 1605 | TB, OpSize; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1606 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1607 | |
| 1608 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1609 | // Arithmetic. |
| 1610 | let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1611 | def ADD8rr : I<0x00, MRMDestReg, (ops R8 :$dst, R8 :$src1, R8 :$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1612 | "add{b} {$src2, $dst|$dst, $src2}", |
| 1613 | [(set R8:$dst, (add R8:$src1, R8:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1614 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1615 | def ADD16rr : I<0x01, MRMDestReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1616 | "add{w} {$src2, $dst|$dst, $src2}", |
| 1617 | [(set R16:$dst, (add R16:$src1, R16:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1618 | def ADD32rr : I<0x01, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1619 | "add{l} {$src2, $dst|$dst, $src2}", |
| 1620 | [(set R32:$dst, (add R32:$src1, R32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1621 | } // end isConvertibleToThreeAddress |
| 1622 | } // end isCommutable |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1623 | def ADD8rm : I<0x02, MRMSrcMem, (ops R8 :$dst, R8 :$src1, i8mem :$src2), |
Evan Cheng | ab24ed2 | 2005-12-09 22:48:48 +0000 | [diff] [blame] | 1624 | "add{b} {$src2, $dst|$dst, $src2}", |
| 1625 | [(set R8:$dst, (add R8:$src1, (load addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1626 | def ADD16rm : I<0x03, MRMSrcMem, (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | ab24ed2 | 2005-12-09 22:48:48 +0000 | [diff] [blame] | 1627 | "add{w} {$src2, $dst|$dst, $src2}", |
| 1628 | [(set R16:$dst, (add R16:$src1, (load addr:$src2)))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1629 | def ADD32rm : I<0x03, MRMSrcMem, (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | ab24ed2 | 2005-12-09 22:48:48 +0000 | [diff] [blame] | 1630 | "add{l} {$src2, $dst|$dst, $src2}", |
| 1631 | [(set R32:$dst, (add R32:$src1, (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1632 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1633 | def ADD8ri : Ii8<0x80, MRM0r, (ops R8:$dst, R8:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1634 | "add{b} {$src2, $dst|$dst, $src2}", |
| 1635 | [(set R8:$dst, (add R8:$src1, imm:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1636 | |
| 1637 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1638 | def ADD16ri : Ii16<0x81, MRM0r, (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1639 | "add{w} {$src2, $dst|$dst, $src2}", |
| 1640 | [(set R16:$dst, (add R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1641 | def ADD32ri : Ii32<0x81, MRM0r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1642 | "add{l} {$src2, $dst|$dst, $src2}", |
| 1643 | [(set R32:$dst, (add R32:$src1, imm:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1644 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1645 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1646 | // FIXME: move ADD16ri8 above ADD16ri to optimize for space. |
| 1647 | def ADD16ri8 : Ii8<0x83, MRM0r, (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1648 | "add{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1649 | [(set R16:$dst, (add R16:$src1, i16immSExt8:$src2))]>, |
| 1650 | OpSize; |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1651 | def ADD32ri8 : Ii8<0x83, MRM0r, (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1652 | "add{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1653 | [(set R32:$dst, (add R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1654 | |
| 1655 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1656 | def ADD8mr : I<0x00, MRMDestMem, (ops i8mem :$dst, R8 :$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1657 | "add{b} {$src2, $dst|$dst, $src2}", |
| 1658 | [(store (add (load addr:$dst), R8:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1659 | def ADD16mr : I<0x01, MRMDestMem, (ops i16mem:$dst, R16:$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1660 | "add{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1661 | [(store (add (load addr:$dst), R16:$src2), addr:$dst)]>, |
| 1662 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1663 | def ADD32mr : I<0x01, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1664 | "add{l} {$src2, $dst|$dst, $src2}", |
| 1665 | [(store (add (load addr:$dst), R32:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1666 | def ADD8mi : Ii8<0x80, MRM0m, (ops i8mem :$dst, i8imm :$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1667 | "add{b} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1668 | [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1669 | def ADD16mi : Ii16<0x81, MRM0m, (ops i16mem:$dst, i16imm:$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1670 | "add{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1671 | [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1672 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1673 | def ADD32mi : Ii32<0x81, MRM0m, (ops i32mem:$dst, i32imm:$src2), |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1674 | "add{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1675 | [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1676 | def ADD16mi8 : Ii8<0x83, MRM0m, (ops i16mem:$dst, i16i8imm :$src2), |
| 1677 | "add{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1678 | [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
| 1679 | OpSize; |
Evan Cheng | ee93f9d | 2005-12-12 19:45:23 +0000 | [diff] [blame] | 1680 | def ADD32mi8 : Ii8<0x83, MRM0m, (ops i32mem:$dst, i32i8imm :$src2), |
| 1681 | "add{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1682 | [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1683 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1684 | |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 1685 | let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1686 | def ADC32rr : I<0x11, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1687 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 1688 | } |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1689 | def ADC32rm : I<0x13, MRMSrcMem , (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1690 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1691 | def ADC32ri : Ii32<0x81, MRM2r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1692 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1693 | def ADC32ri8 : Ii8<0x83, MRM2r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1694 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1695 | |
| 1696 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1697 | def ADC32mr : I<0x11, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1698 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1699 | def ADC32mi : Ii32<0x81, MRM2m, (ops i32mem:$dst, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1700 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1701 | def ADC32mi8 : Ii8<0x83, MRM2m, (ops i32mem:$dst, i8imm :$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1702 | "adc{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1703 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1704 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1705 | def SUB8rr : I<0x28, MRMDestReg, (ops R8 :$dst, R8 :$src1, R8 :$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1706 | "sub{b} {$src2, $dst|$dst, $src2}", |
| 1707 | [(set R8:$dst, (sub R8:$src1, R8:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1708 | def SUB16rr : I<0x29, MRMDestReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1709 | "sub{w} {$src2, $dst|$dst, $src2}", |
| 1710 | [(set R16:$dst, (sub R16:$src1, R16:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1711 | def SUB32rr : I<0x29, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1712 | "sub{l} {$src2, $dst|$dst, $src2}", |
| 1713 | [(set R32:$dst, (sub R32:$src1, R32:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1714 | def SUB8rm : I<0x2A, MRMSrcMem, (ops R8 :$dst, R8 :$src1, i8mem :$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1715 | "sub{b} {$src2, $dst|$dst, $src2}", |
| 1716 | [(set R8:$dst, (sub R8:$src1, (load addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1717 | def SUB16rm : I<0x2B, MRMSrcMem, (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1718 | "sub{w} {$src2, $dst|$dst, $src2}", |
| 1719 | [(set R16:$dst, (sub R16:$src1, (load addr:$src2)))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1720 | def SUB32rm : I<0x2B, MRMSrcMem, (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1721 | "sub{l} {$src2, $dst|$dst, $src2}", |
| 1722 | [(set R32:$dst, (sub R32:$src1, (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1723 | |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1724 | def SUB8ri : Ii8 <0x80, MRM5r, (ops R8:$dst, R8:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1725 | "sub{b} {$src2, $dst|$dst, $src2}", |
| 1726 | [(set R8:$dst, (sub R8:$src1, imm:$src2))]>; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1727 | def SUB16ri : Ii16<0x81, MRM5r, (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1728 | "sub{w} {$src2, $dst|$dst, $src2}", |
| 1729 | [(set R16:$dst, (sub R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1730 | def SUB32ri : Ii32<0x81, MRM5r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1731 | "sub{l} {$src2, $dst|$dst, $src2}", |
| 1732 | [(set R32:$dst, (sub R32:$src1, imm:$src2))]>; |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1733 | def SUB16ri8 : Ii8<0x83, MRM5r, (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1734 | "sub{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1735 | [(set R16:$dst, (sub R16:$src1, i16immSExt8:$src2))]>, |
| 1736 | OpSize; |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1737 | def SUB32ri8 : Ii8<0x83, MRM5r, (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1738 | "sub{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1739 | [(set R32:$dst, (sub R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1740 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1741 | def SUB8mr : I<0x28, MRMDestMem, (ops i8mem :$dst, R8 :$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1742 | "sub{b} {$src2, $dst|$dst, $src2}", |
| 1743 | [(store (sub (load addr:$dst), R8:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1744 | def SUB16mr : I<0x29, MRMDestMem, (ops i16mem:$dst, R16:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1745 | "sub{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1746 | [(store (sub (load addr:$dst), R16:$src2), addr:$dst)]>, |
| 1747 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1748 | def SUB32mr : I<0x29, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1749 | "sub{l} {$src2, $dst|$dst, $src2}", |
| 1750 | [(store (sub (load addr:$dst), R32:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1751 | def SUB8mi : Ii8<0x80, MRM5m, (ops i8mem :$dst, i8imm:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1752 | "sub{b} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1753 | [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1754 | def SUB16mi : Ii16<0x81, MRM5m, (ops i16mem:$dst, i16imm:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1755 | "sub{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1756 | [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1757 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1758 | def SUB32mi : Ii32<0x81, MRM5m, (ops i32mem:$dst, i32imm:$src2), |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1759 | "sub{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | c937ffa | 2005-12-13 02:40:18 +0000 | [diff] [blame] | 1760 | [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1761 | def SUB16mi8 : Ii8<0x83, MRM5m, (ops i16mem:$dst, i16i8imm :$src2), |
| 1762 | "sub{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1763 | [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
| 1764 | OpSize; |
Evan Cheng | d160d48 | 2005-12-12 21:54:05 +0000 | [diff] [blame] | 1765 | def SUB32mi8 : Ii8<0x83, MRM5m, (ops i32mem:$dst, i32i8imm :$src2), |
| 1766 | "sub{l} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1767 | [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1768 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1769 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1770 | def SBB32rr : I<0x19, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1771 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1772 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1773 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1774 | def SBB32mr : I<0x19, MRMDestMem, (ops i32mem:$dst, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1775 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1776 | def SBB8mi : Ii32<0x80, MRM3m, (ops i8mem:$dst, i8imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1777 | "sbb{b} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1778 | def SBB16mi : Ii32<0x81, MRM3m, (ops i16mem:$dst, i16imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1779 | "sbb{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1780 | def SBB32mi : Ii32<0x81, MRM3m, (ops i32mem:$dst, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1781 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1782 | def SBB16mi8 : Ii8<0x83, MRM3m, (ops i16mem:$dst, i8imm :$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1783 | "sbb{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1784 | def SBB32mi8 : Ii8<0x83, MRM3m, (ops i32mem:$dst, i8imm :$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1785 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1786 | } |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1787 | def SBB8ri : Ii8<0x80, MRM3r, (ops R8:$dst, R8:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1788 | "sbb{b} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1789 | def SBB16ri : Ii16<0x81, MRM3r, (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1790 | "sbb{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1791 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1792 | def SBB32rm : I<0x1B, MRMSrcMem, (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1793 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1794 | def SBB32ri : Ii32<0x81, MRM3r, (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1795 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 1796 | |
Chris Lattner | 09c750f | 2004-10-06 14:31:50 +0000 | [diff] [blame] | 1797 | def SBB16ri8 : Ii8<0x83, MRM3r, (ops R16:$dst, R16:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1798 | "sbb{w} {$src2, $dst|$dst, $src2}", []>, OpSize; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1799 | def SBB32ri8 : Ii8<0x83, MRM3r, (ops R32:$dst, R32:$src1, i8imm:$src2), |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1800 | "sbb{l} {$src2, $dst|$dst, $src2}", []>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1801 | |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 1802 | let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1803 | def IMUL16rr : I<0xAF, MRMSrcReg, (ops R16:$dst, R16:$src1, R16:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1804 | "imul{w} {$src2, $dst|$dst, $src2}", |
| 1805 | [(set R16:$dst, (mul R16:$src1, R16:$src2))]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1806 | def IMUL32rr : I<0xAF, MRMSrcReg, (ops R32:$dst, R32:$src1, R32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1807 | "imul{l} {$src2, $dst|$dst, $src2}", |
| 1808 | [(set R32:$dst, (mul R32:$src1, R32:$src2))]>, TB; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 1809 | } |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1810 | def IMUL16rm : I<0xAF, MRMSrcMem, (ops R16:$dst, R16:$src1, i16mem:$src2), |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1811 | "imul{w} {$src2, $dst|$dst, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1812 | [(set R16:$dst, (mul R16:$src1, (load addr:$src2)))]>, |
| 1813 | TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1814 | def IMUL32rm : I<0xAF, MRMSrcMem, (ops R32:$dst, R32:$src1, i32mem:$src2), |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1815 | "imul{l} {$src2, $dst|$dst, $src2}", |
| 1816 | [(set R32:$dst, (mul R32:$src1, (load addr:$src2)))]>, TB; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1817 | |
| 1818 | } // end Two Address instructions |
| 1819 | |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 1820 | // Suprisingly enough, these are not two address instructions! |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1821 | def IMUL16rri : Ii16<0x69, MRMSrcReg, // R16 = R16*I16 |
| 1822 | (ops R16:$dst, R16:$src1, i16imm:$src2), |
Chris Lattner | 78432fe | 2005-11-17 02:01:55 +0000 | [diff] [blame] | 1823 | "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}", |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1824 | [(set R16:$dst, (mul R16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1825 | def IMUL32rri : Ii32<0x69, MRMSrcReg, // R32 = R32*I32 |
| 1826 | (ops R32:$dst, R32:$src1, i32imm:$src2), |
Chris Lattner | 7a12537 | 2005-11-16 22:59:19 +0000 | [diff] [blame] | 1827 | "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}", |
| 1828 | [(set R32:$dst, (mul R32:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1829 | def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // R16 = R16*I8 |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1830 | (ops R16:$dst, R16:$src1, i16i8imm:$src2), |
| 1831 | "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1832 | [(set R16:$dst, (mul R16:$src1, i16immSExt8:$src2))]>, |
| 1833 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1834 | def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // R32 = R32*I8 |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 1835 | (ops R32:$dst, R32:$src1, i32i8imm:$src2), |
| 1836 | "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1837 | [(set R32:$dst, (mul R32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 1838 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1839 | def IMUL16rmi : Ii16<0x69, MRMSrcMem, // R16 = [mem16]*I16 |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1840 | (ops R16:$dst, i16mem:$src1, i16imm:$src2), |
| 1841 | "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}", |
| 1842 | [(set R16:$dst, (mul (load addr:$src1), imm:$src2))]>, |
| 1843 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1844 | def IMUL32rmi : Ii32<0x69, MRMSrcMem, // R32 = [mem32]*I32 |
| 1845 | (ops R32:$dst, i32mem:$src1, i32imm:$src2), |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1846 | "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}", |
| 1847 | [(set R32:$dst, (mul (load addr:$src1), imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1848 | def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // R16 = [mem16]*I8 |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1849 | (ops R16:$dst, i16mem:$src1, i16i8imm :$src2), |
| 1850 | "imul{w} {$src2, $src1, $dst|$dst, $src1, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1851 | [(set R16:$dst, (mul (load addr:$src1), i16immSExt8:$src2))]>, |
| 1852 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1853 | def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // R32 = [mem32]*I8 |
Evan Cheng | f281e02 | 2005-12-12 23:47:46 +0000 | [diff] [blame] | 1854 | (ops R32:$dst, i32mem:$src1, i32i8imm: $src2), |
| 1855 | "imul{l} {$src2, $src1, $dst|$dst, $src1, $src2}", |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1856 | [(set R32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1857 | |
| 1858 | //===----------------------------------------------------------------------===// |
| 1859 | // Test instructions are just like AND, except they don't generate a result. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1860 | // |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1861 | let isCommutable = 1 in { // TEST X, Y --> TEST Y, X |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1862 | def TEST8rr : I<0x84, MRMDestReg, (ops R8:$src1, R8:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1863 | "test{b} {$src2, $src1|$src1, $src2}", |
| 1864 | [(set STATUS, (X86test R8:$src1, R8:$src2))]>, |
| 1865 | Imp<[],[STATUS]>; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1866 | def TEST16rr : I<0x85, MRMDestReg, (ops R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1867 | "test{w} {$src2, $src1|$src1, $src2}", |
| 1868 | [(set STATUS, (X86test R16:$src1, R16:$src2))]>, |
| 1869 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 36b6890 | 2004-08-10 21:21:30 +0000 | [diff] [blame] | 1870 | def TEST32rr : I<0x85, MRMDestReg, (ops R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1871 | "test{l} {$src2, $src1|$src1, $src2}", |
| 1872 | [(set STATUS, (X86test R32:$src1, R32:$src2))]>, |
| 1873 | Imp<[],[STATUS]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1874 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1875 | def TEST8mr : I<0x84, MRMDestMem, (ops i8mem :$src1, R8 :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1876 | "test{b} {$src2, $src1|$src1, $src2}", |
| 1877 | [(set STATUS, (X86test (loadi8 addr:$src1), R8:$src2))]>, |
| 1878 | Imp<[],[STATUS]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1879 | def TEST16mr : I<0x85, MRMDestMem, (ops i16mem:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1880 | "test{w} {$src2, $src1|$src1, $src2}", |
| 1881 | [(set STATUS, (X86test (loadi16 addr:$src1), R16:$src2))]>, |
| 1882 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1883 | def TEST32mr : I<0x85, MRMDestMem, (ops i32mem:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1884 | "test{l} {$src2, $src1|$src1, $src2}", |
| 1885 | [(set STATUS, (X86test (loadi32 addr:$src1), R32:$src2))]>, |
| 1886 | Imp<[],[STATUS]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1887 | def TEST8rm : I<0x84, MRMSrcMem, (ops R8 :$src1, i8mem :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1888 | "test{b} {$src2, $src1|$src1, $src2}", |
| 1889 | [(set STATUS, (X86test R8:$src1, (loadi8 addr:$src2)))]>, |
| 1890 | Imp<[],[STATUS]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1891 | def TEST16rm : I<0x85, MRMSrcMem, (ops R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1892 | "test{w} {$src2, $src1|$src1, $src2}", |
| 1893 | [(set STATUS, (X86test R16:$src1, (loadi16 addr:$src2)))]>, |
| 1894 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1895 | def TEST32rm : I<0x85, MRMSrcMem, (ops R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1896 | "test{l} {$src2, $src1|$src1, $src2}", |
| 1897 | [(set STATUS, (X86test R32:$src1, (loadi32 addr:$src2)))]>, |
| 1898 | Imp<[],[STATUS]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1899 | |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1900 | def TEST8ri : Ii8 <0xF6, MRM0r, // flags = R8 & imm8 |
| 1901 | (ops R8:$src1, i8imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1902 | "test{b} {$src2, $src1|$src1, $src2}", |
| 1903 | [(set STATUS, (X86test R8:$src1, imm:$src2))]>, |
| 1904 | Imp<[],[STATUS]>; |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1905 | def TEST16ri : Ii16<0xF7, MRM0r, // flags = R16 & imm16 |
| 1906 | (ops R16:$src1, i16imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1907 | "test{w} {$src2, $src1|$src1, $src2}", |
| 1908 | [(set STATUS, (X86test R16:$src1, imm:$src2))]>, |
| 1909 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1910 | def TEST32ri : Ii32<0xF7, MRM0r, // flags = R32 & imm32 |
| 1911 | (ops R32:$src1, i32imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1912 | "test{l} {$src2, $src1|$src1, $src2}", |
| 1913 | [(set STATUS, (X86test R32:$src1, imm:$src2))]>, |
| 1914 | Imp<[],[STATUS]>; |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1915 | def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8 |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1916 | (ops i8mem:$src1, i8imm:$src2), |
| 1917 | "test{b} {$src2, $src1|$src1, $src2}", |
| 1918 | [(set STATUS, (X86test (loadi8 addr:$src1), imm:$src2))]>, |
| 1919 | Imp<[],[STATUS]>; |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1920 | def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16 |
| 1921 | (ops i16mem:$src1, i16imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1922 | "test{w} {$src2, $src1|$src1, $src2}", |
| 1923 | [(set STATUS, (X86test (loadi16 addr:$src1), imm:$src2))]>, |
| 1924 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 707c6fe | 2004-10-04 01:38:10 +0000 | [diff] [blame] | 1925 | def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32 |
| 1926 | (ops i32mem:$src1, i32imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 1927 | "test{l} {$src2, $src1|$src1, $src2}", |
| 1928 | [(set STATUS, (X86test (loadi32 addr:$src1), imm:$src2))]>, |
| 1929 | Imp<[],[STATUS]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1930 | |
| 1931 | |
| 1932 | // Condition code ops, incl. set if equal/not equal/... |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 1933 | def SAHF : I<0x9E, RawFrm, (ops), "sahf", []>, Imp<[AH],[]>; // flags = AH |
| 1934 | def LAHF : I<0x9F, RawFrm, (ops), "lahf", []>, Imp<[],[AH]>; // AH = flags |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1935 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1936 | def SETEr : I<0x94, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 1937 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1938 | "sete $dst", |
| 1939 | [(set R8:$dst, (X86setcc X86_COND_E, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1940 | TB; // R8 = == |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1941 | def SETEm : I<0x94, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 1942 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1943 | "sete $dst", |
| 1944 | [(store (X86setcc X86_COND_E, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1945 | TB; // [mem8] = == |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1946 | def SETNEr : I<0x95, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 1947 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1948 | "setne $dst", |
| 1949 | [(set R8:$dst, (X86setcc X86_COND_NE, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1950 | TB; // R8 = != |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1951 | def SETNEm : I<0x95, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 1952 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1953 | "setne $dst", |
| 1954 | [(store (X86setcc X86_COND_NE, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1955 | TB; // [mem8] = != |
| 1956 | def SETLr : I<0x9C, MRM0r, |
| 1957 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1958 | "setl $dst", |
| 1959 | [(set R8:$dst, (X86setcc X86_COND_L, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1960 | TB; // R8 = < signed |
| 1961 | def SETLm : I<0x9C, MRM0m, |
| 1962 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1963 | "setl $dst", |
| 1964 | [(store (X86setcc X86_COND_L, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1965 | TB; // [mem8] = < signed |
| 1966 | def SETGEr : I<0x9D, MRM0r, |
| 1967 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1968 | "setge $dst", |
| 1969 | [(set R8:$dst, (X86setcc X86_COND_GE, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1970 | TB; // R8 = >= signed |
| 1971 | def SETGEm : I<0x9D, MRM0m, |
| 1972 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1973 | "setge $dst", |
| 1974 | [(store (X86setcc X86_COND_GE, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1975 | TB; // [mem8] = >= signed |
| 1976 | def SETLEr : I<0x9E, MRM0r, |
| 1977 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1978 | "setle $dst", |
| 1979 | [(set R8:$dst, (X86setcc X86_COND_LE, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1980 | TB; // R8 = <= signed |
| 1981 | def SETLEm : I<0x9E, MRM0m, |
| 1982 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1983 | "setle $dst", |
| 1984 | [(store (X86setcc X86_COND_LE, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1985 | TB; // [mem8] = <= signed |
| 1986 | def SETGr : I<0x9F, MRM0r, |
| 1987 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1988 | "setg $dst", |
| 1989 | [(set R8:$dst, (X86setcc X86_COND_G, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1990 | TB; // R8 = > signed |
| 1991 | def SETGm : I<0x9F, MRM0m, |
| 1992 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1993 | "setg $dst", |
| 1994 | [(store (X86setcc X86_COND_G, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 1995 | TB; // [mem8] = > signed |
| 1996 | |
| 1997 | def SETBr : I<0x92, MRM0r, |
| 1998 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 1999 | "setb $dst", |
| 2000 | [(set R8:$dst, (X86setcc X86_COND_B, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2001 | TB; // R8 = < unsign |
| 2002 | def SETBm : I<0x92, MRM0m, |
| 2003 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2004 | "setb $dst", |
| 2005 | [(store (X86setcc X86_COND_B, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2006 | TB; // [mem8] = < unsign |
| 2007 | def SETAEr : I<0x93, MRM0r, |
| 2008 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2009 | "setae $dst", |
| 2010 | [(set R8:$dst, (X86setcc X86_COND_AE, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2011 | TB; // R8 = >= unsign |
| 2012 | def SETAEm : I<0x93, MRM0m, |
| 2013 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2014 | "setae $dst", |
| 2015 | [(store (X86setcc X86_COND_AE, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2016 | TB; // [mem8] = >= unsign |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2017 | def SETBEr : I<0x96, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2018 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2019 | "setbe $dst", |
| 2020 | [(set R8:$dst, (X86setcc X86_COND_BE, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2021 | TB; // R8 = <= unsign |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2022 | def SETBEm : I<0x96, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2023 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2024 | "setbe $dst", |
| 2025 | [(store (X86setcc X86_COND_BE, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2026 | TB; // [mem8] = <= unsign |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2027 | def SETAr : I<0x97, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2028 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2029 | "seta $dst", |
| 2030 | [(set R8:$dst, (X86setcc X86_COND_A, STATUS))]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2031 | TB; // R8 = > signed |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2032 | def SETAm : I<0x97, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2033 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2034 | "seta $dst", |
| 2035 | [(store (X86setcc X86_COND_A, STATUS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 2036 | TB; // [mem8] = > signed |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2037 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2038 | def SETSr : I<0x98, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2039 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2040 | "sets $dst", |
| 2041 | [(set R8:$dst, (X86setcc X86_COND_S, STATUS))]>, |
| 2042 | TB; // R8 = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2043 | def SETSm : I<0x98, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2044 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2045 | "sets $dst", |
| 2046 | [(store (X86setcc X86_COND_S, STATUS), addr:$dst)]>, |
| 2047 | TB; // [mem8] = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2048 | def SETNSr : I<0x99, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2049 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2050 | "setns $dst", |
| 2051 | [(set R8:$dst, (X86setcc X86_COND_NS, STATUS))]>, |
| 2052 | TB; // R8 = !<sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2053 | def SETNSm : I<0x99, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2054 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2055 | "setns $dst", |
| 2056 | [(store (X86setcc X86_COND_NS, STATUS), addr:$dst)]>, |
| 2057 | TB; // [mem8] = !<sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2058 | def SETPr : I<0x9A, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2059 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2060 | "setp $dst", |
| 2061 | [(set R8:$dst, (X86setcc X86_COND_P, STATUS))]>, |
| 2062 | TB; // R8 = parity |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2063 | def SETPm : I<0x9A, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2064 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2065 | "setp $dst", |
| 2066 | [(store (X86setcc X86_COND_P, STATUS), addr:$dst)]>, |
| 2067 | TB; // [mem8] = parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2068 | def SETNPr : I<0x9B, MRM0r, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2069 | (ops R8 :$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2070 | "setnp $dst", |
| 2071 | [(set R8:$dst, (X86setcc X86_COND_NP, STATUS))]>, |
| 2072 | TB; // R8 = not parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2073 | def SETNPm : I<0x9B, MRM0m, |
Chris Lattner | 9fb2422 | 2005-12-21 05:34:58 +0000 | [diff] [blame] | 2074 | (ops i8mem:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2075 | "setnp $dst", |
| 2076 | [(store (X86setcc X86_COND_NP, STATUS), addr:$dst)]>, |
| 2077 | TB; // [mem8] = not parity |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2078 | |
| 2079 | // Integer comparisons |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2080 | def CMP8rr : I<0x38, MRMDestReg, |
| 2081 | (ops R8 :$src1, R8 :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2082 | "cmp{b} {$src2, $src1|$src1, $src2}", |
| 2083 | [(set STATUS, (X86cmp R8:$src1, R8:$src2))]>, |
| 2084 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2085 | def CMP16rr : I<0x39, MRMDestReg, |
| 2086 | (ops R16:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2087 | "cmp{w} {$src2, $src1|$src1, $src2}", |
| 2088 | [(set STATUS, (X86cmp R16:$src1, R16:$src2))]>, |
| 2089 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2090 | def CMP32rr : I<0x39, MRMDestReg, |
| 2091 | (ops R32:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2092 | "cmp{l} {$src2, $src1|$src1, $src2}", |
| 2093 | [(set STATUS, (X86cmp R32:$src1, R32:$src2))]>, |
| 2094 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2095 | def CMP8mr : I<0x38, MRMDestMem, |
| 2096 | (ops i8mem :$src1, R8 :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2097 | "cmp{b} {$src2, $src1|$src1, $src2}", |
| 2098 | [(set STATUS, (X86cmp (loadi8 addr:$src1), R8:$src2))]>, |
| 2099 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2100 | def CMP16mr : I<0x39, MRMDestMem, |
| 2101 | (ops i16mem:$src1, R16:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2102 | "cmp{w} {$src2, $src1|$src1, $src2}", |
| 2103 | [(set STATUS, (X86cmp (loadi16 addr:$src1), R16:$src2))]>, |
| 2104 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2105 | def CMP32mr : I<0x39, MRMDestMem, |
| 2106 | (ops i32mem:$src1, R32:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2107 | "cmp{l} {$src2, $src1|$src1, $src2}", |
| 2108 | [(set STATUS, (X86cmp (loadi32 addr:$src1), R32:$src2))]>, |
| 2109 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2110 | def CMP8rm : I<0x3A, MRMSrcMem, |
| 2111 | (ops R8 :$src1, i8mem :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2112 | "cmp{b} {$src2, $src1|$src1, $src2}", |
| 2113 | [(set STATUS, (X86cmp R8:$src1, (loadi8 addr:$src2)))]>, |
| 2114 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2115 | def CMP16rm : I<0x3B, MRMSrcMem, |
| 2116 | (ops R16:$src1, i16mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2117 | "cmp{w} {$src2, $src1|$src1, $src2}", |
| 2118 | [(set STATUS, (X86cmp R16:$src1, (loadi16 addr:$src2)))]>, |
| 2119 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2120 | def CMP32rm : I<0x3B, MRMSrcMem, |
| 2121 | (ops R32:$src1, i32mem:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2122 | "cmp{l} {$src2, $src1|$src1, $src2}", |
| 2123 | [(set STATUS, (X86cmp R32:$src1, (loadi32 addr:$src2)))]>, |
| 2124 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2125 | def CMP8ri : Ii8<0x80, MRM7r, |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2126 | (ops R8:$src1, i8imm:$src2), |
| 2127 | "cmp{b} {$src2, $src1|$src1, $src2}", |
| 2128 | [(set STATUS, (X86cmp R8:$src1, imm:$src2))]>, |
| 2129 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2130 | def CMP16ri : Ii16<0x81, MRM7r, |
| 2131 | (ops R16:$src1, i16imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2132 | "cmp{w} {$src2, $src1|$src1, $src2}", |
| 2133 | [(set STATUS, (X86cmp R16:$src1, imm:$src2))]>, |
| 2134 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2135 | def CMP32ri : Ii32<0x81, MRM7r, |
| 2136 | (ops R32:$src1, i32imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2137 | "cmp{l} {$src2, $src1|$src1, $src2}", |
| 2138 | [(set STATUS, (X86cmp R32:$src1, imm:$src2))]>, |
| 2139 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2140 | def CMP8mi : Ii8 <0x80, MRM7m, |
| 2141 | (ops i8mem :$src1, i8imm :$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2142 | "cmp{b} {$src2, $src1|$src1, $src2}", |
| 2143 | [(set STATUS, (X86cmp (loadi8 addr:$src1), imm:$src2))]>, |
| 2144 | Imp<[],[STATUS]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2145 | def CMP16mi : Ii16<0x81, MRM7m, |
| 2146 | (ops i16mem:$src1, i16imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2147 | "cmp{w} {$src2, $src1|$src1, $src2}", |
| 2148 | [(set STATUS, (X86cmp (loadi16 addr:$src1), imm:$src2))]>, |
| 2149 | Imp<[],[STATUS]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2150 | def CMP32mi : Ii32<0x81, MRM7m, |
| 2151 | (ops i32mem:$src1, i32imm:$src2), |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 2152 | "cmp{l} {$src2, $src1|$src1, $src2}", |
| 2153 | [(set STATUS, (X86cmp (loadi32 addr:$src1), imm:$src2))]>, |
| 2154 | Imp<[],[STATUS]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2155 | |
| 2156 | // Sign/Zero extenders |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2157 | def MOVSX16rr8 : I<0xBE, MRMSrcReg, (ops R16:$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2158 | "movs{bw|x} {$src, $dst|$dst, $src}", |
| 2159 | [(set R16:$dst, (sext R8:$src))]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2160 | def MOVSX16rm8 : I<0xBE, MRMSrcMem, (ops R16:$dst, i8mem :$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2161 | "movs{bw|x} {$src, $dst|$dst, $src}", |
| 2162 | [(set R16:$dst, (sextloadi16i8 addr:$src))]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2163 | def MOVSX32rr8 : I<0xBE, MRMSrcReg, (ops R32:$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2164 | "movs{bl|x} {$src, $dst|$dst, $src}", |
| 2165 | [(set R32:$dst, (sext R8:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2166 | def MOVSX32rm8 : I<0xBE, MRMSrcMem, (ops R32:$dst, i8mem :$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2167 | "movs{bl|x} {$src, $dst|$dst, $src}", |
| 2168 | [(set R32:$dst, (sextloadi32i8 addr:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2169 | def MOVSX32rr16: I<0xBF, MRMSrcReg, (ops R32:$dst, R16:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2170 | "movs{wl|x} {$src, $dst|$dst, $src}", |
| 2171 | [(set R32:$dst, (sext R16:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2172 | def MOVSX32rm16: I<0xBF, MRMSrcMem, (ops R32:$dst, i16mem:$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2173 | "movs{wl|x} {$src, $dst|$dst, $src}", |
| 2174 | [(set R32:$dst, (sextloadi32i16 addr:$src))]>, TB; |
Alkis Evlogimenos | a7be982 | 2004-02-17 09:14:23 +0000 | [diff] [blame] | 2175 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2176 | def MOVZX16rr8 : I<0xB6, MRMSrcReg, (ops R16:$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2177 | "movz{bw|x} {$src, $dst|$dst, $src}", |
| 2178 | [(set R16:$dst, (zext R8:$src))]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2179 | def MOVZX16rm8 : I<0xB6, MRMSrcMem, (ops R16:$dst, i8mem :$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2180 | "movz{bw|x} {$src, $dst|$dst, $src}", |
| 2181 | [(set R16:$dst, (zextloadi16i8 addr:$src))]>, TB, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2182 | def MOVZX32rr8 : I<0xB6, MRMSrcReg, (ops R32:$dst, R8 :$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2183 | "movz{bl|x} {$src, $dst|$dst, $src}", |
| 2184 | [(set R32:$dst, (zext R8:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2185 | def MOVZX32rm8 : I<0xB6, MRMSrcMem, (ops R32:$dst, i8mem :$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2186 | "movz{bl|x} {$src, $dst|$dst, $src}", |
| 2187 | [(set R32:$dst, (zextloadi32i8 addr:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2188 | def MOVZX32rr16: I<0xB7, MRMSrcReg, (ops R32:$dst, R16:$src), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2189 | "movz{wl|x} {$src, $dst|$dst, $src}", |
| 2190 | [(set R32:$dst, (zext R16:$src))]>, TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2191 | def MOVZX32rm16: I<0xB7, MRMSrcMem, (ops R32:$dst, i16mem:$src), |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 2192 | "movz{wl|x} {$src, $dst|$dst, $src}", |
| 2193 | [(set R32:$dst, (zextloadi32i16 addr:$src))]>, TB; |
| 2194 | |
| 2195 | // Handling 1 bit zextload and sextload |
| 2196 | def : Pat<(sextloadi16i1 addr:$src), (MOVSX16rm8 addr:$src)>; |
| 2197 | def : Pat<(sextloadi32i1 addr:$src), (MOVSX32rm8 addr:$src)>; |
| 2198 | def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; |
| 2199 | def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2200 | |
Evan Cheng | cb17bac | 2005-12-15 19:49:23 +0000 | [diff] [blame] | 2201 | // Handling 1 bit extload |
| 2202 | def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>; |
| 2203 | |
Evan Cheng | 1aabc4e | 2005-12-17 01:47:57 +0000 | [diff] [blame] | 2204 | // Modeling anyext as zext |
| 2205 | def : Pat<(i16 (anyext R8 :$src)), (MOVZX16rr8 R8 :$src)>; |
| 2206 | def : Pat<(i32 (anyext R8 :$src)), (MOVZX32rr8 R8 :$src)>; |
| 2207 | def : Pat<(i32 (anyext R16:$src)), (MOVZX32rr16 R16:$src)>; |
| 2208 | |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2209 | //===----------------------------------------------------------------------===// |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2210 | // XMM Floating point support (requires SSE / SSE2) |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2211 | //===----------------------------------------------------------------------===// |
| 2212 | |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2213 | def MOVSSrr : I<0x10, MRMSrcReg, (ops FR32:$dst, FR32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2214 | "movss {$src, $dst|$dst, $src}", []>, |
| 2215 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2216 | def MOVSDrr : I<0x10, MRMSrcReg, (ops FR64:$dst, FR64:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2217 | "movsd {$src, $dst|$dst, $src}", []>, |
| 2218 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2219 | |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2220 | def MOVSSrm : I<0x10, MRMSrcMem, (ops FR32:$dst, f32mem:$src), |
| 2221 | "movss {$src, $dst|$dst, $src}", |
| 2222 | [(set FR32:$dst, (loadf32 addr:$src))]>, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2223 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2224 | def MOVSSmr : I<0x11, MRMDestMem, (ops f32mem:$dst, FR32:$src), |
| 2225 | "movss {$src, $dst|$dst, $src}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2226 | [(store FR32:$src, addr:$dst)]>, |
| 2227 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2228 | def MOVSDrm : I<0x10, MRMSrcMem, (ops FR64:$dst, f64mem:$src), |
| 2229 | "movsd {$src, $dst|$dst, $src}", |
| 2230 | [(set FR64:$dst, (loadf64 addr:$src))]>, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2231 | Requires<[HasSSE2]>, XD; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2232 | def MOVSDmr : I<0x11, MRMDestMem, (ops f64mem:$dst, FR64:$src), |
| 2233 | "movsd {$src, $dst|$dst, $src}", |
| 2234 | [(store FR64:$src, addr:$dst)]>, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2235 | Requires<[HasSSE2]>, XD; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2236 | |
| 2237 | def CVTTSD2SIrr: I<0x2C, MRMSrcReg, (ops R32:$dst, FR64:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2238 | "cvttsd2si {$src, $dst|$dst, $src}", |
| 2239 | [(set R32:$dst, (fp_to_sint FR64:$src))]>, |
| 2240 | Requires<[HasSSE2]>, XD; |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 2241 | def CVTTSD2SIrm: I<0x2C, MRMSrcMem, (ops R32:$dst, f64mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2242 | "cvttsd2si {$src, $dst|$dst, $src}", |
| 2243 | [(set R32:$dst, (fp_to_sint (loadf64 addr:$src)))]>, |
| 2244 | Requires<[HasSSE2]>, XD; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2245 | def CVTTSS2SIrr: I<0x2C, MRMSrcReg, (ops R32:$dst, FR32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2246 | "cvttss2si {$src, $dst|$dst, $src}", |
| 2247 | [(set R32:$dst, (fp_to_sint FR32:$src))]>, |
| 2248 | Requires<[HasSSE1]>, XS; |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 2249 | def CVTTSS2SIrm: I<0x2C, MRMSrcMem, (ops R32:$dst, f32mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2250 | "cvttss2si {$src, $dst|$dst, $src}", |
| 2251 | [(set R32:$dst, (fp_to_sint (loadf32 addr:$src)))]>, |
| 2252 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2253 | def CVTSD2SSrr: I<0x5A, MRMSrcReg, (ops FR32:$dst, FR64:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2254 | "cvtsd2ss {$src, $dst|$dst, $src}", |
| 2255 | [(set FR32:$dst, (fround FR64:$src))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2256 | Requires<[HasSSE2]>, XS; |
| 2257 | def CVTSD2SSrm: I<0x5A, MRMSrcMem, (ops FR32:$dst, f64mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2258 | "cvtsd2ss {$src, $dst|$dst, $src}", |
| 2259 | [(set FR32:$dst, (fround (loadf64 addr:$src)))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2260 | Requires<[HasSSE2]>, XS; |
| 2261 | def CVTSS2SDrr: I<0x5A, MRMSrcReg, (ops FR64:$dst, FR32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2262 | "cvtss2sd {$src, $dst|$dst, $src}", |
| 2263 | [(set FR64:$dst, (fextend FR32:$src))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2264 | Requires<[HasSSE2]>, XD; |
| 2265 | def CVTSS2SDrm: I<0x5A, MRMSrcMem, (ops FR64:$dst, f32mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2266 | "cvtss2sd {$src, $dst|$dst, $src}", |
| 2267 | [(set FR64:$dst, (fextend (loadf32 addr:$src)))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2268 | Requires<[HasSSE2]>, XD; |
| 2269 | def CVTSI2SSrr: I<0x2A, MRMSrcReg, (ops FR32:$dst, R32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2270 | "cvtsi2ss {$src, $dst|$dst, $src}", |
| 2271 | [(set FR32:$dst, (sint_to_fp R32:$src))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2272 | Requires<[HasSSE2]>, XS; |
| 2273 | def CVTSI2SSrm: I<0x2A, MRMSrcMem, (ops FR32:$dst, i32mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2274 | "cvtsi2ss {$src, $dst|$dst, $src}", |
| 2275 | [(set FR32:$dst, (sint_to_fp (loadi32 addr:$src)))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2276 | Requires<[HasSSE2]>, XS; |
| 2277 | def CVTSI2SDrr: I<0x2A, MRMSrcReg, (ops FR64:$dst, R32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2278 | "cvtsi2sd {$src, $dst|$dst, $src}", |
| 2279 | [(set FR64:$dst, (sint_to_fp R32:$src))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2280 | Requires<[HasSSE2]>, XD; |
| 2281 | def CVTSI2SDrm: I<0x2A, MRMSrcMem, (ops FR64:$dst, i32mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2282 | "cvtsi2sd {$src, $dst|$dst, $src}", |
| 2283 | [(set FR64:$dst, (sint_to_fp (loadi32 addr:$src)))]>, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2284 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f63be7d | 2005-07-06 18:59:04 +0000 | [diff] [blame] | 2285 | |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2286 | def SQRTSSrm : I<0x51, MRMSrcMem, (ops FR32:$dst, f32mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2287 | "sqrtss {$src, $dst|$dst, $src}", |
| 2288 | [(set FR32:$dst, (fsqrt (loadf32 addr:$src)))]>, |
| 2289 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2290 | def SQRTSSrr : I<0x51, MRMSrcReg, (ops FR32:$dst, FR32:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2291 | "sqrtss {$src, $dst|$dst, $src}", |
| 2292 | [(set FR32:$dst, (fsqrt FR32:$src))]>, |
| 2293 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2294 | def SQRTSDrm : I<0x51, MRMSrcMem, (ops FR64:$dst, f64mem:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2295 | "sqrtsd {$src, $dst|$dst, $src}", |
| 2296 | [(set FR64:$dst, (fsqrt (loadf64 addr:$src)))]>, |
| 2297 | Requires<[HasSSE2]>, XD; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2298 | def SQRTSDrr : I<0x51, MRMSrcReg, (ops FR64:$dst, FR64:$src), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2299 | "sqrtsd {$src, $dst|$dst, $src}", |
| 2300 | [(set FR64:$dst, (fsqrt FR64:$src))]>, |
| 2301 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2302 | |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2303 | def UCOMISDrr: I<0x2E, MRMSrcReg, (ops FR64:$src1, FR64:$src2), |
| 2304 | "ucomisd {$src2, $src1|$src1, $src2}", |
| 2305 | [(set STATUS, (X86cmp FR64:$src1, FR64:$src2))]>, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2306 | Requires<[HasSSE2]>, TB, OpSize; |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2307 | def UCOMISDrm: I<0x2E, MRMSrcMem, (ops FR64:$src1, f64mem:$src2), |
| 2308 | "ucomisd {$src2, $src1|$src1, $src2}", |
| 2309 | [(set STATUS, (X86cmp FR64:$src1, (loadf64 addr:$src2)))]>, |
| 2310 | Imp<[],[STATUS]>, Requires<[HasSSE2]>, TB, OpSize; |
| 2311 | def UCOMISSrr: I<0x2E, MRMSrcReg, (ops FR32:$src1, FR32:$src2), |
| 2312 | "ucomiss {$src2, $src1|$src1, $src2}", |
| 2313 | [(set STATUS, (X86cmp FR32:$src1, FR32:$src2))]>, |
| 2314 | Imp<[],[STATUS]>, Requires<[HasSSE1]>, TB; |
| 2315 | def UCOMISSrm: I<0x2E, MRMSrcMem, (ops FR32:$src1, f32mem:$src2), |
| 2316 | "ucomiss {$src2, $src1|$src1, $src2}", |
| 2317 | [(set STATUS, (X86cmp FR32:$src1, (loadf32 addr:$src2)))]>, |
| 2318 | Imp<[],[STATUS]>, Requires<[HasSSE1]>, TB; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2319 | |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2320 | // Pseudo-instructions that map fld0 to xorps/xorpd for sse. |
Nate Begeman | 1c73c7b | 2005-08-03 23:26:28 +0000 | [diff] [blame] | 2321 | // FIXME: remove when we can teach regalloc that xor reg, reg is ok. |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2322 | def FLD0SS : I<0x57, MRMSrcReg, (ops FR32:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2323 | "xorps $dst, $dst", [(set FR32:$dst, fp32imm0)]>, |
Evan Cheng | 650d688 | 2006-01-05 02:08:37 +0000 | [diff] [blame] | 2324 | Requires<[HasSSE1]>, TB; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2325 | def FLD0SD : I<0x57, MRMSrcReg, (ops FR64:$dst), |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2326 | "xorpd $dst, $dst", [(set FR64:$dst, fp64imm0)]>, |
Evan Cheng | 650d688 | 2006-01-05 02:08:37 +0000 | [diff] [blame] | 2327 | Requires<[HasSSE2]>, TB, OpSize; |
Nate Begeman | 1c73c7b | 2005-08-03 23:26:28 +0000 | [diff] [blame] | 2328 | |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2329 | let isTwoAddress = 1 in { |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2330 | // SSE Scalar Arithmetic |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2331 | let isCommutable = 1 in { |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2332 | def ADDSSrr : I<0x58, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2333 | "addss {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2334 | [(set FR32:$dst, (fadd FR32:$src1, FR32:$src2))]>, |
| 2335 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2336 | def ADDSDrr : I<0x58, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2337 | "addsd {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2338 | [(set FR64:$dst, (fadd FR64:$src1, FR64:$src2))]>, |
| 2339 | Requires<[HasSSE2]>, XD; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2340 | def MULSSrr : I<0x59, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2341 | "mulss {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2342 | [(set FR32:$dst, (fmul FR32:$src1, FR32:$src2))]>, |
| 2343 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2344 | def MULSDrr : I<0x59, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2345 | "mulsd {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2346 | [(set FR64:$dst, (fmul FR64:$src1, FR64:$src2))]>, |
| 2347 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2348 | } |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2349 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2350 | def ADDSSrm : I<0x58, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2), |
| 2351 | "addss {$src2, $dst|$dst, $src2}", |
| 2352 | [(set FR32:$dst, (fadd FR32:$src1, (loadf32 addr:$src2)))]>, |
| 2353 | Requires<[HasSSE1]>, XS; |
| 2354 | def ADDSDrm : I<0x58, MRMSrcMem, (ops FR64:$dst, FR64:$src1, f64mem:$src2), |
| 2355 | "addsd {$src2, $dst|$dst, $src2}", |
| 2356 | [(set FR64:$dst, (fadd FR64:$src1, (loadf64 addr:$src2)))]>, |
| 2357 | Requires<[HasSSE2]>, XD; |
| 2358 | def MULSSrm : I<0x59, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2), |
| 2359 | "mulss {$src2, $dst|$dst, $src2}", |
| 2360 | [(set FR32:$dst, (fmul FR32:$src1, (loadf32 addr:$src2)))]>, |
| 2361 | Requires<[HasSSE1]>, XS; |
| 2362 | def MULSDrm : I<0x59, MRMSrcMem, (ops FR64:$dst, FR64:$src1, f64mem:$src2), |
| 2363 | "mulsd {$src2, $dst|$dst, $src2}", |
| 2364 | [(set FR64:$dst, (fmul FR64:$src1, (loadf64 addr:$src2)))]>, |
| 2365 | Requires<[HasSSE2]>, XD; |
| 2366 | |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2367 | def DIVSSrr : I<0x5E, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2368 | "divss {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2369 | [(set FR32:$dst, (fdiv FR32:$src1, FR32:$src2))]>, |
| 2370 | Requires<[HasSSE1]>, XS; |
| 2371 | def DIVSSrm : I<0x5E, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2), |
| 2372 | "divss {$src2, $dst|$dst, $src2}", |
| 2373 | [(set FR32:$dst, (fdiv FR32:$src1, (loadf32 addr:$src2)))]>, |
| 2374 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2375 | def DIVSDrr : I<0x5E, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2376 | "divsd {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2377 | [(set FR64:$dst, (fdiv FR64:$src1, FR64:$src2))]>, |
| 2378 | Requires<[HasSSE2]>, XD; |
| 2379 | def DIVSDrm : I<0x5E, MRMSrcMem, (ops FR64:$dst, FR64:$src1, f64mem:$src2), |
| 2380 | "divsd {$src2, $dst|$dst, $src2}", |
| 2381 | [(set FR64:$dst, (fdiv FR64:$src1, (loadf64 addr:$src2)))]>, |
| 2382 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2383 | |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2384 | def SUBSSrr : I<0x5C, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2385 | "subss {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2386 | [(set FR32:$dst, (fsub FR32:$src1, FR32:$src2))]>, |
| 2387 | Requires<[HasSSE1]>, XS; |
| 2388 | def SUBSSrm : I<0x5C, MRMSrcMem, (ops FR32:$dst, FR32:$src1, f32mem:$src2), |
| 2389 | "subss {$src2, $dst|$dst, $src2}", |
| 2390 | [(set FR32:$dst, (fsub FR32:$src1, (loadf32 addr:$src2)))]>, |
| 2391 | Requires<[HasSSE1]>, XS; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2392 | def SUBSDrr : I<0x5C, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2393 | "subsd {$src2, $dst|$dst, $src2}", |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2394 | [(set FR64:$dst, (fsub FR64:$src1, FR64:$src2))]>, |
| 2395 | Requires<[HasSSE2]>, XD; |
| 2396 | def SUBSDrm : I<0x5C, MRMSrcMem, (ops FR64:$dst, FR64:$src1, f64mem:$src2), |
| 2397 | "subsd {$src2, $dst|$dst, $src2}", |
| 2398 | [(set FR64:$dst, (fsub FR64:$src1, (loadf64 addr:$src2)))]>, |
| 2399 | Requires<[HasSSE2]>, XD; |
| 2400 | |
| 2401 | // SSE Logical |
| 2402 | let isCommutable = 1 in { |
| 2403 | def ANDPSrr : I<0x54, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
| 2404 | "andps {$src2, $dst|$dst, $src2}", []>, |
| 2405 | Requires<[HasSSE1]>, TB; |
| 2406 | def ANDPDrr : I<0x54, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
| 2407 | "andpd {$src2, $dst|$dst, $src2}", []>, |
| 2408 | Requires<[HasSSE2]>, TB, OpSize; |
| 2409 | def ORPSrr : I<0x56, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
| 2410 | "orps {$src2, $dst|$dst, $src2}", []>, |
| 2411 | Requires<[HasSSE1]>, TB; |
| 2412 | def ORPDrr : I<0x56, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
| 2413 | "orpd {$src2, $dst|$dst, $src2}", []>, |
| 2414 | Requires<[HasSSE2]>, TB, OpSize; |
| 2415 | def XORPSrr : I<0x57, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
| 2416 | "xorps {$src2, $dst|$dst, $src2}", []>, |
| 2417 | Requires<[HasSSE1]>, TB; |
| 2418 | def XORPDrr : I<0x57, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
| 2419 | "xorpd {$src2, $dst|$dst, $src2}", []>, |
| 2420 | Requires<[HasSSE2]>, TB, OpSize; |
| 2421 | } |
| 2422 | def ANDNPSrr : I<0x55, MRMSrcReg, (ops FR32:$dst, FR32:$src1, FR32:$src2), |
| 2423 | "andnps {$src2, $dst|$dst, $src2}", []>, |
| 2424 | Requires<[HasSSE1]>, TB; |
| 2425 | def ANDNPDrr : I<0x55, MRMSrcReg, (ops FR64:$dst, FR64:$src1, FR64:$src2), |
| 2426 | "andnpd {$src2, $dst|$dst, $src2}", []>, |
| 2427 | Requires<[HasSSE2]>, TB, OpSize; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2428 | |
| 2429 | def CMPSSrr : I<0xC2, MRMSrcReg, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2430 | (ops FR32:$dst, FR32:$src1, FR32:$src, SSECC:$cc), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2431 | "cmp${cc}ss {$src, $dst|$dst, $src}", []>, |
| 2432 | Requires<[HasSSE1]>, XS; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2433 | def CMPSSrm : I<0xC2, MRMSrcMem, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2434 | (ops FR32:$dst, FR32:$src1, f32mem:$src, SSECC:$cc), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2435 | "cmp${cc}ss {$src, $dst|$dst, $src}", []>, |
| 2436 | Requires<[HasSSE1]>, XS; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2437 | def CMPSDrr : I<0xC2, MRMSrcReg, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2438 | (ops FR64:$dst, FR64:$src1, FR64:$src, SSECC:$cc), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2439 | "cmp${cc}sd {$src, $dst|$dst, $src}", []>, |
| 2440 | Requires<[HasSSE1]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2441 | def CMPSDrm : I<0xC2, MRMSrcMem, |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 2442 | (ops FR64:$dst, FR64:$src1, f64mem:$src, SSECC:$cc), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2443 | "cmp${cc}sd {$src, $dst|$dst, $src}", []>, |
| 2444 | Requires<[HasSSE2]>, XD; |
Nate Begeman | f1702ac | 2005-06-27 21:20:31 +0000 | [diff] [blame] | 2445 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2446 | |
| 2447 | //===----------------------------------------------------------------------===// |
Chris Lattner | c515ad1 | 2005-12-21 07:50:26 +0000 | [diff] [blame] | 2448 | // Floating Point Stack Support |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2449 | //===----------------------------------------------------------------------===// |
| 2450 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2451 | // Floating point support. All FP Stack operations are represented with two |
| 2452 | // instructions here. The first instruction, generated by the instruction |
| 2453 | // selector, uses "RFP" registers: a traditional register file to reference |
| 2454 | // floating point values. These instructions are all psuedo instructions and |
| 2455 | // use the "Fp" prefix. The second instruction is defined with FPI, which is |
| 2456 | // the actual instruction emitted by the assembler. The FP stackifier pass |
| 2457 | // converts one to the other after register allocation occurs. |
| 2458 | // |
| 2459 | // Note that the FpI instruction should have instruction selection info (e.g. |
| 2460 | // a pattern) and the FPI instruction should have emission info (e.g. opcode |
| 2461 | // encoding and asm printing info). |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2462 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2463 | // FPI - Floating Point Instruction template. |
| 2464 | class FPI<bits<8> o, Format F, dag ops, string asm> : I<o, F, ops, asm, []> {} |
| 2465 | |
| 2466 | // FpI - Floating Point Psuedo Instruction template. |
| 2467 | class FpI<dag ops, FPFormat fp, list<dag> pattern> |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2468 | : X86Inst<0, Pseudo, NoImm, ops, "">, Requires<[FPStack]> { |
| 2469 | let FPForm = fp; let FPFormBits = FPForm.Value; |
| 2470 | let Pattern = pattern; |
| 2471 | } |
| 2472 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2473 | // Random Pseudo Instructions. |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 2474 | let hasInFlag = 1 in |
| 2475 | def FpGETRESULT : FpI<(ops RFP:$dst), SpecialFP, []>; // FPR = ST(0) |
| 2476 | |
| 2477 | // Do not inline into instruction def. since it isn't predicated on FPStack. |
| 2478 | def : Pat<(X86fpget), (FpGETRESULT)>; |
| 2479 | |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 2480 | let noResults = 1, hasOutFlag = 1 in |
| 2481 | def FpSETRESULT : FpI<(ops RFP:$src), SpecialFP, |
| 2482 | []>, Imp<[], [ST0]>; // ST(0) = FPR |
| 2483 | |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 2484 | // Do not inline into instruction def. since it isn't predicated on FPStack. |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 2485 | def : Pat<(X86fpset RFP:$src), (FpSETRESULT RFP:$src)>; |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2486 | |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 2487 | def FpMOV : FpI<(ops RFP:$dst, RFP:$src), SpecialFP, []>; // f1 = fmov f2 |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2488 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2489 | // Arithmetic |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2490 | // Add, Sub, Mul, Div. |
| 2491 | def FpADD : FpI<(ops RFP:$dst, RFP:$src1, RFP:$src2), TwoArgFP, |
| 2492 | [(set RFP:$dst, (fadd RFP:$src1, RFP:$src2))]>; |
| 2493 | def FpSUB : FpI<(ops RFP:$dst, RFP:$src1, RFP:$src2), TwoArgFP, |
| 2494 | [(set RFP:$dst, (fsub RFP:$src1, RFP:$src2))]>; |
| 2495 | def FpMUL : FpI<(ops RFP:$dst, RFP:$src1, RFP:$src2), TwoArgFP, |
| 2496 | [(set RFP:$dst, (fmul RFP:$src1, RFP:$src2))]>; |
| 2497 | def FpDIV : FpI<(ops RFP:$dst, RFP:$src1, RFP:$src2), TwoArgFP, |
| 2498 | [(set RFP:$dst, (fdiv RFP:$src1, RFP:$src2))]>; |
| 2499 | |
| 2500 | class FPST0rInst<bits<8> o, string asm> |
| 2501 | : FPI<o, AddRegFrm, (ops RST:$op), asm>, D8; |
| 2502 | class FPrST0Inst<bits<8> o, string asm> |
| 2503 | : FPI<o, AddRegFrm, (ops RST:$op), asm>, DC; |
| 2504 | class FPrST0PInst<bits<8> o, string asm> |
| 2505 | : FPI<o, AddRegFrm, (ops RST:$op), asm>, DE; |
| 2506 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2507 | // Binary Ops with a memory source. |
| 2508 | def FpADD32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2509 | [(set RFP:$dst, (fadd RFP:$src1, |
| 2510 | (extloadf64f32 addr:$src2)))]>; |
| 2511 | // ST(0) = ST(0) + [mem32] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2512 | def FpADD64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2513 | [(set RFP:$dst, (fadd RFP:$src1, (loadf64 addr:$src2)))]>; |
| 2514 | // ST(0) = ST(0) + [mem64] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2515 | def FpMUL32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2516 | [(set RFP:$dst, (fmul RFP:$src1, |
| 2517 | (extloadf64f32 addr:$src2)))]>; |
| 2518 | // ST(0) = ST(0) * [mem32] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2519 | def FpMUL64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2520 | [(set RFP:$dst, (fmul RFP:$src1, (loadf64 addr:$src2)))]>; |
| 2521 | // ST(0) = ST(0) * [mem64] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2522 | def FpSUB32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2523 | [(set RFP:$dst, (fsub RFP:$src1, |
| 2524 | (extloadf64f32 addr:$src2)))]>; |
| 2525 | // ST(0) = ST(0) - [mem32] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2526 | def FpSUB64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2527 | [(set RFP:$dst, (fsub RFP:$src1, (loadf64 addr:$src2)))]>; |
| 2528 | // ST(0) = ST(0) - [mem64] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2529 | def FpSUBR32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 2530 | [(set RFP:$dst, (fsub (extloadf64f32 addr:$src2), |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2531 | RFP:$src1))]>; |
| 2532 | // ST(0) = [mem32] - ST(0) |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2533 | def FpSUBR64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2534 | [(set RFP:$dst, (fsub (loadf64 addr:$src2), RFP:$src1))]>; |
| 2535 | // ST(0) = [mem64] - ST(0) |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2536 | def FpDIV32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2537 | [(set RFP:$dst, (fdiv RFP:$src1, |
| 2538 | (extloadf64f32 addr:$src2)))]>; |
| 2539 | // ST(0) = ST(0) / [mem32] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2540 | def FpDIV64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2541 | [(set RFP:$dst, (fdiv RFP:$src1, (loadf64 addr:$src2)))]>; |
| 2542 | // ST(0) = ST(0) / [mem64] |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2543 | def FpDIVR32m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2544 | [(set RFP:$dst, (fdiv (extloadf64f32 addr:$src2), |
| 2545 | RFP:$src1))]>; |
| 2546 | // ST(0) = [mem32] / ST(0) |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2547 | def FpDIVR64m : FpI<(ops RFP:$dst, RFP:$src1, f32mem:$src2), OneArgFPRW, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2548 | [(set RFP:$dst, (fdiv (loadf64 addr:$src2), RFP:$src1))]>; |
| 2549 | // ST(0) = [mem64] / ST(0) |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2550 | |
| 2551 | |
| 2552 | def FADD32m : FPI<0xD8, MRM0m, (ops f32mem:$src), "fadd{s} $src">; |
| 2553 | def FADD64m : FPI<0xDC, MRM0m, (ops f64mem:$src), "fadd{l} $src">; |
| 2554 | def FMUL32m : FPI<0xD8, MRM1m, (ops f32mem:$src), "fmul{s} $src">; |
| 2555 | def FMUL64m : FPI<0xDC, MRM1m, (ops f64mem:$src), "fmul{l} $src">; |
| 2556 | def FSUB32m : FPI<0xD8, MRM4m, (ops f32mem:$src), "fsub{s} $src">; |
| 2557 | def FSUB64m : FPI<0xDC, MRM4m, (ops f64mem:$src), "fsub{l} $src">; |
| 2558 | def FSUBR32m : FPI<0xD8, MRM5m, (ops f32mem:$src), "fsubr{s} $src">; |
| 2559 | def FSUBR64m : FPI<0xDC, MRM5m, (ops f64mem:$src), "fsubr{l} $src">; |
| 2560 | def FDIV32m : FPI<0xD8, MRM6m, (ops f32mem:$src), "fdiv{s} $src">; |
| 2561 | def FDIV64m : FPI<0xDC, MRM6m, (ops f64mem:$src), "fdiv{l} $src">; |
| 2562 | def FDIVR32m : FPI<0xD8, MRM7m, (ops f32mem:$src), "fdivr{s} $src">; |
| 2563 | def FDIVR64m : FPI<0xDC, MRM7m, (ops f64mem:$src), "fdivr{l} $src">; |
| 2564 | |
| 2565 | // FIXME: Implement these when we have a dag-dag isel! |
| 2566 | //def FIADD16m : FPI<0xDE, MRM0m>; // ST(0) = ST(0) + [mem16int] |
| 2567 | //def FIADD32m : FPI<0xDA, MRM0m>; // ST(0) = ST(0) + [mem32int] |
| 2568 | //def FIMUL16m : FPI<0xDE, MRM1m>; // ST(0) = ST(0) * [mem16] |
| 2569 | //def FIMUL32m : FPI<0xDA, MRM1m>; // ST(0) = ST(0) * [mem32] |
| 2570 | //def FISUB16m : FPI<0xDE, MRM4m>; // ST(0) = ST(0) - [mem16int] |
| 2571 | //def FISUB32m : FPI<0xDA, MRM4m>; // ST(0) = ST(0) - [mem32int] |
| 2572 | //def FISUBR16m : FPI<0xDE, MRM5m>; // ST(0) = [mem16int] - ST(0) |
| 2573 | //def FISUBR32m : FPI<0xDA, MRM5m>; // ST(0) = [mem32int] - ST(0) |
| 2574 | //def FIDIV16m : FPI<0xDE, MRM6m>; // ST(0) = ST(0) / [mem16int] |
| 2575 | //def FIDIV32m : FPI<0xDA, MRM6m>; // ST(0) = ST(0) / [mem32int] |
| 2576 | //def FIDIVR16m : FPI<0xDE, MRM7m>; // ST(0) = [mem16int] / ST(0) |
| 2577 | //def FIDIVR32m : FPI<0xDA, MRM7m>; // ST(0) = [mem32int] / ST(0) |
| 2578 | |
| 2579 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2580 | // NOTE: GAS and apparently all other AT&T style assemblers have a broken notion |
| 2581 | // of some of the 'reverse' forms of the fsub and fdiv instructions. As such, |
| 2582 | // we have to put some 'r's in and take them out of weird places. |
| 2583 | def FADDST0r : FPST0rInst <0xC0, "fadd $op">; |
| 2584 | def FADDrST0 : FPrST0Inst <0xC0, "fadd {%ST(0), $op|$op, %ST(0)}">; |
| 2585 | def FADDPrST0 : FPrST0PInst<0xC0, "faddp $op">; |
| 2586 | def FSUBRST0r : FPST0rInst <0xE8, "fsubr $op">; |
| 2587 | def FSUBrST0 : FPrST0Inst <0xE8, "fsub{r} {%ST(0), $op|$op, %ST(0)}">; |
| 2588 | def FSUBPrST0 : FPrST0PInst<0xE8, "fsub{r}p $op">; |
| 2589 | def FSUBST0r : FPST0rInst <0xE0, "fsub $op">; |
| 2590 | def FSUBRrST0 : FPrST0Inst <0xE0, "fsub{|r} {%ST(0), $op|$op, %ST(0)}">; |
| 2591 | def FSUBRPrST0 : FPrST0PInst<0xE0, "fsub{|r}p $op">; |
| 2592 | def FMULST0r : FPST0rInst <0xC8, "fmul $op">; |
| 2593 | def FMULrST0 : FPrST0Inst <0xC8, "fmul {%ST(0), $op|$op, %ST(0)}">; |
| 2594 | def FMULPrST0 : FPrST0PInst<0xC8, "fmulp $op">; |
| 2595 | def FDIVRST0r : FPST0rInst <0xF8, "fdivr $op">; |
| 2596 | def FDIVrST0 : FPrST0Inst <0xF8, "fdiv{r} {%ST(0), $op|$op, %ST(0)}">; |
| 2597 | def FDIVPrST0 : FPrST0PInst<0xF8, "fdiv{r}p $op">; |
| 2598 | def FDIVST0r : FPST0rInst <0xF0, "fdiv $op">; |
| 2599 | def FDIVRrST0 : FPrST0Inst <0xF0, "fdiv{|r} {%ST(0), $op|$op, %ST(0)}">; |
| 2600 | def FDIVRPrST0 : FPrST0PInst<0xF0, "fdiv{|r}p $op">; |
| 2601 | |
| 2602 | |
| 2603 | // Unary operations. |
| 2604 | def FpCHS : FpI<(ops RFP:$dst, RFP:$src), OneArgFPRW, |
| 2605 | [(set RFP:$dst, (fneg RFP:$src))]>; |
| 2606 | def FpABS : FpI<(ops RFP:$dst, RFP:$src), OneArgFPRW, |
| 2607 | [(set RFP:$dst, (fabs RFP:$src))]>; |
| 2608 | def FpSQRT : FpI<(ops RFP:$dst, RFP:$src), OneArgFPRW, |
| 2609 | [(set RFP:$dst, (fsqrt RFP:$src))]>; |
| 2610 | def FpSIN : FpI<(ops RFP:$dst, RFP:$src), OneArgFPRW, |
| 2611 | [(set RFP:$dst, (fsin RFP:$src))]>; |
| 2612 | def FpCOS : FpI<(ops RFP:$dst, RFP:$src), OneArgFPRW, |
| 2613 | [(set RFP:$dst, (fcos RFP:$src))]>; |
| 2614 | def FpTST : FpI<(ops RFP:$src), OneArgFP, |
| 2615 | []>; |
| 2616 | |
| 2617 | def FCHS : FPI<0xE0, RawFrm, (ops), "fchs">, D9; |
| 2618 | def FABS : FPI<0xE1, RawFrm, (ops), "fabs">, D9; |
| 2619 | def FSQRT : FPI<0xFA, RawFrm, (ops), "fsqrt">, D9; |
| 2620 | def FSIN : FPI<0xFE, RawFrm, (ops), "fsin">, D9; |
| 2621 | def FCOS : FPI<0xFF, RawFrm, (ops), "fcos">, D9; |
| 2622 | def FTST : FPI<0xE4, RawFrm, (ops), "ftst">, D9; |
| 2623 | |
| 2624 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2625 | // Floating point cmovs. |
| 2626 | let isTwoAddress = 1 in { |
| 2627 | def FpCMOVB : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2628 | def FpCMOVBE : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2629 | def FpCMOVE : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2630 | def FpCMOVP : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2631 | def FpCMOVAE : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2632 | def FpCMOVA : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2633 | def FpCMOVNE : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2634 | def FpCMOVNP : FpI<(ops RST:$dst, RFP:$src1, RFP:$src2), CondMovFP, []>; |
| 2635 | } |
| 2636 | |
| 2637 | def FCMOVB : FPI<0xC0, AddRegFrm, (ops RST:$op), |
| 2638 | "fcmovb {$op, %ST(0)|%ST(0), $op}">, DA; |
| 2639 | def FCMOVBE : FPI<0xD0, AddRegFrm, (ops RST:$op), |
| 2640 | "fcmovbe {$op, %ST(0)|%ST(0), $op}">, DA; |
| 2641 | def FCMOVE : FPI<0xC8, AddRegFrm, (ops RST:$op), |
| 2642 | "fcmove {$op, %ST(0)|%ST(0), $op}">, DA; |
| 2643 | def FCMOVP : FPI<0xD8, AddRegFrm, (ops RST:$op), |
| 2644 | "fcmovu {$op, %ST(0)|%ST(0), $op}">, DA; |
| 2645 | def FCMOVAE : FPI<0xC0, AddRegFrm, (ops RST:$op), |
| 2646 | "fcmovae {$op, %ST(0)|%ST(0), $op}">, DB; |
| 2647 | def FCMOVA : FPI<0xD0, AddRegFrm, (ops RST:$op), |
| 2648 | "fcmova {$op, %ST(0)|%ST(0), $op}">, DB; |
| 2649 | def FCMOVNE : FPI<0xC8, AddRegFrm, (ops RST:$op), |
| 2650 | "fcmovne {$op, %ST(0)|%ST(0), $op}">, DB; |
| 2651 | def FCMOVNP : FPI<0xD8, AddRegFrm, (ops RST:$op), |
| 2652 | "fcmovnu {$op, %ST(0)|%ST(0), $op}">, DB; |
| 2653 | |
| 2654 | // Floating point loads & stores. |
| 2655 | def FpLD32m : FpI<(ops RFP:$dst, f32mem:$src), ZeroArgFP, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2656 | [(set RFP:$dst, (extloadf64f32 addr:$src))]>; |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2657 | def FpLD64m : FpI<(ops RFP:$dst, f64mem:$src), ZeroArgFP, |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2658 | [(set RFP:$dst, (loadf64 addr:$src))]>; |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2659 | def FpILD16m : FpI<(ops RFP:$dst, i16mem:$src), ZeroArgFP, |
| 2660 | []>; |
| 2661 | def FpILD32m : FpI<(ops RFP:$dst, i32mem:$src), ZeroArgFP, |
| 2662 | []>; |
| 2663 | def FpILD64m : FpI<(ops RFP:$dst, i64mem:$src), ZeroArgFP, |
| 2664 | []>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 2665 | |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2666 | // Required for RET of f32 / f64 values. |
| 2667 | def : Pat<(X86fld addr:$src, f32), (FpLD32m addr:$src)>; |
| 2668 | def : Pat<(X86fld addr:$src, f64), (FpLD64m addr:$src)>; |
| 2669 | |
| 2670 | def FpST32m : FpI<(ops f32mem:$op, RFP:$src), OneArgFP, |
| 2671 | [(truncstore RFP:$src, addr:$op, f32)]>; |
| 2672 | def FpST64m : FpI<(ops f64mem:$op, RFP:$src), OneArgFP, |
| 2673 | [(store RFP:$src, addr:$op)]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 2674 | |
| 2675 | def : Pat<(X86fst RFP:$src, addr:$op, f32), (FpST32m addr:$op, RFP:$src)>; |
| 2676 | def : Pat<(X86fst RFP:$src, addr:$op, f64), (FpST64m addr:$op, RFP:$src)>; |
| 2677 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2678 | def FpSTP32m : FpI<(ops f32mem:$op, RFP:$src), OneArgFP, []>; |
| 2679 | def FpSTP64m : FpI<(ops f64mem:$op, RFP:$src), OneArgFP, []>; |
| 2680 | def FpIST16m : FpI<(ops i16mem:$op, RFP:$src), OneArgFP, []>; |
| 2681 | def FpIST32m : FpI<(ops i32mem:$op, RFP:$src), OneArgFP, []>; |
| 2682 | def FpIST64m : FpI<(ops i64mem:$op, RFP:$src), OneArgFP, []>; |
Alkis Evlogimenos | 978f629 | 2004-09-08 16:54:54 +0000 | [diff] [blame] | 2683 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2684 | def FLD32m : FPI<0xD9, MRM0m, (ops f32mem:$src), "fld{s} $src">; |
| 2685 | def FLD64m : FPI<0xDD, MRM0m, (ops f64mem:$src), "fld{l} $src">; |
| 2686 | def FILD16m : FPI<0xDF, MRM0m, (ops i16mem:$src), "fild{s} $src">; |
| 2687 | def FILD32m : FPI<0xDB, MRM0m, (ops i32mem:$src), "fild{l} $src">; |
| 2688 | def FILD64m : FPI<0xDF, MRM5m, (ops i64mem:$src), "fild{ll} $src">; |
| 2689 | def FST32m : FPI<0xD9, MRM2m, (ops f32mem:$dst), "fst{s} $dst">; |
| 2690 | def FST64m : FPI<0xDD, MRM2m, (ops f64mem:$dst), "fst{l} $dst">; |
| 2691 | def FSTP32m : FPI<0xD9, MRM3m, (ops f32mem:$dst), "fstp{s} $dst">; |
| 2692 | def FSTP64m : FPI<0xDD, MRM3m, (ops f64mem:$dst), "fstp{l} $dst">; |
| 2693 | def FIST16m : FPI<0xDF, MRM2m, (ops i16mem:$dst), "fist{s} $dst">; |
| 2694 | def FIST32m : FPI<0xDB, MRM2m, (ops i32mem:$dst), "fist{l} $dst">; |
| 2695 | def FISTP16m : FPI<0xDF, MRM3m, (ops i16mem:$dst), "fistp{s} $dst">; |
| 2696 | def FISTP32m : FPI<0xDB, MRM3m, (ops i32mem:$dst), "fistp{l} $dst">; |
| 2697 | def FISTP64m : FPI<0xDF, MRM7m, (ops i64mem:$dst), "fistp{ll} $dst">; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2698 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2699 | // FP Stack manipulation instructions. |
| 2700 | def FLDrr : FPI<0xC0, AddRegFrm, (ops RST:$op), "fld $op">, D9; |
| 2701 | def FSTrr : FPI<0xD0, AddRegFrm, (ops RST:$op), "fst $op">, DD; |
| 2702 | def FSTPrr : FPI<0xD8, AddRegFrm, (ops RST:$op), "fstp $op">, DD; |
| 2703 | def FXCH : FPI<0xC8, AddRegFrm, (ops RST:$op), "fxch $op">, D9; |
Chris Lattner | 490e86f | 2004-04-11 20:24:15 +0000 | [diff] [blame] | 2704 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2705 | // Floating point constant loads. |
Evan Cheng | 650d688 | 2006-01-05 02:08:37 +0000 | [diff] [blame] | 2706 | def FpLD0 : FpI<(ops RFP:$dst), ZeroArgFP, |
| 2707 | [(set RFP:$dst, fp64imm0)]>; |
| 2708 | def FpLD1 : FpI<(ops RFP:$dst), ZeroArgFP, |
| 2709 | [(set RFP:$dst, fp64imm1)]>; |
| 2710 | |
| 2711 | def : Pat<(f64 fp64immneg0), (FpCHS (FpLD0))>, Requires<[FPStack]>; |
| 2712 | def : Pat<(f64 fp64immneg1), (FpCHS (FpLD1))>, Requires<[FPStack]>; |
Chris Lattner | 490e86f | 2004-04-11 20:24:15 +0000 | [diff] [blame] | 2713 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2714 | def FLD0 : FPI<0xEE, RawFrm, (ops), "fldz">, D9; |
| 2715 | def FLD1 : FPI<0xE8, RawFrm, (ops), "fld1">, D9; |
Chris Lattner | 490e86f | 2004-04-11 20:24:15 +0000 | [diff] [blame] | 2716 | |
Chris Lattner | 1c54a85 | 2004-03-31 22:02:13 +0000 | [diff] [blame] | 2717 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2718 | // Floating point compares. |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2719 | def FpUCOMr : FpI<(ops RFP:$lhs, RFP:$rhs), CompareFP, |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2720 | []>; // FPSW = cmp ST(0) with ST(i) |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 2721 | def FpUCOMIr : FpI<(ops RFP:$lhs, RFP:$rhs), CompareFP, |
| 2722 | [(set STATUS, (X86cmp RFP:$lhs, RFP:$rhs))]>, |
| 2723 | Imp<[],[STATUS]>; // CC = cmp ST(0) with ST(i) |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2724 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2725 | def FUCOMr : FPI<0xE0, AddRegFrm, // FPSW = cmp ST(0) with ST(i) |
| 2726 | (ops RST:$reg), |
| 2727 | "fucom $reg">, DD, Imp<[ST0],[]>; |
| 2728 | def FUCOMPr : FPI<0xE8, AddRegFrm, // FPSW = cmp ST(0) with ST(i), pop |
| 2729 | (ops RST:$reg), |
| 2730 | "fucomp $reg">, DD, Imp<[ST0],[]>; |
| 2731 | def FUCOMPPr : FPI<0xE9, RawFrm, // cmp ST(0) with ST(1), pop, pop |
| 2732 | (ops), |
| 2733 | "fucompp">, DA, Imp<[ST0],[]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 2734 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2735 | def FUCOMIr : FPI<0xE8, AddRegFrm, // CC = cmp ST(0) with ST(i) |
| 2736 | (ops RST:$reg), |
| 2737 | "fucomi {$reg, %ST(0)|%ST(0), $reg}">, DB, Imp<[ST0],[]>; |
| 2738 | def FUCOMIPr : FPI<0xE8, AddRegFrm, // CC = cmp ST(0) with ST(i), pop |
| 2739 | (ops RST:$reg), |
| 2740 | "fucomip {$reg, %ST(0)|%ST(0), $reg}">, DF, Imp<[ST0],[]>; |
Chris Lattner | 0e967d4 | 2004-08-01 08:13:11 +0000 | [diff] [blame] | 2741 | |
Chris Lattner | a1b5e16 | 2004-04-12 01:38:55 +0000 | [diff] [blame] | 2742 | |
Chris Lattner | 58fe459 | 2005-12-21 07:47:04 +0000 | [diff] [blame] | 2743 | // Floating point flag ops. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2744 | def FNSTSW8r : I<0xE0, RawFrm, // AX = fp flags |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2745 | (ops), "fnstsw", []>, DF, Imp<[],[AX]>; |
Chris Lattner | 96563df | 2004-08-01 06:01:00 +0000 | [diff] [blame] | 2746 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2747 | def FNSTCW16m : I<0xD9, MRM7m, // [mem16] = X87 control world |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2748 | (ops i16mem:$dst), "fnstcw $dst", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2749 | def FLDCW16m : I<0xD9, MRM5m, // X87 control world = [mem16] |
Evan Cheng | f070184 | 2005-11-29 19:38:52 +0000 | [diff] [blame] | 2750 | (ops i16mem:$dst), "fldcw $dst", []>; |
Evan Cheng | 38bcbaf | 2005-12-23 07:31:11 +0000 | [diff] [blame] | 2751 | |
| 2752 | |
| 2753 | //===----------------------------------------------------------------------===// |
| 2754 | // Miscellaneous Instructions |
| 2755 | //===----------------------------------------------------------------------===// |
| 2756 | |
| 2757 | def RDTSC : I<0x31, RawFrm, (ops), "rdtsc", []>, TB, Imp<[],[EAX,EDX]>; |
Evan Cheng | cfa260b | 2006-01-06 02:31:59 +0000 | [diff] [blame^] | 2758 | |
| 2759 | |
| 2760 | //===----------------------------------------------------------------------===// |
| 2761 | // Some peepholes |
| 2762 | //===----------------------------------------------------------------------===// |
| 2763 | |
| 2764 | // (shl x, 1) ==> (add x, x) |
| 2765 | def : Pat<(shl R8 :$src1, (i8 1)), (ADD8rr R8 :$src1, R8 :$src1)>; |
| 2766 | def : Pat<(shl R16:$src1, (i8 1)), (ADD16rr R16:$src1, R16:$src1)>; |
| 2767 | def : Pat<(shl R32:$src1, (i8 1)), (ADD32rr R32:$src1, R32:$src1)>; |