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