Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1 | |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 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 | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 24 | def SDTX86CmpTest : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 25 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 26 | def SDTX86Cmov : SDTypeProfile<1, 4, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 27 | [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, |
| 28 | SDTCisVT<3, i8>, SDTCisVT<4, i32>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 29 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 30 | // Unary and binary operator instructions that set EFLAGS as a side-effect. |
| 31 | def SDTUnaryArithWithFlags : SDTypeProfile<1, 1, |
| 32 | [SDTCisInt<0>]>; |
| 33 | def SDTBinaryArithWithFlags : SDTypeProfile<1, 2, |
| 34 | [SDTCisSameAs<0, 1>, |
| 35 | SDTCisSameAs<0, 2>, |
| 36 | SDTCisInt<0>]>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 37 | def SDTX86BrCond : SDTypeProfile<0, 3, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 38 | [SDTCisVT<0, OtherVT>, |
| 39 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 40 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 41 | def SDTX86SetCC : SDTypeProfile<1, 2, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 42 | [SDTCisVT<0, i8>, |
| 43 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 44 | def SDTX86SetCC_C : SDTypeProfile<1, 2, |
| 45 | [SDTCisInt<0>, |
| 46 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 47 | |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 48 | def SDTX86cas : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisInt<1>, |
| 49 | SDTCisVT<2, i8>]>; |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 50 | def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>; |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 51 | |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 52 | def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>, |
| 53 | SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>; |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 54 | def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 55 | |
Sean Callanan | 1c97ceb | 2009-06-23 23:25:37 +0000 | [diff] [blame] | 56 | def SDT_X86CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; |
| 57 | def SDT_X86CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, |
| 58 | SDTCisVT<1, i32>]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 59 | |
Dan Gohman | d35121a | 2008-05-29 19:57:41 +0000 | [diff] [blame] | 60 | def SDT_X86Call : SDTypeProfile<0, -1, [SDTCisVT<0, iPTR>]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 61 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 62 | def SDT_X86VASTART_SAVE_XMM_REGS : SDTypeProfile<0, -1, [SDTCisVT<0, i8>, |
| 63 | SDTCisVT<1, iPTR>, |
| 64 | SDTCisVT<2, iPTR>]>; |
| 65 | |
Evan Cheng | 67f92a7 | 2006-01-11 22:15:48 +0000 | [diff] [blame] | 66 | def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>; |
| 67 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 68 | def SDTX86RdTsc : SDTypeProfile<0, 0, []>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 69 | |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 70 | def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>; |
| 71 | |
Rafael Espindola | 2ee3db3 | 2009-04-17 14:35:58 +0000 | [diff] [blame] | 72 | def SDT_X86TLSADDR : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 73 | |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 74 | def SDT_X86SegmentBaseAddress : SDTypeProfile<1, 1, [SDTCisPtrTy<0>]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 75 | |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 76 | def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
| 77 | |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 78 | def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>; |
| 79 | |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 80 | def X86bsf : SDNode<"X86ISD::BSF", SDTIntUnaryOp>; |
| 81 | def X86bsr : SDNode<"X86ISD::BSR", SDTIntUnaryOp>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 82 | def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>; |
| 83 | def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 84 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 85 | def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 86 | |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 87 | def X86bt : SDNode<"X86ISD::BT", SDTX86CmpTest>; |
| 88 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 89 | def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 90 | def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 91 | [SDNPHasChain]>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 92 | def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 93 | def X86setcc_c : SDNode<"X86ISD::SETCC_CARRY", SDTX86SetCC_C>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 94 | |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 95 | def X86cas : SDNode<"X86ISD::LCMPXCHG_DAG", SDTX86cas, |
| 96 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 97 | SDNPMayLoad]>; |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 98 | def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8, |
| 99 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 100 | SDNPMayLoad]>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 101 | def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary, |
| 102 | [SDNPHasChain, SDNPMayStore, |
| 103 | SDNPMayLoad, SDNPMemOperand]>; |
| 104 | def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary, |
| 105 | [SDNPHasChain, SDNPMayStore, |
| 106 | SDNPMayLoad, SDNPMemOperand]>; |
| 107 | def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary, |
| 108 | [SDNPHasChain, SDNPMayStore, |
| 109 | SDNPMayLoad, SDNPMemOperand]>; |
| 110 | def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary, |
| 111 | [SDNPHasChain, SDNPMayStore, |
| 112 | SDNPMayLoad, SDNPMemOperand]>; |
| 113 | def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary, |
| 114 | [SDNPHasChain, SDNPMayStore, |
| 115 | SDNPMayLoad, SDNPMemOperand]>; |
| 116 | def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary, |
| 117 | [SDNPHasChain, SDNPMayStore, |
| 118 | SDNPMayLoad, SDNPMemOperand]>; |
Dale Johannesen | 880ae36 | 2008-10-03 22:25:52 +0000 | [diff] [blame] | 119 | def X86AtomSwap64 : SDNode<"X86ISD::ATOMSWAP64_DAG", SDTX86atomicBinary, |
| 120 | [SDNPHasChain, SDNPMayStore, |
| 121 | SDNPMayLoad, SDNPMemOperand]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 122 | def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, |
| 123 | [SDNPHasChain, SDNPOptInFlag]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 124 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 125 | def X86vastart_save_xmm_regs : |
| 126 | SDNode<"X86ISD::VASTART_SAVE_XMM_REGS", |
| 127 | SDT_X86VASTART_SAVE_XMM_REGS, |
| 128 | [SDNPHasChain]>; |
| 129 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 130 | def X86callseq_start : |
| 131 | SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart, |
Evan Cheng | bb7b844 | 2006-08-11 09:03:33 +0000 | [diff] [blame] | 132 | [SDNPHasChain, SDNPOutFlag]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 133 | def X86callseq_end : |
| 134 | SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd, |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 135 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 136 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 137 | def X86call : SDNode<"X86ISD::CALL", SDT_X86Call, |
| 138 | [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 139 | |
Evan Cheng | 67f92a7 | 2006-01-11 22:15:48 +0000 | [diff] [blame] | 140 | def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr, |
Chris Lattner | 9b37aaf | 2008-01-10 05:12:37 +0000 | [diff] [blame] | 141 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>; |
Evan Cheng | 67f92a7 | 2006-01-11 22:15:48 +0000 | [diff] [blame] | 142 | def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr, |
Chris Lattner | 9b37aaf | 2008-01-10 05:12:37 +0000 | [diff] [blame] | 143 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 144 | SDNPMayLoad]>; |
Evan Cheng | 67f92a7 | 2006-01-11 22:15:48 +0000 | [diff] [blame] | 145 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 146 | def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG",SDTX86RdTsc, |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 147 | [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 148 | |
Evan Cheng | 0085a28 | 2006-11-30 21:55:46 +0000 | [diff] [blame] | 149 | def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>; |
| 150 | def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 151 | |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 152 | def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR, |
Anton Korobeynikov | 6625eff | 2008-05-04 21:36:32 +0000 | [diff] [blame] | 153 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 154 | def X86SegmentBaseAddress : SDNode<"X86ISD::SegmentBaseAddress", |
| 155 | SDT_X86SegmentBaseAddress, []>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 156 | |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 157 | def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET, |
| 158 | [SDNPHasChain]>; |
| 159 | |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 160 | def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET, |
| 161 | [SDNPHasChain, SDNPOptInFlag]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 162 | |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 163 | def X86add_flag : SDNode<"X86ISD::ADD", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 164 | [SDNPCommutative]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 165 | def X86sub_flag : SDNode<"X86ISD::SUB", SDTBinaryArithWithFlags>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 166 | def X86smul_flag : SDNode<"X86ISD::SMUL", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 167 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 168 | def X86umul_flag : SDNode<"X86ISD::UMUL", SDTUnaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 169 | [SDNPCommutative]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 170 | def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>; |
| 171 | def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 172 | def X86or_flag : SDNode<"X86ISD::OR", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 173 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 174 | def X86xor_flag : SDNode<"X86ISD::XOR", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 175 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 176 | def X86and_flag : SDNode<"X86ISD::AND", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 177 | [SDNPCommutative]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 178 | |
Evan Cheng | 73f24c9 | 2009-03-30 21:36:47 +0000 | [diff] [blame] | 179 | def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>; |
| 180 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 181 | //===----------------------------------------------------------------------===// |
| 182 | // X86 Operand Definitions. |
| 183 | // |
| 184 | |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 185 | def i32imm_pcrel : Operand<i32> { |
| 186 | let PrintMethod = "print_pcrel_imm"; |
| 187 | } |
| 188 | |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 189 | // A version of ptr_rc which excludes SP, ESP, and RSP. This is used for |
| 190 | // the index operand of an address, to conform to x86 encoding restrictions. |
| 191 | def ptr_rc_nosp : PointerLikeRegClass<1>; |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 192 | |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 193 | // *mem - Operand definitions for the funky X86 addressing mode operands. |
| 194 | // |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 195 | def X86MemAsmOperand : AsmOperandClass { |
| 196 | let Name = "Mem"; |
Daniel Dunbar | 8e00117 | 2009-08-10 19:08:02 +0000 | [diff] [blame] | 197 | let SuperClass = ?; |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 198 | } |
Evan Cheng | af78ef5 | 2006-05-17 21:21:41 +0000 | [diff] [blame] | 199 | class X86MemOperand<string printMethod> : Operand<iPTR> { |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 200 | let PrintMethod = printMethod; |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 201 | let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm); |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 202 | let ParserMatchClass = X86MemAsmOperand; |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 203 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 204 | |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 205 | def opaque32mem : X86MemOperand<"printopaquemem">; |
| 206 | def opaque48mem : X86MemOperand<"printopaquemem">; |
| 207 | def opaque80mem : X86MemOperand<"printopaquemem">; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 208 | def opaque512mem : X86MemOperand<"printopaquemem">; |
| 209 | |
| 210 | def offset8 : Operand<i64> { let PrintMethod = "print_pcrel_imm"; } |
| 211 | def offset16 : Operand<i64> { let PrintMethod = "print_pcrel_imm"; } |
| 212 | def offset32 : Operand<i64> { let PrintMethod = "print_pcrel_imm"; } |
| 213 | def offset64 : Operand<i64> { let PrintMethod = "print_pcrel_imm"; } |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 214 | |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 215 | def i8mem : X86MemOperand<"printi8mem">; |
| 216 | def i16mem : X86MemOperand<"printi16mem">; |
| 217 | def i32mem : X86MemOperand<"printi32mem">; |
| 218 | def i64mem : X86MemOperand<"printi64mem">; |
Evan Cheng | 470a6ad | 2006-02-22 02:26:30 +0000 | [diff] [blame] | 219 | def i128mem : X86MemOperand<"printi128mem">; |
Chris Lattner | e895c61 | 2009-09-20 07:17:49 +0000 | [diff] [blame] | 220 | //def i256mem : X86MemOperand<"printi256mem">; |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 221 | def f32mem : X86MemOperand<"printf32mem">; |
| 222 | def f64mem : X86MemOperand<"printf64mem">; |
Dale Johannesen | 59a5873 | 2007-08-05 18:49:15 +0000 | [diff] [blame] | 223 | def f80mem : X86MemOperand<"printf80mem">; |
Evan Cheng | 223547a | 2006-01-31 22:28:30 +0000 | [diff] [blame] | 224 | def f128mem : X86MemOperand<"printf128mem">; |
Chris Lattner | e895c61 | 2009-09-20 07:17:49 +0000 | [diff] [blame] | 225 | //def f256mem : X86MemOperand<"printf256mem">; |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 226 | |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 227 | // A version of i8mem for use on x86-64 that uses GR64_NOREX instead of |
| 228 | // plain GR64, so that it doesn't potentially require a REX prefix. |
| 229 | def i8mem_NOREX : Operand<i64> { |
| 230 | let PrintMethod = "printi8mem"; |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 231 | let MIOperandInfo = (ops GR64_NOREX, i8imm, GR64_NOREX_NOSP, i32imm, i8imm); |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 232 | let ParserMatchClass = X86MemAsmOperand; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 235 | def lea32mem : Operand<i32> { |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 236 | let PrintMethod = "printlea32mem"; |
Dan Gohman | 74f6f9a | 2009-08-05 17:40:24 +0000 | [diff] [blame] | 237 | let MIOperandInfo = (ops GR32, i8imm, GR32_NOSP, i32imm); |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 238 | let ParserMatchClass = X86MemAsmOperand; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 239 | } |
| 240 | |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 241 | def SSECC : Operand<i8> { |
| 242 | let PrintMethod = "printSSECC"; |
| 243 | } |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 244 | |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 245 | def ImmSExt8AsmOperand : AsmOperandClass { |
| 246 | let Name = "ImmSExt8"; |
| 247 | let SuperClass = ImmAsmOperand; |
| 248 | } |
| 249 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 250 | // A couple of more descriptive operand definitions. |
| 251 | // 16-bits but only 8 bits are significant. |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 252 | def i16i8imm : Operand<i16> { |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 253 | let ParserMatchClass = ImmSExt8AsmOperand; |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 254 | } |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 255 | // 32-bits but only 8 bits are significant. |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 256 | def i32i8imm : Operand<i32> { |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 257 | let ParserMatchClass = ImmSExt8AsmOperand; |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 258 | } |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 259 | |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 260 | // Branch targets have OtherVT type and print as pc-relative values. |
| 261 | def brtarget : Operand<OtherVT> { |
| 262 | let PrintMethod = "print_pcrel_imm"; |
| 263 | } |
Evan Cheng | d35b8c1 | 2005-12-04 08:19:43 +0000 | [diff] [blame] | 264 | |
Evan Cheng | 77159e3 | 2009-07-21 06:00:18 +0000 | [diff] [blame] | 265 | def brtarget8 : Operand<OtherVT> { |
| 266 | let PrintMethod = "print_pcrel_imm"; |
| 267 | } |
| 268 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 269 | //===----------------------------------------------------------------------===// |
| 270 | // X86 Complex Pattern Definitions. |
| 271 | // |
| 272 | |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 273 | // Define X86 specific addressing mode. |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 274 | def addr : ComplexPattern<iPTR, 5, "SelectAddr", [], []>; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 275 | def lea32addr : ComplexPattern<i32, 4, "SelectLEAAddr", |
Dan Gohman | a98634b | 2009-08-02 16:09:17 +0000 | [diff] [blame] | 276 | [add, sub, mul, X86mul_imm, shl, or, frameindex], |
| 277 | []>; |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 278 | def tls32addr : ComplexPattern<i32, 4, "SelectTLSADDRAddr", |
| 279 | [tglobaltlsaddr], []>; |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 280 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 281 | //===----------------------------------------------------------------------===// |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 282 | // X86 Instruction Predicate Definitions. |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 283 | def HasMMX : Predicate<"Subtarget->hasMMX()">; |
| 284 | def HasSSE1 : Predicate<"Subtarget->hasSSE1()">; |
| 285 | def HasSSE2 : Predicate<"Subtarget->hasSSE2()">; |
| 286 | def HasSSE3 : Predicate<"Subtarget->hasSSE3()">; |
Bill Wendling | bb1ee05 | 2007-04-10 22:10:25 +0000 | [diff] [blame] | 287 | def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">; |
Nate Begeman | 63ec90a | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 288 | def HasSSE41 : Predicate<"Subtarget->hasSSE41()">; |
| 289 | def HasSSE42 : Predicate<"Subtarget->hasSSE42()">; |
David Greene | 343dadb | 2009-06-26 22:46:54 +0000 | [diff] [blame] | 290 | def HasSSE4A : Predicate<"Subtarget->hasSSE4A()">; |
| 291 | def HasAVX : Predicate<"Subtarget->hasAVX()">; |
| 292 | def HasFMA3 : Predicate<"Subtarget->hasFMA3()">; |
| 293 | def HasFMA4 : Predicate<"Subtarget->hasFMA4()">; |
Dale Johannesen | f1fc3a8 | 2007-09-23 14:52:20 +0000 | [diff] [blame] | 294 | def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">; |
| 295 | def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">; |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 296 | def In32BitMode : Predicate<"!Subtarget->is64Bit()">; |
| 297 | def In64BitMode : Predicate<"Subtarget->is64Bit()">; |
Anton Korobeynikov | cf6b739 | 2009-08-03 08:12:53 +0000 | [diff] [blame] | 298 | def IsWin64 : Predicate<"Subtarget->isTargetWin64()">; |
| 299 | def NotWin64 : Predicate<"!Subtarget->isTargetWin64()">; |
Anton Korobeynikov | d7697d0 | 2009-08-06 11:23:24 +0000 | [diff] [blame] | 300 | def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">; |
| 301 | def KernelCode : Predicate<"TM.getCodeModel() == CodeModel::Kernel">; |
| 302 | def FarData : Predicate<"TM.getCodeModel() != CodeModel::Small &&" |
Anton Korobeynikov | 186fa1d | 2009-08-06 09:11:19 +0000 | [diff] [blame] | 303 | "TM.getCodeModel() != CodeModel::Kernel">; |
Anton Korobeynikov | d7697d0 | 2009-08-06 11:23:24 +0000 | [diff] [blame] | 304 | def NearData : Predicate<"TM.getCodeModel() == CodeModel::Small ||" |
| 305 | "TM.getCodeModel() == CodeModel::Kernel">; |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 306 | def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">; |
Evan Cheng | b1f4981 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 307 | def OptForSize : Predicate<"OptForSize">; |
Evan Cheng | b7a75a5 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 308 | def OptForSpeed : Predicate<"!OptForSize">; |
Evan Cheng | ccb6976 | 2009-01-02 05:35:45 +0000 | [diff] [blame] | 309 | def FastBTMem : Predicate<"!Subtarget->isBTMemSlow()">; |
Evan Cheng | d7f666a | 2009-05-20 04:53:57 +0000 | [diff] [blame] | 310 | def CallImmAddr : Predicate<"Subtarget->IsLegalToCallImmediateAddr(TM)">; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 311 | |
| 312 | //===----------------------------------------------------------------------===// |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 313 | // X86 Instruction Format Definitions. |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 314 | // |
| 315 | |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 316 | include "X86InstrFormats.td" |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 317 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 318 | //===----------------------------------------------------------------------===// |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 319 | // Pattern fragments... |
| 320 | // |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 321 | |
| 322 | // X86 specific condition code. These correspond to CondCode in |
Nate Begeman | 9a22530 | 2007-05-06 04:00:55 +0000 | [diff] [blame] | 323 | // X86InstrInfo.h. They must be kept in synch. |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 324 | def X86_COND_A : PatLeaf<(i8 0)>; // alt. COND_NBE |
| 325 | def X86_COND_AE : PatLeaf<(i8 1)>; // alt. COND_NC |
| 326 | def X86_COND_B : PatLeaf<(i8 2)>; // alt. COND_C |
| 327 | def X86_COND_BE : PatLeaf<(i8 3)>; // alt. COND_NA |
| 328 | def X86_COND_E : PatLeaf<(i8 4)>; // alt. COND_Z |
| 329 | def X86_COND_G : PatLeaf<(i8 5)>; // alt. COND_NLE |
| 330 | def X86_COND_GE : PatLeaf<(i8 6)>; // alt. COND_NL |
| 331 | def X86_COND_L : PatLeaf<(i8 7)>; // alt. COND_NGE |
| 332 | def X86_COND_LE : PatLeaf<(i8 8)>; // alt. COND_NG |
| 333 | def X86_COND_NE : PatLeaf<(i8 9)>; // alt. COND_NZ |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 334 | def X86_COND_NO : PatLeaf<(i8 10)>; |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 335 | def X86_COND_NP : PatLeaf<(i8 11)>; // alt. COND_PO |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 336 | def X86_COND_NS : PatLeaf<(i8 12)>; |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 337 | def X86_COND_O : PatLeaf<(i8 13)>; |
| 338 | def X86_COND_P : PatLeaf<(i8 14)>; // alt. COND_PE |
| 339 | def X86_COND_S : PatLeaf<(i8 15)>; |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 340 | |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 341 | def i16immSExt8 : PatLeaf<(i16 imm), [{ |
| 342 | // 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] | 343 | // sign extended field. |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 344 | return (int16_t)N->getZExtValue() == (int8_t)N->getZExtValue(); |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 345 | }]>; |
| 346 | |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 347 | def i32immSExt8 : PatLeaf<(i32 imm), [{ |
| 348 | // 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] | 349 | // sign extended field. |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 350 | return (int32_t)N->getZExtValue() == (int8_t)N->getZExtValue(); |
Evan Cheng | b355854 | 2005-12-13 00:01:09 +0000 | [diff] [blame] | 351 | }]>; |
| 352 | |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 353 | // Helper fragments for loads. |
Evan Cheng | b656443 | 2008-05-13 18:59:59 +0000 | [diff] [blame] | 354 | // It's always safe to treat a anyext i16 load as a i32 load if the i16 is |
| 355 | // known to be 32-bit aligned or better. Ditto for i8 to i16. |
Dan Gohman | 3358629 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 356 | def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{ |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 357 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 358 | if (const Value *Src = LD->getSrcValue()) |
| 359 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 360 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 361 | return false; |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 362 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 363 | if (ExtType == ISD::NON_EXTLOAD) |
| 364 | return true; |
| 365 | if (ExtType == ISD::EXTLOAD) |
| 366 | return LD->getAlignment() >= 2 && !LD->isVolatile(); |
Evan Cheng | fa7fd33 | 2008-05-13 00:54:02 +0000 | [diff] [blame] | 367 | return false; |
| 368 | }]>; |
| 369 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 370 | def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), |
| 371 | [{ |
Evan Cheng | ca57f78 | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 372 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 373 | if (const Value *Src = LD->getSrcValue()) |
| 374 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 375 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 376 | return false; |
Evan Cheng | ca57f78 | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 377 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 378 | if (ExtType == ISD::EXTLOAD) |
| 379 | return LD->getAlignment() >= 2 && !LD->isVolatile(); |
| 380 | return false; |
| 381 | }]>; |
| 382 | |
Dan Gohman | 3358629 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 383 | def loadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{ |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 384 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 385 | if (const Value *Src = LD->getSrcValue()) |
| 386 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 387 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 388 | return false; |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 389 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 390 | if (ExtType == ISD::NON_EXTLOAD) |
| 391 | return true; |
| 392 | if (ExtType == ISD::EXTLOAD) |
| 393 | return LD->getAlignment() >= 4 && !LD->isVolatile(); |
Evan Cheng | fa7fd33 | 2008-05-13 00:54:02 +0000 | [diff] [blame] | 394 | return false; |
| 395 | }]>; |
| 396 | |
Dan Gohman | 3358629 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 397 | def nvloadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{ |
Evan Cheng | d47e0b6 | 2008-09-29 17:26:18 +0000 | [diff] [blame] | 398 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 399 | if (const Value *Src = LD->getSrcValue()) |
| 400 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 401 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 402 | return false; |
Evan Cheng | d47e0b6 | 2008-09-29 17:26:18 +0000 | [diff] [blame] | 403 | if (LD->isVolatile()) |
| 404 | return false; |
Evan Cheng | d47e0b6 | 2008-09-29 17:26:18 +0000 | [diff] [blame] | 405 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 406 | if (ExtType == ISD::NON_EXTLOAD) |
| 407 | return true; |
| 408 | if (ExtType == ISD::EXTLOAD) |
| 409 | return LD->getAlignment() >= 4; |
| 410 | return false; |
| 411 | }]>; |
| 412 | |
Nate Begeman | 51a0437 | 2009-01-26 01:24:32 +0000 | [diff] [blame] | 413 | def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 414 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 415 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
| 416 | return PT->getAddressSpace() == 256; |
Nate Begeman | 51a0437 | 2009-01-26 01:24:32 +0000 | [diff] [blame] | 417 | return false; |
| 418 | }]>; |
| 419 | |
Chris Lattner | 1777d0c | 2009-05-05 18:52:19 +0000 | [diff] [blame] | 420 | def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 421 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 422 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
| 423 | return PT->getAddressSpace() == 257; |
| 424 | return false; |
| 425 | }]>; |
| 426 | |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 427 | def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr)), [{ |
| 428 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 429 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 430 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 431 | return false; |
| 432 | return true; |
| 433 | }]>; |
| 434 | def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr)), [{ |
| 435 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 436 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 437 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 438 | return false; |
| 439 | return true; |
| 440 | }]>; |
Evan Cheng | 06a8aa1 | 2006-03-17 19:55:52 +0000 | [diff] [blame] | 441 | |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 442 | def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr)), [{ |
| 443 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 444 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 445 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 446 | return false; |
| 447 | return true; |
| 448 | }]>; |
| 449 | def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr)), [{ |
| 450 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 451 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 452 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 453 | return false; |
| 454 | return true; |
| 455 | }]>; |
| 456 | def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr)), [{ |
| 457 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 458 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 459 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 460 | return false; |
| 461 | return true; |
| 462 | }]>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 463 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 464 | def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>; |
| 465 | def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>; |
| 466 | def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 467 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 468 | def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>; |
| 469 | def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>; |
| 470 | def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>; |
| 471 | def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>; |
| 472 | def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>; |
| 473 | def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 474 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 475 | def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>; |
| 476 | def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>; |
| 477 | def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>; |
| 478 | def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>; |
| 479 | def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>; |
| 480 | def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>; |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 481 | |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 482 | |
| 483 | // An 'and' node with a single use. |
| 484 | def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{ |
Evan Cheng | 07b7ea1 | 2008-03-04 00:40:35 +0000 | [diff] [blame] | 485 | return N->hasOneUse(); |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 486 | }]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 487 | // An 'srl' node with a single use. |
| 488 | def srl_su : PatFrag<(ops node:$lhs, node:$rhs), (srl node:$lhs, node:$rhs), [{ |
| 489 | return N->hasOneUse(); |
| 490 | }]>; |
| 491 | // An 'trunc' node with a single use. |
| 492 | def trunc_su : PatFrag<(ops node:$src), (trunc node:$src), [{ |
| 493 | return N->hasOneUse(); |
| 494 | }]>; |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 495 | |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 496 | // Treat an 'or' node is as an 'add' if the or'ed bits are known to be zero. |
| 497 | def or_is_add : PatFrag<(ops node:$lhs, node:$rhs), (or node:$lhs, node:$rhs),[{ |
| 498 | if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1))) |
| 499 | return CurDAG->MaskedValueIsZero(N->getOperand(0), CN->getAPIntValue()); |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 500 | else { |
| 501 | unsigned BitWidth = N->getValueType(0).getScalarType().getSizeInBits(); |
| 502 | APInt Mask = APInt::getAllOnesValue(BitWidth); |
| 503 | APInt KnownZero0, KnownOne0; |
| 504 | CurDAG->ComputeMaskedBits(N->getOperand(0), Mask, KnownZero0, KnownOne0, 0); |
| 505 | APInt KnownZero1, KnownOne1; |
| 506 | CurDAG->ComputeMaskedBits(N->getOperand(1), Mask, KnownZero1, KnownOne1, 0); |
| 507 | return (~KnownZero0 & ~KnownZero1) == 0; |
| 508 | } |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 509 | }]>; |
| 510 | def or_not_add : PatFrag<(ops node:$lhs, node:$rhs),(or node:$lhs, node:$rhs),[{ |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 511 | if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1))) |
| 512 | return !CurDAG->MaskedValueIsZero(N->getOperand(0), CN->getAPIntValue()); |
| 513 | else { |
| 514 | unsigned BitWidth = N->getValueType(0).getScalarType().getSizeInBits(); |
| 515 | APInt Mask = APInt::getAllOnesValue(BitWidth); |
| 516 | APInt KnownZero0, KnownOne0; |
| 517 | CurDAG->ComputeMaskedBits(N->getOperand(0), Mask, KnownZero0, KnownOne0, 0); |
| 518 | APInt KnownZero1, KnownOne1; |
| 519 | CurDAG->ComputeMaskedBits(N->getOperand(1), Mask, KnownZero1, KnownOne1, 0); |
| 520 | return (~KnownZero0 & ~KnownZero1) != 0; |
| 521 | } |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 522 | }]>; |
| 523 | |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 524 | // 'shld' and 'shrd' instruction patterns. Note that even though these have |
| 525 | // the srl and shl in their patterns, the C++ code must still check for them, |
| 526 | // because predicates are tested before children nodes are explored. |
| 527 | |
| 528 | def shrd : PatFrag<(ops node:$src1, node:$amt1, node:$src2, node:$amt2), |
| 529 | (or (srl node:$src1, node:$amt1), |
| 530 | (shl node:$src2, node:$amt2)), [{ |
| 531 | assert(N->getOpcode() == ISD::OR); |
| 532 | return N->getOperand(0).getOpcode() == ISD::SRL && |
| 533 | N->getOperand(1).getOpcode() == ISD::SHL && |
| 534 | isa<ConstantSDNode>(N->getOperand(0).getOperand(1)) && |
| 535 | isa<ConstantSDNode>(N->getOperand(1).getOperand(1)) && |
| 536 | N->getOperand(0).getConstantOperandVal(1) == |
| 537 | N->getValueSizeInBits(0) - N->getOperand(1).getConstantOperandVal(1); |
| 538 | }]>; |
| 539 | |
| 540 | def shld : PatFrag<(ops node:$src1, node:$amt1, node:$src2, node:$amt2), |
| 541 | (or (shl node:$src1, node:$amt1), |
| 542 | (srl node:$src2, node:$amt2)), [{ |
| 543 | assert(N->getOpcode() == ISD::OR); |
| 544 | return N->getOperand(0).getOpcode() == ISD::SHL && |
| 545 | N->getOperand(1).getOpcode() == ISD::SRL && |
| 546 | isa<ConstantSDNode>(N->getOperand(0).getOperand(1)) && |
| 547 | isa<ConstantSDNode>(N->getOperand(1).getOperand(1)) && |
| 548 | N->getOperand(0).getConstantOperandVal(1) == |
| 549 | N->getValueSizeInBits(0) - N->getOperand(1).getConstantOperandVal(1); |
| 550 | }]>; |
| 551 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 552 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 553 | // Instruction list... |
| 554 | // |
| 555 | |
Chris Lattner | f18c074 | 2006-10-12 17:42:56 +0000 | [diff] [blame] | 556 | // ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into |
| 557 | // a stack adjustment and the codegen must know that they may modify the stack |
| 558 | // pointer before prolog-epilog rewriting occurs. |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 559 | // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become |
| 560 | // sub / add which can clobber EFLAGS. |
Evan Cheng | 8decf6b | 2007-09-28 01:19:48 +0000 | [diff] [blame] | 561 | let Defs = [ESP, EFLAGS], Uses = [ESP] in { |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 562 | def ADJCALLSTACKDOWN32 : I<0, Pseudo, (outs), (ins i32imm:$amt), |
| 563 | "#ADJCALLSTACKDOWN", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 564 | [(X86callseq_start timm:$amt)]>, |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 565 | Requires<[In32BitMode]>; |
| 566 | def ADJCALLSTACKUP32 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), |
| 567 | "#ADJCALLSTACKUP", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 568 | [(X86callseq_end timm:$amt1, timm:$amt2)]>, |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 569 | Requires<[In32BitMode]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 570 | } |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 571 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 572 | // x86-64 va_start lowering magic. |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 573 | let usesCustomInserter = 1 in |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 574 | def VASTART_SAVE_XMM_REGS : I<0, Pseudo, |
| 575 | (outs), |
| 576 | (ins GR8:$al, |
| 577 | i64imm:$regsavefi, i64imm:$offset, |
| 578 | variable_ops), |
| 579 | "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset", |
| 580 | [(X86vastart_save_xmm_regs GR8:$al, |
| 581 | imm:$regsavefi, |
| 582 | imm:$offset)]>; |
| 583 | |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 584 | // Nop |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 585 | let neverHasSideEffects = 1 in { |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 586 | def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 587 | def NOOPW : I<0x1f, MRM0m, (outs), (ins i16mem:$zero), |
| 588 | "nop{w}\t$zero", []>, TB, OpSize; |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 589 | def NOOPL : I<0x1f, MRM0m, (outs), (ins i32mem:$zero), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 590 | "nop{l}\t$zero", []>, TB; |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 591 | } |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 592 | |
Sean Callanan | 1c5cf1b | 2009-08-11 01:09:06 +0000 | [diff] [blame] | 593 | // Trap |
Dan Gohman | e94975e | 2009-11-11 18:07:16 +0000 | [diff] [blame] | 594 | def INT3 : I<0xcc, RawFrm, (outs), (ins), "int\t3", []>; |
Sean Callanan | 1c5cf1b | 2009-08-11 01:09:06 +0000 | [diff] [blame] | 595 | def INT : I<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 596 | def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", []>, OpSize; |
| 597 | def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l}", []>; |
Sean Callanan | 1c5cf1b | 2009-08-11 01:09:06 +0000 | [diff] [blame] | 598 | |
Chris Lattner | 71c7ace | 2009-09-20 07:32:00 +0000 | [diff] [blame] | 599 | // PIC base construction. This expands to code that looks like this: |
| 600 | // call $next_inst |
| 601 | // popl %destreg" |
Dan Gohman | 2662d55 | 2008-10-01 04:14:30 +0000 | [diff] [blame] | 602 | let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in |
Chris Lattner | b3c8547 | 2009-09-20 07:28:26 +0000 | [diff] [blame] | 603 | def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins i32imm:$label), |
Chris Lattner | 71c7ace | 2009-09-20 07:32:00 +0000 | [diff] [blame] | 604 | "", []>; |
Evan Cheng | 8f7f712 | 2006-05-05 05:40:20 +0000 | [diff] [blame] | 605 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 606 | //===----------------------------------------------------------------------===// |
| 607 | // Control Flow Instructions... |
| 608 | // |
| 609 | |
Chris Lattner | 1be4811 | 2005-05-13 17:56:48 +0000 | [diff] [blame] | 610 | // Return instructions. |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 611 | let isTerminator = 1, isReturn = 1, isBarrier = 1, |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 612 | hasCtrlDep = 1, FPForm = SpecialFP, FPFormBits = SpecialFP.Value in { |
Dan Gohman | e4c67cd | 2008-05-31 02:11:25 +0000 | [diff] [blame] | 613 | def RET : I <0xC3, RawFrm, (outs), (ins variable_ops), |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 614 | "ret", |
Dan Gohman | e4c67cd | 2008-05-31 02:11:25 +0000 | [diff] [blame] | 615 | [(X86retflag 0)]>; |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 616 | def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops), |
| 617 | "ret\t$amt", |
Dan Gohman | 2f67df7 | 2009-09-03 17:18:51 +0000 | [diff] [blame] | 618 | [(X86retflag timm:$amt)]>; |
Sean Callanan | 356aed5 | 2009-09-15 23:37:51 +0000 | [diff] [blame] | 619 | def LRET : I <0xCB, RawFrm, (outs), (ins), |
| 620 | "lret", []>; |
| 621 | def LRETI : Ii16<0xCA, RawFrm, (outs), (ins i16imm:$amt), |
| 622 | "lret\t$amt", []>; |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 623 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 624 | |
| 625 | // All branches are RawFrm, Void, Branch, and Terminators |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 626 | let isBranch = 1, isTerminator = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 627 | class IBr<bits<8> opcode, dag ins, string asm, list<dag> pattern> : |
| 628 | I<opcode, RawFrm, (outs), ins, asm, pattern>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 629 | |
Sean Callanan | 5292588 | 2009-07-22 01:05:20 +0000 | [diff] [blame] | 630 | let isBranch = 1, isBarrier = 1 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 631 | def JMP : IBr<0xE9, (ins brtarget:$dst), "jmp\t$dst", [(br bb:$dst)]>; |
Sean Callanan | 5292588 | 2009-07-22 01:05:20 +0000 | [diff] [blame] | 632 | def JMP8 : IBr<0xEB, (ins brtarget8:$dst), "jmp\t$dst", []>; |
| 633 | } |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 634 | |
Owen Anderson | 20ab290 | 2007-11-12 07:39:39 +0000 | [diff] [blame] | 635 | // Indirect branches |
| 636 | let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 637 | def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 638 | [(brind GR32:$dst)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 639 | def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst", |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 640 | [(brind (loadi32 addr:$dst))]>; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 641 | |
| 642 | def FARJMP16i : Iseg16<0xEA, RawFrm, (outs), |
| 643 | (ins i16imm:$seg, i16imm:$off), |
| 644 | "ljmp{w}\t$seg, $off", []>, OpSize; |
| 645 | def FARJMP32i : Iseg32<0xEA, RawFrm, (outs), |
| 646 | (ins i16imm:$seg, i32imm:$off), |
| 647 | "ljmp{l}\t$seg, $off", []>; |
| 648 | |
| 649 | def FARJMP16m : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 650 | "ljmp{w}\t{*}$dst", []>, OpSize; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 651 | def FARJMP32m : I<0xFF, MRM5m, (outs), (ins opaque48mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 652 | "ljmp{l}\t{*}$dst", []>; |
Nate Begeman | 37efe67 | 2006-04-22 18:53:45 +0000 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | // Conditional branches |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 656 | let Uses = [EFLAGS] in { |
Evan Cheng | 77159e3 | 2009-07-21 06:00:18 +0000 | [diff] [blame] | 657 | // Short conditional jumps |
| 658 | def JO8 : IBr<0x70, (ins brtarget8:$dst), "jo\t$dst", []>; |
| 659 | def JNO8 : IBr<0x71, (ins brtarget8:$dst), "jno\t$dst", []>; |
| 660 | def JB8 : IBr<0x72, (ins brtarget8:$dst), "jb\t$dst", []>; |
| 661 | def JAE8 : IBr<0x73, (ins brtarget8:$dst), "jae\t$dst", []>; |
| 662 | def JE8 : IBr<0x74, (ins brtarget8:$dst), "je\t$dst", []>; |
| 663 | def JNE8 : IBr<0x75, (ins brtarget8:$dst), "jne\t$dst", []>; |
| 664 | def JBE8 : IBr<0x76, (ins brtarget8:$dst), "jbe\t$dst", []>; |
| 665 | def JA8 : IBr<0x77, (ins brtarget8:$dst), "ja\t$dst", []>; |
| 666 | def JS8 : IBr<0x78, (ins brtarget8:$dst), "js\t$dst", []>; |
| 667 | def JNS8 : IBr<0x79, (ins brtarget8:$dst), "jns\t$dst", []>; |
| 668 | def JP8 : IBr<0x7A, (ins brtarget8:$dst), "jp\t$dst", []>; |
| 669 | def JNP8 : IBr<0x7B, (ins brtarget8:$dst), "jnp\t$dst", []>; |
| 670 | def JL8 : IBr<0x7C, (ins brtarget8:$dst), "jl\t$dst", []>; |
| 671 | def JGE8 : IBr<0x7D, (ins brtarget8:$dst), "jge\t$dst", []>; |
| 672 | def JLE8 : IBr<0x7E, (ins brtarget8:$dst), "jle\t$dst", []>; |
| 673 | def JG8 : IBr<0x7F, (ins brtarget8:$dst), "jg\t$dst", []>; |
| 674 | |
| 675 | def JCXZ8 : IBr<0xE3, (ins brtarget8:$dst), "jcxz\t$dst", []>; |
| 676 | |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 677 | def JE : IBr<0x84, (ins brtarget:$dst), "je\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 678 | [(X86brcond bb:$dst, X86_COND_E, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 679 | def JNE : IBr<0x85, (ins brtarget:$dst), "jne\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 680 | [(X86brcond bb:$dst, X86_COND_NE, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 681 | def JL : IBr<0x8C, (ins brtarget:$dst), "jl\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 682 | [(X86brcond bb:$dst, X86_COND_L, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 683 | def JLE : IBr<0x8E, (ins brtarget:$dst), "jle\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 684 | [(X86brcond bb:$dst, X86_COND_LE, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 685 | def JG : IBr<0x8F, (ins brtarget:$dst), "jg\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 686 | [(X86brcond bb:$dst, X86_COND_G, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 687 | def JGE : IBr<0x8D, (ins brtarget:$dst), "jge\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 688 | [(X86brcond bb:$dst, X86_COND_GE, EFLAGS)]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 689 | |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 690 | def JB : IBr<0x82, (ins brtarget:$dst), "jb\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 691 | [(X86brcond bb:$dst, X86_COND_B, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 692 | def JBE : IBr<0x86, (ins brtarget:$dst), "jbe\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 693 | [(X86brcond bb:$dst, X86_COND_BE, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 694 | def JA : IBr<0x87, (ins brtarget:$dst), "ja\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 695 | [(X86brcond bb:$dst, X86_COND_A, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 696 | def JAE : IBr<0x83, (ins brtarget:$dst), "jae\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 697 | [(X86brcond bb:$dst, X86_COND_AE, EFLAGS)]>, TB; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 698 | |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 699 | def JS : IBr<0x88, (ins brtarget:$dst), "js\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 700 | [(X86brcond bb:$dst, X86_COND_S, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 701 | def JNS : IBr<0x89, (ins brtarget:$dst), "jns\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 702 | [(X86brcond bb:$dst, X86_COND_NS, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 703 | def JP : IBr<0x8A, (ins brtarget:$dst), "jp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 704 | [(X86brcond bb:$dst, X86_COND_P, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 705 | def JNP : IBr<0x8B, (ins brtarget:$dst), "jnp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 706 | [(X86brcond bb:$dst, X86_COND_NP, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 707 | def JO : IBr<0x80, (ins brtarget:$dst), "jo\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 708 | [(X86brcond bb:$dst, X86_COND_O, EFLAGS)]>, TB; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 709 | def JNO : IBr<0x81, (ins brtarget:$dst), "jno\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 710 | [(X86brcond bb:$dst, X86_COND_NO, EFLAGS)]>, TB; |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 711 | } // Uses = [EFLAGS] |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 712 | |
Sean Callanan | 7e6d727 | 2009-09-16 21:50:07 +0000 | [diff] [blame] | 713 | // Loop instructions |
| 714 | |
| 715 | def LOOP : I<0xE2, RawFrm, (ins brtarget8:$dst), (outs), "loop\t$dst", []>; |
| 716 | def LOOPE : I<0xE1, RawFrm, (ins brtarget8:$dst), (outs), "loope\t$dst", []>; |
| 717 | def LOOPNE : I<0xE0, RawFrm, (ins brtarget8:$dst), (outs), "loopne\t$dst", []>; |
| 718 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 719 | //===----------------------------------------------------------------------===// |
| 720 | // Call Instructions... |
| 721 | // |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 722 | let isCall = 1 in |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 723 | // All calls clobber the non-callee saved registers. ESP is marked as |
| 724 | // a use to prevent stack-pointer assignments that appear immediately |
| 725 | // before calls from potentially appearing dead. Uses for argument |
| 726 | // registers are added manually. |
Nate Begeman | f63be7d | 2005-07-06 18:59:04 +0000 | [diff] [blame] | 727 | let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, |
Bill Wendling | 3f3a17d | 2007-04-25 21:31:48 +0000 | [diff] [blame] | 728 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, |
Evan Cheng | 109a562 | 2008-10-17 21:02:22 +0000 | [diff] [blame] | 729 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, |
| 730 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], |
Dan Gohman | 2662d55 | 2008-10-01 04:14:30 +0000 | [diff] [blame] | 731 | Uses = [ESP] in { |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 732 | def CALLpcrel32 : Ii32<0xE8, RawFrm, |
| 733 | (outs), (ins i32imm_pcrel:$dst,variable_ops), |
| 734 | "call\t$dst", []>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 735 | def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 736 | "call\t{*}$dst", [(X86call GR32:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 737 | def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops), |
Dan Gohman | b410617 | 2008-05-29 21:50:34 +0000 | [diff] [blame] | 738 | "call\t{*}$dst", [(X86call (loadi32 addr:$dst))]>; |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 739 | |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 740 | def FARCALL16i : Iseg16<0x9A, RawFrm, (outs), |
| 741 | (ins i16imm:$seg, i16imm:$off), |
| 742 | "lcall{w}\t$seg, $off", []>, OpSize; |
| 743 | def FARCALL32i : Iseg32<0x9A, RawFrm, (outs), |
| 744 | (ins i16imm:$seg, i32imm:$off), |
| 745 | "lcall{l}\t$seg, $off", []>; |
| 746 | |
| 747 | def FARCALL16m : I<0xFF, MRM3m, (outs), (ins opaque32mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 748 | "lcall{w}\t{*}$dst", []>, OpSize; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 749 | def FARCALL32m : I<0xFF, MRM3m, (outs), (ins opaque48mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 750 | "lcall{l}\t{*}$dst", []>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 751 | } |
| 752 | |
Sean Callanan | 8d70854 | 2009-09-16 02:57:13 +0000 | [diff] [blame] | 753 | // Constructing a stack frame. |
| 754 | |
| 755 | def ENTER : I<0xC8, RawFrm, (outs), (ins i16imm:$len, i8imm:$lvl), |
| 756 | "enter\t$len, $lvl", []>; |
| 757 | |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 758 | // Tail call stuff. |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 759 | |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 760 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 761 | def TCRETURNdi : I<0, Pseudo, (outs), |
| 762 | (ins i32imm:$dst, i32imm:$offset, variable_ops), |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 763 | "#TC_RETURN $dst $offset", |
| 764 | []>; |
| 765 | |
| 766 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 767 | def TCRETURNri : I<0, Pseudo, (outs), |
| 768 | (ins GR32:$dst, i32imm:$offset, variable_ops), |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 769 | "#TC_RETURN $dst $offset", |
| 770 | []>; |
| 771 | |
| 772 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 773 | def TAILJMPd : IBr<0xE9, (ins i32imm_pcrel:$dst), "jmp\t$dst # TAILCALL", |
Evan Cheng | f10c17f | 2006-09-22 21:43:59 +0000 | [diff] [blame] | 774 | []>; |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 775 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 776 | def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32:$dst), |
| 777 | "jmp{l}\t{*}$dst # TAILCALL", |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 778 | []>; |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 779 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 780 | def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 781 | "jmp\t{*}$dst # TAILCALL", []>; |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 782 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 783 | //===----------------------------------------------------------------------===// |
| 784 | // Miscellaneous Instructions... |
| 785 | // |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 786 | let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 787 | def LEAVE : I<0xC9, RawFrm, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 788 | (outs), (ins), "leave", []>; |
| 789 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 790 | def POPCNT16rr : I<0xB8, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 791 | "popcnt{w}\t{$src, $dst|$dst, $src}", []>, OpSize, XS; |
| 792 | def POPCNT16rm : I<0xB8, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 793 | "popcnt{w}\t{$src, $dst|$dst, $src}", []>, OpSize, XS; |
| 794 | def POPCNT32rr : I<0xB8, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 795 | "popcnt{l}\t{$src, $dst|$dst, $src}", []>, XS; |
| 796 | def POPCNT32rm : I<0xB8, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 797 | "popcnt{l}\t{$src, $dst|$dst, $src}", []>, XS; |
| 798 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 799 | let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in { |
Sean Callanan | 1f24e01 | 2009-09-10 18:29:13 +0000 | [diff] [blame] | 800 | let mayLoad = 1 in { |
| 801 | def POP16r : I<0x58, AddRegFrm, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>, |
| 802 | OpSize; |
| 803 | def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>; |
| 804 | def POP16rmr: I<0x8F, MRM0r, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>, |
| 805 | OpSize; |
| 806 | def POP16rmm: I<0x8F, MRM0m, (outs i16mem:$dst), (ins), "pop{w}\t$dst", []>, |
| 807 | OpSize; |
| 808 | def POP32rmr: I<0x8F, MRM0r, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>; |
| 809 | def POP32rmm: I<0x8F, MRM0m, (outs i32mem:$dst), (ins), "pop{l}\t$dst", []>; |
| 810 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 811 | |
Sean Callanan | 1f24e01 | 2009-09-10 18:29:13 +0000 | [diff] [blame] | 812 | let mayStore = 1 in { |
| 813 | def PUSH16r : I<0x50, AddRegFrm, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>, |
| 814 | OpSize; |
Evan Cheng | 2f245ba | 2007-09-26 01:29:06 +0000 | [diff] [blame] | 815 | def PUSH32r : I<0x50, AddRegFrm, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>; |
Sean Callanan | 1f24e01 | 2009-09-10 18:29:13 +0000 | [diff] [blame] | 816 | def PUSH16rmr: I<0xFF, MRM6r, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>, |
| 817 | OpSize; |
| 818 | def PUSH16rmm: I<0xFF, MRM6m, (outs), (ins i16mem:$src), "push{w}\t$src",[]>, |
| 819 | OpSize; |
| 820 | def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>; |
| 821 | def PUSH32rmm: I<0xFF, MRM6m, (outs), (ins i32mem:$src), "push{l}\t$src",[]>; |
| 822 | } |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 823 | } |
Anton Korobeynikov | 57fc00d | 2007-04-17 09:20:00 +0000 | [diff] [blame] | 824 | |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 825 | let Defs = [ESP], Uses = [ESP], neverHasSideEffects = 1, mayStore = 1 in { |
| 826 | def PUSH32i8 : Ii8<0x6a, RawFrm, (outs), (ins i8imm:$imm), |
Bill Wendling | 927788c | 2009-06-15 20:59:31 +0000 | [diff] [blame] | 827 | "push{l}\t$imm", []>; |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 828 | def PUSH32i16 : Ii16<0x68, RawFrm, (outs), (ins i16imm:$imm), |
Bill Wendling | 927788c | 2009-06-15 20:59:31 +0000 | [diff] [blame] | 829 | "push{l}\t$imm", []>; |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 830 | def PUSH32i32 : Ii32<0x68, RawFrm, (outs), (ins i32imm:$imm), |
Bill Wendling | 927788c | 2009-06-15 20:59:31 +0000 | [diff] [blame] | 831 | "push{l}\t$imm", []>; |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 832 | } |
| 833 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 834 | let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in { |
| 835 | def POPF : I<0x9D, RawFrm, (outs), (ins), "popf{w}", []>, OpSize; |
| 836 | def POPFD : I<0x9D, RawFrm, (outs), (ins), "popf{l}", []>; |
| 837 | } |
| 838 | let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in { |
| 839 | def PUSHF : I<0x9C, RawFrm, (outs), (ins), "pushf{w}", []>, OpSize; |
| 840 | def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf{l}", []>; |
| 841 | } |
Evan Cheng | 2f245ba | 2007-09-26 01:29:06 +0000 | [diff] [blame] | 842 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 843 | let isTwoAddress = 1 in // GR32 = bswap GR32 |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 844 | def BSWAP32r : I<0xC8, AddRegFrm, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 845 | (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 846 | "bswap{l}\t$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 847 | [(set GR32:$dst, (bswap GR32:$src))]>, TB; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 848 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 849 | |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 850 | // Bit scan instructions. |
| 851 | let Defs = [EFLAGS] in { |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 852 | def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 853 | "bsf{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 854 | [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 855 | def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 856 | "bsf{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 857 | [(set GR16:$dst, (X86bsf (loadi16 addr:$src))), |
| 858 | (implicit EFLAGS)]>, TB; |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 859 | def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 860 | "bsf{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 861 | [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 862 | def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 863 | "bsf{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 864 | [(set GR32:$dst, (X86bsf (loadi32 addr:$src))), |
| 865 | (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 866 | |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 867 | def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 868 | "bsr{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 869 | [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 870 | def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 871 | "bsr{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 872 | [(set GR16:$dst, (X86bsr (loadi16 addr:$src))), |
| 873 | (implicit EFLAGS)]>, TB; |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 874 | def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 875 | "bsr{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 876 | [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 877 | def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 878 | "bsr{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 152804e | 2007-12-14 08:30:15 +0000 | [diff] [blame] | 879 | [(set GR32:$dst, (X86bsr (loadi32 addr:$src))), |
| 880 | (implicit EFLAGS)]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 881 | } // Defs = [EFLAGS] |
| 882 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 883 | let neverHasSideEffects = 1 in |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 884 | def LEA16r : I<0x8D, MRMSrcMem, |
Evan Cheng | 15b0d97 | 2009-12-12 18:51:56 +0000 | [diff] [blame] | 885 | (outs GR16:$dst), (ins lea32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 886 | "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize; |
Evan Cheng | e771ebd | 2008-03-27 01:41:09 +0000 | [diff] [blame] | 887 | let isReMaterializable = 1 in |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 888 | def LEA32r : I<0x8D, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 889 | (outs GR32:$dst), (ins lea32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 890 | "lea{l}\t{$src|$dst}, {$dst|$src}", |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 891 | [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 892 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 893 | let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 894 | def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 895 | [(X86rep_movs i8)]>, REP; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 896 | def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 897 | [(X86rep_movs i16)]>, REP, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 898 | def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 899 | [(X86rep_movs i32)]>, REP; |
| 900 | } |
Chris Lattner | 915e5e5 | 2004-02-12 17:53:22 +0000 | [diff] [blame] | 901 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 902 | let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 903 | def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 904 | [(X86rep_stos i8)]>, REP; |
| 905 | let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 906 | def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 907 | [(X86rep_stos i16)]>, REP, OpSize; |
| 908 | let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 909 | def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 910 | [(X86rep_stos i32)]>, REP; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 911 | |
Sean Callanan | a82e465 | 2009-09-12 00:37:19 +0000 | [diff] [blame] | 912 | def SCAS8 : I<0xAE, RawFrm, (outs), (ins), "scas{b}", []>; |
| 913 | def SCAS16 : I<0xAF, RawFrm, (outs), (ins), "scas{w}", []>, OpSize; |
| 914 | def SCAS32 : I<0xAF, RawFrm, (outs), (ins), "scas{l}", []>; |
| 915 | |
Sean Callanan | 6f8f462 | 2009-09-12 02:25:20 +0000 | [diff] [blame] | 916 | def CMPS8 : I<0xA6, RawFrm, (outs), (ins), "cmps{b}", []>; |
| 917 | def CMPS16 : I<0xA7, RawFrm, (outs), (ins), "cmps{w}", []>, OpSize; |
| 918 | def CMPS32 : I<0xA7, RawFrm, (outs), (ins), "cmps{l}", []>; |
| 919 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 920 | let Defs = [RAX, RDX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 921 | def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 922 | TB; |
Chris Lattner | b89abef | 2004-02-14 04:45:37 +0000 | [diff] [blame] | 923 | |
Anton Korobeynikov | 66fac79 | 2008-01-15 07:02:33 +0000 | [diff] [blame] | 924 | let isBarrier = 1, hasCtrlDep = 1 in { |
Chris Lattner | da68d30 | 2008-01-15 21:58:22 +0000 | [diff] [blame] | 925 | def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB; |
Anton Korobeynikov | 66fac79 | 2008-01-15 07:02:33 +0000 | [diff] [blame] | 926 | } |
| 927 | |
Chris Lattner | 02552de | 2009-08-11 16:58:39 +0000 | [diff] [blame] | 928 | def SYSCALL : I<0x05, RawFrm, |
| 929 | (outs), (ins), "syscall", []>, TB; |
| 930 | def SYSRET : I<0x07, RawFrm, |
| 931 | (outs), (ins), "sysret", []>, TB; |
| 932 | def SYSENTER : I<0x34, RawFrm, |
| 933 | (outs), (ins), "sysenter", []>, TB; |
| 934 | def SYSEXIT : I<0x35, RawFrm, |
| 935 | (outs), (ins), "sysexit", []>, TB; |
| 936 | |
Sean Callanan | 2a46f36 | 2009-09-12 02:52:41 +0000 | [diff] [blame] | 937 | def WAIT : I<0x9B, RawFrm, (outs), (ins), "wait", []>; |
Chris Lattner | 02552de | 2009-08-11 16:58:39 +0000 | [diff] [blame] | 938 | |
| 939 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 940 | //===----------------------------------------------------------------------===// |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 941 | // Input/Output Instructions... |
| 942 | // |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 943 | let Defs = [AL], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 944 | def IN8rr : I<0xEC, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 945 | "in{b}\t{%dx, %al|%AL, %DX}", []>; |
| 946 | let Defs = [AX], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 947 | def IN16rr : I<0xED, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 948 | "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize; |
| 949 | let Defs = [EAX], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 950 | def IN32rr : I<0xED, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 951 | "in{l}\t{%dx, %eax|%EAX, %DX}", []>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 952 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 953 | let Defs = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 954 | def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 955 | "in{b}\t{$port, %al|%AL, $port}", []>; |
| 956 | let Defs = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 957 | def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 958 | "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize; |
| 959 | let Defs = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 960 | def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 961 | "in{l}\t{$port, %eax|%EAX, $port}", []>; |
Chris Lattner | 440bbc2 | 2004-04-13 17:19:31 +0000 | [diff] [blame] | 962 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 963 | let Uses = [DX, AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 964 | def OUT8rr : I<0xEE, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 965 | "out{b}\t{%al, %dx|%DX, %AL}", []>; |
| 966 | let Uses = [DX, AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 967 | def OUT16rr : I<0xEF, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 968 | "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize; |
| 969 | let Uses = [DX, EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 970 | def OUT32rr : I<0xEF, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 971 | "out{l}\t{%eax, %dx|%DX, %EAX}", []>; |
Chris Lattner | ffff708 | 2004-08-01 07:44:35 +0000 | [diff] [blame] | 972 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 973 | let Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 974 | def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 975 | "out{b}\t{%al, $port|$port, %AL}", []>; |
| 976 | let Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 977 | def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 978 | "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize; |
| 979 | let Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 980 | def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 981 | "out{l}\t{%eax, $port|$port, %EAX}", []>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 982 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 983 | def IN8 : I<0x6C, RawFrm, (outs), (ins), |
| 984 | "ins{b}", []>; |
| 985 | def IN16 : I<0x6D, RawFrm, (outs), (ins), |
| 986 | "ins{w}", []>, OpSize; |
| 987 | def IN32 : I<0x6D, RawFrm, (outs), (ins), |
| 988 | "ins{l}", []>; |
| 989 | |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 990 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 991 | // Move Instructions... |
| 992 | // |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 993 | let neverHasSideEffects = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 994 | def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 995 | "mov{b}\t{$src, $dst|$dst, $src}", []>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 996 | def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 997 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 998 | def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 999 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1000 | } |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 1001 | let isReMaterializable = 1, isAsCheapAsAMove = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1002 | def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1003 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1004 | [(set GR8:$dst, imm:$src)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1005 | def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1006 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1007 | [(set GR16:$dst, imm:$src)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1008 | def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1009 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1010 | [(set GR32:$dst, imm:$src)]>; |
Dan Gohman | d45eddd | 2007-06-26 00:48:07 +0000 | [diff] [blame] | 1011 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1012 | def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1013 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1014 | [(store (i8 imm:$src), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1015 | def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1016 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1017 | [(store (i16 imm:$src), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1018 | def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1019 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1020 | [(store (i32 imm:$src), addr:$dst)]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1021 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1022 | def MOV8o8a : Ii8 <0xA0, RawFrm, (outs), (ins offset8:$src), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1023 | "mov{b}\t{$src, %al|%al, $src}", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1024 | def MOV16o16a : Ii16 <0xA1, RawFrm, (outs), (ins offset16:$src), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1025 | "mov{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1026 | def MOV32o32a : Ii32 <0xA1, RawFrm, (outs), (ins offset32:$src), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1027 | "mov{l}\t{$src, %eax|%eax, $src}", []>; |
| 1028 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1029 | def MOV8ao8 : Ii8 <0xA2, RawFrm, (outs offset8:$dst), (ins), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1030 | "mov{b}\t{%al, $dst|$dst, %al}", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1031 | def MOV16ao16 : Ii16 <0xA3, RawFrm, (outs offset16:$dst), (ins), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1032 | "mov{w}\t{%ax, $dst|$dst, %ax}", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1033 | def MOV32ao32 : Ii32 <0xA3, RawFrm, (outs offset32:$dst), (ins), |
Sean Callanan | 2f34a13 | 2009-09-10 18:33:42 +0000 | [diff] [blame] | 1034 | "mov{l}\t{%eax, $dst|$dst, %eax}", []>; |
| 1035 | |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1036 | // Moves to and from segment registers |
| 1037 | def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src), |
| 1038 | "mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 1039 | def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src), |
| 1040 | "mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 1041 | def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src), |
| 1042 | "mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 1043 | def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src), |
| 1044 | "mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 1045 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1046 | def MOV8rr_REV : I<0x8A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src), |
| 1047 | "mov{b}\t{$src, $dst|$dst, $src}", []>; |
| 1048 | def MOV16rr_REV : I<0x8B, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 1049 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1050 | def MOV32rr_REV : I<0x8B, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 1051 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
| 1052 | |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1053 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1054 | def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1055 | "mov{b}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1056 | [(set GR8:$dst, (loadi8 addr:$src))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1057 | def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1058 | "mov{w}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1059 | [(set GR16:$dst, (loadi16 addr:$src))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1060 | def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1061 | "mov{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1062 | [(set GR32:$dst, (loadi32 addr:$src))]>; |
Evan Cheng | 2f39426 | 2007-08-30 05:49:43 +0000 | [diff] [blame] | 1063 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1064 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1065 | def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1066 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1067 | [(store GR8:$src, addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1068 | def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1069 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1070 | [(store GR16:$src, addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1071 | def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1072 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1073 | [(store GR32:$src, addr:$dst)]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 1074 | |
Dan Gohman | 4af325d | 2009-04-27 16:41:36 +0000 | [diff] [blame] | 1075 | // Versions of MOV8rr, MOV8mr, and MOV8rm that use i8mem_NOREX and GR8_NOREX so |
| 1076 | // that they can be used for copying and storing h registers, which can't be |
| 1077 | // encoded when a REX prefix is present. |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1078 | let neverHasSideEffects = 1 in |
Dan Gohman | df7dfc7 | 2009-04-15 19:48:57 +0000 | [diff] [blame] | 1079 | def MOV8rr_NOREX : I<0x88, MRMDestReg, |
| 1080 | (outs GR8_NOREX:$dst), (ins GR8_NOREX:$src), |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1081 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Evan Cheng | 8c14740 | 2009-04-30 00:58:57 +0000 | [diff] [blame] | 1082 | let mayStore = 1 in |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1083 | def MOV8mr_NOREX : I<0x88, MRMDestMem, |
| 1084 | (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src), |
| 1085 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Evan Cheng | 8c14740 | 2009-04-30 00:58:57 +0000 | [diff] [blame] | 1086 | let mayLoad = 1, |
| 1087 | canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Dan Gohman | 4af325d | 2009-04-27 16:41:36 +0000 | [diff] [blame] | 1088 | def MOV8rm_NOREX : I<0x8A, MRMSrcMem, |
| 1089 | (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src), |
| 1090 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 1091 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1092 | // Moves to and from debug registers |
| 1093 | def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src), |
| 1094 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1095 | def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src), |
| 1096 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1097 | |
| 1098 | // Moves to and from control registers |
| 1099 | def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG_32:$src), |
| 1100 | "mov{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1101 | def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG_32:$dst), (ins GR32:$src), |
| 1102 | "mov{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1103 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1104 | //===----------------------------------------------------------------------===// |
| 1105 | // Fixed-Register Multiplication and Division Instructions... |
| 1106 | // |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1107 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 1108 | // Extra precision multiplication |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1109 | let Defs = [AL,AH,EFLAGS], Uses = [AL] in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1110 | def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src", |
Evan Cheng | cf74a7c | 2006-01-15 10:05:20 +0000 | [diff] [blame] | 1111 | // FIXME: Used for 8-bit mul, ignore result upper 8 bits. |
| 1112 | // This probably ought to be moved to a def : Pat<> if the |
| 1113 | // syntax can be accepted. |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1114 | [(set AL, (mul AL, GR8:$src)), |
| 1115 | (implicit EFLAGS)]>; // AL,AH = AL*GR8 |
| 1116 | |
Chris Lattner | a731c9f | 2008-01-11 07:18:17 +0000 | [diff] [blame] | 1117 | let Defs = [AX,DX,EFLAGS], Uses = [AX], neverHasSideEffects = 1 in |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1118 | def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), |
| 1119 | "mul{w}\t$src", |
| 1120 | []>, OpSize; // AX,DX = AX*GR16 |
| 1121 | |
Chris Lattner | a731c9f | 2008-01-11 07:18:17 +0000 | [diff] [blame] | 1122 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], neverHasSideEffects = 1 in |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1123 | def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), |
| 1124 | "mul{l}\t$src", |
| 1125 | []>; // EAX,EDX = EAX*GR32 |
| 1126 | |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1127 | let Defs = [AL,AH,EFLAGS], Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1128 | def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1129 | "mul{b}\t$src", |
Evan Cheng | cf74a7c | 2006-01-15 10:05:20 +0000 | [diff] [blame] | 1130 | // FIXME: Used for 8-bit mul, ignore result upper 8 bits. |
| 1131 | // This probably ought to be moved to a def : Pat<> if the |
| 1132 | // syntax can be accepted. |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1133 | [(set AL, (mul AL, (loadi8 addr:$src))), |
| 1134 | (implicit EFLAGS)]>; // AL,AH = AL*[mem8] |
| 1135 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1136 | let mayLoad = 1, neverHasSideEffects = 1 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1137 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1138 | def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1139 | "mul{w}\t$src", |
| 1140 | []>, OpSize; // AX,DX = AX*[mem16] |
| 1141 | |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1142 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1143 | def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1144 | "mul{l}\t$src", |
| 1145 | []>; // EAX,EDX = EAX*[mem32] |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1146 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1147 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1148 | let neverHasSideEffects = 1 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1149 | let Defs = [AL,AH,EFLAGS], Uses = [AL] in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1150 | def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>; |
| 1151 | // AL,AH = AL*GR8 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1152 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1153 | def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1154 | OpSize; // AX,DX = AX*GR16 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1155 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1156 | def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>; |
| 1157 | // EAX,EDX = EAX*GR32 |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1158 | let mayLoad = 1 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1159 | let Defs = [AL,AH,EFLAGS], Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1160 | def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1161 | "imul{b}\t$src", []>; // AL,AH = AL*[mem8] |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1162 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1163 | def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1164 | "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] |
Eli Friedman | ba7b1c4 | 2009-12-26 20:08:30 +0000 | [diff] [blame] | 1165 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1166 | def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1167 | "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1168 | } |
Dan Gohman | c99da13 | 2008-11-18 21:29:14 +0000 | [diff] [blame] | 1169 | } // neverHasSideEffects |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 1170 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 1171 | // unsigned division/remainder |
Dale Johannesen | 2cb48ea | 2008-10-07 18:54:28 +0000 | [diff] [blame] | 1172 | let Defs = [AL,AH,EFLAGS], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1173 | def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1174 | "div{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1175 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1176 | def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1177 | "div{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1178 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1179 | def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1180 | "div{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1181 | let mayLoad = 1 in { |
Dale Johannesen | 2cb48ea | 2008-10-07 18:54:28 +0000 | [diff] [blame] | 1182 | let Defs = [AL,AH,EFLAGS], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1183 | def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1184 | "div{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1185 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1186 | def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1187 | "div{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1188 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1189 | // EDX:EAX/[mem32] = EAX,EDX |
| 1190 | def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1191 | "div{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1192 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1193 | |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 1194 | // Signed division/remainder. |
Dale Johannesen | 2cb48ea | 2008-10-07 18:54:28 +0000 | [diff] [blame] | 1195 | let Defs = [AL,AH,EFLAGS], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1196 | def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1197 | "idiv{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1198 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1199 | def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1200 | "idiv{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1201 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1202 | def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1203 | "idiv{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1204 | let mayLoad = 1, mayLoad = 1 in { |
Dale Johannesen | 2cb48ea | 2008-10-07 18:54:28 +0000 | [diff] [blame] | 1205 | let Defs = [AL,AH,EFLAGS], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1206 | def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1207 | "idiv{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1208 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1209 | def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1210 | "idiv{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1211 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1212 | def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), |
| 1213 | // EDX:EAX/[mem32] = EAX,EDX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1214 | "idiv{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1215 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1216 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1217 | //===----------------------------------------------------------------------===// |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1218 | // Two address Instructions. |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1219 | // |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1220 | let isTwoAddress = 1 in { |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1221 | |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 1222 | // Conditional moves |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1223 | let Uses = [EFLAGS] in { |
Dan Gohman | cbbea0f | 2009-08-27 00:14:12 +0000 | [diff] [blame] | 1224 | |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 1225 | // X86 doesn't have 8-bit conditional moves. Use a customInserter to |
Dan Gohman | cbbea0f | 2009-08-27 00:14:12 +0000 | [diff] [blame] | 1226 | // emit control flow. An alternative to this is to mark i8 SELECT as Promote, |
| 1227 | // however that requires promoting the operands, and can induce additional |
Dan Gohman | 71a258c | 2009-08-29 22:19:15 +0000 | [diff] [blame] | 1228 | // i8 register pressure. Note that CMOV_GR8 is conservatively considered to |
| 1229 | // clobber EFLAGS, because if one of the operands is zero, the expansion |
| 1230 | // could involve an xor. |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 1231 | let usesCustomInserter = 1, isTwoAddress = 0, Defs = [EFLAGS] in |
Dan Gohman | cbbea0f | 2009-08-27 00:14:12 +0000 | [diff] [blame] | 1232 | def CMOV_GR8 : I<0, Pseudo, |
| 1233 | (outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cond), |
| 1234 | "#CMOV_GR8 PSEUDO!", |
| 1235 | [(set GR8:$dst, (X86cmov GR8:$src1, GR8:$src2, |
| 1236 | imm:$cond, EFLAGS))]>; |
| 1237 | |
Dan Gohman | a4c5c33 | 2009-08-27 18:16:24 +0000 | [diff] [blame] | 1238 | let isCommutable = 1 in { |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1239 | def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1240 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1241 | "cmovb{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1242 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1243 | X86_COND_B, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1244 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1245 | def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1246 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1247 | "cmovb{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1248 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1249 | X86_COND_B, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1250 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1251 | def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1252 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1253 | "cmovae{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1254 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1255 | X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1256 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1257 | def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1258 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1259 | "cmovae{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1260 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1261 | X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1262 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1263 | def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1264 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1265 | "cmove{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1266 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1267 | X86_COND_E, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1268 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1269 | def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1270 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1271 | "cmove{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1272 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1273 | X86_COND_E, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1274 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1275 | def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1276 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1277 | "cmovne{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1278 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1279 | X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1280 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1281 | def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1282 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1283 | "cmovne{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1284 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1285 | X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1286 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1287 | def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1288 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1289 | "cmovbe{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1290 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1291 | X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1292 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1293 | def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1294 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1295 | "cmovbe{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1296 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1297 | X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1298 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1299 | def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1300 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1301 | "cmova{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1302 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1303 | X86_COND_A, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1304 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1305 | def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1306 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1307 | "cmova{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1308 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1309 | X86_COND_A, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1310 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1311 | def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1312 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1313 | "cmovl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1314 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1315 | X86_COND_L, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1316 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1317 | def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1318 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1319 | "cmovl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1320 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1321 | X86_COND_L, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1322 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1323 | def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1324 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1325 | "cmovge{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1326 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1327 | X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1328 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1329 | def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1330 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1331 | "cmovge{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1332 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1333 | X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1334 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1335 | def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1336 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1337 | "cmovle{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1338 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1339 | X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1340 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1341 | def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1342 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1343 | "cmovle{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1344 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1345 | X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1346 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1347 | def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1348 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1349 | "cmovg{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1350 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1351 | X86_COND_G, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1352 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1353 | def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1354 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1355 | "cmovg{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1356 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1357 | X86_COND_G, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1358 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1359 | def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1360 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1361 | "cmovs{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1362 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1363 | X86_COND_S, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1364 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1365 | def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1366 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1367 | "cmovs{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1368 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1369 | X86_COND_S, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1370 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1371 | def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1372 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1373 | "cmovns{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1374 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1375 | X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1376 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1377 | def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1378 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1379 | "cmovns{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1380 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1381 | X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1382 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1383 | def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1384 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1385 | "cmovp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1386 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1387 | X86_COND_P, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1388 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1389 | def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1390 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1391 | "cmovp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1392 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1393 | X86_COND_P, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1394 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1395 | def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1396 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1397 | "cmovnp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1398 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1399 | X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1400 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1401 | def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1402 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1403 | "cmovnp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1404 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1405 | X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1406 | TB; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1407 | def CMOVO16rr : I<0x40, MRMSrcReg, // if overflow, GR16 = GR16 |
| 1408 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1409 | "cmovo{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1410 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
| 1411 | X86_COND_O, EFLAGS))]>, |
| 1412 | TB, OpSize; |
| 1413 | def CMOVO32rr : I<0x40, MRMSrcReg, // if overflow, GR32 = GR32 |
| 1414 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1415 | "cmovo{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1416 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
| 1417 | X86_COND_O, EFLAGS))]>, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1418 | TB; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1419 | def CMOVNO16rr : I<0x41, MRMSrcReg, // if !overflow, GR16 = GR16 |
| 1420 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1421 | "cmovno{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1422 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
| 1423 | X86_COND_NO, EFLAGS))]>, |
| 1424 | TB, OpSize; |
| 1425 | def CMOVNO32rr : I<0x41, MRMSrcReg, // if !overflow, GR32 = GR32 |
| 1426 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1427 | "cmovno{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1428 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
| 1429 | X86_COND_NO, EFLAGS))]>, |
| 1430 | TB; |
| 1431 | } // isCommutable = 1 |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1432 | |
| 1433 | def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16] |
| 1434 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1435 | "cmovb{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1436 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1437 | X86_COND_B, EFLAGS))]>, |
| 1438 | TB, OpSize; |
| 1439 | def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32] |
| 1440 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1441 | "cmovb{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1442 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1443 | X86_COND_B, EFLAGS))]>, |
| 1444 | TB; |
| 1445 | def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16] |
| 1446 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1447 | "cmovae{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1448 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1449 | X86_COND_AE, EFLAGS))]>, |
| 1450 | TB, OpSize; |
| 1451 | def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32] |
| 1452 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1453 | "cmovae{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1454 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1455 | X86_COND_AE, EFLAGS))]>, |
| 1456 | TB; |
| 1457 | def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16] |
| 1458 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1459 | "cmove{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1460 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1461 | X86_COND_E, EFLAGS))]>, |
| 1462 | TB, OpSize; |
| 1463 | def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32] |
| 1464 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1465 | "cmove{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1466 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1467 | X86_COND_E, EFLAGS))]>, |
| 1468 | TB; |
| 1469 | def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16] |
| 1470 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1471 | "cmovne{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1472 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1473 | X86_COND_NE, EFLAGS))]>, |
| 1474 | TB, OpSize; |
| 1475 | def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32] |
| 1476 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1477 | "cmovne{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1478 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1479 | X86_COND_NE, EFLAGS))]>, |
| 1480 | TB; |
| 1481 | def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16] |
| 1482 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1483 | "cmovbe{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1484 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1485 | X86_COND_BE, EFLAGS))]>, |
| 1486 | TB, OpSize; |
| 1487 | def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32] |
| 1488 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1489 | "cmovbe{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1490 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1491 | X86_COND_BE, EFLAGS))]>, |
| 1492 | TB; |
| 1493 | def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16] |
| 1494 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1495 | "cmova{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1496 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1497 | X86_COND_A, EFLAGS))]>, |
| 1498 | TB, OpSize; |
| 1499 | def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32] |
| 1500 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1501 | "cmova{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1502 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1503 | X86_COND_A, EFLAGS))]>, |
| 1504 | TB; |
| 1505 | def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16] |
| 1506 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1507 | "cmovl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1508 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1509 | X86_COND_L, EFLAGS))]>, |
| 1510 | TB, OpSize; |
| 1511 | def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32] |
| 1512 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1513 | "cmovl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1514 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1515 | X86_COND_L, EFLAGS))]>, |
| 1516 | TB; |
| 1517 | def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16] |
| 1518 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1519 | "cmovge{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1520 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1521 | X86_COND_GE, EFLAGS))]>, |
| 1522 | TB, OpSize; |
| 1523 | def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32] |
| 1524 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1525 | "cmovge{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1526 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1527 | X86_COND_GE, EFLAGS))]>, |
| 1528 | TB; |
| 1529 | def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16] |
| 1530 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1531 | "cmovle{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1532 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1533 | X86_COND_LE, EFLAGS))]>, |
| 1534 | TB, OpSize; |
| 1535 | def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32] |
| 1536 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1537 | "cmovle{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1538 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1539 | X86_COND_LE, EFLAGS))]>, |
| 1540 | TB; |
| 1541 | def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16] |
| 1542 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1543 | "cmovg{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1544 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1545 | X86_COND_G, EFLAGS))]>, |
| 1546 | TB, OpSize; |
| 1547 | def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32] |
| 1548 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1549 | "cmovg{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1550 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1551 | X86_COND_G, EFLAGS))]>, |
| 1552 | TB; |
| 1553 | def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16] |
| 1554 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1555 | "cmovs{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1556 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1557 | X86_COND_S, EFLAGS))]>, |
| 1558 | TB, OpSize; |
| 1559 | def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32] |
| 1560 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1561 | "cmovs{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1562 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1563 | X86_COND_S, EFLAGS))]>, |
| 1564 | TB; |
| 1565 | def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16] |
| 1566 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1567 | "cmovns{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1568 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1569 | X86_COND_NS, EFLAGS))]>, |
| 1570 | TB, OpSize; |
| 1571 | def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32] |
| 1572 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1573 | "cmovns{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1574 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1575 | X86_COND_NS, EFLAGS))]>, |
| 1576 | TB; |
| 1577 | def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16] |
| 1578 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1579 | "cmovp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1580 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1581 | X86_COND_P, EFLAGS))]>, |
| 1582 | TB, OpSize; |
| 1583 | def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32] |
| 1584 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1585 | "cmovp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1586 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1587 | X86_COND_P, EFLAGS))]>, |
| 1588 | TB; |
| 1589 | def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16] |
| 1590 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1591 | "cmovnp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1592 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1593 | X86_COND_NP, EFLAGS))]>, |
| 1594 | TB, OpSize; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1595 | def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32] |
| 1596 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1597 | "cmovnp{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1598 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1599 | X86_COND_NP, EFLAGS))]>, |
| 1600 | TB; |
| 1601 | def CMOVO16rm : I<0x40, MRMSrcMem, // if overflow, GR16 = [mem16] |
| 1602 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1603 | "cmovo{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1604 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1605 | X86_COND_O, EFLAGS))]>, |
| 1606 | TB, OpSize; |
| 1607 | def CMOVO32rm : I<0x40, MRMSrcMem, // if overflow, GR32 = [mem32] |
| 1608 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1609 | "cmovo{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1610 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1611 | X86_COND_O, EFLAGS))]>, |
| 1612 | TB; |
| 1613 | def CMOVNO16rm : I<0x41, MRMSrcMem, // if !overflow, GR16 = [mem16] |
| 1614 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1615 | "cmovno{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1616 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1617 | X86_COND_NO, EFLAGS))]>, |
| 1618 | TB, OpSize; |
| 1619 | def CMOVNO32rm : I<0x41, MRMSrcMem, // if !overflow, GR32 = [mem32] |
| 1620 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1621 | "cmovno{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1622 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1623 | X86_COND_NO, EFLAGS))]>, |
| 1624 | TB; |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1625 | } // Uses = [EFLAGS] |
| 1626 | |
| 1627 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1628 | // unary instructions |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1629 | let CodeSize = 2 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1630 | let Defs = [EFLAGS] in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1631 | def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1632 | [(set GR8:$dst, (ineg GR8:$src)), |
| 1633 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1634 | def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1635 | [(set GR16:$dst, (ineg GR16:$src)), |
| 1636 | (implicit EFLAGS)]>, OpSize; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1637 | def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src), "neg{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1638 | [(set GR32:$dst, (ineg GR32:$src)), |
| 1639 | (implicit EFLAGS)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1640 | let isTwoAddress = 0 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1641 | def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), "neg{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1642 | [(store (ineg (loadi8 addr:$dst)), addr:$dst), |
| 1643 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1644 | def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), "neg{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1645 | [(store (ineg (loadi16 addr:$dst)), addr:$dst), |
| 1646 | (implicit EFLAGS)]>, OpSize; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1647 | def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), "neg{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1648 | [(store (ineg (loadi32 addr:$dst)), addr:$dst), |
| 1649 | (implicit EFLAGS)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1650 | } |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1651 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1652 | |
Evan Cheng | aaf414c | 2009-01-21 02:09:05 +0000 | [diff] [blame] | 1653 | // Match xor -1 to not. Favors these over a move imm + xor to save code size. |
| 1654 | let AddedComplexity = 15 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1655 | def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1656 | [(set GR8:$dst, (not GR8:$src))]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1657 | def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src), "not{w}\t$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1658 | [(set GR16:$dst, (not GR16:$src))]>, OpSize; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1659 | def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src), "not{l}\t$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1660 | [(set GR32:$dst, (not GR32:$src))]>; |
Evan Cheng | aaf414c | 2009-01-21 02:09:05 +0000 | [diff] [blame] | 1661 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1662 | let isTwoAddress = 0 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1663 | def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), "not{b}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1664 | [(store (not (loadi8 addr:$dst)), addr:$dst)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1665 | def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), "not{w}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1666 | [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1667 | def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), "not{l}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1668 | [(store (not (loadi32 addr:$dst)), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1669 | } |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1670 | } // CodeSize |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1671 | |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1672 | // TODO: inc/dec is slow for P4, but fast for Pentium-M. |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1673 | let Defs = [EFLAGS] in { |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1674 | let CodeSize = 2 in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1675 | def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1676 | [(set GR8:$dst, (add GR8:$src, 1)), |
| 1677 | (implicit EFLAGS)]>; |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1678 | let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1679 | def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), |
| 1680 | "inc{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1681 | [(set GR16:$dst, (add GR16:$src, 1)), |
| 1682 | (implicit EFLAGS)]>, |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 1683 | OpSize, Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1684 | def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), |
| 1685 | "inc{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1686 | [(set GR32:$dst, (add GR32:$src, 1)), |
| 1687 | (implicit EFLAGS)]>, Requires<[In32BitMode]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1688 | } |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1689 | let isTwoAddress = 0, CodeSize = 2 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1690 | def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1691 | [(store (add (loadi8 addr:$dst), 1), addr:$dst), |
| 1692 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1693 | def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1694 | [(store (add (loadi16 addr:$dst), 1), addr:$dst), |
| 1695 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1696 | OpSize, Requires<[In32BitMode]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1697 | def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1698 | [(store (add (loadi32 addr:$dst), 1), addr:$dst), |
| 1699 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1700 | Requires<[In32BitMode]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1701 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1702 | |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1703 | let CodeSize = 2 in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1704 | def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "dec{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1705 | [(set GR8:$dst, (add GR8:$src, -1)), |
| 1706 | (implicit EFLAGS)]>; |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1707 | let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1708 | def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), |
| 1709 | "dec{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1710 | [(set GR16:$dst, (add GR16:$src, -1)), |
| 1711 | (implicit EFLAGS)]>, |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 1712 | OpSize, Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1713 | def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), |
| 1714 | "dec{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1715 | [(set GR32:$dst, (add GR32:$src, -1)), |
| 1716 | (implicit EFLAGS)]>, Requires<[In32BitMode]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1717 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1718 | |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1719 | let isTwoAddress = 0, CodeSize = 2 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1720 | def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1721 | [(store (add (loadi8 addr:$dst), -1), addr:$dst), |
| 1722 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1723 | def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1724 | [(store (add (loadi16 addr:$dst), -1), addr:$dst), |
| 1725 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1726 | OpSize, Requires<[In32BitMode]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1727 | def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1728 | [(store (add (loadi32 addr:$dst), -1), addr:$dst), |
| 1729 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1730 | Requires<[In32BitMode]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1731 | } |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1732 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1733 | |
| 1734 | // Logical operators... |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1735 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1736 | let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1737 | def AND8rr : I<0x20, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1738 | (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1739 | "and{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1740 | [(set GR8:$dst, (and GR8:$src1, GR8:$src2)), |
| 1741 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1742 | def AND16rr : I<0x21, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1743 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1744 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1745 | [(set GR16:$dst, (and GR16:$src1, GR16:$src2)), |
| 1746 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1747 | def AND32rr : I<0x21, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1748 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1749 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1750 | [(set GR32:$dst, (and GR32:$src1, GR32:$src2)), |
| 1751 | (implicit EFLAGS)]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1752 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1753 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1754 | // AND instructions with the destination register in REG and the source register |
| 1755 | // in R/M. Included for the disassembler. |
| 1756 | def AND8rr_REV : I<0x22, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 1757 | "and{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 1758 | def AND16rr_REV : I<0x23, MRMSrcReg, (outs GR16:$dst), |
| 1759 | (ins GR16:$src1, GR16:$src2), |
| 1760 | "and{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 1761 | def AND32rr_REV : I<0x23, MRMSrcReg, (outs GR32:$dst), |
| 1762 | (ins GR32:$src1, GR32:$src2), |
| 1763 | "and{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 1764 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1765 | def AND8rm : I<0x22, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1766 | (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1767 | "and{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1768 | [(set GR8:$dst, (and GR8:$src1, (loadi8 addr:$src2))), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1769 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1770 | def AND16rm : I<0x23, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1771 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1772 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1773 | [(set GR16:$dst, (and GR16:$src1, (loadi16 addr:$src2))), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1774 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1775 | def AND32rm : I<0x23, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1776 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1777 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1778 | [(set GR32:$dst, (and GR32:$src1, (loadi32 addr:$src2))), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1779 | (implicit EFLAGS)]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1780 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1781 | def AND8ri : Ii8<0x80, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1782 | (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1783 | "and{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1784 | [(set GR8:$dst, (and GR8:$src1, imm:$src2)), |
| 1785 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1786 | def AND16ri : Ii16<0x81, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1787 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1788 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1789 | [(set GR16:$dst, (and GR16:$src1, imm:$src2)), |
| 1790 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1791 | def AND32ri : Ii32<0x81, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1792 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1793 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1794 | [(set GR32:$dst, (and GR32:$src1, imm:$src2)), |
| 1795 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1796 | def AND16ri8 : Ii8<0x83, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1797 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1798 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1799 | [(set GR16:$dst, (and GR16:$src1, i16immSExt8:$src2)), |
| 1800 | (implicit EFLAGS)]>, |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1801 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1802 | def AND32ri8 : Ii8<0x83, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1803 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1804 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1805 | [(set GR32:$dst, (and GR32:$src1, i32immSExt8:$src2)), |
| 1806 | (implicit EFLAGS)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1807 | |
| 1808 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1809 | def AND8mr : I<0x20, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1810 | (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1811 | "and{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1812 | [(store (and (load addr:$dst), GR8:$src), addr:$dst), |
| 1813 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1814 | def AND16mr : I<0x21, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1815 | (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1816 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1817 | [(store (and (load addr:$dst), GR16:$src), addr:$dst), |
| 1818 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1819 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1820 | def AND32mr : I<0x21, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1821 | (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1822 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1823 | [(store (and (load addr:$dst), GR32:$src), addr:$dst), |
| 1824 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1825 | def AND8mi : Ii8<0x80, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1826 | (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1827 | "and{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1828 | [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 1829 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1830 | def AND16mi : Ii16<0x81, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1831 | (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1832 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1833 | [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 1834 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1835 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1836 | def AND32mi : Ii32<0x81, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1837 | (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1838 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1839 | [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 1840 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1841 | def AND16mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1842 | (outs), (ins i16mem:$dst, i16i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1843 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1844 | [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 1845 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1846 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1847 | def AND32mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1848 | (outs), (ins i32mem:$dst, i32i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1849 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1850 | [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 1851 | (implicit EFLAGS)]>; |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 1852 | |
| 1853 | def AND8i8 : Ii8<0x24, RawFrm, (outs), (ins i8imm:$src), |
| 1854 | "and{b}\t{$src, %al|%al, $src}", []>; |
| 1855 | def AND16i16 : Ii16<0x25, RawFrm, (outs), (ins i16imm:$src), |
| 1856 | "and{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 1857 | def AND32i32 : Ii32<0x25, RawFrm, (outs), (ins i32imm:$src), |
| 1858 | "and{l}\t{$src, %eax|%eax, $src}", []>; |
| 1859 | |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1860 | } |
| 1861 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1862 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1863 | let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1864 | def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), |
| 1865 | (ins GR8 :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1866 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1867 | [(set GR8:$dst, (or GR8:$src1, GR8:$src2)), |
| 1868 | (implicit EFLAGS)]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1869 | def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), |
| 1870 | (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1871 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 1872 | [(set GR16:$dst, (or_not_add GR16:$src1, GR16:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1873 | (implicit EFLAGS)]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1874 | def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), |
| 1875 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1876 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 1877 | [(set GR32:$dst, (or_not_add GR32:$src1, GR32:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1878 | (implicit EFLAGS)]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1879 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1880 | |
| 1881 | // OR instructions with the destination register in REG and the source register |
| 1882 | // in R/M. Included for the disassembler. |
| 1883 | def OR8rr_REV : I<0x0A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 1884 | "or{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 1885 | def OR16rr_REV : I<0x0B, MRMSrcReg, (outs GR16:$dst), |
| 1886 | (ins GR16:$src1, GR16:$src2), |
| 1887 | "or{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 1888 | def OR32rr_REV : I<0x0B, MRMSrcReg, (outs GR32:$dst), |
| 1889 | (ins GR32:$src1, GR32:$src2), |
| 1890 | "or{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 1891 | |
| 1892 | def OR8rm : I<0x0A, MRMSrcMem , (outs GR8 :$dst), |
| 1893 | (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1894 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1895 | [(set GR8:$dst, (or GR8:$src1, (load addr:$src2))), |
| 1896 | (implicit EFLAGS)]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1897 | def OR16rm : I<0x0B, MRMSrcMem , (outs GR16:$dst), |
| 1898 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1899 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1900 | [(set GR16:$dst, (or GR16:$src1, (load addr:$src2))), |
| 1901 | (implicit EFLAGS)]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1902 | def OR32rm : I<0x0B, MRMSrcMem , (outs GR32:$dst), |
| 1903 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1904 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1905 | [(set GR32:$dst, (or GR32:$src1, (load addr:$src2))), |
| 1906 | (implicit EFLAGS)]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1907 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1908 | def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), |
| 1909 | (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1910 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | ac000fa | 2010-01-11 20:18:04 +0000 | [diff] [blame] | 1911 | [(set GR8:$dst, (or GR8:$src1, imm:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1912 | (implicit EFLAGS)]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1913 | def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), |
| 1914 | (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1915 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 1916 | [(set GR16:$dst, (or_not_add GR16:$src1, imm:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1917 | (implicit EFLAGS)]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1918 | def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), |
| 1919 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1920 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 1921 | [(set GR32:$dst, (or_not_add GR32:$src1, imm:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1922 | (implicit EFLAGS)]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1923 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1924 | def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), |
| 1925 | (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1926 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 1927 | [(set GR16:$dst, (or_not_add GR16:$src1, i16immSExt8:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1928 | (implicit EFLAGS)]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1929 | def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), |
| 1930 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1931 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 1932 | [(set GR32:$dst, (or_not_add GR32:$src1, i32immSExt8:$src2)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1933 | (implicit EFLAGS)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1934 | let isTwoAddress = 0 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1935 | def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1936 | "or{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1937 | [(store (or (load addr:$dst), GR8:$src), addr:$dst), |
| 1938 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1939 | def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1940 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1941 | [(store (or (load addr:$dst), GR16:$src), addr:$dst), |
| 1942 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1943 | def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1944 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1945 | [(store (or (load addr:$dst), GR32:$src), addr:$dst), |
| 1946 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1947 | def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1948 | "or{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1949 | [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 1950 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1951 | def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1952 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1953 | [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 1954 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1955 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1956 | def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1957 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1958 | [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 1959 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1960 | def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1961 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1962 | [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 1963 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1964 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1965 | def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1966 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1967 | [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 1968 | (implicit EFLAGS)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 1969 | |
| 1970 | def OR8i8 : Ii8 <0x0C, RawFrm, (outs), (ins i8imm:$src), |
| 1971 | "or{b}\t{$src, %al|%al, $src}", []>; |
| 1972 | def OR16i16 : Ii16 <0x0D, RawFrm, (outs), (ins i16imm:$src), |
| 1973 | "or{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 1974 | def OR32i32 : Ii32 <0x0D, RawFrm, (outs), (ins i32imm:$src), |
| 1975 | "or{l}\t{$src, %eax|%eax, $src}", []>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 1976 | } // isTwoAddress = 0 |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1977 | |
| 1978 | |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 1979 | let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 1980 | def XOR8rr : I<0x30, MRMDestReg, |
| 1981 | (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), |
| 1982 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1983 | [(set GR8:$dst, (xor GR8:$src1, GR8:$src2)), |
| 1984 | (implicit EFLAGS)]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 1985 | def XOR16rr : I<0x31, MRMDestReg, |
| 1986 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
| 1987 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1988 | [(set GR16:$dst, (xor GR16:$src1, GR16:$src2)), |
| 1989 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 1990 | def XOR32rr : I<0x31, MRMDestReg, |
| 1991 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
| 1992 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1993 | [(set GR32:$dst, (xor GR32:$src1, GR32:$src2)), |
| 1994 | (implicit EFLAGS)]>; |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 1995 | } // isCommutable = 1 |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1996 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1997 | // XOR instructions with the destination register in REG and the source register |
| 1998 | // in R/M. Included for the disassembler. |
| 1999 | def XOR8rr_REV : I<0x32, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2000 | "xor{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2001 | def XOR16rr_REV : I<0x33, MRMSrcReg, (outs GR16:$dst), |
| 2002 | (ins GR16:$src1, GR16:$src2), |
| 2003 | "xor{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2004 | def XOR32rr_REV : I<0x33, MRMSrcReg, (outs GR32:$dst), |
| 2005 | (ins GR32:$src1, GR32:$src2), |
| 2006 | "xor{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 2007 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2008 | def XOR8rm : I<0x32, MRMSrcMem , |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2009 | (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2010 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2011 | [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2))), |
| 2012 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2013 | def XOR16rm : I<0x33, MRMSrcMem , |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2014 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2015 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2016 | [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2))), |
| 2017 | (implicit EFLAGS)]>, |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2018 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2019 | def XOR32rm : I<0x33, MRMSrcMem , |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2020 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2021 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2022 | [(set GR32:$dst, (xor GR32:$src1, (load addr:$src2))), |
| 2023 | (implicit EFLAGS)]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2024 | |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2025 | def XOR8ri : Ii8<0x80, MRM6r, |
| 2026 | (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 2027 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2028 | [(set GR8:$dst, (xor GR8:$src1, imm:$src2)), |
| 2029 | (implicit EFLAGS)]>; |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2030 | def XOR16ri : Ii16<0x81, MRM6r, |
| 2031 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
| 2032 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2033 | [(set GR16:$dst, (xor GR16:$src1, imm:$src2)), |
| 2034 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2035 | def XOR32ri : Ii32<0x81, MRM6r, |
| 2036 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
| 2037 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2038 | [(set GR32:$dst, (xor GR32:$src1, imm:$src2)), |
| 2039 | (implicit EFLAGS)]>; |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2040 | def XOR16ri8 : Ii8<0x83, MRM6r, |
| 2041 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
| 2042 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2043 | [(set GR16:$dst, (xor GR16:$src1, i16immSExt8:$src2)), |
| 2044 | (implicit EFLAGS)]>, |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2045 | OpSize; |
| 2046 | def XOR32ri8 : Ii8<0x83, MRM6r, |
| 2047 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
| 2048 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2049 | [(set GR32:$dst, (xor GR32:$src1, i32immSExt8:$src2)), |
| 2050 | (implicit EFLAGS)]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2051 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2052 | let isTwoAddress = 0 in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2053 | def XOR8mr : I<0x30, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2054 | (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2055 | "xor{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2056 | [(store (xor (load addr:$dst), GR8:$src), addr:$dst), |
| 2057 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2058 | def XOR16mr : I<0x31, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2059 | (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2060 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2061 | [(store (xor (load addr:$dst), GR16:$src), addr:$dst), |
| 2062 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2063 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2064 | def XOR32mr : I<0x31, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2065 | (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2066 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2067 | [(store (xor (load addr:$dst), GR32:$src), addr:$dst), |
| 2068 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2069 | def XOR8mi : Ii8<0x80, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2070 | (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2071 | "xor{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2072 | [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 2073 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2074 | def XOR16mi : Ii16<0x81, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2075 | (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2076 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2077 | [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 2078 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2079 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2080 | def XOR32mi : Ii32<0x81, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2081 | (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2082 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2083 | [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 2084 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2085 | def XOR16mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2086 | (outs), (ins i16mem:$dst, i16i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2087 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2088 | [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 2089 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2090 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2091 | def XOR32mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2092 | (outs), (ins i32mem:$dst, i32i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2093 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2094 | [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 2095 | (implicit EFLAGS)]>; |
Sean Callanan | 7893ec6 | 2009-09-10 19:52:26 +0000 | [diff] [blame] | 2096 | |
| 2097 | def XOR8i8 : Ii8 <0x34, RawFrm, (outs), (ins i8imm:$src), |
| 2098 | "xor{b}\t{$src, %al|%al, $src}", []>; |
| 2099 | def XOR16i16 : Ii16 <0x35, RawFrm, (outs), (ins i16imm:$src), |
| 2100 | "xor{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2101 | def XOR32i32 : Ii32 <0x35, RawFrm, (outs), (ins i32imm:$src), |
| 2102 | "xor{l}\t{$src, %eax|%eax, $src}", []>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2103 | } // isTwoAddress = 0 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2104 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2105 | |
| 2106 | // Shift instructions |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2107 | let Defs = [EFLAGS] in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2108 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2109 | def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2110 | "shl{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2111 | [(set GR8:$dst, (shl GR8:$src, CL))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2112 | def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2113 | "shl{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2114 | [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2115 | def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2116 | "shl{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2117 | [(set GR32:$dst, (shl GR32:$src, CL))]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2118 | } // Uses = [CL] |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2119 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2120 | def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2121 | "shl{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2122 | [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2123 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2124 | def SHL16ri : Ii8<0xC1, MRM4r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2125 | "shl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2126 | [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2127 | def SHL32ri : Ii8<0xC1, MRM4r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2128 | "shl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2129 | [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>; |
Sean Callanan | 13cf8e9 | 2009-09-16 02:28:43 +0000 | [diff] [blame] | 2130 | |
| 2131 | // NOTE: We don't include patterns for shifts of a register by one, because |
| 2132 | // 'add reg,reg' is cheaper. |
| 2133 | |
| 2134 | def SHL8r1 : I<0xD0, MRM4r, (outs GR8:$dst), (ins GR8:$src1), |
| 2135 | "shl{b}\t$dst", []>; |
| 2136 | def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1), |
| 2137 | "shl{w}\t$dst", []>, OpSize; |
| 2138 | def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1), |
| 2139 | "shl{l}\t$dst", []>; |
| 2140 | |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2141 | } // isConvertibleToThreeAddress = 1 |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2142 | |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2143 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2144 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2145 | def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2146 | "shl{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2147 | [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2148 | def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2149 | "shl{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2150 | [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2151 | def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2152 | "shl{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2153 | [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2154 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2155 | def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2156 | "shl{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2157 | [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2158 | def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2159 | "shl{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2160 | [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2161 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2162 | def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2163 | "shl{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2164 | [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2165 | |
| 2166 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2167 | def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2168 | "shl{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2169 | [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2170 | def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2171 | "shl{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2172 | [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2173 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2174 | def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2175 | "shl{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2176 | [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2177 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2178 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2179 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2180 | def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2181 | "shr{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2182 | [(set GR8:$dst, (srl GR8:$src, CL))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2183 | def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2184 | "shr{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2185 | [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2186 | def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2187 | "shr{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2188 | [(set GR32:$dst, (srl GR32:$src, CL))]>; |
| 2189 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2190 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2191 | def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2192 | "shr{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2193 | [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2194 | def SHR16ri : Ii8<0xC1, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2195 | "shr{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2196 | [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2197 | def SHR32ri : Ii8<0xC1, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2198 | "shr{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2199 | [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2200 | |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2201 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2202 | def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2203 | "shr{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2204 | [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2205 | def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2206 | "shr{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2207 | [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2208 | def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2209 | "shr{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2210 | [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>; |
| 2211 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2212 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2213 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2214 | def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2215 | "shr{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2216 | [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2217 | def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2218 | "shr{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2219 | [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2220 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2221 | def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2222 | "shr{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2223 | [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2224 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2225 | def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2226 | "shr{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2227 | [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2228 | def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2229 | "shr{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2230 | [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2231 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2232 | def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2233 | "shr{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2234 | [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2235 | |
| 2236 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2237 | def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2238 | "shr{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2239 | [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2240 | def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2241 | "shr{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2242 | [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2243 | def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2244 | "shr{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2245 | [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2246 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2247 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2248 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2249 | def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2250 | "sar{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2251 | [(set GR8:$dst, (sra GR8:$src, CL))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2252 | def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2253 | "sar{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2254 | [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2255 | def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2256 | "sar{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2257 | [(set GR32:$dst, (sra GR32:$src, CL))]>; |
| 2258 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2259 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2260 | def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2261 | "sar{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2262 | [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2263 | def SAR16ri : Ii8<0xC1, MRM7r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2264 | "sar{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2265 | [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>, |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 2266 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2267 | def SAR32ri : Ii8<0xC1, MRM7r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2268 | "sar{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2269 | [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2270 | |
| 2271 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2272 | def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2273 | "sar{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2274 | [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2275 | def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2276 | "sar{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2277 | [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2278 | def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2279 | "sar{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2280 | [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>; |
| 2281 | |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2282 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2283 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2284 | def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2285 | "sar{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2286 | [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2287 | def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2288 | "sar{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2289 | [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2290 | def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2291 | "sar{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2292 | [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2293 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2294 | def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2295 | "sar{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2296 | [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2297 | def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2298 | "sar{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2299 | [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2300 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2301 | def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2302 | "sar{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2303 | [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2304 | |
| 2305 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2306 | def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2307 | "sar{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2308 | [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2309 | def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2310 | "sar{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2311 | [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2312 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2313 | def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2314 | "sar{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2315 | [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2316 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2317 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2318 | // Rotate instructions |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2319 | |
| 2320 | def RCL8r1 : I<0xD0, MRM2r, (outs GR8:$dst), (ins GR8:$src), |
| 2321 | "rcl{b}\t{1, $dst|$dst, 1}", []>; |
| 2322 | def RCL8m1 : I<0xD0, MRM2m, (outs i8mem:$dst), (ins i8mem:$src), |
| 2323 | "rcl{b}\t{1, $dst|$dst, 1}", []>; |
| 2324 | let Uses = [CL] in { |
| 2325 | def RCL8rCL : I<0xD2, MRM2r, (outs GR8:$dst), (ins GR8:$src), |
| 2326 | "rcl{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2327 | def RCL8mCL : I<0xD2, MRM2m, (outs i8mem:$dst), (ins i8mem:$src), |
| 2328 | "rcl{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2329 | } |
| 2330 | def RCL8ri : Ii8<0xC0, MRM2r, (outs GR8:$dst), (ins GR8:$src, i8imm:$cnt), |
| 2331 | "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2332 | def RCL8mi : Ii8<0xC0, MRM2m, (outs i8mem:$dst), (ins i8mem:$src, i8imm:$cnt), |
| 2333 | "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2334 | |
| 2335 | def RCL16r1 : I<0xD1, MRM2r, (outs GR16:$dst), (ins GR16:$src), |
| 2336 | "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2337 | def RCL16m1 : I<0xD1, MRM2m, (outs i16mem:$dst), (ins i16mem:$src), |
| 2338 | "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2339 | let Uses = [CL] in { |
| 2340 | def RCL16rCL : I<0xD3, MRM2r, (outs GR16:$dst), (ins GR16:$src), |
| 2341 | "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2342 | def RCL16mCL : I<0xD3, MRM2m, (outs i16mem:$dst), (ins i16mem:$src), |
| 2343 | "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2344 | } |
| 2345 | def RCL16ri : Ii8<0xC1, MRM2r, (outs GR16:$dst), (ins GR16:$src, i8imm:$cnt), |
| 2346 | "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2347 | def RCL16mi : Ii8<0xC1, MRM2m, (outs i16mem:$dst), |
| 2348 | (ins i16mem:$src, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2349 | "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
| 2350 | |
| 2351 | def RCL32r1 : I<0xD1, MRM2r, (outs GR32:$dst), (ins GR32:$src), |
| 2352 | "rcl{l}\t{1, $dst|$dst, 1}", []>; |
| 2353 | def RCL32m1 : I<0xD1, MRM2m, (outs i32mem:$dst), (ins i32mem:$src), |
| 2354 | "rcl{l}\t{1, $dst|$dst, 1}", []>; |
| 2355 | let Uses = [CL] in { |
| 2356 | def RCL32rCL : I<0xD3, MRM2r, (outs GR32:$dst), (ins GR32:$src), |
| 2357 | "rcl{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2358 | def RCL32mCL : I<0xD3, MRM2m, (outs i32mem:$dst), (ins i32mem:$src), |
| 2359 | "rcl{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2360 | } |
| 2361 | def RCL32ri : Ii8<0xC1, MRM2r, (outs GR32:$dst), (ins GR32:$src, i8imm:$cnt), |
| 2362 | "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2363 | def RCL32mi : Ii8<0xC1, MRM2m, (outs i32mem:$dst), |
| 2364 | (ins i32mem:$src, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2365 | "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2366 | |
| 2367 | def RCR8r1 : I<0xD0, MRM3r, (outs GR8:$dst), (ins GR8:$src), |
| 2368 | "rcr{b}\t{1, $dst|$dst, 1}", []>; |
| 2369 | def RCR8m1 : I<0xD0, MRM3m, (outs i8mem:$dst), (ins i8mem:$src), |
| 2370 | "rcr{b}\t{1, $dst|$dst, 1}", []>; |
| 2371 | let Uses = [CL] in { |
| 2372 | def RCR8rCL : I<0xD2, MRM3r, (outs GR8:$dst), (ins GR8:$src), |
| 2373 | "rcr{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2374 | def RCR8mCL : I<0xD2, MRM3m, (outs i8mem:$dst), (ins i8mem:$src), |
| 2375 | "rcr{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2376 | } |
| 2377 | def RCR8ri : Ii8<0xC0, MRM3r, (outs GR8:$dst), (ins GR8:$src, i8imm:$cnt), |
| 2378 | "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2379 | def RCR8mi : Ii8<0xC0, MRM3m, (outs i8mem:$dst), (ins i8mem:$src, i8imm:$cnt), |
| 2380 | "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2381 | |
| 2382 | def RCR16r1 : I<0xD1, MRM3r, (outs GR16:$dst), (ins GR16:$src), |
| 2383 | "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2384 | def RCR16m1 : I<0xD1, MRM3m, (outs i16mem:$dst), (ins i16mem:$src), |
| 2385 | "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2386 | let Uses = [CL] in { |
| 2387 | def RCR16rCL : I<0xD3, MRM3r, (outs GR16:$dst), (ins GR16:$src), |
| 2388 | "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2389 | def RCR16mCL : I<0xD3, MRM3m, (outs i16mem:$dst), (ins i16mem:$src), |
| 2390 | "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2391 | } |
| 2392 | def RCR16ri : Ii8<0xC1, MRM3r, (outs GR16:$dst), (ins GR16:$src, i8imm:$cnt), |
| 2393 | "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2394 | def RCR16mi : Ii8<0xC1, MRM3m, (outs i16mem:$dst), |
| 2395 | (ins i16mem:$src, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2396 | "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
| 2397 | |
| 2398 | def RCR32r1 : I<0xD1, MRM3r, (outs GR32:$dst), (ins GR32:$src), |
| 2399 | "rcr{l}\t{1, $dst|$dst, 1}", []>; |
| 2400 | def RCR32m1 : I<0xD1, MRM3m, (outs i32mem:$dst), (ins i32mem:$src), |
| 2401 | "rcr{l}\t{1, $dst|$dst, 1}", []>; |
| 2402 | let Uses = [CL] in { |
| 2403 | def RCR32rCL : I<0xD3, MRM3r, (outs GR32:$dst), (ins GR32:$src), |
| 2404 | "rcr{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2405 | def RCR32mCL : I<0xD3, MRM3m, (outs i32mem:$dst), (ins i32mem:$src), |
| 2406 | "rcr{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2407 | } |
| 2408 | def RCR32ri : Ii8<0xC1, MRM3r, (outs GR32:$dst), (ins GR32:$src, i8imm:$cnt), |
| 2409 | "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2410 | def RCR32mi : Ii8<0xC1, MRM3m, (outs i32mem:$dst), |
| 2411 | (ins i32mem:$src, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2412 | "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2413 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2414 | // FIXME: provide shorter instructions when imm8 == 1 |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2415 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2416 | def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2417 | "rol{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2418 | [(set GR8:$dst, (rotl GR8:$src, CL))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2419 | def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2420 | "rol{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2421 | [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2422 | def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2423 | "rol{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2424 | [(set GR32:$dst, (rotl GR32:$src, CL))]>; |
| 2425 | } |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2426 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2427 | def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2428 | "rol{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2429 | [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2430 | def ROL16ri : Ii8<0xC1, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2431 | "rol{w}\t{$src2, $dst|$dst, $src2}", |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2432 | [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, |
| 2433 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2434 | def ROL32ri : Ii8<0xC1, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2435 | "rol{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2436 | [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2437 | |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2438 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2439 | def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2440 | "rol{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2441 | [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2442 | def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2443 | "rol{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2444 | [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2445 | def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2446 | "rol{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2447 | [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>; |
| 2448 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2449 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2450 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2451 | def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2452 | "rol{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2453 | [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2454 | def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2455 | "rol{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2456 | [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2457 | def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2458 | "rol{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2459 | [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2460 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2461 | def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2462 | "rol{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2463 | [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2464 | def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2465 | "rol{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2466 | [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2467 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2468 | def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2469 | "rol{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2470 | [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2471 | |
| 2472 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2473 | def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2474 | "rol{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2475 | [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2476 | def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2477 | "rol{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2478 | [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2479 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2480 | def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2481 | "rol{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2482 | [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2483 | } |
| 2484 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2485 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2486 | def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2487 | "ror{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2488 | [(set GR8:$dst, (rotr GR8:$src, CL))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2489 | def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2490 | "ror{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2491 | [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2492 | def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2493 | "ror{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2494 | [(set GR32:$dst, (rotr GR32:$src, CL))]>; |
| 2495 | } |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2496 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2497 | def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2498 | "ror{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2499 | [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2500 | def ROR16ri : Ii8<0xC1, MRM1r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2501 | "ror{w}\t{$src2, $dst|$dst, $src2}", |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2502 | [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, |
| 2503 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2504 | def ROR32ri : Ii8<0xC1, MRM1r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2505 | "ror{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2506 | [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2507 | |
| 2508 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2509 | def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2510 | "ror{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2511 | [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2512 | def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2513 | "ror{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2514 | [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2515 | def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2516 | "ror{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2517 | [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>; |
| 2518 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2519 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2520 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2521 | def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2522 | "ror{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2523 | [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2524 | def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2525 | "ror{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2526 | [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2527 | def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2528 | "ror{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2529 | [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2530 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2531 | def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2532 | "ror{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2533 | [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2534 | def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2535 | "ror{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2536 | [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2537 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2538 | def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2539 | "ror{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2540 | [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2541 | |
| 2542 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2543 | def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2544 | "ror{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2545 | [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2546 | def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2547 | "ror{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2548 | [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2549 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2550 | def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2551 | "ror{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2552 | [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2553 | } |
| 2554 | |
| 2555 | |
| 2556 | |
| 2557 | // Double shift instructions (generalizations of rotate) |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2558 | let Uses = [CL] in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2559 | def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), |
| 2560 | (ins GR32:$src1, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2561 | "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2562 | [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2563 | def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), |
| 2564 | (ins GR32:$src1, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2565 | "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2566 | [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2567 | def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), |
| 2568 | (ins GR16:$src1, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2569 | "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2570 | [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2571 | TB, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2572 | def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), |
| 2573 | (ins GR16:$src1, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2574 | "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2575 | [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2576 | TB, OpSize; |
| 2577 | } |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 2578 | |
| 2579 | let isCommutable = 1 in { // These instructions commute to each other. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2580 | def SHLD32rri8 : Ii8<0xA4, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2581 | (outs GR32:$dst), |
| 2582 | (ins GR32:$src1, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2583 | "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2584 | [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2585 | (i8 imm:$src3)))]>, |
| 2586 | TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2587 | def SHRD32rri8 : Ii8<0xAC, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2588 | (outs GR32:$dst), |
| 2589 | (ins GR32:$src1, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2590 | "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2591 | [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2592 | (i8 imm:$src3)))]>, |
| 2593 | TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2594 | def SHLD16rri8 : Ii8<0xA4, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2595 | (outs GR16:$dst), |
| 2596 | (ins GR16:$src1, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2597 | "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2598 | [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2599 | (i8 imm:$src3)))]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2600 | TB, OpSize; |
| 2601 | def SHRD16rri8 : Ii8<0xAC, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2602 | (outs GR16:$dst), |
| 2603 | (ins GR16:$src1, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2604 | "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2605 | [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2606 | (i8 imm:$src3)))]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2607 | TB, OpSize; |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 2608 | } |
Chris Lattner | 0e967d4 | 2004-08-01 08:13:11 +0000 | [diff] [blame] | 2609 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2610 | let isTwoAddress = 0 in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2611 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2612 | def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2613 | "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2614 | [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2615 | addr:$dst)]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2616 | def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2617 | "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2618 | [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2619 | addr:$dst)]>, TB; |
| 2620 | } |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2621 | def SHLD32mri8 : Ii8<0xA4, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2622 | (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2623 | "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2624 | [(store (X86shld (loadi32 addr:$dst), GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2625 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 2626 | TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2627 | def SHRD32mri8 : Ii8<0xAC, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2628 | (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2629 | "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2630 | [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2631 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 2632 | TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2633 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2634 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2635 | def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2636 | "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2637 | [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2638 | addr:$dst)]>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2639 | def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2640 | "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2641 | [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2642 | addr:$dst)]>, TB, OpSize; |
| 2643 | } |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2644 | def SHLD16mri8 : Ii8<0xA4, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2645 | (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2646 | "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2647 | [(store (X86shld (loadi16 addr:$dst), GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2648 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2649 | TB, OpSize; |
| 2650 | def SHRD16mri8 : Ii8<0xAC, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2651 | (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2652 | "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2653 | [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2654 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2655 | TB, OpSize; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2656 | } |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2657 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2658 | |
| 2659 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2660 | // Arithmetic. |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2661 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2662 | let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2663 | // Register-Register Addition |
| 2664 | def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst), |
| 2665 | (ins GR8 :$src1, GR8 :$src2), |
| 2666 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2667 | [(set GR8:$dst, (add GR8:$src1, GR8:$src2)), |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2668 | (implicit EFLAGS)]>; |
| 2669 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2670 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2671 | // Register-Register Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2672 | def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst), |
| 2673 | (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2674 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2675 | [(set GR16:$dst, (add GR16:$src1, GR16:$src2)), |
| 2676 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2677 | def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), |
| 2678 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2679 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2680 | [(set GR32:$dst, (add GR32:$src1, GR32:$src2)), |
| 2681 | (implicit EFLAGS)]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2682 | } // end isConvertibleToThreeAddress |
| 2683 | } // end isCommutable |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2684 | |
| 2685 | // Register-Memory Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2686 | def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst), |
| 2687 | (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2688 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2689 | [(set GR8:$dst, (add GR8:$src1, (load addr:$src2))), |
| 2690 | (implicit EFLAGS)]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2691 | def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), |
| 2692 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2693 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2694 | [(set GR16:$dst, (add GR16:$src1, (load addr:$src2))), |
| 2695 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2696 | def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), |
| 2697 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2698 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2699 | [(set GR32:$dst, (add GR32:$src1, (load addr:$src2))), |
| 2700 | (implicit EFLAGS)]>; |
Sean Callanan | 37be590 | 2009-09-15 20:53:57 +0000 | [diff] [blame] | 2701 | |
Sean Callanan | 62c28e3 | 2009-09-15 21:43:27 +0000 | [diff] [blame] | 2702 | // Register-Register Addition - Equivalent to the normal rr forms (ADD8rr, |
| 2703 | // ADD16rr, and ADD32rr), but differently encoded. |
Sean Callanan | 37be590 | 2009-09-15 20:53:57 +0000 | [diff] [blame] | 2704 | def ADD8mrmrr: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2705 | "add{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2706 | def ADD16mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), |
| 2707 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2708 | def ADD32mrmrr: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), |
| 2709 | "add{l}\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2710 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2711 | // Register-Integer Addition |
| 2712 | def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 2713 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2714 | [(set GR8:$dst, (add GR8:$src1, imm:$src2)), |
| 2715 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2716 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2717 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2718 | // Register-Integer Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2719 | def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst), |
| 2720 | (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2721 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2722 | [(set GR16:$dst, (add GR16:$src1, imm:$src2)), |
| 2723 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2724 | def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst), |
| 2725 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2726 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2727 | [(set GR32:$dst, (add GR32:$src1, imm:$src2)), |
| 2728 | (implicit EFLAGS)]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2729 | def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst), |
| 2730 | (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2731 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2732 | [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2)), |
| 2733 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2734 | def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst), |
| 2735 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2736 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2737 | [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2)), |
| 2738 | (implicit EFLAGS)]>; |
Evan Cheng | 09e3c80 | 2006-05-19 18:40:54 +0000 | [diff] [blame] | 2739 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2740 | |
| 2741 | let isTwoAddress = 0 in { |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2742 | // Memory-Register Addition |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2743 | def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2744 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2745 | [(store (add (load addr:$dst), GR8:$src2), addr:$dst), |
| 2746 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2747 | def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2748 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2749 | [(store (add (load addr:$dst), GR16:$src2), addr:$dst), |
| 2750 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2751 | def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2752 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2753 | [(store (add (load addr:$dst), GR32:$src2), addr:$dst), |
| 2754 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2755 | def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2756 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2757 | [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst), |
| 2758 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2759 | def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2760 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2761 | [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst), |
| 2762 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2763 | def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2764 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2765 | [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst), |
| 2766 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2767 | def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2768 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2769 | [(store (add (load addr:$dst), i16immSExt8:$src2), |
| 2770 | addr:$dst), |
| 2771 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2772 | def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2773 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2774 | [(store (add (load addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2775 | addr:$dst), |
| 2776 | (implicit EFLAGS)]>; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2777 | |
| 2778 | // addition to rAX |
| 2779 | def ADD8i8 : Ii8<0x04, RawFrm, (outs), (ins i8imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2780 | "add{b}\t{$src, %al|%al, $src}", []>; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2781 | def ADD16i16 : Ii16<0x05, RawFrm, (outs), (ins i16imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2782 | "add{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2783 | def ADD32i32 : Ii32<0x05, RawFrm, (outs), (ins i32imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2784 | "add{l}\t{$src, %eax|%eax, $src}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2785 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2786 | |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 2787 | let Uses = [EFLAGS] in { |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 2788 | let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2789 | def ADC8rr : I<0x10, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2790 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2791 | [(set GR8:$dst, (adde GR8:$src1, GR8:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2792 | def ADC16rr : I<0x11, MRMDestReg, (outs GR16:$dst), |
| 2793 | (ins GR16:$src1, GR16:$src2), |
| 2794 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2795 | [(set GR16:$dst, (adde GR16:$src1, GR16:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2796 | def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), |
| 2797 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2798 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2799 | [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 2800 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2801 | |
| 2802 | def ADC8rr_REV : I<0x12, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2803 | "adc{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2804 | def ADC16rr_REV : I<0x13, MRMSrcReg, (outs GR16:$dst), |
| 2805 | (ins GR16:$src1, GR16:$src2), |
| 2806 | "adc{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2807 | def ADC32rr_REV : I<0x13, MRMSrcReg, (outs GR32:$dst), |
| 2808 | (ins GR32:$src1, GR32:$src2), |
| 2809 | "adc{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 2810 | |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2811 | def ADC8rm : I<0x12, MRMSrcMem , (outs GR8:$dst), |
| 2812 | (ins GR8:$src1, i8mem:$src2), |
| 2813 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2814 | [(set GR8:$dst, (adde GR8:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2815 | def ADC16rm : I<0x13, MRMSrcMem , (outs GR16:$dst), |
| 2816 | (ins GR16:$src1, i16mem:$src2), |
| 2817 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2818 | [(set GR16:$dst, (adde GR16:$src1, (load addr:$src2)))]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 2819 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2820 | def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), |
| 2821 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2822 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2823 | [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>; |
| 2824 | def ADC8ri : Ii8<0x80, MRM2r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2825 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2826 | [(set GR8:$dst, (adde GR8:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2827 | def ADC16ri : Ii16<0x81, MRM2r, (outs GR16:$dst), |
| 2828 | (ins GR16:$src1, i16imm:$src2), |
| 2829 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2830 | [(set GR16:$dst, (adde GR16:$src1, imm:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2831 | def ADC16ri8 : Ii8<0x83, MRM2r, (outs GR16:$dst), |
| 2832 | (ins GR16:$src1, i16i8imm:$src2), |
| 2833 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2834 | [(set GR16:$dst, (adde GR16:$src1, i16immSExt8:$src2))]>, |
| 2835 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2836 | def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), |
| 2837 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2838 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2839 | [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2840 | def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), |
| 2841 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2842 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2843 | [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2844 | |
| 2845 | let isTwoAddress = 0 in { |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2846 | def ADC8mr : I<0x10, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2847 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2848 | [(store (adde (load addr:$dst), GR8:$src2), addr:$dst)]>; |
| 2849 | def ADC16mr : I<0x11, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2850 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2851 | [(store (adde (load addr:$dst), GR16:$src2), addr:$dst)]>, |
| 2852 | OpSize; |
| 2853 | def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2854 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2855 | [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>; |
| 2856 | def ADC8mi : Ii8<0x80, MRM2m, (outs), (ins i8mem:$dst, i8imm:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2857 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2858 | [(store (adde (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
| 2859 | def ADC16mi : Ii16<0x81, MRM2m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2860 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2861 | [(store (adde (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
| 2862 | OpSize; |
| 2863 | def ADC16mi8 : Ii8<0x83, MRM2m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2864 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2865 | [(store (adde (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
| 2866 | OpSize; |
| 2867 | def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2868 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2869 | [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
| 2870 | def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2871 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2872 | [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 2873 | |
| 2874 | def ADC8i8 : Ii8<0x14, RawFrm, (outs), (ins i8imm:$src), |
| 2875 | "adc{b}\t{$src, %al|%al, $src}", []>; |
| 2876 | def ADC16i16 : Ii16<0x15, RawFrm, (outs), (ins i16imm:$src), |
| 2877 | "adc{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2878 | def ADC32i32 : Ii32<0x15, RawFrm, (outs), (ins i32imm:$src), |
| 2879 | "adc{l}\t{$src, %eax|%eax, $src}", []>; |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2880 | } |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 2881 | } // Uses = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2882 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2883 | // Register-Register Subtraction |
| 2884 | def SUB8rr : I<0x28, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2885 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2886 | [(set GR8:$dst, (sub GR8:$src1, GR8:$src2)), |
| 2887 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2888 | def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2), |
| 2889 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2890 | [(set GR16:$dst, (sub GR16:$src1, GR16:$src2)), |
| 2891 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2892 | def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2), |
| 2893 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2894 | [(set GR32:$dst, (sub GR32:$src1, GR32:$src2)), |
| 2895 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2896 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2897 | def SUB8rr_REV : I<0x2A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2898 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2899 | def SUB16rr_REV : I<0x2B, MRMSrcReg, (outs GR16:$dst), |
| 2900 | (ins GR16:$src1, GR16:$src2), |
| 2901 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2902 | def SUB32rr_REV : I<0x2B, MRMSrcReg, (outs GR32:$dst), |
| 2903 | (ins GR32:$src1, GR32:$src2), |
| 2904 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 2905 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2906 | // Register-Memory Subtraction |
| 2907 | def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), |
| 2908 | (ins GR8 :$src1, i8mem :$src2), |
| 2909 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2910 | [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2))), |
| 2911 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2912 | def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), |
| 2913 | (ins GR16:$src1, i16mem:$src2), |
| 2914 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2915 | [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2))), |
| 2916 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2917 | def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), |
| 2918 | (ins GR32:$src1, i32mem:$src2), |
| 2919 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2920 | [(set GR32:$dst, (sub GR32:$src1, (load addr:$src2))), |
| 2921 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2922 | |
| 2923 | // Register-Integer Subtraction |
| 2924 | def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), |
| 2925 | (ins GR8:$src1, i8imm:$src2), |
| 2926 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2927 | [(set GR8:$dst, (sub GR8:$src1, imm:$src2)), |
| 2928 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2929 | def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), |
| 2930 | (ins GR16:$src1, i16imm:$src2), |
| 2931 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2932 | [(set GR16:$dst, (sub GR16:$src1, imm:$src2)), |
| 2933 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2934 | def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), |
| 2935 | (ins GR32:$src1, i32imm:$src2), |
| 2936 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2937 | [(set GR32:$dst, (sub GR32:$src1, imm:$src2)), |
| 2938 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2939 | def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), |
| 2940 | (ins GR16:$src1, i16i8imm:$src2), |
| 2941 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2942 | [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2)), |
| 2943 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2944 | def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), |
| 2945 | (ins GR32:$src1, i32i8imm:$src2), |
| 2946 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2947 | [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2)), |
| 2948 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2949 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2950 | let isTwoAddress = 0 in { |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2951 | // Memory-Register Subtraction |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2952 | def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2953 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2954 | [(store (sub (load addr:$dst), GR8:$src2), addr:$dst), |
| 2955 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2956 | def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2957 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2958 | [(store (sub (load addr:$dst), GR16:$src2), addr:$dst), |
| 2959 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2960 | def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2961 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2962 | [(store (sub (load addr:$dst), GR32:$src2), addr:$dst), |
| 2963 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2964 | |
| 2965 | // Memory-Integer Subtraction |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2966 | def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2967 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2968 | [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst), |
| 2969 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2970 | def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2971 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2972 | [(store (sub (loadi16 addr:$dst), imm:$src2),addr:$dst), |
| 2973 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2974 | def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2975 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2976 | [(store (sub (loadi32 addr:$dst), imm:$src2),addr:$dst), |
| 2977 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2978 | def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2979 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2980 | [(store (sub (load addr:$dst), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2981 | addr:$dst), |
| 2982 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2983 | def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2984 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2985 | [(store (sub (load addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2986 | addr:$dst), |
| 2987 | (implicit EFLAGS)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 2988 | |
| 2989 | def SUB8i8 : Ii8<0x2C, RawFrm, (outs), (ins i8imm:$src), |
| 2990 | "sub{b}\t{$src, %al|%al, $src}", []>; |
| 2991 | def SUB16i16 : Ii16<0x2D, RawFrm, (outs), (ins i16imm:$src), |
| 2992 | "sub{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2993 | def SUB32i32 : Ii32<0x2D, RawFrm, (outs), (ins i32imm:$src), |
| 2994 | "sub{l}\t{$src, %eax|%eax, $src}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2995 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2996 | |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 2997 | let Uses = [EFLAGS] in { |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2998 | def SBB8rr : I<0x18, MRMDestReg, (outs GR8:$dst), |
| 2999 | (ins GR8:$src1, GR8:$src2), |
| 3000 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3001 | [(set GR8:$dst, (sube GR8:$src1, GR8:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3002 | def SBB16rr : I<0x19, MRMDestReg, (outs GR16:$dst), |
| 3003 | (ins GR16:$src1, GR16:$src2), |
| 3004 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3005 | [(set GR16:$dst, (sube GR16:$src1, GR16:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3006 | def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), |
| 3007 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3008 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3009 | [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 3010 | |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 3011 | let isTwoAddress = 0 in { |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3012 | def SBB8mr : I<0x18, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
| 3013 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3014 | [(store (sube (load addr:$dst), GR8:$src2), addr:$dst)]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3015 | def SBB16mr : I<0x19, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 3016 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3017 | [(store (sube (load addr:$dst), GR16:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3018 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3019 | def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3020 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3021 | [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3022 | def SBB8mi : Ii32<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3023 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3024 | [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3025 | def SBB16mi : Ii16<0x81, MRM3m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 3026 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3027 | [(store (sube (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3028 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3029 | def SBB16mi8 : Ii8<0x83, MRM3m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
| 3030 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3031 | [(store (sube (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3032 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3033 | def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3034 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3035 | [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3036 | def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3037 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3038 | [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 3039 | |
| 3040 | def SBB8i8 : Ii8<0x1C, RawFrm, (outs), (ins i8imm:$src), |
| 3041 | "sbb{b}\t{$src, %al|%al, $src}", []>; |
| 3042 | def SBB16i16 : Ii16<0x1D, RawFrm, (outs), (ins i16imm:$src), |
| 3043 | "sbb{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3044 | def SBB32i32 : Ii32<0x1D, RawFrm, (outs), (ins i32imm:$src), |
| 3045 | "sbb{l}\t{$src, %eax|%eax, $src}", []>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 3046 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3047 | |
| 3048 | def SBB8rr_REV : I<0x1A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 3049 | "sbb{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 3050 | def SBB16rr_REV : I<0x1B, MRMSrcReg, (outs GR16:$dst), |
| 3051 | (ins GR16:$src1, GR16:$src2), |
| 3052 | "sbb{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 3053 | def SBB32rr_REV : I<0x1B, MRMSrcReg, (outs GR32:$dst), |
| 3054 | (ins GR32:$src1, GR32:$src2), |
| 3055 | "sbb{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 3056 | |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3057 | def SBB8rm : I<0x1A, MRMSrcMem, (outs GR8:$dst), (ins GR8:$src1, i8mem:$src2), |
| 3058 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3059 | [(set GR8:$dst, (sube GR8:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3060 | def SBB16rm : I<0x1B, MRMSrcMem, (outs GR16:$dst), |
| 3061 | (ins GR16:$src1, i16mem:$src2), |
| 3062 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3063 | [(set GR16:$dst, (sube GR16:$src1, (load addr:$src2)))]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3064 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3065 | def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), |
| 3066 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3067 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3068 | [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3069 | def SBB8ri : Ii8<0x80, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 3070 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3071 | [(set GR8:$dst, (sube GR8:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3072 | def SBB16ri : Ii16<0x81, MRM3r, (outs GR16:$dst), |
| 3073 | (ins GR16:$src1, i16imm:$src2), |
| 3074 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3075 | [(set GR16:$dst, (sube GR16:$src1, imm:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3076 | def SBB16ri8 : Ii8<0x83, MRM3r, (outs GR16:$dst), |
| 3077 | (ins GR16:$src1, i16i8imm:$src2), |
| 3078 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3079 | [(set GR16:$dst, (sube GR16:$src1, i16immSExt8:$src2))]>, |
| 3080 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3081 | def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), |
| 3082 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3083 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3084 | [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3085 | def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), |
| 3086 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3087 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3088 | [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>; |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 3089 | } // Uses = [EFLAGS] |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3090 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3091 | |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3092 | let Defs = [EFLAGS] in { |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 3093 | let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3094 | // Register-Register Signed Integer Multiply |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3095 | def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3096 | "imul{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3097 | [(set GR16:$dst, (mul GR16:$src1, GR16:$src2)), |
| 3098 | (implicit EFLAGS)]>, TB, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3099 | def IMUL32rr : I<0xAF, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3100 | "imul{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3101 | [(set GR32:$dst, (mul GR32:$src1, GR32:$src2)), |
| 3102 | (implicit EFLAGS)]>, TB; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 3103 | } |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3104 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3105 | // Register-Memory Signed Integer Multiply |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3106 | def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), |
| 3107 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3108 | "imul{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3109 | [(set GR16:$dst, (mul GR16:$src1, (load addr:$src2))), |
| 3110 | (implicit EFLAGS)]>, TB, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3111 | def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), |
| 3112 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3113 | "imul{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3114 | [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2))), |
| 3115 | (implicit EFLAGS)]>, TB; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3116 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3117 | } // end Two Address instructions |
| 3118 | |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 3119 | // Suprisingly enough, these are not two address instructions! |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3120 | let Defs = [EFLAGS] in { |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3121 | // Register-Integer Signed Integer Multiply |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3122 | def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3123 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3124 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3125 | [(set GR16:$dst, (mul GR16:$src1, imm:$src2)), |
| 3126 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3127 | def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3128 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3129 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3130 | [(set GR32:$dst, (mul GR32:$src1, imm:$src2)), |
| 3131 | (implicit EFLAGS)]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3132 | def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3133 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3134 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3135 | [(set GR16:$dst, (mul GR16:$src1, i16immSExt8:$src2)), |
| 3136 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3137 | def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3138 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3139 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3140 | [(set GR32:$dst, (mul GR32:$src1, i32immSExt8:$src2)), |
| 3141 | (implicit EFLAGS)]>; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 3142 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3143 | // Memory-Integer Signed Integer Multiply |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3144 | def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3145 | (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3146 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3147 | [(set GR16:$dst, (mul (load addr:$src1), imm:$src2)), |
| 3148 | (implicit EFLAGS)]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3149 | def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3150 | (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3151 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3152 | [(set GR32:$dst, (mul (load addr:$src1), imm:$src2)), |
| 3153 | (implicit EFLAGS)]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3154 | def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3155 | (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3156 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3157 | [(set GR16:$dst, (mul (load addr:$src1), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3158 | i16immSExt8:$src2)), |
| 3159 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3160 | def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3161 | (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3162 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3163 | [(set GR32:$dst, (mul (load addr:$src1), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3164 | i32immSExt8:$src2)), |
| 3165 | (implicit EFLAGS)]>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3166 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3167 | |
| 3168 | //===----------------------------------------------------------------------===// |
| 3169 | // 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] | 3170 | // |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3171 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3172 | let isCommutable = 1 in { // TEST X, Y --> TEST Y, X |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3173 | def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3174 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3175 | [(X86cmp (and_su GR8:$src1, GR8:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3176 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3177 | def TEST16rr : I<0x85, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3178 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3179 | [(X86cmp (and_su GR16:$src1, GR16:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3180 | (implicit EFLAGS)]>, |
| 3181 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3182 | def TEST32rr : I<0x85, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3183 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3184 | [(X86cmp (and_su GR32:$src1, GR32:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3185 | (implicit EFLAGS)]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3186 | } |
Evan Cheng | 734503b | 2006-09-11 02:19:56 +0000 | [diff] [blame] | 3187 | |
Sean Callanan | 4a93b71 | 2009-09-01 18:14:18 +0000 | [diff] [blame] | 3188 | def TEST8i8 : Ii8<0xA8, RawFrm, (outs), (ins i8imm:$src), |
| 3189 | "test{b}\t{$src, %al|%al, $src}", []>; |
| 3190 | def TEST16i16 : Ii16<0xA9, RawFrm, (outs), (ins i16imm:$src), |
| 3191 | "test{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3192 | def TEST32i32 : Ii32<0xA9, RawFrm, (outs), (ins i32imm:$src), |
| 3193 | "test{l}\t{$src, %eax|%eax, $src}", []>; |
| 3194 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3195 | def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3196 | "test{b}\t{$src2, $src1|$src1, $src2}", |
| 3197 | [(X86cmp (and GR8:$src1, (loadi8 addr:$src2)), 0), |
| 3198 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3199 | def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3200 | "test{w}\t{$src2, $src1|$src1, $src2}", |
| 3201 | [(X86cmp (and GR16:$src1, (loadi16 addr:$src2)), 0), |
| 3202 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3203 | def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3204 | "test{l}\t{$src2, $src1|$src1, $src2}", |
| 3205 | [(X86cmp (and GR32:$src1, (loadi32 addr:$src2)), 0), |
| 3206 | (implicit EFLAGS)]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3207 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3208 | def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3209 | (outs), (ins GR8:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3210 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3211 | [(X86cmp (and_su GR8:$src1, imm:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3212 | (implicit EFLAGS)]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3213 | def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3214 | (outs), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3215 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3216 | [(X86cmp (and_su GR16:$src1, imm:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3217 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3218 | def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3219 | (outs), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3220 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3221 | [(X86cmp (and_su GR32:$src1, imm:$src2), 0), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3222 | (implicit EFLAGS)]>; |
Evan Cheng | 734503b | 2006-09-11 02:19:56 +0000 | [diff] [blame] | 3223 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3224 | def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3225 | (outs), (ins i8mem:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3226 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3227 | [(X86cmp (and (loadi8 addr:$src1), imm:$src2), 0), |
| 3228 | (implicit EFLAGS)]>; |
| 3229 | def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3230 | (outs), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3231 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3232 | [(X86cmp (and (loadi16 addr:$src1), imm:$src2), 0), |
| 3233 | (implicit EFLAGS)]>, OpSize; |
| 3234 | def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3235 | (outs), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3236 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3237 | [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0), |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3238 | (implicit EFLAGS)]>; |
| 3239 | } // Defs = [EFLAGS] |
| 3240 | |
| 3241 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3242 | // Condition code ops, incl. set if equal/not equal/... |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3243 | let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 3244 | def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3245 | let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 3246 | def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3247 | |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3248 | let Uses = [EFLAGS] in { |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3249 | // Use sbb to materialize carry bit. |
| 3250 | |
| 3251 | let Defs = [EFLAGS], isCodeGenOnly = 1 in { |
| 3252 | def SETB_C8r : I<0x18, MRMInitReg, (outs GR8:$dst), (ins), |
| 3253 | "sbb{b}\t$dst, $dst", |
| 3254 | [(set GR8:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>; |
| 3255 | def SETB_C16r : I<0x19, MRMInitReg, (outs GR16:$dst), (ins), |
| 3256 | "sbb{w}\t$dst, $dst", |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 3257 | [(set GR16:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>, |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3258 | OpSize; |
| 3259 | def SETB_C32r : I<0x19, MRMInitReg, (outs GR32:$dst), (ins), |
| 3260 | "sbb{l}\t$dst, $dst", |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 3261 | [(set GR32:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>; |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3262 | } // isCodeGenOnly |
| 3263 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3264 | def SETEr : I<0x94, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3265 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3266 | "sete\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3267 | [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3268 | TB; // GR8 = == |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3269 | def SETEm : I<0x94, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3270 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3271 | "sete\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3272 | [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3273 | TB; // [mem8] = == |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3274 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3275 | def SETNEr : I<0x95, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3276 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3277 | "setne\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3278 | [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3279 | TB; // GR8 = != |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3280 | def SETNEm : I<0x95, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3281 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3282 | "setne\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3283 | [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3284 | TB; // [mem8] = != |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3285 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3286 | def SETLr : I<0x9C, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3287 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3288 | "setl\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3289 | [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3290 | TB; // GR8 = < signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3291 | def SETLm : I<0x9C, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3292 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3293 | "setl\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3294 | [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3295 | TB; // [mem8] = < signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3296 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3297 | def SETGEr : I<0x9D, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3298 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3299 | "setge\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3300 | [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3301 | TB; // GR8 = >= signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3302 | def SETGEm : I<0x9D, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3303 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3304 | "setge\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3305 | [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3306 | TB; // [mem8] = >= signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3307 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3308 | def SETLEr : I<0x9E, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3309 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3310 | "setle\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3311 | [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3312 | TB; // GR8 = <= signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3313 | def SETLEm : I<0x9E, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3314 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3315 | "setle\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3316 | [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3317 | TB; // [mem8] = <= signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3318 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3319 | def SETGr : I<0x9F, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3320 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3321 | "setg\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3322 | [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3323 | TB; // GR8 = > signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3324 | def SETGm : I<0x9F, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3325 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3326 | "setg\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3327 | [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3328 | TB; // [mem8] = > signed |
| 3329 | |
| 3330 | def SETBr : I<0x92, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3331 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3332 | "setb\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3333 | [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3334 | TB; // GR8 = < unsign |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3335 | def SETBm : I<0x92, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3336 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3337 | "setb\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3338 | [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3339 | TB; // [mem8] = < unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3340 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3341 | def SETAEr : I<0x93, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3342 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3343 | "setae\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3344 | [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3345 | TB; // GR8 = >= unsign |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3346 | def SETAEm : I<0x93, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3347 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3348 | "setae\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3349 | [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3350 | TB; // [mem8] = >= unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3351 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3352 | def SETBEr : I<0x96, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3353 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3354 | "setbe\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3355 | [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3356 | TB; // GR8 = <= unsign |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3357 | def SETBEm : I<0x96, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3358 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3359 | "setbe\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3360 | [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3361 | TB; // [mem8] = <= unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3362 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3363 | def SETAr : I<0x97, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3364 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3365 | "seta\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3366 | [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3367 | TB; // GR8 = > signed |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3368 | def SETAm : I<0x97, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3369 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3370 | "seta\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3371 | [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3372 | TB; // [mem8] = > signed |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3373 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3374 | def SETSr : I<0x98, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3375 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3376 | "sets\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3377 | [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3378 | TB; // GR8 = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3379 | def SETSm : I<0x98, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3380 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3381 | "sets\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3382 | [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3383 | TB; // [mem8] = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3384 | def SETNSr : I<0x99, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3385 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3386 | "setns\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3387 | [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3388 | TB; // GR8 = !<sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3389 | def SETNSm : I<0x99, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3390 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3391 | "setns\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3392 | [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3393 | TB; // [mem8] = !<sign bit> |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3394 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3395 | def SETPr : I<0x9A, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3396 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3397 | "setp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3398 | [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3399 | TB; // GR8 = parity |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3400 | def SETPm : I<0x9A, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3401 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3402 | "setp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3403 | [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3404 | TB; // [mem8] = parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3405 | def SETNPr : I<0x9B, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3406 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3407 | "setnp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3408 | [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3409 | TB; // GR8 = not parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3410 | def SETNPm : I<0x9B, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3411 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3412 | "setnp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3413 | [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3414 | TB; // [mem8] = not parity |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3415 | |
| 3416 | def SETOr : I<0x90, MRM0r, |
| 3417 | (outs GR8 :$dst), (ins), |
| 3418 | "seto\t$dst", |
| 3419 | [(set GR8:$dst, (X86setcc X86_COND_O, EFLAGS))]>, |
| 3420 | TB; // GR8 = overflow |
| 3421 | def SETOm : I<0x90, MRM0m, |
| 3422 | (outs), (ins i8mem:$dst), |
| 3423 | "seto\t$dst", |
| 3424 | [(store (X86setcc X86_COND_O, EFLAGS), addr:$dst)]>, |
| 3425 | TB; // [mem8] = overflow |
| 3426 | def SETNOr : I<0x91, MRM0r, |
| 3427 | (outs GR8 :$dst), (ins), |
| 3428 | "setno\t$dst", |
| 3429 | [(set GR8:$dst, (X86setcc X86_COND_NO, EFLAGS))]>, |
| 3430 | TB; // GR8 = not overflow |
| 3431 | def SETNOm : I<0x91, MRM0m, |
| 3432 | (outs), (ins i8mem:$dst), |
| 3433 | "setno\t$dst", |
| 3434 | [(store (X86setcc X86_COND_NO, EFLAGS), addr:$dst)]>, |
| 3435 | TB; // [mem8] = not overflow |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3436 | } // Uses = [EFLAGS] |
| 3437 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 3438 | |
| 3439 | // Integer comparisons |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3440 | let Defs = [EFLAGS] in { |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 3441 | def CMP8i8 : Ii8<0x3C, RawFrm, (outs), (ins i8imm:$src), |
| 3442 | "cmp{b}\t{$src, %al|%al, $src}", []>; |
| 3443 | def CMP16i16 : Ii16<0x3D, RawFrm, (outs), (ins i16imm:$src), |
| 3444 | "cmp{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3445 | def CMP32i32 : Ii32<0x3D, RawFrm, (outs), (ins i32imm:$src), |
| 3446 | "cmp{l}\t{$src, %eax|%eax, $src}", []>; |
| 3447 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3448 | def CMP8rr : I<0x38, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3449 | (outs), (ins GR8 :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3450 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3451 | [(X86cmp GR8:$src1, GR8:$src2), (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3452 | def CMP16rr : I<0x39, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3453 | (outs), (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3454 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3455 | [(X86cmp GR16:$src1, GR16:$src2), (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3456 | def CMP32rr : I<0x39, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3457 | (outs), (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3458 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3459 | [(X86cmp GR32:$src1, GR32:$src2), (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3460 | def CMP8mr : I<0x38, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3461 | (outs), (ins i8mem :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3462 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3463 | [(X86cmp (loadi8 addr:$src1), GR8:$src2), |
| 3464 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3465 | def CMP16mr : I<0x39, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3466 | (outs), (ins i16mem:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3467 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3468 | [(X86cmp (loadi16 addr:$src1), GR16:$src2), |
| 3469 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3470 | def CMP32mr : I<0x39, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3471 | (outs), (ins i32mem:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3472 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3473 | [(X86cmp (loadi32 addr:$src1), GR32:$src2), |
| 3474 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3475 | def CMP8rm : I<0x3A, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3476 | (outs), (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3477 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3478 | [(X86cmp GR8:$src1, (loadi8 addr:$src2)), |
| 3479 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3480 | def CMP16rm : I<0x3B, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3481 | (outs), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3482 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3483 | [(X86cmp GR16:$src1, (loadi16 addr:$src2)), |
| 3484 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3485 | def CMP32rm : I<0x3B, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3486 | (outs), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3487 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3488 | [(X86cmp GR32:$src1, (loadi32 addr:$src2)), |
| 3489 | (implicit EFLAGS)]>; |
Sean Callanan | d2125a0 | 2009-09-16 21:11:23 +0000 | [diff] [blame] | 3490 | def CMP8mrmrr : I<0x3A, MRMSrcReg, (outs), (ins GR8:$src1, GR8:$src2), |
| 3491 | "cmp{b}\t{$src2, $src1|$src1, $src2}", []>; |
| 3492 | def CMP16mrmrr : I<0x3B, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3493 | "cmp{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize; |
| 3494 | def CMP32mrmrr : I<0x3B, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3495 | "cmp{l}\t{$src2, $src1|$src1, $src2}", []>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3496 | def CMP8ri : Ii8<0x80, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3497 | (outs), (ins GR8:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3498 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3499 | [(X86cmp GR8:$src1, imm:$src2), (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3500 | def CMP16ri : Ii16<0x81, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3501 | (outs), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3502 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3503 | [(X86cmp GR16:$src1, imm:$src2), |
| 3504 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3505 | def CMP32ri : Ii32<0x81, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3506 | (outs), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3507 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3508 | [(X86cmp GR32:$src1, imm:$src2), (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3509 | def CMP8mi : Ii8 <0x80, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3510 | (outs), (ins i8mem :$src1, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3511 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3512 | [(X86cmp (loadi8 addr:$src1), imm:$src2), |
| 3513 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3514 | def CMP16mi : Ii16<0x81, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3515 | (outs), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3516 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3517 | [(X86cmp (loadi16 addr:$src1), imm:$src2), |
| 3518 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3519 | def CMP32mi : Ii32<0x81, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3520 | (outs), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3521 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3522 | [(X86cmp (loadi32 addr:$src1), imm:$src2), |
| 3523 | (implicit EFLAGS)]>; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3524 | def CMP16ri8 : Ii8<0x83, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3525 | (outs), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3526 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3527 | [(X86cmp GR16:$src1, i16immSExt8:$src2), |
| 3528 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3529 | def CMP16mi8 : Ii8<0x83, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3530 | (outs), (ins i16mem:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3531 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3532 | [(X86cmp (loadi16 addr:$src1), i16immSExt8:$src2), |
| 3533 | (implicit EFLAGS)]>, OpSize; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3534 | def CMP32mi8 : Ii8<0x83, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3535 | (outs), (ins i32mem:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3536 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3537 | [(X86cmp (loadi32 addr:$src1), i32immSExt8:$src2), |
| 3538 | (implicit EFLAGS)]>; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3539 | def CMP32ri8 : Ii8<0x83, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3540 | (outs), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3541 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3542 | [(X86cmp GR32:$src1, i32immSExt8:$src2), |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3543 | (implicit EFLAGS)]>; |
| 3544 | } // Defs = [EFLAGS] |
| 3545 | |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3546 | // Bit tests. |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3547 | // TODO: BTC, BTR, and BTS |
| 3548 | let Defs = [EFLAGS] in { |
Dan Gohman | 0c89b7e | 2009-01-13 20:32:45 +0000 | [diff] [blame] | 3549 | def BT16rr : I<0xA3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3550 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
| 3551 | [(X86bt GR16:$src1, GR16:$src2), |
Chris Lattner | f1e9fd5 | 2008-12-25 01:32:49 +0000 | [diff] [blame] | 3552 | (implicit EFLAGS)]>, OpSize, TB; |
Dan Gohman | 0c89b7e | 2009-01-13 20:32:45 +0000 | [diff] [blame] | 3553 | def BT32rr : I<0xA3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3554 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
| 3555 | [(X86bt GR32:$src1, GR32:$src2), |
Chris Lattner | f1e9fd5 | 2008-12-25 01:32:49 +0000 | [diff] [blame] | 3556 | (implicit EFLAGS)]>, TB; |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3557 | |
| 3558 | // Unlike with the register+register form, the memory+register form of the |
| 3559 | // bt instruction does not ignore the high bits of the index. From ISel's |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3560 | // perspective, this is pretty bizarre. Make these instructions disassembly |
| 3561 | // only for now. |
| 3562 | |
| 3563 | def BT16mr : I<0xA3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3564 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3565 | // [(X86bt (loadi16 addr:$src1), GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3566 | // (implicit EFLAGS)] |
| 3567 | [] |
| 3568 | >, OpSize, TB, Requires<[FastBTMem]>; |
| 3569 | def BT32mr : I<0xA3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3570 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3571 | // [(X86bt (loadi32 addr:$src1), GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3572 | // (implicit EFLAGS)] |
| 3573 | [] |
| 3574 | >, TB, Requires<[FastBTMem]>; |
Dan Gohman | 4afe15b | 2009-01-13 20:33:23 +0000 | [diff] [blame] | 3575 | |
| 3576 | def BT16ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3577 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
| 3578 | [(X86bt GR16:$src1, i16immSExt8:$src2), |
| 3579 | (implicit EFLAGS)]>, OpSize, TB; |
| 3580 | def BT32ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3581 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
| 3582 | [(X86bt GR32:$src1, i32immSExt8:$src2), |
| 3583 | (implicit EFLAGS)]>, TB; |
| 3584 | // Note that these instructions don't need FastBTMem because that |
| 3585 | // only applies when the other operand is in a register. When it's |
| 3586 | // an immediate, bt is still fast. |
| 3587 | def BT16mi8 : Ii8<0xBA, MRM4m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3588 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
| 3589 | [(X86bt (loadi16 addr:$src1), i16immSExt8:$src2), |
| 3590 | (implicit EFLAGS)]>, OpSize, TB; |
| 3591 | def BT32mi8 : Ii8<0xBA, MRM4m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3592 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
| 3593 | [(X86bt (loadi32 addr:$src1), i32immSExt8:$src2), |
| 3594 | (implicit EFLAGS)]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3595 | |
| 3596 | def BTC16rr : I<0xBB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3597 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3598 | def BTC32rr : I<0xBB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3599 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3600 | def BTC16mr : I<0xBB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3601 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3602 | def BTC32mr : I<0xBB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3603 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3604 | def BTC16ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3605 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3606 | def BTC32ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3607 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3608 | def BTC16mi8 : Ii8<0xBA, MRM7m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3609 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3610 | def BTC32mi8 : Ii8<0xBA, MRM7m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3611 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3612 | |
| 3613 | def BTR16rr : I<0xB3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3614 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3615 | def BTR32rr : I<0xB3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3616 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3617 | def BTR16mr : I<0xB3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3618 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3619 | def BTR32mr : I<0xB3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3620 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3621 | def BTR16ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3622 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3623 | def BTR32ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3624 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3625 | def BTR16mi8 : Ii8<0xBA, MRM6m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3626 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3627 | def BTR32mi8 : Ii8<0xBA, MRM6m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3628 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3629 | |
| 3630 | def BTS16rr : I<0xAB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3631 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3632 | def BTS32rr : I<0xAB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3633 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3634 | def BTS16mr : I<0xAB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3635 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3636 | def BTS32mr : I<0xAB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3637 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3638 | def BTS16ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3639 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3640 | def BTS32ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3641 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3642 | def BTS16mi8 : Ii8<0xBA, MRM5m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3643 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3644 | def BTS32mi8 : Ii8<0xBA, MRM5m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3645 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3646 | } // Defs = [EFLAGS] |
| 3647 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 3648 | // Sign/Zero extenders |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 3649 | // Use movsbl intead of movsbw; we don't care about the high 16 bits |
| 3650 | // of the register here. This has a smaller encoding and avoids a |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3651 | // partial-register update. Actual movsbw included for the disassembler. |
| 3652 | def MOVSX16rr8W : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src), |
| 3653 | "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3654 | def MOVSX16rm8W : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src), |
| 3655 | "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3656 | def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3657 | "", [(set GR16:$dst, (sext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3658 | def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3659 | "", [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3660 | def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3661 | "movs{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3662 | [(set GR32:$dst, (sext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3663 | def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3664 | "movs{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3665 | [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3666 | def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3667 | "movs{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3668 | [(set GR32:$dst, (sext GR16:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3669 | def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3670 | "movs{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3671 | [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB; |
Alkis Evlogimenos | a7be982 | 2004-02-17 09:14:23 +0000 | [diff] [blame] | 3672 | |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 3673 | // Use movzbl intead of movzbw; we don't care about the high 16 bits |
| 3674 | // of the register here. This has a smaller encoding and avoids a |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3675 | // partial-register update. Actual movzbw included for the disassembler. |
| 3676 | def MOVZX16rr8W : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src), |
| 3677 | "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3678 | def MOVZX16rm8W : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src), |
| 3679 | "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3680 | def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3681 | "", [(set GR16:$dst, (zext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3682 | def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3683 | "", [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3684 | def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3685 | "movz{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3686 | [(set GR32:$dst, (zext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3687 | def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3688 | "movz{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3689 | [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3690 | def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3691 | "movz{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3692 | [(set GR32:$dst, (zext GR16:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3693 | def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3694 | "movz{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3695 | [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 3696 | |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 3697 | // These are the same as the regular regular MOVZX32rr8 and MOVZX32rm8 |
| 3698 | // except that they use GR32_NOREX for the output operand register class |
| 3699 | // instead of GR32. This allows them to operate on h registers on x86-64. |
| 3700 | def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg, |
| 3701 | (outs GR32_NOREX:$dst), (ins GR8:$src), |
| 3702 | "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX", |
| 3703 | []>, TB; |
Dan Gohman | 78e04d4 | 2009-04-30 03:11:48 +0000 | [diff] [blame] | 3704 | let mayLoad = 1 in |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 3705 | def MOVZX32_NOREXrm8 : I<0xB6, MRMSrcMem, |
| 3706 | (outs GR32_NOREX:$dst), (ins i8mem:$src), |
| 3707 | "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX", |
| 3708 | []>, TB; |
| 3709 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3710 | let neverHasSideEffects = 1 in { |
| 3711 | let Defs = [AX], Uses = [AL] in |
| 3712 | def CBW : I<0x98, RawFrm, (outs), (ins), |
| 3713 | "{cbtw|cbw}", []>, OpSize; // AX = signext(AL) |
| 3714 | let Defs = [EAX], Uses = [AX] in |
| 3715 | def CWDE : I<0x98, RawFrm, (outs), (ins), |
| 3716 | "{cwtl|cwde}", []>; // EAX = signext(AX) |
Evan Cheng | f91c101 | 2006-05-31 22:05:11 +0000 | [diff] [blame] | 3717 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3718 | let Defs = [AX,DX], Uses = [AX] in |
| 3719 | def CWD : I<0x99, RawFrm, (outs), (ins), |
| 3720 | "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX) |
| 3721 | let Defs = [EAX,EDX], Uses = [EAX] in |
| 3722 | def CDQ : I<0x99, RawFrm, (outs), (ins), |
| 3723 | "{cltd|cdq}", []>; // EDX:EAX = signext(EAX) |
| 3724 | } |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 3725 | |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 3726 | //===----------------------------------------------------------------------===// |
| 3727 | // Alias Instructions |
| 3728 | //===----------------------------------------------------------------------===// |
| 3729 | |
| 3730 | // Alias instructions that map movr0 to xor. |
| 3731 | // FIXME: remove when we can teach regalloc that xor reg, reg is ok. |
Daniel Dunbar | 7417b76 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 3732 | let Defs = [EFLAGS], isReMaterializable = 1, isAsCheapAsAMove = 1, |
| 3733 | isCodeGenOnly = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3734 | def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3735 | "xor{b}\t$dst, $dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3736 | [(set GR8:$dst, 0)]>; |
Dan Gohman | f1b4d26 | 2010-01-12 04:42:54 +0000 | [diff] [blame^] | 3737 | |
| 3738 | // We want to rewrite MOV16r0 in terms of MOV32r0, because it's a smaller |
| 3739 | // encoding and avoids a partial-register update sometimes, but doing so |
| 3740 | // at isel time interferes with rematerialization in the current register |
| 3741 | // allocator. For now, this is rewritten when the instruction is lowered |
| 3742 | // to an MCInst. |
| 3743 | def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), |
| 3744 | "", |
| 3745 | [(set GR16:$dst, 0)]>, OpSize; |
Chris Lattner | 6a38182 | 2009-12-23 01:30:26 +0000 | [diff] [blame] | 3746 | |
Chris Lattner | ac105c4 | 2009-12-23 01:46:40 +0000 | [diff] [blame] | 3747 | def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), |
| 3748 | "xor{l}\t$dst, $dst", |
| 3749 | [(set GR32:$dst, 0)]>; |
| 3750 | } |
Chris Lattner | 6a38182 | 2009-12-23 01:30:26 +0000 | [diff] [blame] | 3751 | |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 3752 | //===----------------------------------------------------------------------===// |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3753 | // Thread Local Storage Instructions |
| 3754 | // |
| 3755 | |
Rafael Espindola | 15f1b66 | 2009-04-24 12:59:40 +0000 | [diff] [blame] | 3756 | // All calls clobber the non-callee saved registers. ESP is marked as |
| 3757 | // a use to prevent stack-pointer assignments that appear immediately |
| 3758 | // before calls from potentially appearing dead. |
| 3759 | let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, |
| 3760 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, |
| 3761 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, |
| 3762 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 3763 | Uses = [ESP] in |
| 3764 | def TLS_addr32 : I<0, Pseudo, (outs), (ins lea32mem:$sym), |
| 3765 | "leal\t$sym, %eax; " |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3766 | "call\t___tls_get_addr@PLT", |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 3767 | [(X86tlsaddr tls32addr:$sym)]>, |
Rafael Espindola | 2ee3db3 | 2009-04-17 14:35:58 +0000 | [diff] [blame] | 3768 | Requires<[In32BitMode]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3769 | |
Daniel Dunbar | 0c420fc | 2009-08-11 22:24:40 +0000 | [diff] [blame] | 3770 | let AddedComplexity = 5, isCodeGenOnly = 1 in |
Nate Begeman | 51a0437 | 2009-01-26 01:24:32 +0000 | [diff] [blame] | 3771 | def GS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 3772 | "movl\t%gs:$src, $dst", |
| 3773 | [(set GR32:$dst, (gsload addr:$src))]>, SegGS; |
| 3774 | |
Daniel Dunbar | 0c420fc | 2009-08-11 22:24:40 +0000 | [diff] [blame] | 3775 | let AddedComplexity = 5, isCodeGenOnly = 1 in |
Chris Lattner | 1777d0c | 2009-05-05 18:52:19 +0000 | [diff] [blame] | 3776 | def FS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 3777 | "movl\t%fs:$src, $dst", |
| 3778 | [(set GR32:$dst, (fsload addr:$src))]>, SegFS; |
| 3779 | |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3780 | //===----------------------------------------------------------------------===// |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 3781 | // EH Pseudo Instructions |
| 3782 | // |
| 3783 | let isTerminator = 1, isReturn = 1, isBarrier = 1, |
Daniel Dunbar | 1ca3a0b | 2009-08-27 07:58:05 +0000 | [diff] [blame] | 3784 | hasCtrlDep = 1, isCodeGenOnly = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3785 | def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3786 | "ret\t#eh_return, addr: $addr", |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 3787 | [(X86ehret GR32:$addr)]>; |
| 3788 | |
| 3789 | } |
| 3790 | |
| 3791 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | ab0b949 | 2008-02-21 06:45:13 +0000 | [diff] [blame] | 3792 | // Atomic support |
| 3793 | // |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3794 | |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3795 | // Atomic swap. These are just normal xchg instructions. But since a memory |
| 3796 | // operand is referenced, the atomicity is ensured. |
Dan Gohman | 165660e | 2008-08-06 15:52:50 +0000 | [diff] [blame] | 3797 | let Constraints = "$val = $dst" in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3798 | def XCHG32rm : I<0x87, MRMSrcMem, (outs GR32:$dst), |
| 3799 | (ins GR32:$val, i32mem:$ptr), |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3800 | "xchg{l}\t{$val, $ptr|$ptr, $val}", |
| 3801 | [(set GR32:$dst, (atomic_swap_32 addr:$ptr, GR32:$val))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3802 | def XCHG16rm : I<0x87, MRMSrcMem, (outs GR16:$dst), |
| 3803 | (ins GR16:$val, i16mem:$ptr), |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3804 | "xchg{w}\t{$val, $ptr|$ptr, $val}", |
| 3805 | [(set GR16:$dst, (atomic_swap_16 addr:$ptr, GR16:$val))]>, |
| 3806 | OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3807 | def XCHG8rm : I<0x86, MRMSrcMem, (outs GR8:$dst), (ins GR8:$val, i8mem:$ptr), |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3808 | "xchg{b}\t{$val, $ptr|$ptr, $val}", |
| 3809 | [(set GR8:$dst, (atomic_swap_8 addr:$ptr, GR8:$val))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3810 | |
| 3811 | def XCHG32rr : I<0x87, MRMSrcReg, (outs GR32:$dst), (ins GR32:$val, GR32:$src), |
| 3812 | "xchg{l}\t{$val, $src|$src, $val}", []>; |
| 3813 | def XCHG16rr : I<0x87, MRMSrcReg, (outs GR16:$dst), (ins GR16:$val, GR16:$src), |
| 3814 | "xchg{w}\t{$val, $src|$src, $val}", []>, OpSize; |
| 3815 | def XCHG8rr : I<0x86, MRMSrcReg, (outs GR8:$dst), (ins GR8:$val, GR8:$src), |
| 3816 | "xchg{b}\t{$val, $src|$src, $val}", []>; |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3817 | } |
| 3818 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3819 | def XCHG16ar : I<0x90, AddRegFrm, (outs), (ins GR16:$src), |
| 3820 | "xchg{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3821 | def XCHG32ar : I<0x90, AddRegFrm, (outs), (ins GR32:$src), |
| 3822 | "xchg{l}\t{$src, %eax|%eax, $src}", []>; |
| 3823 | |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3824 | // Atomic compare and swap. |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3825 | let Defs = [EAX, EFLAGS], Uses = [EAX] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3826 | def LCMPXCHG32 : I<0xB1, MRMDestMem, (outs), (ins i32mem:$ptr, GR32:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3827 | "lock\n\t" |
| 3828 | "cmpxchg{l}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3829 | [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3830 | } |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 3831 | let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { |
Evan Cheng | b093bd0 | 2010-01-08 01:29:19 +0000 | [diff] [blame] | 3832 | def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i64mem:$ptr), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3833 | "lock\n\t" |
| 3834 | "cmpxchg8b\t$ptr", |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 3835 | [(X86cas8 addr:$ptr)]>, TB, LOCK; |
| 3836 | } |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3837 | |
| 3838 | let Defs = [AX, EFLAGS], Uses = [AX] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3839 | def LCMPXCHG16 : I<0xB1, MRMDestMem, (outs), (ins i16mem:$ptr, GR16:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3840 | "lock\n\t" |
| 3841 | "cmpxchg{w}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3842 | [(X86cas addr:$ptr, GR16:$swap, 2)]>, TB, OpSize, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3843 | } |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3844 | let Defs = [AL, EFLAGS], Uses = [AL] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3845 | def LCMPXCHG8 : I<0xB0, MRMDestMem, (outs), (ins i8mem:$ptr, GR8:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3846 | "lock\n\t" |
| 3847 | "cmpxchg{b}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3848 | [(X86cas addr:$ptr, GR8:$swap, 1)]>, TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3849 | } |
| 3850 | |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3851 | // Atomic exchange and add |
| 3852 | let Constraints = "$val = $dst", Defs = [EFLAGS] in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3853 | def LXADD32 : I<0xC1, MRMSrcMem, (outs GR32:$dst), (ins GR32:$val, i32mem:$ptr), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3854 | "lock\n\t" |
| 3855 | "xadd{l}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3856 | [(set GR32:$dst, (atomic_load_add_32 addr:$ptr, GR32:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3857 | TB, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3858 | def LXADD16 : I<0xC1, MRMSrcMem, (outs GR16:$dst), (ins GR16:$val, i16mem:$ptr), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3859 | "lock\n\t" |
| 3860 | "xadd{w}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3861 | [(set GR16:$dst, (atomic_load_add_16 addr:$ptr, GR16:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3862 | TB, OpSize, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3863 | def LXADD8 : I<0xC0, MRMSrcMem, (outs GR8:$dst), (ins GR8:$val, i8mem:$ptr), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3864 | "lock\n\t" |
| 3865 | "xadd{b}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3866 | [(set GR8:$dst, (atomic_load_add_8 addr:$ptr, GR8:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3867 | TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3868 | } |
| 3869 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3870 | def XADD8rr : I<0xC0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src), |
| 3871 | "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3872 | def XADD16rr : I<0xC1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
| 3873 | "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3874 | def XADD32rr : I<0xC1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 3875 | "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3876 | |
| 3877 | def XADD8rm : I<0xC0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
| 3878 | "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3879 | def XADD16rm : I<0xC1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
| 3880 | "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3881 | def XADD32rm : I<0xC1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 3882 | "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3883 | |
| 3884 | def CMPXCHG8rr : I<0xB0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src), |
| 3885 | "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3886 | def CMPXCHG16rr : I<0xB1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
| 3887 | "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3888 | def CMPXCHG32rr : I<0xB1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 3889 | "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3890 | |
| 3891 | def CMPXCHG8rm : I<0xB0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
| 3892 | "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3893 | def CMPXCHG16rm : I<0xB1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
| 3894 | "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3895 | def CMPXCHG32rm : I<0xB1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 3896 | "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3897 | |
Evan Cheng | b093bd0 | 2010-01-08 01:29:19 +0000 | [diff] [blame] | 3898 | let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3899 | def CMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i64mem:$dst), |
| 3900 | "cmpxchg8b\t$dst", []>, TB; |
| 3901 | |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 3902 | // Optimized codegen when the non-memory output is not used. |
| 3903 | // FIXME: Use normal add / sub instructions and add lock prefix dynamically. |
Dan Gohman | bab42bd | 2009-10-20 18:14:49 +0000 | [diff] [blame] | 3904 | let Defs = [EFLAGS] in { |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 3905 | def LOCK_ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
| 3906 | "lock\n\t" |
| 3907 | "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3908 | def LOCK_ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 3909 | "lock\n\t" |
| 3910 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 3911 | def LOCK_ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
| 3912 | "lock\n\t" |
| 3913 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3914 | def LOCK_ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2), |
| 3915 | "lock\n\t" |
| 3916 | "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3917 | def LOCK_ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 3918 | "lock\n\t" |
| 3919 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3920 | def LOCK_ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2), |
| 3921 | "lock\n\t" |
| 3922 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3923 | def LOCK_ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
| 3924 | "lock\n\t" |
| 3925 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 3926 | def LOCK_ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
| 3927 | "lock\n\t" |
| 3928 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3929 | |
| 3930 | def LOCK_INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), |
| 3931 | "lock\n\t" |
| 3932 | "inc{b}\t$dst", []>, LOCK; |
| 3933 | def LOCK_INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), |
| 3934 | "lock\n\t" |
| 3935 | "inc{w}\t$dst", []>, OpSize, LOCK; |
| 3936 | def LOCK_INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), |
| 3937 | "lock\n\t" |
| 3938 | "inc{l}\t$dst", []>, LOCK; |
| 3939 | |
| 3940 | def LOCK_SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2), |
| 3941 | "lock\n\t" |
| 3942 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3943 | def LOCK_SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 3944 | "lock\n\t" |
| 3945 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 3946 | def LOCK_SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
| 3947 | "lock\n\t" |
| 3948 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3949 | def LOCK_SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2), |
| 3950 | "lock\n\t" |
| 3951 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3952 | def LOCK_SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 3953 | "lock\n\t" |
| 3954 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 3955 | def LOCK_SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2), |
| 3956 | "lock\n\t" |
| 3957 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3958 | def LOCK_SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 3959 | "lock\n\t" |
| 3960 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 3961 | def LOCK_SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
| 3962 | "lock\n\t" |
| 3963 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 3964 | |
| 3965 | def LOCK_DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), |
| 3966 | "lock\n\t" |
| 3967 | "dec{b}\t$dst", []>, LOCK; |
| 3968 | def LOCK_DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), |
| 3969 | "lock\n\t" |
| 3970 | "dec{w}\t$dst", []>, OpSize, LOCK; |
| 3971 | def LOCK_DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), |
| 3972 | "lock\n\t" |
| 3973 | "dec{l}\t$dst", []>, LOCK; |
Dan Gohman | bab42bd | 2009-10-20 18:14:49 +0000 | [diff] [blame] | 3974 | } |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 3975 | |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3976 | // Atomic exchange, and, or, xor |
Mon P Wang | 63307c3 | 2008-05-05 19:05:59 +0000 | [diff] [blame] | 3977 | let Constraints = "$val = $dst", Defs = [EFLAGS], |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 3978 | usesCustomInserter = 1 in { |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3979 | def ATOMAND32 : I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3980 | "#ATOMAND32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3981 | [(set GR32:$dst, (atomic_load_and_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3982 | def ATOMOR32 : I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3983 | "#ATOMOR32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3984 | [(set GR32:$dst, (atomic_load_or_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3985 | def ATOMXOR32 : I<0, Pseudo,(outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3986 | "#ATOMXOR32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3987 | [(set GR32:$dst, (atomic_load_xor_32 addr:$ptr, GR32:$val))]>; |
Andrew Lenharth | 507a58a | 2008-06-14 05:48:15 +0000 | [diff] [blame] | 3988 | def ATOMNAND32 : I<0, Pseudo,(outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3989 | "#ATOMNAND32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3990 | [(set GR32:$dst, (atomic_load_nand_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3991 | def ATOMMIN32: I<0, Pseudo, (outs GR32:$dst), (ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3992 | "#ATOMMIN32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3993 | [(set GR32:$dst, (atomic_load_min_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3994 | def ATOMMAX32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3995 | "#ATOMMAX32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3996 | [(set GR32:$dst, (atomic_load_max_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 3997 | def ATOMUMIN32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 3998 | "#ATOMUMIN32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 3999 | [(set GR32:$dst, (atomic_load_umin_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4000 | def ATOMUMAX32: I<0, Pseudo, (outs GR32:$dst),(ins i32mem:$ptr, GR32:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4001 | "#ATOMUMAX32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4002 | [(set GR32:$dst, (atomic_load_umax_32 addr:$ptr, GR32:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4003 | |
| 4004 | def ATOMAND16 : I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4005 | "#ATOMAND16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4006 | [(set GR16:$dst, (atomic_load_and_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4007 | def ATOMOR16 : I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4008 | "#ATOMOR16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4009 | [(set GR16:$dst, (atomic_load_or_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4010 | def ATOMXOR16 : I<0, Pseudo,(outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4011 | "#ATOMXOR16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4012 | [(set GR16:$dst, (atomic_load_xor_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4013 | def ATOMNAND16 : I<0, Pseudo,(outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4014 | "#ATOMNAND16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4015 | [(set GR16:$dst, (atomic_load_nand_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4016 | def ATOMMIN16: I<0, Pseudo, (outs GR16:$dst), (ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4017 | "#ATOMMIN16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4018 | [(set GR16:$dst, (atomic_load_min_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4019 | def ATOMMAX16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4020 | "#ATOMMAX16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4021 | [(set GR16:$dst, (atomic_load_max_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4022 | def ATOMUMIN16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4023 | "#ATOMUMIN16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4024 | [(set GR16:$dst, (atomic_load_umin_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4025 | def ATOMUMAX16: I<0, Pseudo, (outs GR16:$dst),(ins i16mem:$ptr, GR16:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4026 | "#ATOMUMAX16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4027 | [(set GR16:$dst, (atomic_load_umax_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4028 | |
| 4029 | def ATOMAND8 : I<0, Pseudo, (outs GR8:$dst),(ins i8mem:$ptr, GR8:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4030 | "#ATOMAND8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4031 | [(set GR8:$dst, (atomic_load_and_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4032 | def ATOMOR8 : I<0, Pseudo, (outs GR8:$dst),(ins i8mem:$ptr, GR8:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4033 | "#ATOMOR8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4034 | [(set GR8:$dst, (atomic_load_or_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4035 | def ATOMXOR8 : I<0, Pseudo,(outs GR8:$dst),(ins i8mem:$ptr, GR8:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4036 | "#ATOMXOR8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4037 | [(set GR8:$dst, (atomic_load_xor_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4038 | def ATOMNAND8 : I<0, Pseudo,(outs GR8:$dst),(ins i8mem:$ptr, GR8:$val), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4039 | "#ATOMNAND8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4040 | [(set GR8:$dst, (atomic_load_nand_8 addr:$ptr, GR8:$val))]>; |
Mon P Wang | 63307c3 | 2008-05-05 19:05:59 +0000 | [diff] [blame] | 4041 | } |
| 4042 | |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4043 | let Constraints = "$val1 = $dst1, $val2 = $dst2", |
| 4044 | Defs = [EFLAGS, EAX, EBX, ECX, EDX], |
| 4045 | Uses = [EAX, EBX, ECX, EDX], |
Dale Johannesen | 1b54c7f | 2008-10-03 19:41:08 +0000 | [diff] [blame] | 4046 | mayLoad = 1, mayStore = 1, |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 4047 | usesCustomInserter = 1 in { |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4048 | def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4049 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4050 | "#ATOMAND6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4051 | def ATOMOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4052 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4053 | "#ATOMOR6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4054 | def ATOMXOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4055 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4056 | "#ATOMXOR6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4057 | def ATOMNAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4058 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4059 | "#ATOMNAND6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4060 | def ATOMADD6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4061 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4062 | "#ATOMADD6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4063 | def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4064 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4065 | "#ATOMSUB6432 PSEUDO!", []>; |
Dale Johannesen | 880ae36 | 2008-10-03 22:25:52 +0000 | [diff] [blame] | 4066 | def ATOMSWAP6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4067 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4068 | "#ATOMSWAP6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4069 | } |
| 4070 | |
Sean Callanan | 358f1ef | 2009-09-16 21:55:34 +0000 | [diff] [blame] | 4071 | // Segmentation support instructions. |
| 4072 | |
| 4073 | def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 4074 | "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4075 | def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 4076 | "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4077 | |
| 4078 | // i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo. |
| 4079 | def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
| 4080 | "lar{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4081 | def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4082 | "lar{l}\t{$src, $dst|$dst, $src}", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4083 | |
| 4084 | def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 4085 | "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4086 | def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 4087 | "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4088 | def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 4089 | "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4090 | def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4091 | "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4092 | |
| 4093 | def INVLPG : I<0x01, RawFrm, (outs), (ins), "invlpg", []>, TB; |
| 4094 | |
| 4095 | def STRr : I<0x00, MRM1r, (outs GR16:$dst), (ins), |
| 4096 | "str{w}\t{$dst}", []>, TB; |
| 4097 | def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins), |
| 4098 | "str{w}\t{$dst}", []>, TB; |
| 4099 | def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src), |
| 4100 | "ltr{w}\t{$src}", []>, TB; |
| 4101 | def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src), |
| 4102 | "ltr{w}\t{$src}", []>, TB; |
| 4103 | |
| 4104 | def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins), |
| 4105 | "push{w}\t%fs", []>, OpSize, TB; |
| 4106 | def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins), |
| 4107 | "push{l}\t%fs", []>, TB; |
| 4108 | def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins), |
| 4109 | "push{w}\t%gs", []>, OpSize, TB; |
| 4110 | def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins), |
| 4111 | "push{l}\t%gs", []>, TB; |
| 4112 | |
| 4113 | def POPFS16 : I<0xa1, RawFrm, (outs), (ins), |
| 4114 | "pop{w}\t%fs", []>, OpSize, TB; |
| 4115 | def POPFS32 : I<0xa1, RawFrm, (outs), (ins), |
| 4116 | "pop{l}\t%fs", []>, TB; |
| 4117 | def POPGS16 : I<0xa9, RawFrm, (outs), (ins), |
| 4118 | "pop{w}\t%gs", []>, OpSize, TB; |
| 4119 | def POPGS32 : I<0xa9, RawFrm, (outs), (ins), |
| 4120 | "pop{l}\t%gs", []>, TB; |
| 4121 | |
| 4122 | def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4123 | "lds{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 4124 | def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4125 | "lds{l}\t{$src, $dst|$dst, $src}", []>; |
| 4126 | def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4127 | "lss{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4128 | def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4129 | "lss{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4130 | def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4131 | "les{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 4132 | def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4133 | "les{l}\t{$src, $dst|$dst, $src}", []>; |
| 4134 | def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4135 | "lfs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4136 | def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4137 | "lfs{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4138 | def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4139 | "lgs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4140 | def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4141 | "lgs{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4142 | |
| 4143 | def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg), |
| 4144 | "verr\t$seg", []>, TB; |
| 4145 | def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg), |
| 4146 | "verr\t$seg", []>, TB; |
| 4147 | def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg), |
| 4148 | "verw\t$seg", []>, TB; |
| 4149 | def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg), |
| 4150 | "verw\t$seg", []>, TB; |
| 4151 | |
| 4152 | // Descriptor-table support instructions |
| 4153 | |
| 4154 | def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins), |
| 4155 | "sgdt\t$dst", []>, TB; |
| 4156 | def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins), |
| 4157 | "sidt\t$dst", []>, TB; |
| 4158 | def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins), |
| 4159 | "sldt{w}\t$dst", []>, TB; |
| 4160 | def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins), |
| 4161 | "sldt{w}\t$dst", []>, TB; |
| 4162 | def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src), |
| 4163 | "lgdt\t$src", []>, TB; |
| 4164 | def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src), |
| 4165 | "lidt\t$src", []>, TB; |
| 4166 | def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src), |
| 4167 | "lldt{w}\t$src", []>, TB; |
| 4168 | def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src), |
| 4169 | "lldt{w}\t$src", []>, TB; |
Sean Callanan | 9a86f10 | 2009-09-16 22:59:28 +0000 | [diff] [blame] | 4170 | |
| 4171 | // String manipulation instructions |
| 4172 | |
| 4173 | def LODSB : I<0xAC, RawFrm, (outs), (ins), "lodsb", []>; |
| 4174 | def LODSW : I<0xAD, RawFrm, (outs), (ins), "lodsw", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4175 | def LODSD : I<0xAD, RawFrm, (outs), (ins), "lods{l|d}", []>; |
| 4176 | |
| 4177 | def OUTSB : I<0x6E, RawFrm, (outs), (ins), "outsb", []>; |
| 4178 | def OUTSW : I<0x6F, RawFrm, (outs), (ins), "outsw", []>, OpSize; |
| 4179 | def OUTSD : I<0x6F, RawFrm, (outs), (ins), "outs{l|d}", []>; |
| 4180 | |
| 4181 | // CPU flow control instructions |
| 4182 | |
| 4183 | def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", []>; |
| 4184 | def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", []>, TB; |
| 4185 | |
| 4186 | // FPU control instructions |
| 4187 | |
| 4188 | def FNINIT : I<0xE3, RawFrm, (outs), (ins), "fninit", []>, DB; |
| 4189 | |
| 4190 | // Flag instructions |
| 4191 | |
| 4192 | def CLC : I<0xF8, RawFrm, (outs), (ins), "clc", []>; |
| 4193 | def STC : I<0xF9, RawFrm, (outs), (ins), "stc", []>; |
| 4194 | def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", []>; |
| 4195 | def STI : I<0xFB, RawFrm, (outs), (ins), "sti", []>; |
| 4196 | def CLD : I<0xFC, RawFrm, (outs), (ins), "cld", []>; |
| 4197 | def STD : I<0xFD, RawFrm, (outs), (ins), "std", []>; |
| 4198 | def CMC : I<0xF5, RawFrm, (outs), (ins), "cmc", []>; |
| 4199 | |
| 4200 | def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", []>, TB; |
| 4201 | |
| 4202 | // Table lookup instructions |
| 4203 | |
| 4204 | def XLAT : I<0xD7, RawFrm, (outs), (ins), "xlatb", []>; |
| 4205 | |
| 4206 | // Specialized register support |
| 4207 | |
| 4208 | def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB; |
| 4209 | def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB; |
| 4210 | def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", []>, TB; |
| 4211 | |
| 4212 | def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins), |
| 4213 | "smsw{w}\t$dst", []>, OpSize, TB; |
| 4214 | def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins), |
| 4215 | "smsw{l}\t$dst", []>, TB; |
| 4216 | // For memory operands, there is only a 16-bit form |
| 4217 | def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins), |
| 4218 | "smsw{w}\t$dst", []>, TB; |
| 4219 | |
| 4220 | def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src), |
| 4221 | "lmsw{w}\t$src", []>, TB; |
| 4222 | def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src), |
| 4223 | "lmsw{w}\t$src", []>, TB; |
| 4224 | |
| 4225 | def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", []>, TB; |
| 4226 | |
| 4227 | // Cache instructions |
| 4228 | |
| 4229 | def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB; |
| 4230 | def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB; |
| 4231 | |
| 4232 | // VMX instructions |
| 4233 | |
| 4234 | // 66 0F 38 80 |
| 4235 | def INVEPT : I<0x38, RawFrm, (outs), (ins), "invept", []>, OpSize, TB; |
| 4236 | // 66 0F 38 81 |
| 4237 | def INVVPID : I<0x38, RawFrm, (outs), (ins), "invvpid", []>, OpSize, TB; |
| 4238 | // 0F 01 C1 |
| 4239 | def VMCALL : I<0x01, RawFrm, (outs), (ins), "vmcall", []>, TB; |
| 4240 | def VMCLEARm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs), |
| 4241 | "vmclear\t$vmcs", []>, OpSize, TB; |
| 4242 | // 0F 01 C2 |
| 4243 | def VMLAUNCH : I<0x01, RawFrm, (outs), (ins), "vmlaunch", []>, TB; |
| 4244 | // 0F 01 C3 |
| 4245 | def VMRESUME : I<0x01, RawFrm, (outs), (ins), "vmresume", []>, TB; |
| 4246 | def VMPTRLDm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs), |
| 4247 | "vmptrld\t$vmcs", []>, TB; |
| 4248 | def VMPTRSTm : I<0xC7, MRM7m, (outs i64mem:$vmcs), (ins), |
| 4249 | "vmptrst\t$vmcs", []>, TB; |
| 4250 | def VMREAD64rm : I<0x78, MRMDestMem, (outs i64mem:$dst), (ins GR64:$src), |
| 4251 | "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4252 | def VMREAD64rr : I<0x78, MRMDestReg, (outs GR64:$dst), (ins GR64:$src), |
| 4253 | "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4254 | def VMREAD32rm : I<0x78, MRMDestMem, (outs i32mem:$dst), (ins GR32:$src), |
| 4255 | "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4256 | def VMREAD32rr : I<0x78, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 4257 | "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4258 | def VMWRITE64rm : I<0x79, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), |
| 4259 | "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4260 | def VMWRITE64rr : I<0x79, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), |
| 4261 | "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4262 | def VMWRITE32rm : I<0x79, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 4263 | "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4264 | def VMWRITE32rr : I<0x79, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4265 | "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4266 | // 0F 01 C4 |
| 4267 | def VMXOFF : I<0x01, RawFrm, (outs), (ins), "vmxoff", []>, OpSize; |
| 4268 | def VMXON : I<0xC7, MRM6m, (outs), (ins i64mem:$vmxon), |
| 4269 | "vmxon\t{$vmxon}", []>, XD; |
Sean Callanan | 358f1ef | 2009-09-16 21:55:34 +0000 | [diff] [blame] | 4270 | |
Andrew Lenharth | ab0b949 | 2008-02-21 06:45:13 +0000 | [diff] [blame] | 4271 | //===----------------------------------------------------------------------===// |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4272 | // Non-Instruction Patterns |
| 4273 | //===----------------------------------------------------------------------===// |
| 4274 | |
Bill Wendling | 056292f | 2008-09-16 21:48:12 +0000 | [diff] [blame] | 4275 | // ConstantPool GlobalAddress, ExternalSymbol, and JumpTable |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4276 | def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>; |
Nate Begeman | 37efe67 | 2006-04-22 18:53:45 +0000 | [diff] [blame] | 4277 | def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>; |
Nate Begeman | 6795ebb | 2008-04-12 00:47:57 +0000 | [diff] [blame] | 4278 | def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4279 | def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>; |
| 4280 | def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4281 | def : Pat<(i32 (X86Wrapper tblockaddress:$dst)), (MOV32ri tblockaddress:$dst)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4282 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4283 | def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)), |
| 4284 | (ADD32ri GR32:$src1, tconstpool:$src2)>; |
| 4285 | def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)), |
| 4286 | (ADD32ri GR32:$src1, tjumptable:$src2)>; |
| 4287 | def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)), |
| 4288 | (ADD32ri GR32:$src1, tglobaladdr:$src2)>; |
| 4289 | def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)), |
| 4290 | (ADD32ri GR32:$src1, texternalsym:$src2)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4291 | def : Pat<(add GR32:$src1, (X86Wrapper tblockaddress:$src2)), |
| 4292 | (ADD32ri GR32:$src1, tblockaddress:$src2)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4293 | |
Evan Cheng | fc8feb1 | 2006-05-19 07:30:36 +0000 | [diff] [blame] | 4294 | def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst), |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4295 | (MOV32mi addr:$dst, tglobaladdr:$src)>; |
Evan Cheng | fc8feb1 | 2006-05-19 07:30:36 +0000 | [diff] [blame] | 4296 | def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst), |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4297 | (MOV32mi addr:$dst, texternalsym:$src)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4298 | def : Pat<(store (i32 (X86Wrapper tblockaddress:$src)), addr:$dst), |
| 4299 | (MOV32mi addr:$dst, tblockaddress:$src)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4300 | |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4301 | // Calls |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 4302 | // tailcall stuff |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 4303 | def : Pat<(X86tcret GR32:$dst, imm:$off), |
| 4304 | (TCRETURNri GR32:$dst, imm:$off)>; |
| 4305 | |
| 4306 | def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), |
| 4307 | (TCRETURNdi texternalsym:$dst, imm:$off)>; |
| 4308 | |
| 4309 | def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off), |
| 4310 | (TCRETURNdi texternalsym:$dst, imm:$off)>; |
Evan Cheng | fea89c1 | 2006-04-27 08:40:39 +0000 | [diff] [blame] | 4311 | |
Dan Gohman | cadb226 | 2009-08-02 16:10:01 +0000 | [diff] [blame] | 4312 | // Normal calls, with various flavors of addresses. |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 4313 | def : Pat<(X86call (i32 tglobaladdr:$dst)), |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4314 | (CALLpcrel32 tglobaladdr:$dst)>; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 4315 | def : Pat<(X86call (i32 texternalsym:$dst)), |
Evan Cheng | 8700e14 | 2006-01-11 06:09:51 +0000 | [diff] [blame] | 4316 | (CALLpcrel32 texternalsym:$dst)>; |
Evan Cheng | d7f666a | 2009-05-20 04:53:57 +0000 | [diff] [blame] | 4317 | def : Pat<(X86call (i32 imm:$dst)), |
| 4318 | (CALLpcrel32 imm:$dst)>, Requires<[CallImmAddr]>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4319 | |
| 4320 | // X86 specific add which produces a flag. |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4321 | def : Pat<(addc GR32:$src1, GR32:$src2), |
| 4322 | (ADD32rr GR32:$src1, GR32:$src2)>; |
| 4323 | def : Pat<(addc GR32:$src1, (load addr:$src2)), |
| 4324 | (ADD32rm GR32:$src1, addr:$src2)>; |
| 4325 | def : Pat<(addc GR32:$src1, imm:$src2), |
| 4326 | (ADD32ri GR32:$src1, imm:$src2)>; |
| 4327 | def : Pat<(addc GR32:$src1, i32immSExt8:$src2), |
| 4328 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4329 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4330 | def : Pat<(subc GR32:$src1, GR32:$src2), |
| 4331 | (SUB32rr GR32:$src1, GR32:$src2)>; |
| 4332 | def : Pat<(subc GR32:$src1, (load addr:$src2)), |
| 4333 | (SUB32rm GR32:$src1, addr:$src2)>; |
| 4334 | def : Pat<(subc GR32:$src1, imm:$src2), |
| 4335 | (SUB32ri GR32:$src1, imm:$src2)>; |
| 4336 | def : Pat<(subc GR32:$src1, i32immSExt8:$src2), |
| 4337 | (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4338 | |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4339 | // Comparisons. |
| 4340 | |
| 4341 | // TEST R,R is smaller than CMP R,0 |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 4342 | def : Pat<(parallel (X86cmp GR8:$src1, 0), (implicit EFLAGS)), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4343 | (TEST8rr GR8:$src1, GR8:$src1)>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 4344 | def : Pat<(parallel (X86cmp GR16:$src1, 0), (implicit EFLAGS)), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4345 | (TEST16rr GR16:$src1, GR16:$src1)>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 4346 | def : Pat<(parallel (X86cmp GR32:$src1, 0), (implicit EFLAGS)), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4347 | (TEST32rr GR32:$src1, GR32:$src1)>; |
| 4348 | |
Dan Gohman | fbb7486 | 2009-01-07 01:00:24 +0000 | [diff] [blame] | 4349 | // Conditional moves with folded loads with operands swapped and conditions |
| 4350 | // inverted. |
| 4351 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_B, EFLAGS), |
| 4352 | (CMOVAE16rm GR16:$src2, addr:$src1)>; |
| 4353 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_B, EFLAGS), |
| 4354 | (CMOVAE32rm GR32:$src2, addr:$src1)>; |
| 4355 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_AE, EFLAGS), |
| 4356 | (CMOVB16rm GR16:$src2, addr:$src1)>; |
| 4357 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_AE, EFLAGS), |
| 4358 | (CMOVB32rm GR32:$src2, addr:$src1)>; |
| 4359 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_E, EFLAGS), |
| 4360 | (CMOVNE16rm GR16:$src2, addr:$src1)>; |
| 4361 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_E, EFLAGS), |
| 4362 | (CMOVNE32rm GR32:$src2, addr:$src1)>; |
| 4363 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NE, EFLAGS), |
| 4364 | (CMOVE16rm GR16:$src2, addr:$src1)>; |
| 4365 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NE, EFLAGS), |
| 4366 | (CMOVE32rm GR32:$src2, addr:$src1)>; |
| 4367 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_BE, EFLAGS), |
| 4368 | (CMOVA16rm GR16:$src2, addr:$src1)>; |
| 4369 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_BE, EFLAGS), |
| 4370 | (CMOVA32rm GR32:$src2, addr:$src1)>; |
| 4371 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_A, EFLAGS), |
| 4372 | (CMOVBE16rm GR16:$src2, addr:$src1)>; |
| 4373 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_A, EFLAGS), |
| 4374 | (CMOVBE32rm GR32:$src2, addr:$src1)>; |
| 4375 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_L, EFLAGS), |
| 4376 | (CMOVGE16rm GR16:$src2, addr:$src1)>; |
| 4377 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_L, EFLAGS), |
| 4378 | (CMOVGE32rm GR32:$src2, addr:$src1)>; |
| 4379 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_GE, EFLAGS), |
| 4380 | (CMOVL16rm GR16:$src2, addr:$src1)>; |
| 4381 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_GE, EFLAGS), |
| 4382 | (CMOVL32rm GR32:$src2, addr:$src1)>; |
| 4383 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_LE, EFLAGS), |
| 4384 | (CMOVG16rm GR16:$src2, addr:$src1)>; |
| 4385 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_LE, EFLAGS), |
| 4386 | (CMOVG32rm GR32:$src2, addr:$src1)>; |
| 4387 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_G, EFLAGS), |
| 4388 | (CMOVLE16rm GR16:$src2, addr:$src1)>; |
| 4389 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_G, EFLAGS), |
| 4390 | (CMOVLE32rm GR32:$src2, addr:$src1)>; |
| 4391 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_P, EFLAGS), |
| 4392 | (CMOVNP16rm GR16:$src2, addr:$src1)>; |
| 4393 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_P, EFLAGS), |
| 4394 | (CMOVNP32rm GR32:$src2, addr:$src1)>; |
| 4395 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NP, EFLAGS), |
| 4396 | (CMOVP16rm GR16:$src2, addr:$src1)>; |
| 4397 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NP, EFLAGS), |
| 4398 | (CMOVP32rm GR32:$src2, addr:$src1)>; |
| 4399 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_S, EFLAGS), |
| 4400 | (CMOVNS16rm GR16:$src2, addr:$src1)>; |
| 4401 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_S, EFLAGS), |
| 4402 | (CMOVNS32rm GR32:$src2, addr:$src1)>; |
| 4403 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NS, EFLAGS), |
| 4404 | (CMOVS16rm GR16:$src2, addr:$src1)>; |
| 4405 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NS, EFLAGS), |
| 4406 | (CMOVS32rm GR32:$src2, addr:$src1)>; |
| 4407 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_O, EFLAGS), |
| 4408 | (CMOVNO16rm GR16:$src2, addr:$src1)>; |
| 4409 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_O, EFLAGS), |
| 4410 | (CMOVNO32rm GR32:$src2, addr:$src1)>; |
| 4411 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NO, EFLAGS), |
| 4412 | (CMOVO16rm GR16:$src2, addr:$src1)>; |
| 4413 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NO, EFLAGS), |
| 4414 | (CMOVO32rm GR32:$src2, addr:$src1)>; |
| 4415 | |
Duncan Sands | f9c98e6 | 2008-01-23 20:39:46 +0000 | [diff] [blame] | 4416 | // zextload bool -> zextload byte |
Evan Cheng | e5d9343 | 2006-01-17 07:02:46 +0000 | [diff] [blame] | 4417 | def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4418 | def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; |
| 4419 | def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; |
| 4420 | |
| 4421 | // extload bool -> extload byte |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4422 | def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4423 | def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4424 | def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4425 | def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>; |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4426 | def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>; |
| 4427 | def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4428 | |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4429 | // anyext. Define these to do an explicit zero-extend to |
| 4430 | // avoid partial-register updates. |
| 4431 | def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>; |
| 4432 | def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>; |
| 4433 | def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4434 | |
Evan Cheng | 1314b00 | 2007-12-13 00:43:27 +0000 | [diff] [blame] | 4435 | // (and (i32 load), 255) -> (zextload i8) |
Evan Cheng | d47e0b6 | 2008-09-29 17:26:18 +0000 | [diff] [blame] | 4436 | def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 255))), |
| 4437 | (MOVZX32rm8 addr:$src)>; |
| 4438 | def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 65535))), |
| 4439 | (MOVZX32rm16 addr:$src)>; |
Evan Cheng | 1314b00 | 2007-12-13 00:43:27 +0000 | [diff] [blame] | 4440 | |
Evan Cheng | cfa260b | 2006-01-06 02:31:59 +0000 | [diff] [blame] | 4441 | //===----------------------------------------------------------------------===// |
| 4442 | // Some peepholes |
| 4443 | //===----------------------------------------------------------------------===// |
| 4444 | |
Dan Gohman | 63f9720 | 2008-10-17 01:33:43 +0000 | [diff] [blame] | 4445 | // Odd encoding trick: -128 fits into an 8-bit immediate field while |
| 4446 | // +128 doesn't, so in this special case use a sub instead of an add. |
| 4447 | def : Pat<(add GR16:$src1, 128), |
| 4448 | (SUB16ri8 GR16:$src1, -128)>; |
| 4449 | def : Pat<(store (add (loadi16 addr:$dst), 128), addr:$dst), |
| 4450 | (SUB16mi8 addr:$dst, -128)>; |
| 4451 | def : Pat<(add GR32:$src1, 128), |
| 4452 | (SUB32ri8 GR32:$src1, -128)>; |
| 4453 | def : Pat<(store (add (loadi32 addr:$dst), 128), addr:$dst), |
| 4454 | (SUB32mi8 addr:$dst, -128)>; |
| 4455 | |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 4456 | // r & (2^16-1) ==> movz |
| 4457 | def : Pat<(and GR32:$src1, 0xffff), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4458 | (MOVZX32rr16 (EXTRACT_SUBREG GR32:$src1, x86_subreg_16bit))>; |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4459 | // r & (2^8-1) ==> movz |
| 4460 | def : Pat<(and GR32:$src1, 0xff), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4461 | (MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src1, |
| 4462 | GR32_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4463 | x86_subreg_8bit))>, |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4464 | Requires<[In32BitMode]>; |
| 4465 | // r & (2^8-1) ==> movz |
| 4466 | def : Pat<(and GR16:$src1, 0xff), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4467 | (MOVZX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src1, |
| 4468 | GR16_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4469 | x86_subreg_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4470 | Requires<[In32BitMode]>; |
| 4471 | |
| 4472 | // sext_inreg patterns |
| 4473 | def : Pat<(sext_inreg GR32:$src, i16), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4474 | (MOVSX32rr16 (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit))>; |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4475 | def : Pat<(sext_inreg GR32:$src, i8), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4476 | (MOVSX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, |
| 4477 | GR32_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4478 | x86_subreg_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4479 | Requires<[In32BitMode]>; |
| 4480 | def : Pat<(sext_inreg GR16:$src, i8), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4481 | (MOVSX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4482 | GR16_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4483 | x86_subreg_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4484 | Requires<[In32BitMode]>; |
| 4485 | |
| 4486 | // trunc patterns |
| 4487 | def : Pat<(i16 (trunc GR32:$src)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4488 | (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit)>; |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4489 | def : Pat<(i8 (trunc GR32:$src)), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4490 | (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4491 | x86_subreg_8bit)>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4492 | Requires<[In32BitMode]>; |
| 4493 | def : Pat<(i8 (trunc GR16:$src)), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4494 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4495 | x86_subreg_8bit)>, |
| 4496 | Requires<[In32BitMode]>; |
| 4497 | |
| 4498 | // h-register tricks |
| 4499 | def : Pat<(i8 (trunc (srl_su GR16:$src, (i8 8)))), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4500 | (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4501 | x86_subreg_8bit_hi)>, |
| 4502 | Requires<[In32BitMode]>; |
| 4503 | def : Pat<(i8 (trunc (srl_su GR32:$src, (i8 8)))), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4504 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4505 | x86_subreg_8bit_hi)>, |
| 4506 | Requires<[In32BitMode]>; |
Dan Gohman | 7e0d64a | 2010-01-11 17:21:05 +0000 | [diff] [blame] | 4507 | def : Pat<(srl GR16:$src, (i8 8)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4508 | (EXTRACT_SUBREG |
| 4509 | (MOVZX32rr8 |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4510 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4511 | x86_subreg_8bit_hi)), |
| 4512 | x86_subreg_16bit)>, |
| 4513 | Requires<[In32BitMode]>; |
Evan Cheng | cb219f0 | 2009-05-29 01:44:43 +0000 | [diff] [blame] | 4514 | def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4515 | (MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4516 | GR16_ABCD)), |
Evan Cheng | cb219f0 | 2009-05-29 01:44:43 +0000 | [diff] [blame] | 4517 | x86_subreg_8bit_hi))>, |
| 4518 | Requires<[In32BitMode]>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4519 | def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4520 | (MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4521 | GR16_ABCD)), |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4522 | x86_subreg_8bit_hi))>, |
| 4523 | Requires<[In32BitMode]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4524 | def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4525 | (MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, |
| 4526 | GR32_ABCD)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4527 | x86_subreg_8bit_hi))>, |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4528 | Requires<[In32BitMode]>; |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 4529 | |
Evan Cheng | cfa260b | 2006-01-06 02:31:59 +0000 | [diff] [blame] | 4530 | // (shl x, 1) ==> (add x, x) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4531 | def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>; |
| 4532 | def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>; |
| 4533 | def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>; |
Evan Cheng | 68b951a | 2006-01-19 01:56:29 +0000 | [diff] [blame] | 4534 | |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4535 | // (shl x (and y, 31)) ==> (shl x, y) |
| 4536 | def : Pat<(shl GR8:$src1, (and CL:$amt, 31)), |
| 4537 | (SHL8rCL GR8:$src1)>; |
| 4538 | def : Pat<(shl GR16:$src1, (and CL:$amt, 31)), |
| 4539 | (SHL16rCL GR16:$src1)>; |
| 4540 | def : Pat<(shl GR32:$src1, (and CL:$amt, 31)), |
| 4541 | (SHL32rCL GR32:$src1)>; |
| 4542 | def : Pat<(store (shl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4543 | (SHL8mCL addr:$dst)>; |
| 4544 | def : Pat<(store (shl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4545 | (SHL16mCL addr:$dst)>; |
| 4546 | def : Pat<(store (shl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4547 | (SHL32mCL addr:$dst)>; |
| 4548 | |
| 4549 | def : Pat<(srl GR8:$src1, (and CL:$amt, 31)), |
| 4550 | (SHR8rCL GR8:$src1)>; |
| 4551 | def : Pat<(srl GR16:$src1, (and CL:$amt, 31)), |
| 4552 | (SHR16rCL GR16:$src1)>; |
| 4553 | def : Pat<(srl GR32:$src1, (and CL:$amt, 31)), |
| 4554 | (SHR32rCL GR32:$src1)>; |
| 4555 | def : Pat<(store (srl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4556 | (SHR8mCL addr:$dst)>; |
| 4557 | def : Pat<(store (srl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4558 | (SHR16mCL addr:$dst)>; |
| 4559 | def : Pat<(store (srl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4560 | (SHR32mCL addr:$dst)>; |
| 4561 | |
| 4562 | def : Pat<(sra GR8:$src1, (and CL:$amt, 31)), |
| 4563 | (SAR8rCL GR8:$src1)>; |
| 4564 | def : Pat<(sra GR16:$src1, (and CL:$amt, 31)), |
| 4565 | (SAR16rCL GR16:$src1)>; |
| 4566 | def : Pat<(sra GR32:$src1, (and CL:$amt, 31)), |
| 4567 | (SAR32rCL GR32:$src1)>; |
| 4568 | def : Pat<(store (sra (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4569 | (SAR8mCL addr:$dst)>; |
| 4570 | def : Pat<(store (sra (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4571 | (SAR16mCL addr:$dst)>; |
| 4572 | def : Pat<(store (sra (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst), |
| 4573 | (SAR32mCL addr:$dst)>; |
| 4574 | |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4575 | // (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4576 | def : Pat<(or (srl GR32:$src1, CL:$amt), |
| 4577 | (shl GR32:$src2, (sub 32, CL:$amt))), |
| 4578 | (SHRD32rrCL GR32:$src1, GR32:$src2)>; |
Evan Cheng | 68b951a | 2006-01-19 01:56:29 +0000 | [diff] [blame] | 4579 | |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4580 | def : Pat<(store (or (srl (loadi32 addr:$dst), CL:$amt), |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4581 | (shl GR32:$src2, (sub 32, CL:$amt))), addr:$dst), |
| 4582 | (SHRD32mrCL addr:$dst, GR32:$src2)>; |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4583 | |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 4584 | def : Pat<(or (srl GR32:$src1, (i8 (trunc ECX:$amt))), |
| 4585 | (shl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))), |
| 4586 | (SHRD32rrCL GR32:$src1, GR32:$src2)>; |
| 4587 | |
| 4588 | def : Pat<(store (or (srl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))), |
| 4589 | (shl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))), |
| 4590 | addr:$dst), |
| 4591 | (SHRD32mrCL addr:$dst, GR32:$src2)>; |
| 4592 | |
| 4593 | def : Pat<(shrd GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)), |
| 4594 | (SHRD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>; |
| 4595 | |
| 4596 | def : Pat<(store (shrd (loadi32 addr:$dst), (i8 imm:$amt1), |
| 4597 | GR32:$src2, (i8 imm:$amt2)), addr:$dst), |
| 4598 | (SHRD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>; |
| 4599 | |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4600 | // (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4601 | def : Pat<(or (shl GR32:$src1, CL:$amt), |
| 4602 | (srl GR32:$src2, (sub 32, CL:$amt))), |
| 4603 | (SHLD32rrCL GR32:$src1, GR32:$src2)>; |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4604 | |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4605 | def : Pat<(store (or (shl (loadi32 addr:$dst), CL:$amt), |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4606 | (srl GR32:$src2, (sub 32, CL:$amt))), addr:$dst), |
| 4607 | (SHLD32mrCL addr:$dst, GR32:$src2)>; |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4608 | |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 4609 | def : Pat<(or (shl GR32:$src1, (i8 (trunc ECX:$amt))), |
| 4610 | (srl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))), |
| 4611 | (SHLD32rrCL GR32:$src1, GR32:$src2)>; |
| 4612 | |
| 4613 | def : Pat<(store (or (shl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))), |
| 4614 | (srl GR32:$src2, (i8 (trunc (sub 32, ECX:$amt))))), |
| 4615 | addr:$dst), |
| 4616 | (SHLD32mrCL addr:$dst, GR32:$src2)>; |
| 4617 | |
| 4618 | def : Pat<(shld GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)), |
| 4619 | (SHLD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>; |
| 4620 | |
| 4621 | def : Pat<(store (shld (loadi32 addr:$dst), (i8 imm:$amt1), |
| 4622 | GR32:$src2, (i8 imm:$amt2)), addr:$dst), |
| 4623 | (SHLD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>; |
| 4624 | |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4625 | // (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4626 | def : Pat<(or (srl GR16:$src1, CL:$amt), |
| 4627 | (shl GR16:$src2, (sub 16, CL:$amt))), |
| 4628 | (SHRD16rrCL GR16:$src1, GR16:$src2)>; |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4629 | |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4630 | def : Pat<(store (or (srl (loadi16 addr:$dst), CL:$amt), |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4631 | (shl GR16:$src2, (sub 16, CL:$amt))), addr:$dst), |
| 4632 | (SHRD16mrCL addr:$dst, GR16:$src2)>; |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4633 | |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 4634 | def : Pat<(or (srl GR16:$src1, (i8 (trunc CX:$amt))), |
| 4635 | (shl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))), |
| 4636 | (SHRD16rrCL GR16:$src1, GR16:$src2)>; |
| 4637 | |
| 4638 | def : Pat<(store (or (srl (loadi16 addr:$dst), (i8 (trunc CX:$amt))), |
| 4639 | (shl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))), |
| 4640 | addr:$dst), |
| 4641 | (SHRD16mrCL addr:$dst, GR16:$src2)>; |
| 4642 | |
| 4643 | def : Pat<(shrd GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)), |
| 4644 | (SHRD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>; |
| 4645 | |
| 4646 | def : Pat<(store (shrd (loadi16 addr:$dst), (i8 imm:$amt1), |
| 4647 | GR16:$src2, (i8 imm:$amt2)), addr:$dst), |
| 4648 | (SHRD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>; |
| 4649 | |
Evan Cheng | 956044c | 2006-01-19 23:26:24 +0000 | [diff] [blame] | 4650 | // (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4651 | def : Pat<(or (shl GR16:$src1, CL:$amt), |
| 4652 | (srl GR16:$src2, (sub 16, CL:$amt))), |
| 4653 | (SHLD16rrCL GR16:$src1, GR16:$src2)>; |
Evan Cheng | 21d5443 | 2006-01-20 01:13:30 +0000 | [diff] [blame] | 4654 | |
| 4655 | def : Pat<(store (or (shl (loadi16 addr:$dst), CL:$amt), |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4656 | (srl GR16:$src2, (sub 16, CL:$amt))), addr:$dst), |
| 4657 | (SHLD16mrCL addr:$dst, GR16:$src2)>; |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 4658 | |
Dan Gohman | 74feef2 | 2008-10-17 01:23:35 +0000 | [diff] [blame] | 4659 | def : Pat<(or (shl GR16:$src1, (i8 (trunc CX:$amt))), |
| 4660 | (srl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))), |
| 4661 | (SHLD16rrCL GR16:$src1, GR16:$src2)>; |
| 4662 | |
| 4663 | def : Pat<(store (or (shl (loadi16 addr:$dst), (i8 (trunc CX:$amt))), |
| 4664 | (srl GR16:$src2, (i8 (trunc (sub 16, CX:$amt))))), |
| 4665 | addr:$dst), |
| 4666 | (SHLD16mrCL addr:$dst, GR16:$src2)>; |
| 4667 | |
| 4668 | def : Pat<(shld GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)), |
| 4669 | (SHLD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>; |
| 4670 | |
| 4671 | def : Pat<(store (shld (loadi16 addr:$dst), (i8 imm:$amt1), |
| 4672 | GR16:$src2, (i8 imm:$amt2)), addr:$dst), |
| 4673 | (SHLD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>; |
| 4674 | |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 4675 | // (anyext (setcc_carry)) -> (setcc_carry) |
| 4676 | def : Pat<(i16 (anyext (i8 (X86setcc_c X86_COND_B, EFLAGS)))), |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 4677 | (SETB_C16r)>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 4678 | def : Pat<(i32 (anyext (i8 (X86setcc_c X86_COND_B, EFLAGS)))), |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 4679 | (SETB_C32r)>; |
| 4680 | |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 4681 | // (or x1, x2) -> (add x1, x2) if two operands are known not to share bits. |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4682 | def : Pat<(parallel (or_is_add GR16:$src1, imm:$src2), |
| 4683 | (implicit EFLAGS)), |
| 4684 | (ADD16ri GR16:$src1, imm:$src2)>; |
| 4685 | def : Pat<(parallel (or_is_add GR32:$src1, imm:$src2), |
| 4686 | (implicit EFLAGS)), |
| 4687 | (ADD32ri GR32:$src1, imm:$src2)>; |
| 4688 | def : Pat<(parallel (or_is_add GR16:$src1, i16immSExt8:$src2), |
| 4689 | (implicit EFLAGS)), |
| 4690 | (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>; |
| 4691 | def : Pat<(parallel (or_is_add GR32:$src1, i32immSExt8:$src2), |
| 4692 | (implicit EFLAGS)), |
| 4693 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 4694 | def : Pat<(parallel (or_is_add GR16:$src1, GR16:$src2), |
| 4695 | (implicit EFLAGS)), |
| 4696 | (ADD16rr GR16:$src1, GR16:$src2)>; |
| 4697 | def : Pat<(parallel (or_is_add GR32:$src1, GR32:$src2), |
| 4698 | (implicit EFLAGS)), |
| 4699 | (ADD32rr GR32:$src1, GR32:$src2)>; |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4700 | |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 4701 | //===----------------------------------------------------------------------===// |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4702 | // EFLAGS-defining Patterns |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4703 | //===----------------------------------------------------------------------===// |
| 4704 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4705 | // Register-Register Addition with EFLAGS result |
| 4706 | def : Pat<(parallel (X86add_flag GR8:$src1, GR8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4707 | (implicit EFLAGS)), |
| 4708 | (ADD8rr GR8:$src1, GR8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4709 | def : Pat<(parallel (X86add_flag GR16:$src1, GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4710 | (implicit EFLAGS)), |
| 4711 | (ADD16rr GR16:$src1, GR16:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4712 | def : Pat<(parallel (X86add_flag GR32:$src1, GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4713 | (implicit EFLAGS)), |
| 4714 | (ADD32rr GR32:$src1, GR32:$src2)>; |
| 4715 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4716 | // Register-Memory Addition with EFLAGS result |
| 4717 | def : Pat<(parallel (X86add_flag GR8:$src1, (loadi8 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4718 | (implicit EFLAGS)), |
| 4719 | (ADD8rm GR8:$src1, addr:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4720 | def : Pat<(parallel (X86add_flag GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4721 | (implicit EFLAGS)), |
| 4722 | (ADD16rm GR16:$src1, addr:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4723 | def : Pat<(parallel (X86add_flag GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4724 | (implicit EFLAGS)), |
| 4725 | (ADD32rm GR32:$src1, addr:$src2)>; |
| 4726 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4727 | // Register-Integer Addition with EFLAGS result |
| 4728 | def : Pat<(parallel (X86add_flag GR8:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4729 | (implicit EFLAGS)), |
| 4730 | (ADD8ri GR8:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4731 | def : Pat<(parallel (X86add_flag GR16:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4732 | (implicit EFLAGS)), |
| 4733 | (ADD16ri GR16:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4734 | def : Pat<(parallel (X86add_flag GR32:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4735 | (implicit EFLAGS)), |
| 4736 | (ADD32ri GR32:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4737 | def : Pat<(parallel (X86add_flag GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4738 | (implicit EFLAGS)), |
| 4739 | (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4740 | def : Pat<(parallel (X86add_flag GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4741 | (implicit EFLAGS)), |
| 4742 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4743 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4744 | // Memory-Register Addition with EFLAGS result |
| 4745 | def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), GR8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4746 | addr:$dst), |
| 4747 | (implicit EFLAGS)), |
| 4748 | (ADD8mr addr:$dst, GR8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4749 | def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4750 | addr:$dst), |
| 4751 | (implicit EFLAGS)), |
| 4752 | (ADD16mr addr:$dst, GR16:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4753 | def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4754 | addr:$dst), |
| 4755 | (implicit EFLAGS)), |
| 4756 | (ADD32mr addr:$dst, GR32:$src2)>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 4757 | |
| 4758 | // Memory-Integer Addition with EFLAGS result |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4759 | def : Pat<(parallel (store (X86add_flag (loadi8 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4760 | addr:$dst), |
| 4761 | (implicit EFLAGS)), |
| 4762 | (ADD8mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4763 | def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4764 | addr:$dst), |
| 4765 | (implicit EFLAGS)), |
| 4766 | (ADD16mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4767 | def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4768 | addr:$dst), |
| 4769 | (implicit EFLAGS)), |
| 4770 | (ADD32mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4771 | def : Pat<(parallel (store (X86add_flag (loadi16 addr:$dst), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4772 | addr:$dst), |
| 4773 | (implicit EFLAGS)), |
| 4774 | (ADD16mi8 addr:$dst, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4775 | def : Pat<(parallel (store (X86add_flag (loadi32 addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4776 | addr:$dst), |
| 4777 | (implicit EFLAGS)), |
| 4778 | (ADD32mi8 addr:$dst, i32immSExt8:$src2)>; |
| 4779 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4780 | // Register-Register Subtraction with EFLAGS result |
| 4781 | def : Pat<(parallel (X86sub_flag GR8:$src1, GR8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4782 | (implicit EFLAGS)), |
| 4783 | (SUB8rr GR8:$src1, GR8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4784 | def : Pat<(parallel (X86sub_flag GR16:$src1, GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4785 | (implicit EFLAGS)), |
| 4786 | (SUB16rr GR16:$src1, GR16:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4787 | def : Pat<(parallel (X86sub_flag GR32:$src1, GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4788 | (implicit EFLAGS)), |
| 4789 | (SUB32rr GR32:$src1, GR32:$src2)>; |
| 4790 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4791 | // Register-Memory Subtraction with EFLAGS result |
| 4792 | def : Pat<(parallel (X86sub_flag GR8:$src1, (loadi8 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4793 | (implicit EFLAGS)), |
| 4794 | (SUB8rm GR8:$src1, addr:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4795 | def : Pat<(parallel (X86sub_flag GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4796 | (implicit EFLAGS)), |
| 4797 | (SUB16rm GR16:$src1, addr:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4798 | def : Pat<(parallel (X86sub_flag GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4799 | (implicit EFLAGS)), |
| 4800 | (SUB32rm GR32:$src1, addr:$src2)>; |
| 4801 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4802 | // Register-Integer Subtraction with EFLAGS result |
| 4803 | def : Pat<(parallel (X86sub_flag GR8:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4804 | (implicit EFLAGS)), |
| 4805 | (SUB8ri GR8:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4806 | def : Pat<(parallel (X86sub_flag GR16:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4807 | (implicit EFLAGS)), |
| 4808 | (SUB16ri GR16:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4809 | def : Pat<(parallel (X86sub_flag GR32:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4810 | (implicit EFLAGS)), |
| 4811 | (SUB32ri GR32:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4812 | def : Pat<(parallel (X86sub_flag GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4813 | (implicit EFLAGS)), |
| 4814 | (SUB16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4815 | def : Pat<(parallel (X86sub_flag GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4816 | (implicit EFLAGS)), |
| 4817 | (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4818 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4819 | // Memory-Register Subtraction with EFLAGS result |
| 4820 | def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), GR8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4821 | addr:$dst), |
| 4822 | (implicit EFLAGS)), |
| 4823 | (SUB8mr addr:$dst, GR8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4824 | def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4825 | addr:$dst), |
| 4826 | (implicit EFLAGS)), |
| 4827 | (SUB16mr addr:$dst, GR16:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4828 | def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4829 | addr:$dst), |
| 4830 | (implicit EFLAGS)), |
| 4831 | (SUB32mr addr:$dst, GR32:$src2)>; |
| 4832 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4833 | // Memory-Integer Subtraction with EFLAGS result |
| 4834 | def : Pat<(parallel (store (X86sub_flag (loadi8 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4835 | addr:$dst), |
| 4836 | (implicit EFLAGS)), |
| 4837 | (SUB8mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4838 | def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4839 | addr:$dst), |
| 4840 | (implicit EFLAGS)), |
| 4841 | (SUB16mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4842 | def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4843 | addr:$dst), |
| 4844 | (implicit EFLAGS)), |
| 4845 | (SUB32mi addr:$dst, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4846 | def : Pat<(parallel (store (X86sub_flag (loadi16 addr:$dst), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4847 | addr:$dst), |
| 4848 | (implicit EFLAGS)), |
| 4849 | (SUB16mi8 addr:$dst, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4850 | def : Pat<(parallel (store (X86sub_flag (loadi32 addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4851 | addr:$dst), |
| 4852 | (implicit EFLAGS)), |
| 4853 | (SUB32mi8 addr:$dst, i32immSExt8:$src2)>; |
| 4854 | |
| 4855 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4856 | // Register-Register Signed Integer Multiply with EFLAGS result |
| 4857 | def : Pat<(parallel (X86smul_flag GR16:$src1, GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4858 | (implicit EFLAGS)), |
| 4859 | (IMUL16rr GR16:$src1, GR16:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4860 | def : Pat<(parallel (X86smul_flag GR32:$src1, GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4861 | (implicit EFLAGS)), |
| 4862 | (IMUL32rr GR32:$src1, GR32:$src2)>; |
| 4863 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4864 | // Register-Memory Signed Integer Multiply with EFLAGS result |
| 4865 | def : Pat<(parallel (X86smul_flag GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4866 | (implicit EFLAGS)), |
| 4867 | (IMUL16rm GR16:$src1, addr:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4868 | def : Pat<(parallel (X86smul_flag GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4869 | (implicit EFLAGS)), |
| 4870 | (IMUL32rm GR32:$src1, addr:$src2)>; |
| 4871 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4872 | // Register-Integer Signed Integer Multiply with EFLAGS result |
| 4873 | def : Pat<(parallel (X86smul_flag GR16:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4874 | (implicit EFLAGS)), |
| 4875 | (IMUL16rri GR16:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4876 | def : Pat<(parallel (X86smul_flag GR32:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4877 | (implicit EFLAGS)), |
| 4878 | (IMUL32rri GR32:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4879 | def : Pat<(parallel (X86smul_flag GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4880 | (implicit EFLAGS)), |
| 4881 | (IMUL16rri8 GR16:$src1, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4882 | def : Pat<(parallel (X86smul_flag GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4883 | (implicit EFLAGS)), |
| 4884 | (IMUL32rri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4885 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4886 | // Memory-Integer Signed Integer Multiply with EFLAGS result |
| 4887 | def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4888 | (implicit EFLAGS)), |
| 4889 | (IMUL16rmi addr:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4890 | def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4891 | (implicit EFLAGS)), |
| 4892 | (IMUL32rmi addr:$src1, imm:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4893 | def : Pat<(parallel (X86smul_flag (loadi16 addr:$src1), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4894 | (implicit EFLAGS)), |
| 4895 | (IMUL16rmi8 addr:$src1, i16immSExt8:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4896 | def : Pat<(parallel (X86smul_flag (loadi32 addr:$src1), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4897 | (implicit EFLAGS)), |
| 4898 | (IMUL32rmi8 addr:$src1, i32immSExt8:$src2)>; |
| 4899 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4900 | // Optimize multiply by 2 with EFLAGS result. |
Evan Cheng | 6a86bd7 | 2009-01-27 03:30:42 +0000 | [diff] [blame] | 4901 | let AddedComplexity = 2 in { |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4902 | def : Pat<(parallel (X86smul_flag GR16:$src1, 2), |
Evan Cheng | 6a86bd7 | 2009-01-27 03:30:42 +0000 | [diff] [blame] | 4903 | (implicit EFLAGS)), |
| 4904 | (ADD16rr GR16:$src1, GR16:$src1)>; |
| 4905 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4906 | def : Pat<(parallel (X86smul_flag GR32:$src1, 2), |
Evan Cheng | 6a86bd7 | 2009-01-27 03:30:42 +0000 | [diff] [blame] | 4907 | (implicit EFLAGS)), |
| 4908 | (ADD32rr GR32:$src1, GR32:$src1)>; |
| 4909 | } |
| 4910 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4911 | // INC and DEC with EFLAGS result. Note that these do not set CF. |
| 4912 | def : Pat<(parallel (X86inc_flag GR8:$src), (implicit EFLAGS)), |
| 4913 | (INC8r GR8:$src)>; |
| 4914 | def : Pat<(parallel (store (i8 (X86inc_flag (loadi8 addr:$dst))), addr:$dst), |
| 4915 | (implicit EFLAGS)), |
| 4916 | (INC8m addr:$dst)>; |
| 4917 | def : Pat<(parallel (X86dec_flag GR8:$src), (implicit EFLAGS)), |
| 4918 | (DEC8r GR8:$src)>; |
| 4919 | def : Pat<(parallel (store (i8 (X86dec_flag (loadi8 addr:$dst))), addr:$dst), |
| 4920 | (implicit EFLAGS)), |
| 4921 | (DEC8m addr:$dst)>; |
| 4922 | |
| 4923 | def : Pat<(parallel (X86inc_flag GR16:$src), (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4924 | (INC16r GR16:$src)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4925 | def : Pat<(parallel (store (i16 (X86inc_flag (loadi16 addr:$dst))), addr:$dst), |
| 4926 | (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4927 | (INC16m addr:$dst)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4928 | def : Pat<(parallel (X86dec_flag GR16:$src), (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4929 | (DEC16r GR16:$src)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4930 | def : Pat<(parallel (store (i16 (X86dec_flag (loadi16 addr:$dst))), addr:$dst), |
| 4931 | (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4932 | (DEC16m addr:$dst)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4933 | |
| 4934 | def : Pat<(parallel (X86inc_flag GR32:$src), (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4935 | (INC32r GR32:$src)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4936 | def : Pat<(parallel (store (i32 (X86inc_flag (loadi32 addr:$dst))), addr:$dst), |
| 4937 | (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4938 | (INC32m addr:$dst)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4939 | def : Pat<(parallel (X86dec_flag GR32:$src), (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4940 | (DEC32r GR32:$src)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4941 | def : Pat<(parallel (store (i32 (X86dec_flag (loadi32 addr:$dst))), addr:$dst), |
| 4942 | (implicit EFLAGS)), |
Dan Gohman | 1f4af26 | 2009-03-05 21:32:23 +0000 | [diff] [blame] | 4943 | (DEC32m addr:$dst)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4944 | |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4945 | // Register-Register Or with EFLAGS result |
| 4946 | def : Pat<(parallel (X86or_flag GR8:$src1, GR8:$src2), |
| 4947 | (implicit EFLAGS)), |
| 4948 | (OR8rr GR8:$src1, GR8:$src2)>; |
| 4949 | def : Pat<(parallel (X86or_flag GR16:$src1, GR16:$src2), |
| 4950 | (implicit EFLAGS)), |
| 4951 | (OR16rr GR16:$src1, GR16:$src2)>; |
| 4952 | def : Pat<(parallel (X86or_flag GR32:$src1, GR32:$src2), |
| 4953 | (implicit EFLAGS)), |
| 4954 | (OR32rr GR32:$src1, GR32:$src2)>; |
| 4955 | |
| 4956 | // Register-Memory Or with EFLAGS result |
| 4957 | def : Pat<(parallel (X86or_flag GR8:$src1, (loadi8 addr:$src2)), |
| 4958 | (implicit EFLAGS)), |
| 4959 | (OR8rm GR8:$src1, addr:$src2)>; |
| 4960 | def : Pat<(parallel (X86or_flag GR16:$src1, (loadi16 addr:$src2)), |
| 4961 | (implicit EFLAGS)), |
| 4962 | (OR16rm GR16:$src1, addr:$src2)>; |
| 4963 | def : Pat<(parallel (X86or_flag GR32:$src1, (loadi32 addr:$src2)), |
| 4964 | (implicit EFLAGS)), |
| 4965 | (OR32rm GR32:$src1, addr:$src2)>; |
| 4966 | |
| 4967 | // Register-Integer Or with EFLAGS result |
| 4968 | def : Pat<(parallel (X86or_flag GR8:$src1, imm:$src2), |
| 4969 | (implicit EFLAGS)), |
| 4970 | (OR8ri GR8:$src1, imm:$src2)>; |
| 4971 | def : Pat<(parallel (X86or_flag GR16:$src1, imm:$src2), |
| 4972 | (implicit EFLAGS)), |
| 4973 | (OR16ri GR16:$src1, imm:$src2)>; |
| 4974 | def : Pat<(parallel (X86or_flag GR32:$src1, imm:$src2), |
| 4975 | (implicit EFLAGS)), |
| 4976 | (OR32ri GR32:$src1, imm:$src2)>; |
| 4977 | def : Pat<(parallel (X86or_flag GR16:$src1, i16immSExt8:$src2), |
| 4978 | (implicit EFLAGS)), |
| 4979 | (OR16ri8 GR16:$src1, i16immSExt8:$src2)>; |
| 4980 | def : Pat<(parallel (X86or_flag GR32:$src1, i32immSExt8:$src2), |
| 4981 | (implicit EFLAGS)), |
| 4982 | (OR32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4983 | |
| 4984 | // Memory-Register Or with EFLAGS result |
| 4985 | def : Pat<(parallel (store (X86or_flag (loadi8 addr:$dst), GR8:$src2), |
| 4986 | addr:$dst), |
| 4987 | (implicit EFLAGS)), |
| 4988 | (OR8mr addr:$dst, GR8:$src2)>; |
| 4989 | def : Pat<(parallel (store (X86or_flag (loadi16 addr:$dst), GR16:$src2), |
| 4990 | addr:$dst), |
| 4991 | (implicit EFLAGS)), |
| 4992 | (OR16mr addr:$dst, GR16:$src2)>; |
| 4993 | def : Pat<(parallel (store (X86or_flag (loadi32 addr:$dst), GR32:$src2), |
| 4994 | addr:$dst), |
| 4995 | (implicit EFLAGS)), |
| 4996 | (OR32mr addr:$dst, GR32:$src2)>; |
| 4997 | |
| 4998 | // Memory-Integer Or with EFLAGS result |
| 4999 | def : Pat<(parallel (store (X86or_flag (loadi8 addr:$dst), imm:$src2), |
| 5000 | addr:$dst), |
| 5001 | (implicit EFLAGS)), |
| 5002 | (OR8mi addr:$dst, imm:$src2)>; |
| 5003 | def : Pat<(parallel (store (X86or_flag (loadi16 addr:$dst), imm:$src2), |
| 5004 | addr:$dst), |
| 5005 | (implicit EFLAGS)), |
| 5006 | (OR16mi addr:$dst, imm:$src2)>; |
| 5007 | def : Pat<(parallel (store (X86or_flag (loadi32 addr:$dst), imm:$src2), |
| 5008 | addr:$dst), |
| 5009 | (implicit EFLAGS)), |
| 5010 | (OR32mi addr:$dst, imm:$src2)>; |
| 5011 | def : Pat<(parallel (store (X86or_flag (loadi16 addr:$dst), i16immSExt8:$src2), |
| 5012 | addr:$dst), |
| 5013 | (implicit EFLAGS)), |
| 5014 | (OR16mi8 addr:$dst, i16immSExt8:$src2)>; |
| 5015 | def : Pat<(parallel (store (X86or_flag (loadi32 addr:$dst), i32immSExt8:$src2), |
| 5016 | addr:$dst), |
| 5017 | (implicit EFLAGS)), |
| 5018 | (OR32mi8 addr:$dst, i32immSExt8:$src2)>; |
| 5019 | |
| 5020 | // Register-Register XOr with EFLAGS result |
| 5021 | def : Pat<(parallel (X86xor_flag GR8:$src1, GR8:$src2), |
| 5022 | (implicit EFLAGS)), |
| 5023 | (XOR8rr GR8:$src1, GR8:$src2)>; |
| 5024 | def : Pat<(parallel (X86xor_flag GR16:$src1, GR16:$src2), |
| 5025 | (implicit EFLAGS)), |
| 5026 | (XOR16rr GR16:$src1, GR16:$src2)>; |
| 5027 | def : Pat<(parallel (X86xor_flag GR32:$src1, GR32:$src2), |
| 5028 | (implicit EFLAGS)), |
| 5029 | (XOR32rr GR32:$src1, GR32:$src2)>; |
| 5030 | |
| 5031 | // Register-Memory XOr with EFLAGS result |
| 5032 | def : Pat<(parallel (X86xor_flag GR8:$src1, (loadi8 addr:$src2)), |
| 5033 | (implicit EFLAGS)), |
| 5034 | (XOR8rm GR8:$src1, addr:$src2)>; |
| 5035 | def : Pat<(parallel (X86xor_flag GR16:$src1, (loadi16 addr:$src2)), |
| 5036 | (implicit EFLAGS)), |
| 5037 | (XOR16rm GR16:$src1, addr:$src2)>; |
| 5038 | def : Pat<(parallel (X86xor_flag GR32:$src1, (loadi32 addr:$src2)), |
| 5039 | (implicit EFLAGS)), |
| 5040 | (XOR32rm GR32:$src1, addr:$src2)>; |
| 5041 | |
| 5042 | // Register-Integer XOr with EFLAGS result |
| 5043 | def : Pat<(parallel (X86xor_flag GR8:$src1, imm:$src2), |
| 5044 | (implicit EFLAGS)), |
| 5045 | (XOR8ri GR8:$src1, imm:$src2)>; |
| 5046 | def : Pat<(parallel (X86xor_flag GR16:$src1, imm:$src2), |
| 5047 | (implicit EFLAGS)), |
| 5048 | (XOR16ri GR16:$src1, imm:$src2)>; |
| 5049 | def : Pat<(parallel (X86xor_flag GR32:$src1, imm:$src2), |
| 5050 | (implicit EFLAGS)), |
| 5051 | (XOR32ri GR32:$src1, imm:$src2)>; |
| 5052 | def : Pat<(parallel (X86xor_flag GR16:$src1, i16immSExt8:$src2), |
| 5053 | (implicit EFLAGS)), |
| 5054 | (XOR16ri8 GR16:$src1, i16immSExt8:$src2)>; |
| 5055 | def : Pat<(parallel (X86xor_flag GR32:$src1, i32immSExt8:$src2), |
| 5056 | (implicit EFLAGS)), |
| 5057 | (XOR32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 5058 | |
| 5059 | // Memory-Register XOr with EFLAGS result |
| 5060 | def : Pat<(parallel (store (X86xor_flag (loadi8 addr:$dst), GR8:$src2), |
| 5061 | addr:$dst), |
| 5062 | (implicit EFLAGS)), |
| 5063 | (XOR8mr addr:$dst, GR8:$src2)>; |
| 5064 | def : Pat<(parallel (store (X86xor_flag (loadi16 addr:$dst), GR16:$src2), |
| 5065 | addr:$dst), |
| 5066 | (implicit EFLAGS)), |
| 5067 | (XOR16mr addr:$dst, GR16:$src2)>; |
| 5068 | def : Pat<(parallel (store (X86xor_flag (loadi32 addr:$dst), GR32:$src2), |
| 5069 | addr:$dst), |
| 5070 | (implicit EFLAGS)), |
| 5071 | (XOR32mr addr:$dst, GR32:$src2)>; |
| 5072 | |
| 5073 | // Memory-Integer XOr with EFLAGS result |
| 5074 | def : Pat<(parallel (store (X86xor_flag (loadi8 addr:$dst), imm:$src2), |
| 5075 | addr:$dst), |
| 5076 | (implicit EFLAGS)), |
| 5077 | (XOR8mi addr:$dst, imm:$src2)>; |
| 5078 | def : Pat<(parallel (store (X86xor_flag (loadi16 addr:$dst), imm:$src2), |
| 5079 | addr:$dst), |
| 5080 | (implicit EFLAGS)), |
| 5081 | (XOR16mi addr:$dst, imm:$src2)>; |
| 5082 | def : Pat<(parallel (store (X86xor_flag (loadi32 addr:$dst), imm:$src2), |
| 5083 | addr:$dst), |
| 5084 | (implicit EFLAGS)), |
| 5085 | (XOR32mi addr:$dst, imm:$src2)>; |
| 5086 | def : Pat<(parallel (store (X86xor_flag (loadi16 addr:$dst), i16immSExt8:$src2), |
| 5087 | addr:$dst), |
| 5088 | (implicit EFLAGS)), |
| 5089 | (XOR16mi8 addr:$dst, i16immSExt8:$src2)>; |
| 5090 | def : Pat<(parallel (store (X86xor_flag (loadi32 addr:$dst), i32immSExt8:$src2), |
| 5091 | addr:$dst), |
| 5092 | (implicit EFLAGS)), |
| 5093 | (XOR32mi8 addr:$dst, i32immSExt8:$src2)>; |
| 5094 | |
| 5095 | // Register-Register And with EFLAGS result |
| 5096 | def : Pat<(parallel (X86and_flag GR8:$src1, GR8:$src2), |
| 5097 | (implicit EFLAGS)), |
| 5098 | (AND8rr GR8:$src1, GR8:$src2)>; |
| 5099 | def : Pat<(parallel (X86and_flag GR16:$src1, GR16:$src2), |
| 5100 | (implicit EFLAGS)), |
| 5101 | (AND16rr GR16:$src1, GR16:$src2)>; |
| 5102 | def : Pat<(parallel (X86and_flag GR32:$src1, GR32:$src2), |
| 5103 | (implicit EFLAGS)), |
| 5104 | (AND32rr GR32:$src1, GR32:$src2)>; |
| 5105 | |
| 5106 | // Register-Memory And with EFLAGS result |
| 5107 | def : Pat<(parallel (X86and_flag GR8:$src1, (loadi8 addr:$src2)), |
| 5108 | (implicit EFLAGS)), |
| 5109 | (AND8rm GR8:$src1, addr:$src2)>; |
| 5110 | def : Pat<(parallel (X86and_flag GR16:$src1, (loadi16 addr:$src2)), |
| 5111 | (implicit EFLAGS)), |
| 5112 | (AND16rm GR16:$src1, addr:$src2)>; |
| 5113 | def : Pat<(parallel (X86and_flag GR32:$src1, (loadi32 addr:$src2)), |
| 5114 | (implicit EFLAGS)), |
| 5115 | (AND32rm GR32:$src1, addr:$src2)>; |
| 5116 | |
| 5117 | // Register-Integer And with EFLAGS result |
| 5118 | def : Pat<(parallel (X86and_flag GR8:$src1, imm:$src2), |
| 5119 | (implicit EFLAGS)), |
| 5120 | (AND8ri GR8:$src1, imm:$src2)>; |
| 5121 | def : Pat<(parallel (X86and_flag GR16:$src1, imm:$src2), |
| 5122 | (implicit EFLAGS)), |
| 5123 | (AND16ri GR16:$src1, imm:$src2)>; |
| 5124 | def : Pat<(parallel (X86and_flag GR32:$src1, imm:$src2), |
| 5125 | (implicit EFLAGS)), |
| 5126 | (AND32ri GR32:$src1, imm:$src2)>; |
| 5127 | def : Pat<(parallel (X86and_flag GR16:$src1, i16immSExt8:$src2), |
| 5128 | (implicit EFLAGS)), |
| 5129 | (AND16ri8 GR16:$src1, i16immSExt8:$src2)>; |
| 5130 | def : Pat<(parallel (X86and_flag GR32:$src1, i32immSExt8:$src2), |
| 5131 | (implicit EFLAGS)), |
| 5132 | (AND32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 5133 | |
| 5134 | // Memory-Register And with EFLAGS result |
| 5135 | def : Pat<(parallel (store (X86and_flag (loadi8 addr:$dst), GR8:$src2), |
| 5136 | addr:$dst), |
| 5137 | (implicit EFLAGS)), |
| 5138 | (AND8mr addr:$dst, GR8:$src2)>; |
| 5139 | def : Pat<(parallel (store (X86and_flag (loadi16 addr:$dst), GR16:$src2), |
| 5140 | addr:$dst), |
| 5141 | (implicit EFLAGS)), |
| 5142 | (AND16mr addr:$dst, GR16:$src2)>; |
| 5143 | def : Pat<(parallel (store (X86and_flag (loadi32 addr:$dst), GR32:$src2), |
| 5144 | addr:$dst), |
| 5145 | (implicit EFLAGS)), |
| 5146 | (AND32mr addr:$dst, GR32:$src2)>; |
| 5147 | |
| 5148 | // Memory-Integer And with EFLAGS result |
| 5149 | def : Pat<(parallel (store (X86and_flag (loadi8 addr:$dst), imm:$src2), |
| 5150 | addr:$dst), |
| 5151 | (implicit EFLAGS)), |
| 5152 | (AND8mi addr:$dst, imm:$src2)>; |
| 5153 | def : Pat<(parallel (store (X86and_flag (loadi16 addr:$dst), imm:$src2), |
| 5154 | addr:$dst), |
| 5155 | (implicit EFLAGS)), |
| 5156 | (AND16mi addr:$dst, imm:$src2)>; |
| 5157 | def : Pat<(parallel (store (X86and_flag (loadi32 addr:$dst), imm:$src2), |
| 5158 | addr:$dst), |
| 5159 | (implicit EFLAGS)), |
| 5160 | (AND32mi addr:$dst, imm:$src2)>; |
| 5161 | def : Pat<(parallel (store (X86and_flag (loadi16 addr:$dst), i16immSExt8:$src2), |
| 5162 | addr:$dst), |
| 5163 | (implicit EFLAGS)), |
| 5164 | (AND16mi8 addr:$dst, i16immSExt8:$src2)>; |
| 5165 | def : Pat<(parallel (store (X86and_flag (loadi32 addr:$dst), i32immSExt8:$src2), |
| 5166 | addr:$dst), |
| 5167 | (implicit EFLAGS)), |
| 5168 | (AND32mi8 addr:$dst, i32immSExt8:$src2)>; |
| 5169 | |
Dan Gohman | 2f67df7 | 2009-09-03 17:18:51 +0000 | [diff] [blame] | 5170 | // -disable-16bit support. |
| 5171 | def : Pat<(truncstorei16 (i32 imm:$src), addr:$dst), |
| 5172 | (MOV16mi addr:$dst, imm:$src)>; |
| 5173 | def : Pat<(truncstorei16 GR32:$src, addr:$dst), |
| 5174 | (MOV16mr addr:$dst, (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit))>; |
| 5175 | def : Pat<(i32 (sextloadi16 addr:$dst)), |
| 5176 | (MOVSX32rm16 addr:$dst)>; |
| 5177 | def : Pat<(i32 (zextloadi16 addr:$dst)), |
| 5178 | (MOVZX32rm16 addr:$dst)>; |
| 5179 | def : Pat<(i32 (extloadi16 addr:$dst)), |
| 5180 | (MOVZX32rm16 addr:$dst)>; |
| 5181 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 5182 | //===----------------------------------------------------------------------===// |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 5183 | // Floating Point Stack Support |
| 5184 | //===----------------------------------------------------------------------===// |
| 5185 | |
| 5186 | include "X86InstrFPStack.td" |
| 5187 | |
| 5188 | //===----------------------------------------------------------------------===// |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 5189 | // X86-64 Support |
| 5190 | //===----------------------------------------------------------------------===// |
| 5191 | |
Chris Lattner | 36fe6d2 | 2008-01-10 05:50:42 +0000 | [diff] [blame] | 5192 | include "X86Instr64bit.td" |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 5193 | |
| 5194 | //===----------------------------------------------------------------------===// |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 5195 | // XMM Floating point support (requires SSE / SSE2) |
| 5196 | //===----------------------------------------------------------------------===// |
| 5197 | |
| 5198 | include "X86InstrSSE.td" |
Evan Cheng | 80f5404 | 2008-04-25 18:19:54 +0000 | [diff] [blame] | 5199 | |
| 5200 | //===----------------------------------------------------------------------===// |
| 5201 | // MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2) |
| 5202 | //===----------------------------------------------------------------------===// |
| 5203 | |
| 5204 | include "X86InstrMMX.td" |