Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +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 | |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 24 | def SDTX86CmpTest : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisSameAs<1, 2>]>; |
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. |
Chris Lattner | 74c8d67 | 2010-03-24 00:47:47 +0000 | [diff] [blame] | 31 | def SDTUnaryArithWithFlags : SDTypeProfile<2, 1, |
| 32 | [SDTCisInt<0>, SDTCisVT<1, i32>]>; |
| 33 | |
Chris Lattner | 1aec4d7 | 2010-03-24 00:49:29 +0000 | [diff] [blame] | 34 | def SDTBinaryArithWithFlags : SDTypeProfile<2, 2, |
| 35 | [SDTCisSameAs<0, 2>, |
| 36 | SDTCisSameAs<0, 3>, |
| 37 | SDTCisInt<0>, SDTCisVT<1, i32>]>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 38 | def SDTX86BrCond : SDTypeProfile<0, 3, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 39 | [SDTCisVT<0, OtherVT>, |
| 40 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 41 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 42 | def SDTX86SetCC : SDTypeProfile<1, 2, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 43 | [SDTCisVT<0, i8>, |
| 44 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 45 | def SDTX86SetCC_C : SDTypeProfile<1, 2, |
| 46 | [SDTCisInt<0>, |
| 47 | SDTCisVT<1, i8>, SDTCisVT<2, i32>]>; |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 48 | |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 49 | def SDTX86cas : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisInt<1>, |
| 50 | SDTCisVT<2, i8>]>; |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 51 | def SDTX86cas8 : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>; |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 52 | |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 53 | def SDTX86atomicBinary : SDTypeProfile<2, 3, [SDTCisInt<0>, SDTCisInt<1>, |
| 54 | SDTCisPtrTy<2>, SDTCisInt<3>,SDTCisInt<4>]>; |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 55 | def SDTX86Ret : SDTypeProfile<0, -1, [SDTCisVT<0, i16>]>; |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 56 | |
Sean Callanan | 1c97ceb | 2009-06-23 23:25:37 +0000 | [diff] [blame] | 57 | def SDT_X86CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; |
| 58 | def SDT_X86CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, |
| 59 | SDTCisVT<1, i32>]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 60 | |
Dan Gohman | d35121a | 2008-05-29 19:57:41 +0000 | [diff] [blame] | 61 | def SDT_X86Call : SDTypeProfile<0, -1, [SDTCisVT<0, iPTR>]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 62 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 63 | def SDT_X86VASTART_SAVE_XMM_REGS : SDTypeProfile<0, -1, [SDTCisVT<0, i8>, |
| 64 | SDTCisVT<1, iPTR>, |
| 65 | SDTCisVT<2, iPTR>]>; |
| 66 | |
Chris Lattner | ed52c8f | 2010-03-28 07:38:39 +0000 | [diff] [blame] | 67 | def SDTX86RepStr : SDTypeProfile<0, 1, [SDTCisVT<0, OtherVT>]>; |
| 68 | |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 69 | def SDTX86Void : SDTypeProfile<0, 0, []>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 70 | |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 71 | def SDTX86Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>; |
| 72 | |
Rafael Espindola | 2ee3db3 | 2009-04-17 14:35:58 +0000 | [diff] [blame] | 73 | def SDT_X86TLSADDR : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 74 | |
Eric Christopher | 30ef0e5 | 2010-06-03 04:07:48 +0000 | [diff] [blame] | 75 | def SDT_X86TLSCALL : SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>; |
| 76 | |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 77 | def SDT_X86SegmentBaseAddress : SDTypeProfile<1, 1, [SDTCisPtrTy<0>]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 78 | |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 79 | def SDT_X86EHRET : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
| 80 | |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 81 | def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>; |
| 82 | |
Chris Lattner | d486d77 | 2010-03-28 05:07:17 +0000 | [diff] [blame] | 83 | def X86bsf : SDNode<"X86ISD::BSF", SDTUnaryArithWithFlags>; |
| 84 | def X86bsr : SDNode<"X86ISD::BSR", SDTUnaryArithWithFlags>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 85 | def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>; |
| 86 | def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 87 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 88 | def X86cmp : SDNode<"X86ISD::CMP" , SDTX86CmpTest>; |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 89 | def X86bt : SDNode<"X86ISD::BT", SDTX86CmpTest>; |
| 90 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 91 | def X86cmov : SDNode<"X86ISD::CMOV", SDTX86Cmov>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 92 | def X86brcond : SDNode<"X86ISD::BRCOND", SDTX86BrCond, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 93 | [SDNPHasChain]>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 94 | def X86setcc : SDNode<"X86ISD::SETCC", SDTX86SetCC>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 95 | def X86setcc_c : SDNode<"X86ISD::SETCC_CARRY", SDTX86SetCC_C>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 96 | |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 97 | def X86cas : SDNode<"X86ISD::LCMPXCHG_DAG", SDTX86cas, |
| 98 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 99 | SDNPMayLoad]>; |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 100 | def X86cas8 : SDNode<"X86ISD::LCMPXCHG8_DAG", SDTX86cas8, |
| 101 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 102 | SDNPMayLoad]>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 103 | def X86AtomAdd64 : SDNode<"X86ISD::ATOMADD64_DAG", SDTX86atomicBinary, |
| 104 | [SDNPHasChain, SDNPMayStore, |
| 105 | SDNPMayLoad, SDNPMemOperand]>; |
| 106 | def X86AtomSub64 : SDNode<"X86ISD::ATOMSUB64_DAG", SDTX86atomicBinary, |
| 107 | [SDNPHasChain, SDNPMayStore, |
| 108 | SDNPMayLoad, SDNPMemOperand]>; |
| 109 | def X86AtomOr64 : SDNode<"X86ISD::ATOMOR64_DAG", SDTX86atomicBinary, |
| 110 | [SDNPHasChain, SDNPMayStore, |
| 111 | SDNPMayLoad, SDNPMemOperand]>; |
| 112 | def X86AtomXor64 : SDNode<"X86ISD::ATOMXOR64_DAG", SDTX86atomicBinary, |
| 113 | [SDNPHasChain, SDNPMayStore, |
| 114 | SDNPMayLoad, SDNPMemOperand]>; |
| 115 | def X86AtomAnd64 : SDNode<"X86ISD::ATOMAND64_DAG", SDTX86atomicBinary, |
| 116 | [SDNPHasChain, SDNPMayStore, |
| 117 | SDNPMayLoad, SDNPMemOperand]>; |
| 118 | def X86AtomNand64 : SDNode<"X86ISD::ATOMNAND64_DAG", SDTX86atomicBinary, |
| 119 | [SDNPHasChain, SDNPMayStore, |
| 120 | SDNPMayLoad, SDNPMemOperand]>; |
Dale Johannesen | 880ae36 | 2008-10-03 22:25:52 +0000 | [diff] [blame] | 121 | def X86AtomSwap64 : SDNode<"X86ISD::ATOMSWAP64_DAG", SDTX86atomicBinary, |
| 122 | [SDNPHasChain, SDNPMayStore, |
| 123 | SDNPMayLoad, SDNPMemOperand]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 124 | def X86retflag : SDNode<"X86ISD::RET_FLAG", SDTX86Ret, |
Chris Lattner | e8cabf3 | 2010-03-19 05:07:09 +0000 | [diff] [blame] | 125 | [SDNPHasChain, SDNPOptInFlag, SDNPVariadic]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 126 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 127 | def X86vastart_save_xmm_regs : |
| 128 | SDNode<"X86ISD::VASTART_SAVE_XMM_REGS", |
| 129 | SDT_X86VASTART_SAVE_XMM_REGS, |
Chris Lattner | e8cabf3 | 2010-03-19 05:07:09 +0000 | [diff] [blame] | 130 | [SDNPHasChain, SDNPVariadic]>; |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 131 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 132 | def X86callseq_start : |
| 133 | SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart, |
Evan Cheng | bb7b844 | 2006-08-11 09:03:33 +0000 | [diff] [blame] | 134 | [SDNPHasChain, SDNPOutFlag]>; |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 135 | def X86callseq_end : |
| 136 | SDNode<"ISD::CALLSEQ_END", SDT_X86CallSeqEnd, |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 137 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
Evan Cheng | b077b84 | 2005-12-21 02:39:21 +0000 | [diff] [blame] | 138 | |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 139 | def X86call : SDNode<"X86ISD::CALL", SDT_X86Call, |
Chris Lattner | e8cabf3 | 2010-03-19 05:07:09 +0000 | [diff] [blame] | 140 | [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag, |
| 141 | SDNPVariadic]>; |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 142 | |
Chris Lattner | ed52c8f | 2010-03-28 07:38:39 +0000 | [diff] [blame] | 143 | def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr, |
Chris Lattner | 9b37aaf | 2008-01-10 05:12:37 +0000 | [diff] [blame] | 144 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore]>; |
Chris Lattner | ed52c8f | 2010-03-28 07:38:39 +0000 | [diff] [blame] | 145 | def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr, |
Chris Lattner | 9b37aaf | 2008-01-10 05:12:37 +0000 | [diff] [blame] | 146 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag, SDNPMayStore, |
| 147 | SDNPMayLoad]>; |
Evan Cheng | 67f92a7 | 2006-01-11 22:15:48 +0000 | [diff] [blame] | 148 | |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 149 | def X86rdtsc : SDNode<"X86ISD::RDTSC_DAG", SDTX86Void, |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 150 | [SDNPHasChain, SDNPOutFlag, SDNPSideEffect]>; |
Evan Cheng | d90eb7f | 2006-01-05 00:27:02 +0000 | [diff] [blame] | 151 | |
Evan Cheng | 0085a28 | 2006-11-30 21:55:46 +0000 | [diff] [blame] | 152 | def X86Wrapper : SDNode<"X86ISD::Wrapper", SDTX86Wrapper>; |
| 153 | def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP", SDTX86Wrapper>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 154 | |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 155 | def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR, |
Anton Korobeynikov | 6625eff | 2008-05-04 21:36:32 +0000 | [diff] [blame] | 156 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 157 | def X86SegmentBaseAddress : SDNode<"X86ISD::SegmentBaseAddress", |
| 158 | SDT_X86SegmentBaseAddress, []>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 159 | |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 160 | def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET, |
| 161 | [SDNPHasChain]>; |
| 162 | |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 163 | def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET, |
Chris Lattner | e8cabf3 | 2010-03-19 05:07:09 +0000 | [diff] [blame] | 164 | [SDNPHasChain, SDNPOptInFlag, SDNPVariadic]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 165 | |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 166 | def X86add_flag : SDNode<"X86ISD::ADD", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 167 | [SDNPCommutative]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 168 | def X86sub_flag : SDNode<"X86ISD::SUB", SDTBinaryArithWithFlags>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 169 | def X86smul_flag : SDNode<"X86ISD::SMUL", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 170 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 171 | def X86umul_flag : SDNode<"X86ISD::UMUL", SDTUnaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 172 | [SDNPCommutative]>; |
Chris Lattner | 74c8d67 | 2010-03-24 00:47:47 +0000 | [diff] [blame] | 173 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 174 | def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>; |
| 175 | def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 176 | def X86or_flag : SDNode<"X86ISD::OR", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 177 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 178 | def X86xor_flag : SDNode<"X86ISD::XOR", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 179 | [SDNPCommutative]>; |
Dan Gohman | 43ffe67 | 2010-01-04 20:51:05 +0000 | [diff] [blame] | 180 | def X86and_flag : SDNode<"X86ISD::AND", SDTBinaryArithWithFlags, |
Dan Gohman | 4361bbf | 2010-01-05 00:44:20 +0000 | [diff] [blame] | 181 | [SDNPCommutative]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 182 | |
Evan Cheng | 73f24c9 | 2009-03-30 21:36:47 +0000 | [diff] [blame] | 183 | def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>; |
| 184 | |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 185 | def X86MingwAlloca : SDNode<"X86ISD::MINGW_ALLOCA", SDTX86Void, |
| 186 | [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>; |
Eric Christopher | 30ef0e5 | 2010-06-03 04:07:48 +0000 | [diff] [blame] | 187 | |
| 188 | def X86TLSCall : SDNode<"X86ISD::TLSCALL", SDT_X86TLSCALL, |
| 189 | []>; |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 190 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 191 | //===----------------------------------------------------------------------===// |
| 192 | // X86 Operand Definitions. |
| 193 | // |
| 194 | |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 195 | // A version of ptr_rc which excludes SP, ESP, and RSP. This is used for |
| 196 | // the index operand of an address, to conform to x86 encoding restrictions. |
| 197 | def ptr_rc_nosp : PointerLikeRegClass<1>; |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 198 | |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 199 | // *mem - Operand definitions for the funky X86 addressing mode operands. |
| 200 | // |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 201 | def X86MemAsmOperand : AsmOperandClass { |
| 202 | let Name = "Mem"; |
Daniel Dunbar | 54ddf3d | 2010-05-22 21:02:29 +0000 | [diff] [blame] | 203 | let SuperClasses = []; |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 204 | } |
Daniel Dunbar | c26ae5a | 2010-05-06 22:39:14 +0000 | [diff] [blame] | 205 | def X86AbsMemAsmOperand : AsmOperandClass { |
| 206 | let Name = "AbsMem"; |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 207 | let SuperClasses = [X86MemAsmOperand]; |
Daniel Dunbar | c26ae5a | 2010-05-06 22:39:14 +0000 | [diff] [blame] | 208 | } |
Evan Cheng | af78ef5 | 2006-05-17 21:21:41 +0000 | [diff] [blame] | 209 | class X86MemOperand<string printMethod> : Operand<iPTR> { |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 210 | let PrintMethod = printMethod; |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 211 | let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm); |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 212 | let ParserMatchClass = X86MemAsmOperand; |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 213 | } |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 214 | |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 215 | def opaque32mem : X86MemOperand<"printopaquemem">; |
| 216 | def opaque48mem : X86MemOperand<"printopaquemem">; |
| 217 | def opaque80mem : X86MemOperand<"printopaquemem">; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 218 | def opaque512mem : X86MemOperand<"printopaquemem">; |
| 219 | |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 220 | def i8mem : X86MemOperand<"printi8mem">; |
| 221 | def i16mem : X86MemOperand<"printi16mem">; |
| 222 | def i32mem : X86MemOperand<"printi32mem">; |
| 223 | def i64mem : X86MemOperand<"printi64mem">; |
Evan Cheng | 470a6ad | 2006-02-22 02:26:30 +0000 | [diff] [blame] | 224 | def i128mem : X86MemOperand<"printi128mem">; |
Bruno Cardoso Lopes | 94143ee | 2010-07-19 23:32:44 +0000 | [diff] [blame^] | 225 | def i256mem : X86MemOperand<"printi256mem">; |
Chris Lattner | 4543251 | 2005-12-17 19:47:05 +0000 | [diff] [blame] | 226 | def f32mem : X86MemOperand<"printf32mem">; |
| 227 | def f64mem : X86MemOperand<"printf64mem">; |
Dale Johannesen | 59a5873 | 2007-08-05 18:49:15 +0000 | [diff] [blame] | 228 | def f80mem : X86MemOperand<"printf80mem">; |
Evan Cheng | 223547a | 2006-01-31 22:28:30 +0000 | [diff] [blame] | 229 | def f128mem : X86MemOperand<"printf128mem">; |
Bruno Cardoso Lopes | e86b01c | 2010-07-09 18:27:43 +0000 | [diff] [blame] | 230 | def f256mem : X86MemOperand<"printf256mem">; |
Nate Begeman | 391c5d2 | 2005-11-30 18:54:35 +0000 | [diff] [blame] | 231 | |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 232 | // A version of i8mem for use on x86-64 that uses GR64_NOREX instead of |
| 233 | // plain GR64, so that it doesn't potentially require a REX prefix. |
| 234 | def i8mem_NOREX : Operand<i64> { |
| 235 | let PrintMethod = "printi8mem"; |
Dan Gohman | a4714e0 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 236 | let MIOperandInfo = (ops GR64_NOREX, i8imm, GR64_NOREX_NOSP, i32imm, i8imm); |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 237 | let ParserMatchClass = X86MemAsmOperand; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 240 | // Special i32mem for addresses of load folding tail calls. These are not |
| 241 | // allowed to use callee-saved registers since they must be scheduled |
| 242 | // after callee-saved register are popped. |
| 243 | def i32mem_TC : Operand<i32> { |
| 244 | let PrintMethod = "printi32mem"; |
| 245 | let MIOperandInfo = (ops GR32_TC, i8imm, GR32_TC, i32imm, i8imm); |
| 246 | let ParserMatchClass = X86MemAsmOperand; |
| 247 | } |
| 248 | |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 249 | |
Daniel Dunbar | b834f5d | 2010-01-30 01:02:48 +0000 | [diff] [blame] | 250 | let ParserMatchClass = X86AbsMemAsmOperand, |
| 251 | PrintMethod = "print_pcrel_imm" in { |
Daniel Dunbar | 728e5eb | 2010-01-30 00:24:12 +0000 | [diff] [blame] | 252 | def i32imm_pcrel : Operand<i32>; |
Chris Lattner | 9fc0522 | 2010-07-07 22:27:31 +0000 | [diff] [blame] | 253 | def i16imm_pcrel : Operand<i16>; |
Daniel Dunbar | 728e5eb | 2010-01-30 00:24:12 +0000 | [diff] [blame] | 254 | |
| 255 | def offset8 : Operand<i64>; |
| 256 | def offset16 : Operand<i64>; |
| 257 | def offset32 : Operand<i64>; |
| 258 | def offset64 : Operand<i64>; |
| 259 | |
| 260 | // Branch targets have OtherVT type and print as pc-relative values. |
| 261 | def brtarget : Operand<OtherVT>; |
| 262 | def brtarget8 : Operand<OtherVT>; |
| 263 | |
| 264 | } |
| 265 | |
Nate Begeman | 16b04f3 | 2005-07-15 00:38:55 +0000 | [diff] [blame] | 266 | def SSECC : Operand<i8> { |
| 267 | let PrintMethod = "printSSECC"; |
| 268 | } |
Chris Lattner | 66fa1dc | 2004-08-11 02:25:00 +0000 | [diff] [blame] | 269 | |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 270 | class ImmSExtAsmOperandClass : AsmOperandClass { |
Daniel Dunbar | 54ddf3d | 2010-05-22 21:02:29 +0000 | [diff] [blame] | 271 | let SuperClasses = [ImmAsmOperand]; |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 272 | let RenderMethod = "addImmOperands"; |
Daniel Dunbar | 1fe591d | 2010-05-20 20:20:39 +0000 | [diff] [blame] | 273 | } |
| 274 | |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 275 | // Sign-extended immediate classes. We don't need to define the full lattice |
| 276 | // here because there is no instruction with an ambiguity between ImmSExti64i32 |
| 277 | // and ImmSExti32i8. |
| 278 | // |
| 279 | // The strange ranges come from the fact that the assembler always works with |
| 280 | // 64-bit immediates, but for a 16-bit target value we want to accept both "-1" |
| 281 | // (which will be a -1ULL), and "0xFF" (-1 in 16-bits). |
| 282 | |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 283 | // [0, 0x7FFFFFFF] | |
| 284 | // [0xFFFFFFFF80000000, 0xFFFFFFFFFFFFFFFF] |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 285 | def ImmSExti64i32AsmOperand : ImmSExtAsmOperandClass { |
| 286 | let Name = "ImmSExti64i32"; |
| 287 | } |
| 288 | |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 289 | // [0, 0x0000007F] | [0x000000000000FF80, 0x000000000000FFFF] | |
| 290 | // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF] |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 291 | def ImmSExti16i8AsmOperand : ImmSExtAsmOperandClass { |
| 292 | let Name = "ImmSExti16i8"; |
| 293 | let SuperClasses = [ImmSExti64i32AsmOperand]; |
| 294 | } |
| 295 | |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 296 | // [0, 0x0000007F] | [0x00000000FFFFFF80, 0x00000000FFFFFFFF] | |
| 297 | // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF] |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 298 | def ImmSExti32i8AsmOperand : ImmSExtAsmOperandClass { |
| 299 | let Name = "ImmSExti32i8"; |
| 300 | } |
| 301 | |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 302 | // [0, 0x0000007F] | |
| 303 | // [0xFFFFFFFFFFFFFF80, 0xFFFFFFFFFFFFFFFF] |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 304 | def ImmSExti64i8AsmOperand : ImmSExtAsmOperandClass { |
| 305 | let Name = "ImmSExti64i8"; |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 306 | let SuperClasses = [ImmSExti16i8AsmOperand, ImmSExti32i8AsmOperand, |
| 307 | ImmSExti64i32AsmOperand]; |
Daniel Dunbar | 338825c | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 310 | // A couple of more descriptive operand definitions. |
| 311 | // 16-bits but only 8 bits are significant. |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 312 | def i16i8imm : Operand<i16> { |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 313 | let ParserMatchClass = ImmSExti16i8AsmOperand; |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 314 | } |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 315 | // 32-bits but only 8 bits are significant. |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 316 | def i32i8imm : Operand<i32> { |
Daniel Dunbar | 62e4c67 | 2010-05-22 21:02:33 +0000 | [diff] [blame] | 317 | let ParserMatchClass = ImmSExti32i8AsmOperand; |
Daniel Dunbar | 5fe6338 | 2009-08-09 07:20:21 +0000 | [diff] [blame] | 318 | } |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 319 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 320 | //===----------------------------------------------------------------------===// |
| 321 | // X86 Complex Pattern Definitions. |
| 322 | // |
| 323 | |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 324 | // Define X86 specific addressing mode. |
Rafael Espindola | 094fad3 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 325 | def addr : ComplexPattern<iPTR, 5, "SelectAddr", [], []>; |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 326 | def lea32addr : ComplexPattern<i32, 5, "SelectLEAAddr", |
Dan Gohman | a98634b | 2009-08-02 16:09:17 +0000 | [diff] [blame] | 327 | [add, sub, mul, X86mul_imm, shl, or, frameindex], |
| 328 | []>; |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 329 | def tls32addr : ComplexPattern<i32, 5, "SelectTLSADDRAddr", |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 330 | [tglobaltlsaddr], []>; |
Evan Cheng | ec693f7 | 2005-12-08 02:01:35 +0000 | [diff] [blame] | 331 | |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 332 | //===----------------------------------------------------------------------===// |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 333 | // X86 Instruction Predicate Definitions. |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 334 | def HasCMov : Predicate<"Subtarget->hasCMov()">; |
| 335 | def NoCMov : Predicate<"!Subtarget->hasCMov()">; |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 336 | def HasMMX : Predicate<"Subtarget->hasMMX()">; |
| 337 | def HasSSE1 : Predicate<"Subtarget->hasSSE1()">; |
| 338 | def HasSSE2 : Predicate<"Subtarget->hasSSE2()">; |
| 339 | def HasSSE3 : Predicate<"Subtarget->hasSSE3()">; |
Bill Wendling | bb1ee05 | 2007-04-10 22:10:25 +0000 | [diff] [blame] | 340 | def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">; |
Nate Begeman | 63ec90a | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 341 | def HasSSE41 : Predicate<"Subtarget->hasSSE41()">; |
| 342 | def HasSSE42 : Predicate<"Subtarget->hasSSE42()">; |
David Greene | 343dadb | 2009-06-26 22:46:54 +0000 | [diff] [blame] | 343 | def HasSSE4A : Predicate<"Subtarget->hasSSE4A()">; |
| 344 | def HasAVX : Predicate<"Subtarget->hasAVX()">; |
| 345 | def HasFMA3 : Predicate<"Subtarget->hasFMA3()">; |
| 346 | def HasFMA4 : Predicate<"Subtarget->hasFMA4()">; |
Dale Johannesen | f1fc3a8 | 2007-09-23 14:52:20 +0000 | [diff] [blame] | 347 | def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">; |
| 348 | def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">; |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 349 | def In32BitMode : Predicate<"!Subtarget->is64Bit()">; |
| 350 | def In64BitMode : Predicate<"Subtarget->is64Bit()">; |
Anton Korobeynikov | cf6b739 | 2009-08-03 08:12:53 +0000 | [diff] [blame] | 351 | def IsWin64 : Predicate<"Subtarget->isTargetWin64()">; |
| 352 | def NotWin64 : Predicate<"!Subtarget->isTargetWin64()">; |
Anton Korobeynikov | d7697d0 | 2009-08-06 11:23:24 +0000 | [diff] [blame] | 353 | def SmallCode : Predicate<"TM.getCodeModel() == CodeModel::Small">; |
| 354 | def KernelCode : Predicate<"TM.getCodeModel() == CodeModel::Kernel">; |
| 355 | def FarData : Predicate<"TM.getCodeModel() != CodeModel::Small &&" |
Anton Korobeynikov | 186fa1d | 2009-08-06 09:11:19 +0000 | [diff] [blame] | 356 | "TM.getCodeModel() != CodeModel::Kernel">; |
Anton Korobeynikov | d7697d0 | 2009-08-06 11:23:24 +0000 | [diff] [blame] | 357 | def NearData : Predicate<"TM.getCodeModel() == CodeModel::Small ||" |
| 358 | "TM.getCodeModel() == CodeModel::Kernel">; |
Evan Cheng | 28b51439 | 2006-12-05 19:50:18 +0000 | [diff] [blame] | 359 | def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">; |
Evan Cheng | cb0f06e | 2010-03-25 00:10:31 +0000 | [diff] [blame] | 360 | def IsNotPIC : Predicate<"TM.getRelocationModel() != Reloc::PIC_">; |
Evan Cheng | b1f4981 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 361 | def OptForSize : Predicate<"OptForSize">; |
Evan Cheng | b7a75a5 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 362 | def OptForSpeed : Predicate<"!OptForSize">; |
Evan Cheng | ccb6976 | 2009-01-02 05:35:45 +0000 | [diff] [blame] | 363 | def FastBTMem : Predicate<"!Subtarget->isBTMemSlow()">; |
Evan Cheng | d7f666a | 2009-05-20 04:53:57 +0000 | [diff] [blame] | 364 | def CallImmAddr : Predicate<"Subtarget->IsLegalToCallImmediateAddr(TM)">; |
Eric Christopher | 6d1cd1c | 2010-04-02 21:54:27 +0000 | [diff] [blame] | 365 | def HasAES : Predicate<"Subtarget->hasAES()">; |
Evan Cheng | bbc8ddb | 2005-12-20 22:59:51 +0000 | [diff] [blame] | 366 | |
| 367 | //===----------------------------------------------------------------------===// |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 368 | // X86 Instruction Format Definitions. |
Evan Cheng | aed7c72 | 2005-12-17 01:24:02 +0000 | [diff] [blame] | 369 | // |
| 370 | |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 371 | include "X86InstrFormats.td" |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 372 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 373 | //===----------------------------------------------------------------------===// |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 374 | // Pattern fragments... |
| 375 | // |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 376 | |
| 377 | // X86 specific condition code. These correspond to CondCode in |
Nate Begeman | 9a22530 | 2007-05-06 04:00:55 +0000 | [diff] [blame] | 378 | // X86InstrInfo.h. They must be kept in synch. |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 379 | def X86_COND_A : PatLeaf<(i8 0)>; // alt. COND_NBE |
| 380 | def X86_COND_AE : PatLeaf<(i8 1)>; // alt. COND_NC |
| 381 | def X86_COND_B : PatLeaf<(i8 2)>; // alt. COND_C |
| 382 | def X86_COND_BE : PatLeaf<(i8 3)>; // alt. COND_NA |
| 383 | def X86_COND_E : PatLeaf<(i8 4)>; // alt. COND_Z |
| 384 | def X86_COND_G : PatLeaf<(i8 5)>; // alt. COND_NLE |
| 385 | def X86_COND_GE : PatLeaf<(i8 6)>; // alt. COND_NL |
| 386 | def X86_COND_L : PatLeaf<(i8 7)>; // alt. COND_NGE |
| 387 | def X86_COND_LE : PatLeaf<(i8 8)>; // alt. COND_NG |
| 388 | def X86_COND_NE : PatLeaf<(i8 9)>; // alt. COND_NZ |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 389 | def X86_COND_NO : PatLeaf<(i8 10)>; |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 390 | def X86_COND_NP : PatLeaf<(i8 11)>; // alt. COND_PO |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 391 | def X86_COND_NS : PatLeaf<(i8 12)>; |
Dan Gohman | 653456c | 2009-01-07 00:15:08 +0000 | [diff] [blame] | 392 | def X86_COND_O : PatLeaf<(i8 13)>; |
| 393 | def X86_COND_P : PatLeaf<(i8 14)>; // alt. COND_PE |
| 394 | def X86_COND_S : PatLeaf<(i8 15)>; |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 395 | |
Chris Lattner | 1840991 | 2010-03-03 01:45:01 +0000 | [diff] [blame] | 396 | def immSext8 : PatLeaf<(imm), [{ |
| 397 | return N->getSExtValue() == (int8_t)N->getSExtValue(); |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 398 | }]>; |
| 399 | |
Chris Lattner | 1840991 | 2010-03-03 01:45:01 +0000 | [diff] [blame] | 400 | def i16immSExt8 : PatLeaf<(i16 immSext8)>; |
| 401 | def i32immSExt8 : PatLeaf<(i32 immSext8)>; |
Evan Cheng | b355854 | 2005-12-13 00:01:09 +0000 | [diff] [blame] | 402 | |
Chris Lattner | f85eff7 | 2010-03-03 01:52:59 +0000 | [diff] [blame] | 403 | /// Load patterns: these constraint the match to the right address space. |
| 404 | def dsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 405 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 406 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
| 407 | if (PT->getAddressSpace() > 255) |
| 408 | return false; |
| 409 | return true; |
| 410 | }]>; |
| 411 | |
| 412 | def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 413 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 414 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
| 415 | return PT->getAddressSpace() == 256; |
| 416 | return false; |
| 417 | }]>; |
| 418 | |
| 419 | def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 420 | if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue()) |
| 421 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
| 422 | return PT->getAddressSpace() == 257; |
| 423 | return false; |
| 424 | }]>; |
| 425 | |
| 426 | |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 427 | // Helper fragments for loads. |
Evan Cheng | b656443 | 2008-05-13 18:59:59 +0000 | [diff] [blame] | 428 | // It's always safe to treat a anyext i16 load as a i32 load if the i16 is |
| 429 | // 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] | 430 | def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{ |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 431 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 432 | if (const Value *Src = LD->getSrcValue()) |
| 433 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 434 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 435 | return false; |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 436 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 437 | if (ExtType == ISD::NON_EXTLOAD) |
| 438 | return true; |
| 439 | if (ExtType == ISD::EXTLOAD) |
| 440 | return LD->getAlignment() >= 2 && !LD->isVolatile(); |
Evan Cheng | fa7fd33 | 2008-05-13 00:54:02 +0000 | [diff] [blame] | 441 | return false; |
| 442 | }]>; |
| 443 | |
Chris Lattner | f85eff7 | 2010-03-03 01:52:59 +0000 | [diff] [blame] | 444 | def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),[{ |
Evan Cheng | ca57f78 | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 445 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 446 | if (const Value *Src = LD->getSrcValue()) |
| 447 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 448 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 449 | return false; |
Evan Cheng | ca57f78 | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 450 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 451 | if (ExtType == ISD::EXTLOAD) |
| 452 | return LD->getAlignment() >= 2 && !LD->isVolatile(); |
| 453 | return false; |
| 454 | }]>; |
| 455 | |
Dan Gohman | 3358629 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 456 | def loadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{ |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 457 | LoadSDNode *LD = cast<LoadSDNode>(N); |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 458 | if (const Value *Src = LD->getSrcValue()) |
| 459 | if (const PointerType *PT = dyn_cast<PointerType>(Src->getType())) |
Mon P Wang | a7e01d7 | 2009-04-27 07:22:10 +0000 | [diff] [blame] | 460 | if (PT->getAddressSpace() > 255) |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 461 | return false; |
Dan Gohman | 67ca6be | 2008-08-20 15:24:22 +0000 | [diff] [blame] | 462 | ISD::LoadExtType ExtType = LD->getExtensionType(); |
| 463 | if (ExtType == ISD::NON_EXTLOAD) |
| 464 | return true; |
| 465 | if (ExtType == ISD::EXTLOAD) |
| 466 | return LD->getAlignment() >= 4 && !LD->isVolatile(); |
Evan Cheng | fa7fd33 | 2008-05-13 00:54:02 +0000 | [diff] [blame] | 467 | return false; |
| 468 | }]>; |
| 469 | |
Chris Lattner | f85eff7 | 2010-03-03 01:52:59 +0000 | [diff] [blame] | 470 | def loadi8 : PatFrag<(ops node:$ptr), (i8 (dsload node:$ptr))>; |
| 471 | def loadi64 : PatFrag<(ops node:$ptr), (i64 (dsload node:$ptr))>; |
| 472 | def loadf32 : PatFrag<(ops node:$ptr), (f32 (dsload node:$ptr))>; |
| 473 | def loadf64 : PatFrag<(ops node:$ptr), (f64 (dsload node:$ptr))>; |
| 474 | def loadf80 : PatFrag<(ops node:$ptr), (f80 (dsload node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 475 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 476 | def sextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>; |
| 477 | def sextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>; |
| 478 | def sextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (sextloadi16 node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 479 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 480 | def zextloadi8i1 : PatFrag<(ops node:$ptr), (i8 (zextloadi1 node:$ptr))>; |
| 481 | def zextloadi16i1 : PatFrag<(ops node:$ptr), (i16 (zextloadi1 node:$ptr))>; |
| 482 | def zextloadi32i1 : PatFrag<(ops node:$ptr), (i32 (zextloadi1 node:$ptr))>; |
| 483 | def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>; |
| 484 | def zextloadi32i8 : PatFrag<(ops node:$ptr), (i32 (zextloadi8 node:$ptr))>; |
| 485 | def zextloadi32i16 : PatFrag<(ops node:$ptr), (i32 (zextloadi16 node:$ptr))>; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 486 | |
Evan Cheng | 466685d | 2006-10-09 20:57:25 +0000 | [diff] [blame] | 487 | def extloadi8i1 : PatFrag<(ops node:$ptr), (i8 (extloadi1 node:$ptr))>; |
| 488 | def extloadi16i1 : PatFrag<(ops node:$ptr), (i16 (extloadi1 node:$ptr))>; |
| 489 | def extloadi32i1 : PatFrag<(ops node:$ptr), (i32 (extloadi1 node:$ptr))>; |
| 490 | def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 (extloadi8 node:$ptr))>; |
| 491 | def extloadi32i8 : PatFrag<(ops node:$ptr), (i32 (extloadi8 node:$ptr))>; |
| 492 | def extloadi32i16 : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>; |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 493 | |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 494 | |
| 495 | // An 'and' node with a single use. |
| 496 | 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] | 497 | return N->hasOneUse(); |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 498 | }]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 499 | // An 'srl' node with a single use. |
| 500 | def srl_su : PatFrag<(ops node:$lhs, node:$rhs), (srl node:$lhs, node:$rhs), [{ |
| 501 | return N->hasOneUse(); |
| 502 | }]>; |
| 503 | // An 'trunc' node with a single use. |
| 504 | def trunc_su : PatFrag<(ops node:$src), (trunc node:$src), [{ |
| 505 | return N->hasOneUse(); |
| 506 | }]>; |
Chris Lattner | ce2bcc8 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 507 | |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 508 | // Treat an 'or' node is as an 'add' if the or'ed bits are known to be zero. |
| 509 | def or_is_add : PatFrag<(ops node:$lhs, node:$rhs), (or node:$lhs, node:$rhs),[{ |
| 510 | if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1))) |
| 511 | return CurDAG->MaskedValueIsZero(N->getOperand(0), CN->getAPIntValue()); |
Chris Lattner | fdac0b6 | 2010-03-24 00:12:57 +0000 | [diff] [blame] | 512 | |
| 513 | unsigned BitWidth = N->getValueType(0).getScalarType().getSizeInBits(); |
| 514 | APInt Mask = APInt::getAllOnesValue(BitWidth); |
| 515 | APInt KnownZero0, KnownOne0; |
| 516 | CurDAG->ComputeMaskedBits(N->getOperand(0), Mask, KnownZero0, KnownOne0, 0); |
| 517 | APInt KnownZero1, KnownOne1; |
| 518 | CurDAG->ComputeMaskedBits(N->getOperand(1), Mask, KnownZero1, KnownOne1, 0); |
| 519 | return (~KnownZero0 & ~KnownZero1) == 0; |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 520 | }]>; |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 521 | |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 522 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 523 | // Instruction list... |
| 524 | // |
| 525 | |
Chris Lattner | f18c074 | 2006-10-12 17:42:56 +0000 | [diff] [blame] | 526 | // ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into |
| 527 | // a stack adjustment and the codegen must know that they may modify the stack |
| 528 | // pointer before prolog-epilog rewriting occurs. |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 529 | // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become |
| 530 | // sub / add which can clobber EFLAGS. |
Evan Cheng | 8decf6b | 2007-09-28 01:19:48 +0000 | [diff] [blame] | 531 | let Defs = [ESP, EFLAGS], Uses = [ESP] in { |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 532 | def ADJCALLSTACKDOWN32 : I<0, Pseudo, (outs), (ins i32imm:$amt), |
| 533 | "#ADJCALLSTACKDOWN", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 534 | [(X86callseq_start timm:$amt)]>, |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 535 | Requires<[In32BitMode]>; |
| 536 | def ADJCALLSTACKUP32 : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), |
| 537 | "#ADJCALLSTACKUP", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 538 | [(X86callseq_end timm:$amt1, timm:$amt2)]>, |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 539 | Requires<[In32BitMode]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 540 | } |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 541 | |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 542 | // x86-64 va_start lowering magic. |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 543 | let usesCustomInserter = 1 in { |
Dan Gohman | d6708ea | 2009-08-15 01:38:56 +0000 | [diff] [blame] | 544 | def VASTART_SAVE_XMM_REGS : I<0, Pseudo, |
| 545 | (outs), |
| 546 | (ins GR8:$al, |
| 547 | i64imm:$regsavefi, i64imm:$offset, |
| 548 | variable_ops), |
| 549 | "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset", |
| 550 | [(X86vastart_save_xmm_regs GR8:$al, |
| 551 | imm:$regsavefi, |
| 552 | imm:$offset)]>; |
| 553 | |
Anton Korobeynikov | e765f2b | 2010-03-06 20:07:32 +0000 | [diff] [blame] | 554 | // Dynamic stack allocation yields _alloca call for Cygwin/Mingw targets. Calls |
| 555 | // to _alloca is needed to probe the stack when allocating more than 4k bytes in |
| 556 | // one go. Touching the stack at 4K increments is necessary to ensure that the |
| 557 | // guard pages used by the OS virtual memory manager are allocated in correct |
| 558 | // sequence. |
| 559 | // The main point of having separate instruction are extra unmodelled effects |
| 560 | // (compared to ordinary calls) like stack pointer change. |
| 561 | |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 562 | def MINGW_ALLOCA : I<0, Pseudo, (outs), (ins), |
Anton Korobeynikov | e765f2b | 2010-03-06 20:07:32 +0000 | [diff] [blame] | 563 | "# dynamic stack allocation", |
Anton Korobeynikov | 043f3c2 | 2010-03-06 19:32:29 +0000 | [diff] [blame] | 564 | [(X86MingwAlloca)]>; |
| 565 | } |
| 566 | |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 567 | // Nop |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 568 | let neverHasSideEffects = 1 in { |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 569 | def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 570 | def NOOPW : I<0x1f, MRM0m, (outs), (ins i16mem:$zero), |
| 571 | "nop{w}\t$zero", []>, TB, OpSize; |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 572 | def NOOPL : I<0x1f, MRM0m, (outs), (ins i32mem:$zero), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 573 | "nop{l}\t$zero", []>, TB; |
Sean Callanan | 74e5210 | 2009-07-23 23:39:34 +0000 | [diff] [blame] | 574 | } |
Evan Cheng | 4a46080 | 2006-01-11 00:33:36 +0000 | [diff] [blame] | 575 | |
Sean Callanan | 1c5cf1b | 2009-08-11 01:09:06 +0000 | [diff] [blame] | 576 | // Trap |
Kevin Enderby | c3ce05c | 2010-05-14 19:16:02 +0000 | [diff] [blame] | 577 | def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>; |
| 578 | def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3", []>; |
| 579 | // FIXME: need to make sure that "int $3" matches int3 |
| 580 | def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap", []>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 581 | def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", []>, OpSize; |
| 582 | def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l}", []>; |
Sean Callanan | 1c5cf1b | 2009-08-11 01:09:06 +0000 | [diff] [blame] | 583 | |
Chris Lattner | 71c7ace | 2009-09-20 07:32:00 +0000 | [diff] [blame] | 584 | // PIC base construction. This expands to code that looks like this: |
| 585 | // call $next_inst |
| 586 | // popl %destreg" |
Dan Gohman | 2662d55 | 2008-10-01 04:14:30 +0000 | [diff] [blame] | 587 | let neverHasSideEffects = 1, isNotDuplicable = 1, Uses = [ESP] in |
Chris Lattner | b3c8547 | 2009-09-20 07:28:26 +0000 | [diff] [blame] | 588 | def MOVPC32r : Ii32<0xE8, Pseudo, (outs GR32:$reg), (ins i32imm:$label), |
Chris Lattner | 71c7ace | 2009-09-20 07:32:00 +0000 | [diff] [blame] | 589 | "", []>; |
Evan Cheng | 8f7f712 | 2006-05-05 05:40:20 +0000 | [diff] [blame] | 590 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 591 | //===----------------------------------------------------------------------===// |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 592 | // Control Flow Instructions. |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 593 | // |
| 594 | |
Chris Lattner | 1be4811 | 2005-05-13 17:56:48 +0000 | [diff] [blame] | 595 | // Return instructions. |
Evan Cheng | 2b4ea79 | 2005-12-26 09:11:45 +0000 | [diff] [blame] | 596 | let isTerminator = 1, isReturn = 1, isBarrier = 1, |
Jakob Stoklund Olesen | 70feca4 | 2010-03-25 18:52:01 +0000 | [diff] [blame] | 597 | hasCtrlDep = 1, FPForm = SpecialFP in { |
Dan Gohman | e4c67cd | 2008-05-31 02:11:25 +0000 | [diff] [blame] | 598 | def RET : I <0xC3, RawFrm, (outs), (ins variable_ops), |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 599 | "ret", |
Dan Gohman | e4c67cd | 2008-05-31 02:11:25 +0000 | [diff] [blame] | 600 | [(X86retflag 0)]>; |
Chris Lattner | 447ff68 | 2008-03-11 03:23:40 +0000 | [diff] [blame] | 601 | def RETI : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops), |
| 602 | "ret\t$amt", |
Dan Gohman | 2f67df7 | 2009-09-03 17:18:51 +0000 | [diff] [blame] | 603 | [(X86retflag timm:$amt)]>; |
Sean Callanan | 356aed5 | 2009-09-15 23:37:51 +0000 | [diff] [blame] | 604 | def LRET : I <0xCB, RawFrm, (outs), (ins), |
| 605 | "lret", []>; |
| 606 | def LRETI : Ii16<0xCA, RawFrm, (outs), (ins i16imm:$amt), |
| 607 | "lret\t$amt", []>; |
Evan Cheng | 171049d | 2005-12-23 22:14:32 +0000 | [diff] [blame] | 608 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 609 | |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 610 | // Unconditional branches. |
Chris Lattner | b8db331 | 2010-02-11 21:45:31 +0000 | [diff] [blame] | 611 | let isBarrier = 1, isBranch = 1, isTerminator = 1 in { |
Chris Lattner | a033119 | 2010-02-12 22:27:07 +0000 | [diff] [blame] | 612 | def JMP_4 : Ii32PCRel<0xE9, RawFrm, (outs), (ins brtarget:$dst), |
| 613 | "jmp\t$dst", [(br bb:$dst)]>; |
| 614 | def JMP_1 : Ii8PCRel<0xEB, RawFrm, (outs), (ins brtarget8:$dst), |
| 615 | "jmp\t$dst", []>; |
Sean Callanan | 5292588 | 2009-07-22 01:05:20 +0000 | [diff] [blame] | 616 | } |
Evan Cheng | 898101c | 2005-12-19 23:12:38 +0000 | [diff] [blame] | 617 | |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 618 | // Conditional Branches. |
| 619 | let isBranch = 1, isTerminator = 1, Uses = [EFLAGS] in { |
| 620 | multiclass ICBr<bits<8> opc1, bits<8> opc4, string asm, PatFrag Cond> { |
Chris Lattner | a033119 | 2010-02-12 22:27:07 +0000 | [diff] [blame] | 621 | def _1 : Ii8PCRel <opc1, RawFrm, (outs), (ins brtarget8:$dst), asm, []>; |
| 622 | def _4 : Ii32PCRel<opc4, RawFrm, (outs), (ins brtarget:$dst), asm, |
| 623 | [(X86brcond bb:$dst, Cond, EFLAGS)]>, TB; |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 624 | } |
| 625 | } |
| 626 | |
| 627 | defm JO : ICBr<0x70, 0x80, "jo\t$dst" , X86_COND_O>; |
Chris Lattner | 8b442a8 | 2010-02-11 19:52:11 +0000 | [diff] [blame] | 628 | defm JNO : ICBr<0x71, 0x81, "jno\t$dst" , X86_COND_NO>; |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 629 | defm JB : ICBr<0x72, 0x82, "jb\t$dst" , X86_COND_B>; |
| 630 | defm JAE : ICBr<0x73, 0x83, "jae\t$dst", X86_COND_AE>; |
| 631 | defm JE : ICBr<0x74, 0x84, "je\t$dst" , X86_COND_E>; |
| 632 | defm JNE : ICBr<0x75, 0x85, "jne\t$dst", X86_COND_NE>; |
| 633 | defm JBE : ICBr<0x76, 0x86, "jbe\t$dst", X86_COND_BE>; |
| 634 | defm JA : ICBr<0x77, 0x87, "ja\t$dst" , X86_COND_A>; |
| 635 | defm JS : ICBr<0x78, 0x88, "js\t$dst" , X86_COND_S>; |
| 636 | defm JNS : ICBr<0x79, 0x89, "jns\t$dst", X86_COND_NS>; |
| 637 | defm JP : ICBr<0x7A, 0x8A, "jp\t$dst" , X86_COND_P>; |
| 638 | defm JNP : ICBr<0x7B, 0x8B, "jnp\t$dst", X86_COND_NP>; |
| 639 | defm JL : ICBr<0x7C, 0x8C, "jl\t$dst" , X86_COND_L>; |
| 640 | defm JGE : ICBr<0x7D, 0x8D, "jge\t$dst", X86_COND_GE>; |
| 641 | defm JLE : ICBr<0x7E, 0x8E, "jle\t$dst", X86_COND_LE>; |
| 642 | defm JG : ICBr<0x7F, 0x8F, "jg\t$dst" , X86_COND_G>; |
| 643 | |
| 644 | // FIXME: What about the CX/RCX versions of this instruction? |
Chris Lattner | b8db331 | 2010-02-11 21:45:31 +0000 | [diff] [blame] | 645 | let Uses = [ECX], isBranch = 1, isTerminator = 1 in |
Chris Lattner | a033119 | 2010-02-12 22:27:07 +0000 | [diff] [blame] | 646 | def JCXZ8 : Ii8PCRel<0xE3, RawFrm, (outs), (ins brtarget8:$dst), |
| 647 | "jcxz\t$dst", []>; |
Chris Lattner | bd13fb6 | 2010-02-11 19:25:55 +0000 | [diff] [blame] | 648 | |
| 649 | |
Owen Anderson | 20ab290 | 2007-11-12 07:39:39 +0000 | [diff] [blame] | 650 | // Indirect branches |
| 651 | let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 652 | def JMP32r : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst", |
Daniel Dunbar | 77e2dd7 | 2010-07-19 20:44:16 +0000 | [diff] [blame] | 653 | [(brind GR32:$dst)]>, Requires<[In32BitMode]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 654 | def JMP32m : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst", |
Daniel Dunbar | 77e2dd7 | 2010-07-19 20:44:16 +0000 | [diff] [blame] | 655 | [(brind (loadi32 addr:$dst))]>, Requires<[In32BitMode]>; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 656 | |
| 657 | def FARJMP16i : Iseg16<0xEA, RawFrm, (outs), |
| 658 | (ins i16imm:$seg, i16imm:$off), |
| 659 | "ljmp{w}\t$seg, $off", []>, OpSize; |
| 660 | def FARJMP32i : Iseg32<0xEA, RawFrm, (outs), |
| 661 | (ins i16imm:$seg, i32imm:$off), |
| 662 | "ljmp{l}\t$seg, $off", []>; |
| 663 | |
| 664 | def FARJMP16m : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 665 | "ljmp{w}\t{*}$dst", []>, OpSize; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 666 | def FARJMP32m : I<0xFF, MRM5m, (outs), (ins opaque48mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 667 | "ljmp{l}\t{*}$dst", []>; |
Nate Begeman | 37efe67 | 2006-04-22 18:53:45 +0000 | [diff] [blame] | 668 | } |
| 669 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 670 | |
Sean Callanan | 7e6d727 | 2009-09-16 21:50:07 +0000 | [diff] [blame] | 671 | // Loop instructions |
| 672 | |
Chris Lattner | 34b8a88 | 2010-03-18 20:50:06 +0000 | [diff] [blame] | 673 | def LOOP : I<0xE2, RawFrm, (outs), (ins brtarget8:$dst), "loop\t$dst", []>; |
| 674 | def LOOPE : I<0xE1, RawFrm, (outs), (ins brtarget8:$dst), "loope\t$dst", []>; |
| 675 | def LOOPNE : I<0xE0, RawFrm, (outs), (ins brtarget8:$dst), "loopne\t$dst", []>; |
Sean Callanan | 7e6d727 | 2009-09-16 21:50:07 +0000 | [diff] [blame] | 676 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 677 | //===----------------------------------------------------------------------===// |
| 678 | // Call Instructions... |
| 679 | // |
Evan Cheng | ffbacca | 2007-07-21 00:34:19 +0000 | [diff] [blame] | 680 | let isCall = 1 in |
Dan Gohman | 6d4b052 | 2008-10-01 18:28:06 +0000 | [diff] [blame] | 681 | // All calls clobber the non-callee saved registers. ESP is marked as |
| 682 | // a use to prevent stack-pointer assignments that appear immediately |
| 683 | // before calls from potentially appearing dead. Uses for argument |
| 684 | // registers are added manually. |
Nate Begeman | f63be7d | 2005-07-06 18:59:04 +0000 | [diff] [blame] | 685 | 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] | 686 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, |
Evan Cheng | 109a562 | 2008-10-17 21:02:22 +0000 | [diff] [blame] | 687 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, |
| 688 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], |
Dan Gohman | 2662d55 | 2008-10-01 04:14:30 +0000 | [diff] [blame] | 689 | Uses = [ESP] in { |
Chris Lattner | a033119 | 2010-02-12 22:27:07 +0000 | [diff] [blame] | 690 | def CALLpcrel32 : Ii32PCRel<0xE8, RawFrm, |
Chris Lattner | 7680e73 | 2009-06-20 19:34:09 +0000 | [diff] [blame] | 691 | (outs), (ins i32imm_pcrel:$dst,variable_ops), |
| 692 | "call\t$dst", []>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 693 | def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 694 | "call\t{*}$dst", [(X86call GR32:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 695 | def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops), |
Dan Gohman | b410617 | 2008-05-29 21:50:34 +0000 | [diff] [blame] | 696 | "call\t{*}$dst", [(X86call (loadi32 addr:$dst))]>; |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 697 | |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 698 | def FARCALL16i : Iseg16<0x9A, RawFrm, (outs), |
| 699 | (ins i16imm:$seg, i16imm:$off), |
| 700 | "lcall{w}\t$seg, $off", []>, OpSize; |
| 701 | def FARCALL32i : Iseg32<0x9A, RawFrm, (outs), |
| 702 | (ins i16imm:$seg, i32imm:$off), |
| 703 | "lcall{l}\t$seg, $off", []>; |
| 704 | |
| 705 | def FARCALL16m : I<0xFF, MRM3m, (outs), (ins opaque32mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 706 | "lcall{w}\t{*}$dst", []>, OpSize; |
Sean Callanan | 76f14be | 2009-09-15 00:35:17 +0000 | [diff] [blame] | 707 | def FARCALL32m : I<0xFF, MRM3m, (outs), (ins opaque48mem:$dst), |
Sean Callanan | 9947bbb | 2009-09-03 00:04:47 +0000 | [diff] [blame] | 708 | "lcall{l}\t{*}$dst", []>; |
Chris Lattner | 9fc0522 | 2010-07-07 22:27:31 +0000 | [diff] [blame] | 709 | |
| 710 | // callw for 16 bit code for the assembler. |
| 711 | let isAsmParserOnly = 1 in |
| 712 | def CALLpcrel16 : Ii16PCRel<0xE8, RawFrm, |
| 713 | (outs), (ins i16imm_pcrel:$dst, variable_ops), |
| 714 | "callw\t$dst", []>, OpSize; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 715 | } |
| 716 | |
Sean Callanan | 8d70854 | 2009-09-16 02:57:13 +0000 | [diff] [blame] | 717 | // Constructing a stack frame. |
| 718 | |
| 719 | def ENTER : I<0xC8, RawFrm, (outs), (ins i16imm:$len, i8imm:$lvl), |
| 720 | "enter\t$len, $lvl", []>; |
| 721 | |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 722 | // Tail call stuff. |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 723 | |
Daniel Dunbar | e4c52a2 | 2010-07-19 07:21:04 +0000 | [diff] [blame] | 724 | let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, |
| 725 | isCodeGenOnly = 1 in |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 726 | let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, |
| 727 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, |
| 728 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, |
| 729 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], |
| 730 | Uses = [ESP] in { |
| 731 | def TCRETURNdi : I<0, Pseudo, (outs), |
| 732 | (ins i32imm_pcrel:$dst, i32imm:$offset, variable_ops), |
| 733 | "#TC_RETURN $dst $offset", []>; |
| 734 | def TCRETURNri : I<0, Pseudo, (outs), |
| 735 | (ins GR32_TC:$dst, i32imm:$offset, variable_ops), |
| 736 | "#TC_RETURN $dst $offset", []>; |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 737 | let mayLoad = 1 in |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 738 | def TCRETURNmi : I<0, Pseudo, (outs), |
| 739 | (ins i32mem_TC:$dst, i32imm:$offset, variable_ops), |
| 740 | "#TC_RETURN $dst $offset", []>; |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 741 | |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 742 | // FIXME: The should be pseudo instructions that are lowered when going to |
| 743 | // mcinst. |
Chris Lattner | 840e637 | 2010-03-16 06:30:18 +0000 | [diff] [blame] | 744 | def TAILJMPd : Ii32PCRel<0xE9, RawFrm, (outs), |
| 745 | (ins i32imm_pcrel:$dst, variable_ops), |
Evan Cheng | aa92bec | 2010-01-31 07:28:44 +0000 | [diff] [blame] | 746 | "jmp\t$dst # TAILCALL", |
Evan Cheng | f10c17f | 2006-09-22 21:43:59 +0000 | [diff] [blame] | 747 | []>; |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 748 | def TAILJMPr : I<0xFF, MRM4r, (outs), (ins GR32_TC:$dst, variable_ops), |
Chris Lattner | c5f5626 | 2010-07-09 00:49:41 +0000 | [diff] [blame] | 749 | "", []>; // FIXME: Remove encoding when JIT is dead. |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 750 | let mayLoad = 1 in |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 751 | def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem_TC:$dst, variable_ops), |
| 752 | "jmp{l}\t{*}$dst # TAILCALL", []>; |
| 753 | } |
Chris Lattner | 1e9448b | 2005-05-15 03:10:37 +0000 | [diff] [blame] | 754 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 755 | //===----------------------------------------------------------------------===// |
| 756 | // Miscellaneous Instructions... |
| 757 | // |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 758 | let Defs = [EBP, ESP], Uses = [EBP, ESP], mayLoad = 1, neverHasSideEffects=1 in |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 759 | def LEAVE : I<0xC9, RawFrm, |
Daniel Dunbar | df4c47b | 2010-07-19 07:21:01 +0000 | [diff] [blame] | 760 | (outs), (ins), "leave", []>, Requires<[In32BitMode]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 761 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 762 | def POPCNT16rr : I<0xB8, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 763 | "popcnt{w}\t{$src, $dst|$dst, $src}", []>, OpSize, XS; |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 764 | let mayLoad = 1 in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 765 | def POPCNT16rm : I<0xB8, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 766 | "popcnt{w}\t{$src, $dst|$dst, $src}", []>, OpSize, XS; |
| 767 | def POPCNT32rr : I<0xB8, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 768 | "popcnt{l}\t{$src, $dst|$dst, $src}", []>, XS; |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 769 | let mayLoad = 1 in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 770 | def POPCNT32rm : I<0xB8, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 771 | "popcnt{l}\t{$src, $dst|$dst, $src}", []>, XS; |
| 772 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 773 | let Defs = [ESP], Uses = [ESP], neverHasSideEffects=1 in { |
Sean Callanan | 1f24e01 | 2009-09-10 18:29:13 +0000 | [diff] [blame] | 774 | let mayLoad = 1 in { |
| 775 | def POP16r : I<0x58, AddRegFrm, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>, |
| 776 | OpSize; |
| 777 | def POP32r : I<0x58, AddRegFrm, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>; |
| 778 | def POP16rmr: I<0x8F, MRM0r, (outs GR16:$reg), (ins), "pop{w}\t$reg", []>, |
| 779 | OpSize; |
| 780 | def POP16rmm: I<0x8F, MRM0m, (outs i16mem:$dst), (ins), "pop{w}\t$dst", []>, |
| 781 | OpSize; |
| 782 | def POP32rmr: I<0x8F, MRM0r, (outs GR32:$reg), (ins), "pop{l}\t$reg", []>; |
| 783 | def POP32rmm: I<0x8F, MRM0m, (outs i32mem:$dst), (ins), "pop{l}\t$dst", []>; |
| 784 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 785 | |
Sean Callanan | 1f24e01 | 2009-09-10 18:29:13 +0000 | [diff] [blame] | 786 | let mayStore = 1 in { |
| 787 | def PUSH16r : I<0x50, AddRegFrm, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>, |
| 788 | OpSize; |
Evan Cheng | 2f245ba | 2007-09-26 01:29:06 +0000 | [diff] [blame] | 789 | 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] | 790 | def PUSH16rmr: I<0xFF, MRM6r, (outs), (ins GR16:$reg), "push{w}\t$reg",[]>, |
| 791 | OpSize; |
| 792 | def PUSH16rmm: I<0xFF, MRM6m, (outs), (ins i16mem:$src), "push{w}\t$src",[]>, |
| 793 | OpSize; |
| 794 | def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[]>; |
| 795 | def PUSH32rmm: I<0xFF, MRM6m, (outs), (ins i32mem:$src), "push{l}\t$src",[]>; |
| 796 | } |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 797 | } |
Anton Korobeynikov | 57fc00d | 2007-04-17 09:20:00 +0000 | [diff] [blame] | 798 | |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 799 | let Defs = [ESP], Uses = [ESP], neverHasSideEffects = 1, mayStore = 1 in { |
Kevin Enderby | 3c979b0 | 2010-05-03 20:45:05 +0000 | [diff] [blame] | 800 | def PUSHi8 : Ii8<0x6a, RawFrm, (outs), (ins i32i8imm:$imm), |
Bill Wendling | 927788c | 2009-06-15 20:59:31 +0000 | [diff] [blame] | 801 | "push{l}\t$imm", []>; |
Kevin Enderby | 3c979b0 | 2010-05-03 20:45:05 +0000 | [diff] [blame] | 802 | def PUSHi16 : Ii16<0x68, RawFrm, (outs), (ins i16imm:$imm), |
| 803 | "push{w}\t$imm", []>, OpSize; |
| 804 | def PUSHi32 : Ii32<0x68, RawFrm, (outs), (ins i32imm:$imm), |
Bill Wendling | 927788c | 2009-06-15 20:59:31 +0000 | [diff] [blame] | 805 | "push{l}\t$imm", []>; |
Bill Wendling | 453eb26 | 2009-06-15 19:39:04 +0000 | [diff] [blame] | 806 | } |
| 807 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 808 | let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, neverHasSideEffects=1 in { |
Dan Gohman | e5e4ff9 | 2010-05-20 16:16:00 +0000 | [diff] [blame] | 809 | def POPF16 : I<0x9D, RawFrm, (outs), (ins), "popf{w}", []>, OpSize; |
| 810 | def POPF32 : I<0x9D, RawFrm, (outs), (ins), "popf{l|d}", []>, |
| 811 | Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 812 | } |
| 813 | let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, neverHasSideEffects=1 in { |
Dan Gohman | e5e4ff9 | 2010-05-20 16:16:00 +0000 | [diff] [blame] | 814 | def PUSHF16 : I<0x9C, RawFrm, (outs), (ins), "pushf{w}", []>, OpSize; |
| 815 | def PUSHF32 : I<0x9C, RawFrm, (outs), (ins), "pushf{l|d}", []>, |
| 816 | Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 817 | } |
Evan Cheng | 2f245ba | 2007-09-26 01:29:06 +0000 | [diff] [blame] | 818 | |
Nico Weber | 50b9efc | 2010-06-23 20:00:58 +0000 | [diff] [blame] | 819 | let Defs = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP], Uses = [ESP], |
| 820 | mayLoad=1, neverHasSideEffects=1 in { |
| 821 | def POPA32 : I<0x61, RawFrm, (outs), (ins), "popa{l}", []>, |
| 822 | Requires<[In32BitMode]>; |
| 823 | } |
| 824 | let Defs = [ESP], Uses = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP], |
| 825 | mayStore=1, neverHasSideEffects=1 in { |
| 826 | def PUSHA32 : I<0x60, RawFrm, (outs), (ins), "pusha{l}", []>, |
| 827 | Requires<[In32BitMode]>; |
| 828 | } |
| 829 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 830 | let Uses = [EFLAGS], Constraints = "$src = $dst" in // GR32 = bswap GR32 |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 831 | def BSWAP32r : I<0xC8, AddRegFrm, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 832 | (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 833 | "bswap{l}\t$dst", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 834 | [(set GR32:$dst, (bswap GR32:$src))]>, TB; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 835 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 836 | |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 837 | // Bit scan instructions. |
| 838 | let Defs = [EFLAGS] in { |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 839 | def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 840 | "bsf{w}\t{$src, $dst|$dst, $src}", |
Kevin Enderby | 9ac7282 | 2010-04-28 23:20:40 +0000 | [diff] [blame] | 841 | [(set GR16:$dst, EFLAGS, (X86bsf GR16:$src))]>, TB, OpSize; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 842 | def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 843 | "bsf{w}\t{$src, $dst|$dst, $src}", |
Kevin Enderby | 9ac7282 | 2010-04-28 23:20:40 +0000 | [diff] [blame] | 844 | [(set GR16:$dst, EFLAGS, (X86bsf (loadi16 addr:$src)))]>, TB, |
| 845 | OpSize; |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 846 | def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 847 | "bsf{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | d486d77 | 2010-03-28 05:07:17 +0000 | [diff] [blame] | 848 | [(set GR32:$dst, EFLAGS, (X86bsf GR32:$src))]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 849 | def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 850 | "bsf{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | d486d77 | 2010-03-28 05:07:17 +0000 | [diff] [blame] | 851 | [(set GR32:$dst, EFLAGS, (X86bsf (loadi32 addr:$src)))]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 852 | |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 853 | def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 854 | "bsr{w}\t{$src, $dst|$dst, $src}", |
Kevin Enderby | 9ac7282 | 2010-04-28 23:20:40 +0000 | [diff] [blame] | 855 | [(set GR16:$dst, EFLAGS, (X86bsr GR16:$src))]>, TB, OpSize; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 856 | def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 857 | "bsr{w}\t{$src, $dst|$dst, $src}", |
Kevin Enderby | 9ac7282 | 2010-04-28 23:20:40 +0000 | [diff] [blame] | 858 | [(set GR16:$dst, EFLAGS, (X86bsr (loadi16 addr:$src)))]>, TB, |
| 859 | OpSize; |
Evan Cheng | fd9e473 | 2007-12-14 18:49:43 +0000 | [diff] [blame] | 860 | def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 861 | "bsr{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | d486d77 | 2010-03-28 05:07:17 +0000 | [diff] [blame] | 862 | [(set GR32:$dst, EFLAGS, (X86bsr GR32:$src))]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 863 | def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | 1a8001e | 2007-12-14 15:10:00 +0000 | [diff] [blame] | 864 | "bsr{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | d486d77 | 2010-03-28 05:07:17 +0000 | [diff] [blame] | 865 | [(set GR32:$dst, EFLAGS, (X86bsr (loadi32 addr:$src)))]>, TB; |
Evan Cheng | 18efe26 | 2007-12-14 02:13:44 +0000 | [diff] [blame] | 866 | } // Defs = [EFLAGS] |
| 867 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 868 | let neverHasSideEffects = 1 in |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 869 | def LEA16r : I<0x8D, MRMSrcMem, |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 870 | (outs GR16:$dst), (ins i32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 871 | "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize; |
Evan Cheng | e771ebd | 2008-03-27 01:41:09 +0000 | [diff] [blame] | 872 | let isReMaterializable = 1 in |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 873 | def LEA32r : I<0x8D, MRMSrcMem, |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 874 | (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 875 | "lea{l}\t{$src|$dst}, {$dst|$src}", |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 876 | [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 877 | |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 878 | let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI], isCodeGenOnly = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 879 | def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 880 | [(X86rep_movs i8)]>, REP; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 881 | def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 882 | [(X86rep_movs i16)]>, REP, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 883 | def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 884 | [(X86rep_movs i32)]>, REP; |
| 885 | } |
Chris Lattner | 915e5e5 | 2004-02-12 17:53:22 +0000 | [diff] [blame] | 886 | |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 887 | // These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI |
| 888 | let Defs = [EDI,ESI], Uses = [EDI,ESI,EFLAGS] in { |
| 889 | def MOVSB : I<0xA4, RawFrm, (outs), (ins), "{movsb}", []>; |
| 890 | def MOVSW : I<0xA5, RawFrm, (outs), (ins), "{movsw}", []>, OpSize; |
| 891 | def MOVSD : I<0xA5, RawFrm, (outs), (ins), "{movsl|movsd}", []>; |
| 892 | } |
| 893 | |
| 894 | let Defs = [ECX,EDI], Uses = [AL,ECX,EDI], isCodeGenOnly = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 895 | def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 896 | [(X86rep_stos i8)]>, REP; |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 897 | let Defs = [ECX,EDI], Uses = [AX,ECX,EDI], isCodeGenOnly = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 898 | def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 899 | [(X86rep_stos i16)]>, REP, OpSize; |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 900 | let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI], isCodeGenOnly = 1 in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 901 | def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 902 | [(X86rep_stos i32)]>, REP; |
Chris Lattner | 30bf2d8 | 2004-08-10 20:17:41 +0000 | [diff] [blame] | 903 | |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 904 | // These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI |
| 905 | let Defs = [EDI], Uses = [AL,EDI,EFLAGS] in |
| 906 | def STOSB : I<0xAA, RawFrm, (outs), (ins), "{stosb}", []>; |
| 907 | let Defs = [EDI], Uses = [AX,EDI,EFLAGS] in |
| 908 | def STOSW : I<0xAB, RawFrm, (outs), (ins), "{stosw}", []>, OpSize; |
| 909 | let Defs = [EDI], Uses = [EAX,EDI,EFLAGS] in |
| 910 | def STOSD : I<0xAB, RawFrm, (outs), (ins), "{stosl|stosd}", []>; |
| 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 | |
Sean Callanan | cebe955 | 2010-02-13 02:06:11 +0000 | [diff] [blame] | 924 | let Defs = [RAX, RCX, RDX] in |
| 925 | def RDTSCP : I<0x01, MRM_F9, (outs), (ins), "rdtscp", []>, TB; |
| 926 | |
Dan Gohman | effc8c5 | 2010-05-14 16:46:02 +0000 | [diff] [blame] | 927 | let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in { |
Chris Lattner | da68d30 | 2008-01-15 21:58:22 +0000 | [diff] [blame] | 928 | def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB; |
Anton Korobeynikov | 66fac79 | 2008-01-15 07:02:33 +0000 | [diff] [blame] | 929 | } |
| 930 | |
Chris Lattner | 02552de | 2009-08-11 16:58:39 +0000 | [diff] [blame] | 931 | def SYSCALL : I<0x05, RawFrm, |
| 932 | (outs), (ins), "syscall", []>, TB; |
| 933 | def SYSRET : I<0x07, RawFrm, |
| 934 | (outs), (ins), "sysret", []>, TB; |
| 935 | def SYSENTER : I<0x34, RawFrm, |
| 936 | (outs), (ins), "sysenter", []>, TB; |
| 937 | def SYSEXIT : I<0x35, RawFrm, |
Daniel Dunbar | df4c47b | 2010-07-19 07:21:01 +0000 | [diff] [blame] | 938 | (outs), (ins), "sysexit", []>, TB, Requires<[In32BitMode]>; |
Chris Lattner | 02552de | 2009-08-11 16:58:39 +0000 | [diff] [blame] | 939 | |
Sean Callanan | 2a46f36 | 2009-09-12 02:52:41 +0000 | [diff] [blame] | 940 | def WAIT : I<0x9B, RawFrm, (outs), (ins), "wait", []>; |
Chris Lattner | 02552de | 2009-08-11 16:58:39 +0000 | [diff] [blame] | 941 | |
| 942 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 943 | //===----------------------------------------------------------------------===// |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 944 | // Input/Output Instructions... |
| 945 | // |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 946 | let Defs = [AL], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 947 | def IN8rr : I<0xEC, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 948 | "in{b}\t{%dx, %al|%AL, %DX}", []>; |
| 949 | let Defs = [AX], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 950 | def IN16rr : I<0xED, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 951 | "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize; |
| 952 | let Defs = [EAX], Uses = [DX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 953 | def IN32rr : I<0xED, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 954 | "in{l}\t{%dx, %eax|%EAX, %DX}", []>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 955 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 956 | let Defs = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 957 | def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 958 | "in{b}\t{$port, %al|%AL, $port}", []>; |
| 959 | let Defs = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 960 | def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 961 | "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize; |
| 962 | let Defs = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 963 | def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 964 | "in{l}\t{$port, %eax|%EAX, $port}", []>; |
Chris Lattner | 440bbc2 | 2004-04-13 17:19:31 +0000 | [diff] [blame] | 965 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 966 | let Uses = [DX, AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 967 | def OUT8rr : I<0xEE, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 968 | "out{b}\t{%al, %dx|%DX, %AL}", []>; |
| 969 | let Uses = [DX, AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 970 | def OUT16rr : I<0xEF, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 971 | "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize; |
| 972 | let Uses = [DX, EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 973 | def OUT32rr : I<0xEF, RawFrm, (outs), (ins), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 974 | "out{l}\t{%eax, %dx|%DX, %EAX}", []>; |
Chris Lattner | ffff708 | 2004-08-01 07:44:35 +0000 | [diff] [blame] | 975 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 976 | let Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 977 | def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 978 | "out{b}\t{%al, $port|$port, %AL}", []>; |
| 979 | let Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 980 | def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 981 | "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize; |
| 982 | let Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 983 | def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 984 | "out{l}\t{%eax, $port|$port, %EAX}", []>; |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 985 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 986 | def IN8 : I<0x6C, RawFrm, (outs), (ins), |
| 987 | "ins{b}", []>; |
| 988 | def IN16 : I<0x6D, RawFrm, (outs), (ins), |
| 989 | "ins{w}", []>, OpSize; |
| 990 | def IN32 : I<0x6D, RawFrm, (outs), (ins), |
| 991 | "ins{l}", []>; |
| 992 | |
John Criswell | 4ffff9e | 2004-04-08 20:31:47 +0000 | [diff] [blame] | 993 | //===----------------------------------------------------------------------===// |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 994 | // Move Instructions... |
| 995 | // |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 996 | let neverHasSideEffects = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 997 | def MOV8rr : I<0x88, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 998 | "mov{b}\t{$src, $dst|$dst, $src}", []>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 999 | def MOV16rr : I<0x89, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1000 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1001 | def MOV32rr : I<0x89, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1002 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1003 | } |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 1004 | let isReMaterializable = 1, isAsCheapAsAMove = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1005 | def MOV8ri : Ii8 <0xB0, AddRegFrm, (outs GR8 :$dst), (ins i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1006 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1007 | [(set GR8:$dst, imm:$src)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1008 | def MOV16ri : Ii16<0xB8, AddRegFrm, (outs GR16:$dst), (ins i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1009 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1010 | [(set GR16:$dst, imm:$src)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1011 | def MOV32ri : Ii32<0xB8, AddRegFrm, (outs GR32:$dst), (ins i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1012 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1013 | [(set GR32:$dst, imm:$src)]>; |
Dan Gohman | d45eddd | 2007-06-26 00:48:07 +0000 | [diff] [blame] | 1014 | } |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 1015 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1016 | def MOV8mi : Ii8 <0xC6, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1017 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1018 | [(store (i8 imm:$src), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1019 | def MOV16mi : Ii16<0xC7, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1020 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1021 | [(store (i16 imm:$src), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1022 | def MOV32mi : Ii32<0xC7, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1023 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1024 | [(store (i32 imm:$src), addr:$dst)]>; |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1025 | |
Chris Lattner | b5505d0 | 2010-05-13 00:02:47 +0000 | [diff] [blame] | 1026 | /// moffs8, moffs16 and moffs32 versions of moves. The immediate is a |
| 1027 | /// 32-bit offset from the PC. These are only valid in x86-32 mode. |
Chris Lattner | 2745f6e | 2010-05-12 22:48:24 +0000 | [diff] [blame] | 1028 | def MOV8o8a : Ii32 <0xA0, RawFrm, (outs), (ins offset8:$src), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1029 | "mov{b}\t{$src, %al|%al, $src}", []>, |
| 1030 | Requires<[In32BitMode]>; |
Chris Lattner | 2745f6e | 2010-05-12 22:48:24 +0000 | [diff] [blame] | 1031 | def MOV16o16a : Ii32 <0xA1, RawFrm, (outs), (ins offset16:$src), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1032 | "mov{w}\t{$src, %ax|%ax, $src}", []>, OpSize, |
| 1033 | Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1034 | def MOV32o32a : Ii32 <0xA1, RawFrm, (outs), (ins offset32:$src), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1035 | "mov{l}\t{$src, %eax|%eax, $src}", []>, |
| 1036 | Requires<[In32BitMode]>; |
Chris Lattner | 2745f6e | 2010-05-12 22:48:24 +0000 | [diff] [blame] | 1037 | def MOV8ao8 : Ii32 <0xA2, RawFrm, (outs offset8:$dst), (ins), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1038 | "mov{b}\t{%al, $dst|$dst, %al}", []>, |
| 1039 | Requires<[In32BitMode]>; |
Chris Lattner | 2745f6e | 2010-05-12 22:48:24 +0000 | [diff] [blame] | 1040 | def MOV16ao16 : Ii32 <0xA3, RawFrm, (outs offset16:$dst), (ins), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1041 | "mov{w}\t{%ax, $dst|$dst, %ax}", []>, OpSize, |
| 1042 | Requires<[In32BitMode]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1043 | def MOV32ao32 : Ii32 <0xA3, RawFrm, (outs offset32:$dst), (ins), |
Daniel Dunbar | 6c2c9a2 | 2010-07-19 06:14:44 +0000 | [diff] [blame] | 1044 | "mov{l}\t{%eax, $dst|$dst, %eax}", []>, |
| 1045 | Requires<[In32BitMode]>; |
Chris Lattner | b5505d0 | 2010-05-13 00:02:47 +0000 | [diff] [blame] | 1046 | |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1047 | // Moves to and from segment registers |
| 1048 | def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src), |
Kevin Enderby | b106543 | 2010-05-26 20:10:45 +0000 | [diff] [blame] | 1049 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1050 | def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src), |
| 1051 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1052 | def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src), |
Kevin Enderby | b106543 | 2010-05-26 20:10:45 +0000 | [diff] [blame] | 1053 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1054 | def MOV32ms : I<0x8C, MRMDestMem, (outs i32mem:$dst), (ins SEGMENT_REG:$src), |
| 1055 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1056 | def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src), |
Kevin Enderby | b106543 | 2010-05-26 20:10:45 +0000 | [diff] [blame] | 1057 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1058 | def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src), |
| 1059 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1060 | def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src), |
Kevin Enderby | b106543 | 2010-05-26 20:10:45 +0000 | [diff] [blame] | 1061 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1062 | def MOV32sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i32mem:$src), |
| 1063 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Sean Callanan | 38fee0e | 2009-09-15 18:47:29 +0000 | [diff] [blame] | 1064 | |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1065 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1066 | def MOV8rr_REV : I<0x8A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src), |
| 1067 | "mov{b}\t{$src, $dst|$dst, $src}", []>; |
| 1068 | def MOV16rr_REV : I<0x8B, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 1069 | "mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 1070 | def MOV32rr_REV : I<0x8B, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 1071 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1072 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1073 | |
Dan Gohman | bc9d98b | 2010-02-27 23:47:46 +0000 | [diff] [blame] | 1074 | let canFoldAsLoad = 1, isReMaterializable = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1075 | def MOV8rm : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1076 | "mov{b}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1077 | [(set GR8:$dst, (loadi8 addr:$src))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1078 | def MOV16rm : I<0x8B, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1079 | "mov{w}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1080 | [(set GR16:$dst, (loadi16 addr:$src))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1081 | def MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1082 | "mov{l}\t{$src, $dst|$dst, $src}", |
Chris Lattner | c2406f2 | 2009-04-10 00:16:23 +0000 | [diff] [blame] | 1083 | [(set GR32:$dst, (loadi32 addr:$src))]>; |
Evan Cheng | 2f39426 | 2007-08-30 05:49:43 +0000 | [diff] [blame] | 1084 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1085 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1086 | def MOV8mr : I<0x88, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1087 | "mov{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1088 | [(store GR8:$src, addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1089 | def MOV16mr : I<0x89, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1090 | "mov{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1091 | [(store GR16:$src, addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1092 | def MOV32mr : I<0x89, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1093 | "mov{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1094 | [(store GR32:$src, addr:$dst)]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 1095 | |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 1096 | /// Versions of MOV32rr, MOV32rm, and MOV32mr for i32mem_TC and GR32_TC. |
Daniel Dunbar | cf246b7 | 2010-07-19 06:14:49 +0000 | [diff] [blame] | 1097 | let isCodeGenOnly = 1 in { |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 1098 | let neverHasSideEffects = 1 in |
| 1099 | def MOV32rr_TC : I<0x89, MRMDestReg, (outs GR32_TC:$dst), (ins GR32_TC:$src), |
| 1100 | "mov{l}\t{$src, $dst|$dst, $src}", []>; |
| 1101 | |
| 1102 | let mayLoad = 1, |
| 1103 | canFoldAsLoad = 1, isReMaterializable = 1 in |
| 1104 | def MOV32rm_TC : I<0x8B, MRMSrcMem, (outs GR32_TC:$dst), (ins i32mem_TC:$src), |
| 1105 | "mov{l}\t{$src, $dst|$dst, $src}", |
| 1106 | []>; |
| 1107 | |
| 1108 | let mayStore = 1 in |
| 1109 | def MOV32mr_TC : I<0x89, MRMDestMem, (outs), (ins i32mem_TC:$dst, GR32_TC:$src), |
| 1110 | "mov{l}\t{$src, $dst|$dst, $src}", |
| 1111 | []>; |
Daniel Dunbar | cf246b7 | 2010-07-19 06:14:49 +0000 | [diff] [blame] | 1112 | } |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 1113 | |
Dan Gohman | 4af325d | 2009-04-27 16:41:36 +0000 | [diff] [blame] | 1114 | // Versions of MOV8rr, MOV8mr, and MOV8rm that use i8mem_NOREX and GR8_NOREX so |
| 1115 | // that they can be used for copying and storing h registers, which can't be |
| 1116 | // encoded when a REX prefix is present. |
Daniel Dunbar | cf246b7 | 2010-07-19 06:14:49 +0000 | [diff] [blame] | 1117 | let isCodeGenOnly = 1 in { |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1118 | let neverHasSideEffects = 1 in |
Dan Gohman | df7dfc7 | 2009-04-15 19:48:57 +0000 | [diff] [blame] | 1119 | def MOV8rr_NOREX : I<0x88, MRMDestReg, |
| 1120 | (outs GR8_NOREX:$dst), (ins GR8_NOREX:$src), |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1121 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Evan Cheng | 8c14740 | 2009-04-30 00:58:57 +0000 | [diff] [blame] | 1122 | let mayStore = 1 in |
Dan Gohman | 6d9305c | 2009-04-15 00:04:23 +0000 | [diff] [blame] | 1123 | def MOV8mr_NOREX : I<0x88, MRMDestMem, |
| 1124 | (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src), |
| 1125 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Evan Cheng | 8c14740 | 2009-04-30 00:58:57 +0000 | [diff] [blame] | 1126 | let mayLoad = 1, |
Dan Gohman | bc9d98b | 2010-02-27 23:47:46 +0000 | [diff] [blame] | 1127 | canFoldAsLoad = 1, isReMaterializable = 1 in |
Dan Gohman | 4af325d | 2009-04-27 16:41:36 +0000 | [diff] [blame] | 1128 | def MOV8rm_NOREX : I<0x8A, MRMSrcMem, |
| 1129 | (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src), |
| 1130 | "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>; |
Daniel Dunbar | cf246b7 | 2010-07-19 06:14:49 +0000 | [diff] [blame] | 1131 | } |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 1132 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1133 | // Moves to and from debug registers |
| 1134 | def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src), |
| 1135 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1136 | def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src), |
| 1137 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1138 | |
| 1139 | // Moves to and from control registers |
Sean Callanan | 1a8b789 | 2010-05-06 20:59:00 +0000 | [diff] [blame] | 1140 | def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src), |
| 1141 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 1142 | def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src), |
| 1143 | "mov{l}\t{$src, $dst|$dst, $src}", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1144 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1145 | //===----------------------------------------------------------------------===// |
| 1146 | // Fixed-Register Multiplication and Division Instructions... |
| 1147 | // |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1148 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 1149 | // Extra precision multiplication |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1150 | |
| 1151 | // AL is really implied by AX, by the registers in Defs must match the |
| 1152 | // SDNode results (i8, i32). |
| 1153 | let Defs = [AL,EFLAGS,AX], Uses = [AL] in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1154 | 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] | 1155 | // FIXME: Used for 8-bit mul, ignore result upper 8 bits. |
| 1156 | // This probably ought to be moved to a def : Pat<> if the |
| 1157 | // syntax can be accepted. |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1158 | [(set AL, (mul AL, GR8:$src)), |
| 1159 | (implicit EFLAGS)]>; // AL,AH = AL*GR8 |
| 1160 | |
Chris Lattner | a731c9f | 2008-01-11 07:18:17 +0000 | [diff] [blame] | 1161 | let Defs = [AX,DX,EFLAGS], Uses = [AX], neverHasSideEffects = 1 in |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1162 | def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), |
| 1163 | "mul{w}\t$src", |
| 1164 | []>, OpSize; // AX,DX = AX*GR16 |
| 1165 | |
Chris Lattner | a731c9f | 2008-01-11 07:18:17 +0000 | [diff] [blame] | 1166 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX], neverHasSideEffects = 1 in |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1167 | def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), |
| 1168 | "mul{l}\t$src", |
| 1169 | []>; // EAX,EDX = EAX*GR32 |
| 1170 | |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1171 | let Defs = [AL,EFLAGS,AX], Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1172 | def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1173 | "mul{b}\t$src", |
Evan Cheng | cf74a7c | 2006-01-15 10:05:20 +0000 | [diff] [blame] | 1174 | // FIXME: Used for 8-bit mul, ignore result upper 8 bits. |
| 1175 | // This probably ought to be moved to a def : Pat<> if the |
| 1176 | // syntax can be accepted. |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1177 | [(set AL, (mul AL, (loadi8 addr:$src))), |
| 1178 | (implicit EFLAGS)]>; // AL,AH = AL*[mem8] |
| 1179 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1180 | let mayLoad = 1, neverHasSideEffects = 1 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1181 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1182 | def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1183 | "mul{w}\t$src", |
| 1184 | []>, OpSize; // AX,DX = AX*[mem16] |
| 1185 | |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1186 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1187 | def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 1188 | "mul{l}\t$src", |
| 1189 | []>; // EAX,EDX = EAX*[mem32] |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1190 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1191 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1192 | let neverHasSideEffects = 1 in { |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1193 | let Defs = [AL,EFLAGS,AX], Uses = [AL] in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1194 | def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>; |
| 1195 | // AL,AH = AL*GR8 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1196 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1197 | 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] | 1198 | OpSize; // AX,DX = AX*GR16 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1199 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1200 | def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>; |
| 1201 | // EAX,EDX = EAX*GR32 |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1202 | let mayLoad = 1 in { |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1203 | let Defs = [AL,EFLAGS,AX], Uses = [AL] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1204 | def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1205 | "imul{b}\t$src", []>; // AL,AH = AL*[mem8] |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1206 | let Defs = [AX,DX,EFLAGS], Uses = [AX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1207 | def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1208 | "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] |
Eli Friedman | ba7b1c4 | 2009-12-26 20:08:30 +0000 | [diff] [blame] | 1209 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1210 | def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1211 | "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1212 | } |
Dan Gohman | c99da13 | 2008-11-18 21:29:14 +0000 | [diff] [blame] | 1213 | } // neverHasSideEffects |
Chris Lattner | 1e6a715 | 2005-04-06 04:19:22 +0000 | [diff] [blame] | 1214 | |
Chris Lattner | c8f4587 | 2003-08-04 04:59:56 +0000 | [diff] [blame] | 1215 | // unsigned division/remainder |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1216 | let Defs = [AL,EFLAGS,AX], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1217 | 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] | 1218 | "div{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1219 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1220 | 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] | 1221 | "div{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1222 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1223 | 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] | 1224 | "div{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1225 | let mayLoad = 1 in { |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1226 | let Defs = [AL,EFLAGS,AX], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1227 | 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] | 1228 | "div{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1229 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1230 | 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] | 1231 | "div{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1232 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1233 | // EDX:EAX/[mem32] = EAX,EDX |
| 1234 | def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1235 | "div{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1236 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1237 | |
Chris Lattner | fc75271 | 2004-08-01 09:52:59 +0000 | [diff] [blame] | 1238 | // Signed division/remainder. |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1239 | let Defs = [AL,EFLAGS,AX], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1240 | 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] | 1241 | "idiv{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1242 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1243 | 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] | 1244 | "idiv{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1245 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1246 | 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] | 1247 | "idiv{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1248 | let mayLoad = 1, mayLoad = 1 in { |
Jakob Stoklund Olesen | 3cfe010 | 2010-03-04 20:42:07 +0000 | [diff] [blame] | 1249 | let Defs = [AL,EFLAGS,AX], Uses = [AX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1250 | 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] | 1251 | "idiv{b}\t$src", []>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1252 | let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1253 | 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] | 1254 | "idiv{w}\t$src", []>, OpSize; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1255 | let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1256 | def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), |
| 1257 | // EDX:EAX/[mem32] = EAX,EDX |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 1258 | "idiv{l}\t$src", []>; |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1259 | } |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1260 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1261 | //===----------------------------------------------------------------------===// |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1262 | // Two address Instructions. |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1263 | // |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1264 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 1265 | |
Alkis Evlogimenos | a3f6684 | 2004-03-12 17:59:56 +0000 | [diff] [blame] | 1266 | // Conditional moves |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1267 | let Uses = [EFLAGS] in { |
Dan Gohman | cbbea0f | 2009-08-27 00:14:12 +0000 | [diff] [blame] | 1268 | |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1269 | let Predicates = [HasCMov] in { |
Dan Gohman | a4c5c33 | 2009-08-27 18:16:24 +0000 | [diff] [blame] | 1270 | let isCommutable = 1 in { |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1271 | def CMOVB16rr : I<0x42, MRMSrcReg, // if <u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1272 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1273 | "cmovb{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1274 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1275 | X86_COND_B, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1276 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1277 | def CMOVB32rr : I<0x42, MRMSrcReg, // if <u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1278 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1279 | "cmovb{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1280 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1281 | X86_COND_B, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1282 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1283 | def CMOVAE16rr: I<0x43, MRMSrcReg, // if >=u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1284 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1285 | "cmovae{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1286 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1287 | X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1288 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1289 | def CMOVAE32rr: I<0x43, MRMSrcReg, // if >=u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1290 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1291 | "cmovae{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1292 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1293 | X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1294 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1295 | def CMOVE16rr : I<0x44, MRMSrcReg, // if ==, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1296 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1297 | "cmove{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1298 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1299 | X86_COND_E, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1300 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1301 | def CMOVE32rr : I<0x44, MRMSrcReg, // if ==, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1302 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1303 | "cmove{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1304 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1305 | X86_COND_E, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1306 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1307 | def CMOVNE16rr: I<0x45, MRMSrcReg, // if !=, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1308 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1309 | "cmovne{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1310 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1311 | X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1312 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1313 | def CMOVNE32rr: I<0x45, MRMSrcReg, // if !=, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1314 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1315 | "cmovne{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1316 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1317 | X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1318 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1319 | def CMOVBE16rr: I<0x46, MRMSrcReg, // if <=u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1320 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1321 | "cmovbe{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1322 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1323 | X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1324 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1325 | def CMOVBE32rr: I<0x46, MRMSrcReg, // if <=u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1326 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1327 | "cmovbe{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1328 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1329 | X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1330 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1331 | def CMOVA16rr : I<0x47, MRMSrcReg, // if >u, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1332 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1333 | "cmova{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1334 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1335 | X86_COND_A, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1336 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1337 | def CMOVA32rr : I<0x47, MRMSrcReg, // if >u, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1338 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1339 | "cmova{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1340 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1341 | X86_COND_A, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1342 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1343 | def CMOVL16rr : I<0x4C, MRMSrcReg, // if <s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1344 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1345 | "cmovl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1346 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1347 | X86_COND_L, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1348 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1349 | def CMOVL32rr : I<0x4C, MRMSrcReg, // if <s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1350 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1351 | "cmovl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1352 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1353 | X86_COND_L, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1354 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1355 | def CMOVGE16rr: I<0x4D, MRMSrcReg, // if >=s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1356 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1357 | "cmovge{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1358 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1359 | X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1360 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1361 | def CMOVGE32rr: I<0x4D, MRMSrcReg, // if >=s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1362 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1363 | "cmovge{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1364 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1365 | X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1366 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1367 | def CMOVLE16rr: I<0x4E, MRMSrcReg, // if <=s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1368 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1369 | "cmovle{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1370 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1371 | X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1372 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1373 | def CMOVLE32rr: I<0x4E, MRMSrcReg, // if <=s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1374 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1375 | "cmovle{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1376 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1377 | X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1378 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1379 | def CMOVG16rr : I<0x4F, MRMSrcReg, // if >s, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1380 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1381 | "cmovg{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1382 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1383 | X86_COND_G, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1384 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1385 | def CMOVG32rr : I<0x4F, MRMSrcReg, // if >s, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1386 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1387 | "cmovg{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1388 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1389 | X86_COND_G, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1390 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1391 | def CMOVS16rr : I<0x48, MRMSrcReg, // if signed, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1392 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1393 | "cmovs{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1394 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1395 | X86_COND_S, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1396 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1397 | def CMOVS32rr : I<0x48, MRMSrcReg, // if signed, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1398 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1399 | "cmovs{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1400 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1401 | X86_COND_S, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1402 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1403 | def CMOVNS16rr: I<0x49, MRMSrcReg, // if !signed, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1404 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1405 | "cmovns{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1406 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1407 | X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1408 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1409 | def CMOVNS32rr: I<0x49, MRMSrcReg, // if !signed, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1410 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1411 | "cmovns{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1412 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1413 | X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1414 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1415 | def CMOVP16rr : I<0x4A, MRMSrcReg, // if parity, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1416 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1417 | "cmovp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1418 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1419 | X86_COND_P, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1420 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1421 | def CMOVP32rr : I<0x4A, MRMSrcReg, // if parity, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1422 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1423 | "cmovp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1424 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1425 | X86_COND_P, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1426 | TB; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1427 | def CMOVNP16rr : I<0x4B, MRMSrcReg, // if !parity, GR16 = GR16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1428 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1429 | "cmovnp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1430 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1431 | X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1432 | TB, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1433 | def CMOVNP32rr : I<0x4B, MRMSrcReg, // if !parity, GR32 = GR32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1434 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1435 | "cmovnp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 1436 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1437 | X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 71fb9ad | 2006-01-26 00:29:36 +0000 | [diff] [blame] | 1438 | TB; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1439 | def CMOVO16rr : I<0x40, MRMSrcReg, // if overflow, GR16 = GR16 |
| 1440 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1441 | "cmovo{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1442 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
| 1443 | X86_COND_O, EFLAGS))]>, |
| 1444 | TB, OpSize; |
| 1445 | def CMOVO32rr : I<0x40, MRMSrcReg, // if overflow, GR32 = GR32 |
| 1446 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1447 | "cmovo{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1448 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
| 1449 | X86_COND_O, EFLAGS))]>, |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1450 | TB; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1451 | def CMOVNO16rr : I<0x41, MRMSrcReg, // if !overflow, GR16 = GR16 |
| 1452 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1453 | "cmovno{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1454 | [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, |
| 1455 | X86_COND_NO, EFLAGS))]>, |
| 1456 | TB, OpSize; |
| 1457 | def CMOVNO32rr : I<0x41, MRMSrcReg, // if !overflow, GR32 = GR32 |
| 1458 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1459 | "cmovno{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1460 | [(set GR32:$dst, (X86cmov GR32:$src1, GR32:$src2, |
| 1461 | X86_COND_NO, EFLAGS))]>, |
| 1462 | TB; |
| 1463 | } // isCommutable = 1 |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1464 | |
| 1465 | def CMOVB16rm : I<0x42, MRMSrcMem, // if <u, GR16 = [mem16] |
| 1466 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1467 | "cmovb{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1468 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1469 | X86_COND_B, EFLAGS))]>, |
| 1470 | TB, OpSize; |
| 1471 | def CMOVB32rm : I<0x42, MRMSrcMem, // if <u, GR32 = [mem32] |
| 1472 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1473 | "cmovb{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1474 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1475 | X86_COND_B, EFLAGS))]>, |
| 1476 | TB; |
| 1477 | def CMOVAE16rm: I<0x43, MRMSrcMem, // if >=u, GR16 = [mem16] |
| 1478 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1479 | "cmovae{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1480 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1481 | X86_COND_AE, EFLAGS))]>, |
| 1482 | TB, OpSize; |
| 1483 | def CMOVAE32rm: I<0x43, MRMSrcMem, // if >=u, GR32 = [mem32] |
| 1484 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1485 | "cmovae{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1486 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1487 | X86_COND_AE, EFLAGS))]>, |
| 1488 | TB; |
| 1489 | def CMOVE16rm : I<0x44, MRMSrcMem, // if ==, GR16 = [mem16] |
| 1490 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1491 | "cmove{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1492 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1493 | X86_COND_E, EFLAGS))]>, |
| 1494 | TB, OpSize; |
| 1495 | def CMOVE32rm : I<0x44, MRMSrcMem, // if ==, GR32 = [mem32] |
| 1496 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1497 | "cmove{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1498 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1499 | X86_COND_E, EFLAGS))]>, |
| 1500 | TB; |
| 1501 | def CMOVNE16rm: I<0x45, MRMSrcMem, // if !=, GR16 = [mem16] |
| 1502 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1503 | "cmovne{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1504 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1505 | X86_COND_NE, EFLAGS))]>, |
| 1506 | TB, OpSize; |
| 1507 | def CMOVNE32rm: I<0x45, MRMSrcMem, // if !=, GR32 = [mem32] |
| 1508 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1509 | "cmovne{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1510 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1511 | X86_COND_NE, EFLAGS))]>, |
| 1512 | TB; |
| 1513 | def CMOVBE16rm: I<0x46, MRMSrcMem, // if <=u, GR16 = [mem16] |
| 1514 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1515 | "cmovbe{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1516 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1517 | X86_COND_BE, EFLAGS))]>, |
| 1518 | TB, OpSize; |
| 1519 | def CMOVBE32rm: I<0x46, MRMSrcMem, // if <=u, GR32 = [mem32] |
| 1520 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1521 | "cmovbe{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1522 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1523 | X86_COND_BE, EFLAGS))]>, |
| 1524 | TB; |
| 1525 | def CMOVA16rm : I<0x47, MRMSrcMem, // if >u, GR16 = [mem16] |
| 1526 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1527 | "cmova{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1528 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1529 | X86_COND_A, EFLAGS))]>, |
| 1530 | TB, OpSize; |
| 1531 | def CMOVA32rm : I<0x47, MRMSrcMem, // if >u, GR32 = [mem32] |
| 1532 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1533 | "cmova{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1534 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1535 | X86_COND_A, EFLAGS))]>, |
| 1536 | TB; |
| 1537 | def CMOVL16rm : I<0x4C, MRMSrcMem, // if <s, GR16 = [mem16] |
| 1538 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1539 | "cmovl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1540 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1541 | X86_COND_L, EFLAGS))]>, |
| 1542 | TB, OpSize; |
| 1543 | def CMOVL32rm : I<0x4C, MRMSrcMem, // if <s, GR32 = [mem32] |
| 1544 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1545 | "cmovl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1546 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1547 | X86_COND_L, EFLAGS))]>, |
| 1548 | TB; |
| 1549 | def CMOVGE16rm: I<0x4D, MRMSrcMem, // if >=s, GR16 = [mem16] |
| 1550 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1551 | "cmovge{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1552 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1553 | X86_COND_GE, EFLAGS))]>, |
| 1554 | TB, OpSize; |
| 1555 | def CMOVGE32rm: I<0x4D, MRMSrcMem, // if >=s, GR32 = [mem32] |
| 1556 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1557 | "cmovge{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1558 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1559 | X86_COND_GE, EFLAGS))]>, |
| 1560 | TB; |
| 1561 | def CMOVLE16rm: I<0x4E, MRMSrcMem, // if <=s, GR16 = [mem16] |
| 1562 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1563 | "cmovle{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1564 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1565 | X86_COND_LE, EFLAGS))]>, |
| 1566 | TB, OpSize; |
| 1567 | def CMOVLE32rm: I<0x4E, MRMSrcMem, // if <=s, GR32 = [mem32] |
| 1568 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1569 | "cmovle{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1570 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1571 | X86_COND_LE, EFLAGS))]>, |
| 1572 | TB; |
| 1573 | def CMOVG16rm : I<0x4F, MRMSrcMem, // if >s, GR16 = [mem16] |
| 1574 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1575 | "cmovg{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1576 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1577 | X86_COND_G, EFLAGS))]>, |
| 1578 | TB, OpSize; |
| 1579 | def CMOVG32rm : I<0x4F, MRMSrcMem, // if >s, GR32 = [mem32] |
| 1580 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1581 | "cmovg{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1582 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1583 | X86_COND_G, EFLAGS))]>, |
| 1584 | TB; |
| 1585 | def CMOVS16rm : I<0x48, MRMSrcMem, // if signed, GR16 = [mem16] |
| 1586 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1587 | "cmovs{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1588 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1589 | X86_COND_S, EFLAGS))]>, |
| 1590 | TB, OpSize; |
| 1591 | def CMOVS32rm : I<0x48, MRMSrcMem, // if signed, GR32 = [mem32] |
| 1592 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1593 | "cmovs{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1594 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1595 | X86_COND_S, EFLAGS))]>, |
| 1596 | TB; |
| 1597 | def CMOVNS16rm: I<0x49, MRMSrcMem, // if !signed, GR16 = [mem16] |
| 1598 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1599 | "cmovns{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1600 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1601 | X86_COND_NS, EFLAGS))]>, |
| 1602 | TB, OpSize; |
| 1603 | def CMOVNS32rm: I<0x49, MRMSrcMem, // if !signed, GR32 = [mem32] |
| 1604 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1605 | "cmovns{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1606 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1607 | X86_COND_NS, EFLAGS))]>, |
| 1608 | TB; |
| 1609 | def CMOVP16rm : I<0x4A, MRMSrcMem, // if parity, GR16 = [mem16] |
| 1610 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1611 | "cmovp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1612 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1613 | X86_COND_P, EFLAGS))]>, |
| 1614 | TB, OpSize; |
| 1615 | def CMOVP32rm : I<0x4A, MRMSrcMem, // if parity, GR32 = [mem32] |
| 1616 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1617 | "cmovp{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1618 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1619 | X86_COND_P, EFLAGS))]>, |
| 1620 | TB; |
| 1621 | def CMOVNP16rm : I<0x4B, MRMSrcMem, // if !parity, GR16 = [mem16] |
| 1622 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1623 | "cmovnp{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 7ad42d9 | 2007-10-05 23:13:21 +0000 | [diff] [blame] | 1624 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1625 | X86_COND_NP, EFLAGS))]>, |
| 1626 | TB, OpSize; |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1627 | def CMOVNP32rm : I<0x4B, MRMSrcMem, // if !parity, GR32 = [mem32] |
| 1628 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1629 | "cmovnp{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1630 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1631 | X86_COND_NP, EFLAGS))]>, |
| 1632 | TB; |
| 1633 | def CMOVO16rm : I<0x40, MRMSrcMem, // if overflow, GR16 = [mem16] |
| 1634 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1635 | "cmovo{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1636 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1637 | X86_COND_O, EFLAGS))]>, |
| 1638 | TB, OpSize; |
| 1639 | def CMOVO32rm : I<0x40, MRMSrcMem, // if overflow, GR32 = [mem32] |
| 1640 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1641 | "cmovo{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1642 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1643 | X86_COND_O, EFLAGS))]>, |
| 1644 | TB; |
| 1645 | def CMOVNO16rm : I<0x41, MRMSrcMem, // if !overflow, GR16 = [mem16] |
| 1646 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1647 | "cmovno{w}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1648 | [(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2), |
| 1649 | X86_COND_NO, EFLAGS))]>, |
| 1650 | TB, OpSize; |
| 1651 | def CMOVNO32rm : I<0x41, MRMSrcMem, // if !overflow, GR32 = [mem32] |
| 1652 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1653 | "cmovno{l}\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | 305fceb | 2009-01-07 00:35:10 +0000 | [diff] [blame] | 1654 | [(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2), |
| 1655 | X86_COND_NO, EFLAGS))]>, |
| 1656 | TB; |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1657 | } // Predicates = [HasCMov] |
| 1658 | |
| 1659 | // X86 doesn't have 8-bit conditional moves. Use a customInserter to |
| 1660 | // emit control flow. An alternative to this is to mark i8 SELECT as Promote, |
| 1661 | // however that requires promoting the operands, and can induce additional |
| 1662 | // i8 register pressure. Note that CMOV_GR8 is conservatively considered to |
| 1663 | // clobber EFLAGS, because if one of the operands is zero, the expansion |
| 1664 | // could involve an xor. |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1665 | let usesCustomInserter = 1, Constraints = "", Defs = [EFLAGS] in { |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1666 | def CMOV_GR8 : I<0, Pseudo, |
| 1667 | (outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cond), |
| 1668 | "#CMOV_GR8 PSEUDO!", |
| 1669 | [(set GR8:$dst, (X86cmov GR8:$src1, GR8:$src2, |
| 1670 | imm:$cond, EFLAGS))]>; |
| 1671 | |
| 1672 | let Predicates = [NoCMov] in { |
| 1673 | def CMOV_GR32 : I<0, Pseudo, |
| 1674 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$cond), |
| 1675 | "#CMOV_GR32* PSEUDO!", |
| 1676 | [(set GR32:$dst, |
| 1677 | (X86cmov GR32:$src1, GR32:$src2, imm:$cond, EFLAGS))]>; |
| 1678 | def CMOV_GR16 : I<0, Pseudo, |
| 1679 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$cond), |
| 1680 | "#CMOV_GR16* PSEUDO!", |
| 1681 | [(set GR16:$dst, |
| 1682 | (X86cmov GR16:$src1, GR16:$src2, imm:$cond, EFLAGS))]>; |
| 1683 | def CMOV_RFP32 : I<0, Pseudo, |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1684 | (outs RFP32:$dst), |
| 1685 | (ins RFP32:$src1, RFP32:$src2, i8imm:$cond), |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1686 | "#CMOV_RFP32 PSEUDO!", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1687 | [(set RFP32:$dst, |
| 1688 | (X86cmov RFP32:$src1, RFP32:$src2, imm:$cond, |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1689 | EFLAGS))]>; |
| 1690 | def CMOV_RFP64 : I<0, Pseudo, |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1691 | (outs RFP64:$dst), |
| 1692 | (ins RFP64:$src1, RFP64:$src2, i8imm:$cond), |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1693 | "#CMOV_RFP64 PSEUDO!", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1694 | [(set RFP64:$dst, |
| 1695 | (X86cmov RFP64:$src1, RFP64:$src2, imm:$cond, |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1696 | EFLAGS))]>; |
| 1697 | def CMOV_RFP80 : I<0, Pseudo, |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1698 | (outs RFP80:$dst), |
| 1699 | (ins RFP80:$src1, RFP80:$src2, i8imm:$cond), |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1700 | "#CMOV_RFP80 PSEUDO!", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1701 | [(set RFP80:$dst, |
| 1702 | (X86cmov RFP80:$src1, RFP80:$src2, imm:$cond, |
Chris Lattner | 314a113 | 2010-03-14 18:31:44 +0000 | [diff] [blame] | 1703 | EFLAGS))]>; |
| 1704 | } // Predicates = [NoCMov] |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1705 | } // UsesCustomInserter = 1, Constraints = "", Defs = [EFLAGS] |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1706 | } // Uses = [EFLAGS] |
| 1707 | |
| 1708 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1709 | // unary instructions |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1710 | let CodeSize = 2 in { |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1711 | let Defs = [EFLAGS] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1712 | def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src1), |
| 1713 | "neg{b}\t$dst", |
| 1714 | [(set GR8:$dst, (ineg GR8:$src1)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1715 | (implicit EFLAGS)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1716 | def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src1), |
| 1717 | "neg{w}\t$dst", |
| 1718 | [(set GR16:$dst, (ineg GR16:$src1)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1719 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1720 | def NEG32r : I<0xF7, MRM3r, (outs GR32:$dst), (ins GR32:$src1), |
| 1721 | "neg{l}\t$dst", |
| 1722 | [(set GR32:$dst, (ineg GR32:$src1)), |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1723 | (implicit EFLAGS)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1724 | |
| 1725 | let Constraints = "" in { |
| 1726 | def NEG8m : I<0xF6, MRM3m, (outs), (ins i8mem :$dst), |
| 1727 | "neg{b}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1728 | [(store (ineg (loadi8 addr:$dst)), addr:$dst), |
| 1729 | (implicit EFLAGS)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1730 | def NEG16m : I<0xF7, MRM3m, (outs), (ins i16mem:$dst), |
| 1731 | "neg{w}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1732 | [(store (ineg (loadi16 addr:$dst)), addr:$dst), |
| 1733 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1734 | def NEG32m : I<0xF7, MRM3m, (outs), (ins i32mem:$dst), |
| 1735 | "neg{l}\t$dst", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1736 | [(store (ineg (loadi32 addr:$dst)), addr:$dst), |
| 1737 | (implicit EFLAGS)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1738 | } // Constraints = "" |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1739 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1740 | |
Evan Cheng | aaf414c | 2009-01-21 02:09:05 +0000 | [diff] [blame] | 1741 | // Match xor -1 to not. Favors these over a move imm + xor to save code size. |
| 1742 | let AddedComplexity = 15 in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1743 | def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src1), |
| 1744 | "not{b}\t$dst", |
| 1745 | [(set GR8:$dst, (not GR8:$src1))]>; |
| 1746 | def NOT16r : I<0xF7, MRM2r, (outs GR16:$dst), (ins GR16:$src1), |
| 1747 | "not{w}\t$dst", |
| 1748 | [(set GR16:$dst, (not GR16:$src1))]>, OpSize; |
| 1749 | def NOT32r : I<0xF7, MRM2r, (outs GR32:$dst), (ins GR32:$src1), |
| 1750 | "not{l}\t$dst", |
| 1751 | [(set GR32:$dst, (not GR32:$src1))]>; |
Evan Cheng | aaf414c | 2009-01-21 02:09:05 +0000 | [diff] [blame] | 1752 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1753 | let Constraints = "" in { |
| 1754 | def NOT8m : I<0xF6, MRM2m, (outs), (ins i8mem :$dst), |
| 1755 | "not{b}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1756 | [(store (not (loadi8 addr:$dst)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1757 | def NOT16m : I<0xF7, MRM2m, (outs), (ins i16mem:$dst), |
| 1758 | "not{w}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1759 | [(store (not (loadi16 addr:$dst)), addr:$dst)]>, OpSize; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1760 | def NOT32m : I<0xF7, MRM2m, (outs), (ins i32mem:$dst), |
| 1761 | "not{l}\t$dst", |
Evan Cheng | 605c415 | 2005-12-13 01:57:51 +0000 | [diff] [blame] | 1762 | [(store (not (loadi32 addr:$dst)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1763 | } // Constraints = "" |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1764 | } // CodeSize |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1765 | |
Evan Cheng | b51a059 | 2005-12-10 00:48:20 +0000 | [diff] [blame] | 1766 | // TODO: inc/dec is slow for P4, but fast for Pentium-M. |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1767 | let Defs = [EFLAGS] in { |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1768 | let CodeSize = 2 in |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1769 | def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1), |
| 1770 | "inc{b}\t$dst", |
| 1771 | [(set GR8:$dst, EFLAGS, (X86inc_flag GR8:$src1))]>; |
Chris Lattner | c54a2f1 | 2010-03-24 01:02:12 +0000 | [diff] [blame] | 1772 | |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1773 | let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1774 | def INC16r : I<0x40, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1775 | "inc{w}\t$dst", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1776 | [(set GR16:$dst, EFLAGS, (X86inc_flag GR16:$src1))]>, |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 1777 | OpSize, Requires<[In32BitMode]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1778 | def INC32r : I<0x40, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1779 | "inc{l}\t$dst", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1780 | [(set GR32:$dst, EFLAGS, (X86inc_flag GR32:$src1))]>, |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1781 | Requires<[In32BitMode]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1782 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1783 | let Constraints = "", CodeSize = 2 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1784 | 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] | 1785 | [(store (add (loadi8 addr:$dst), 1), addr:$dst), |
| 1786 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1787 | 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] | 1788 | [(store (add (loadi16 addr:$dst), 1), addr:$dst), |
| 1789 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1790 | OpSize, Requires<[In32BitMode]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1791 | 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] | 1792 | [(store (add (loadi32 addr:$dst), 1), addr:$dst), |
| 1793 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1794 | Requires<[In32BitMode]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1795 | } // Constraints = "", CodeSize = 2 |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1796 | |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1797 | let CodeSize = 2 in |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1798 | def DEC8r : I<0xFE, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1), |
| 1799 | "dec{b}\t$dst", |
| 1800 | [(set GR8:$dst, EFLAGS, (X86dec_flag GR8:$src1))]>; |
Evan Cheng | 1693e48 | 2006-07-19 00:27:29 +0000 | [diff] [blame] | 1801 | let isConvertibleToThreeAddress = 1, CodeSize = 1 in { // Can xform into LEA. |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1802 | def DEC16r : I<0x48, AddRegFrm, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1803 | "dec{w}\t$dst", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1804 | [(set GR16:$dst, EFLAGS, (X86dec_flag GR16:$src1))]>, |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 1805 | OpSize, Requires<[In32BitMode]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1806 | def DEC32r : I<0x48, AddRegFrm, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1807 | "dec{l}\t$dst", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1808 | [(set GR32:$dst, EFLAGS, (X86dec_flag GR32:$src1))]>, |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1809 | Requires<[In32BitMode]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1810 | } // CodeSize = 2 |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1811 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1812 | let Constraints = "", CodeSize = 2 in { |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1813 | 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] | 1814 | [(store (add (loadi8 addr:$dst), -1), addr:$dst), |
| 1815 | (implicit EFLAGS)]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1816 | 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] | 1817 | [(store (add (loadi16 addr:$dst), -1), addr:$dst), |
| 1818 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1819 | OpSize, Requires<[In32BitMode]>; |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1820 | 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] | 1821 | [(store (add (loadi32 addr:$dst), -1), addr:$dst), |
| 1822 | (implicit EFLAGS)]>, |
Evan Cheng | 66f7163 | 2007-10-19 21:23:22 +0000 | [diff] [blame] | 1823 | Requires<[In32BitMode]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1824 | } // Constraints = "", CodeSize = 2 |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1825 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1826 | |
| 1827 | // Logical operators... |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 1828 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1829 | let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1830 | def AND8rr : I<0x20, MRMDestReg, |
| 1831 | (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), |
| 1832 | "and{b}\t{$src2, $dst|$dst, $src2}", |
| 1833 | [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1, GR8:$src2))]>; |
| 1834 | def AND16rr : I<0x21, MRMDestReg, |
| 1835 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
| 1836 | "and{w}\t{$src2, $dst|$dst, $src2}", |
| 1837 | [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1, |
| 1838 | GR16:$src2))]>, OpSize; |
| 1839 | def AND32rr : I<0x21, MRMDestReg, |
| 1840 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
| 1841 | "and{l}\t{$src2, $dst|$dst, $src2}", |
| 1842 | [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1, |
| 1843 | GR32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1844 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 1845 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1846 | // AND instructions with the destination register in REG and the source register |
| 1847 | // in R/M. Included for the disassembler. |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1848 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1849 | def AND8rr_REV : I<0x22, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 1850 | "and{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 1851 | def AND16rr_REV : I<0x23, MRMSrcReg, (outs GR16:$dst), |
| 1852 | (ins GR16:$src1, GR16:$src2), |
| 1853 | "and{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 1854 | def AND32rr_REV : I<0x23, MRMSrcReg, (outs GR32:$dst), |
| 1855 | (ins GR32:$src1, GR32:$src2), |
| 1856 | "and{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1857 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1858 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1859 | def AND8rm : I<0x22, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1860 | (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1861 | "and{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1862 | [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1, |
| 1863 | (loadi8 addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1864 | def AND16rm : I<0x23, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1865 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1866 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1867 | [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1, |
| 1868 | (loadi16 addr:$src2)))]>, |
| 1869 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1870 | def AND32rm : I<0x23, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1871 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1872 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1873 | [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1, |
| 1874 | (loadi32 addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1875 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1876 | def AND8ri : Ii8<0x80, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1877 | (outs GR8 :$dst), (ins GR8 :$src1, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1878 | "and{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1879 | [(set GR8:$dst, EFLAGS, (X86and_flag GR8:$src1, |
| 1880 | imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1881 | def AND16ri : Ii16<0x81, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1882 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1883 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1884 | [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1, |
| 1885 | imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1886 | def AND32ri : Ii32<0x81, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1887 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1888 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1889 | [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1, |
| 1890 | imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1891 | def AND16ri8 : Ii8<0x83, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1892 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1893 | "and{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1894 | [(set GR16:$dst, EFLAGS, (X86and_flag GR16:$src1, |
| 1895 | i16immSExt8:$src2))]>, |
Evan Cheng | 9b6b642 | 2005-12-13 00:14:11 +0000 | [diff] [blame] | 1896 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1897 | def AND32ri8 : Ii8<0x83, MRM4r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1898 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1899 | "and{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1900 | [(set GR32:$dst, EFLAGS, (X86and_flag GR32:$src1, |
| 1901 | i32immSExt8:$src2))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1902 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1903 | let Constraints = "" in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1904 | def AND8mr : I<0x20, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1905 | (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1906 | "and{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1907 | [(store (and (load addr:$dst), GR8:$src), addr:$dst), |
| 1908 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1909 | def AND16mr : I<0x21, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1910 | (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1911 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1912 | [(store (and (load addr:$dst), GR16:$src), addr:$dst), |
| 1913 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1914 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1915 | def AND32mr : I<0x21, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1916 | (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1917 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1918 | [(store (and (load addr:$dst), GR32:$src), addr:$dst), |
| 1919 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1920 | def AND8mi : Ii8<0x80, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1921 | (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1922 | "and{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1923 | [(store (and (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 1924 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1925 | def AND16mi : Ii16<0x81, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1926 | (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1927 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1928 | [(store (and (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 1929 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1930 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1931 | def AND32mi : Ii32<0x81, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1932 | (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1933 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1934 | [(store (and (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 1935 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1936 | def AND16mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1937 | (outs), (ins i16mem:$dst, i16i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1938 | "and{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1939 | [(store (and (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 1940 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 1941 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 1942 | def AND32mi8 : Ii8<0x83, MRM4m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1943 | (outs), (ins i32mem:$dst, i32i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1944 | "and{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 1945 | [(store (and (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 1946 | (implicit EFLAGS)]>; |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 1947 | |
| 1948 | def AND8i8 : Ii8<0x24, RawFrm, (outs), (ins i8imm:$src), |
| 1949 | "and{b}\t{$src, %al|%al, $src}", []>; |
| 1950 | def AND16i16 : Ii16<0x25, RawFrm, (outs), (ins i16imm:$src), |
| 1951 | "and{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 1952 | def AND32i32 : Ii32<0x25, RawFrm, (outs), (ins i32imm:$src), |
| 1953 | "and{l}\t{$src, %eax|%eax, $src}", []>; |
| 1954 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 1955 | } // Constraints = "" |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 1956 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 1957 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1958 | let isCommutable = 1 in { // X = OR Y, Z --> X = OR Z, Y |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1959 | def OR8rr : I<0x08, MRMDestReg, (outs GR8 :$dst), |
| 1960 | (ins GR8 :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1961 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1962 | [(set GR8:$dst, EFLAGS, (X86or_flag GR8:$src1, GR8:$src2))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1963 | def OR16rr : I<0x09, MRMDestReg, (outs GR16:$dst), |
| 1964 | (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1965 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1966 | [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1,GR16:$src2))]>, |
| 1967 | OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1968 | def OR32rr : I<0x09, MRMDestReg, (outs GR32:$dst), |
| 1969 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1970 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1971 | [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1,GR32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 1972 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1973 | |
| 1974 | // OR instructions with the destination register in REG and the source register |
| 1975 | // in R/M. Included for the disassembler. |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1976 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1977 | def OR8rr_REV : I<0x0A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 1978 | "or{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 1979 | def OR16rr_REV : I<0x0B, MRMSrcReg, (outs GR16:$dst), |
| 1980 | (ins GR16:$src1, GR16:$src2), |
| 1981 | "or{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 1982 | def OR32rr_REV : I<0x0B, MRMSrcReg, (outs GR32:$dst), |
| 1983 | (ins GR32:$src1, GR32:$src2), |
| 1984 | "or{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 1985 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1986 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1987 | def OR8rm : I<0x0A, MRMSrcMem, (outs GR8 :$dst), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1988 | (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1989 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1990 | [(set GR8:$dst, EFLAGS, (X86or_flag GR8:$src1, |
| 1991 | (load addr:$src2)))]>; |
| 1992 | def OR16rm : I<0x0B, MRMSrcMem, (outs GR16:$dst), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1993 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1994 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 1995 | [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1, |
| 1996 | (load addr:$src2)))]>, |
| 1997 | OpSize; |
| 1998 | def OR32rm : I<0x0B, MRMSrcMem, (outs GR32:$dst), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1999 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2000 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2001 | [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1, |
| 2002 | (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2003 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2004 | def OR8ri : Ii8 <0x80, MRM1r, (outs GR8 :$dst), |
| 2005 | (ins GR8 :$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2006 | "or{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2007 | [(set GR8:$dst,EFLAGS, (X86or_flag GR8:$src1, imm:$src2))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2008 | def OR16ri : Ii16<0x81, MRM1r, (outs GR16:$dst), |
| 2009 | (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2010 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2011 | [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1, |
| 2012 | imm:$src2))]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2013 | def OR32ri : Ii32<0x81, MRM1r, (outs GR32:$dst), |
| 2014 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2015 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2016 | [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1, |
| 2017 | imm:$src2))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2018 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2019 | def OR16ri8 : Ii8<0x83, MRM1r, (outs GR16:$dst), |
| 2020 | (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2021 | "or{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2022 | [(set GR16:$dst, EFLAGS, (X86or_flag GR16:$src1, |
| 2023 | i16immSExt8:$src2))]>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2024 | def OR32ri8 : Ii8<0x83, MRM1r, (outs GR32:$dst), |
| 2025 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2026 | "or{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2027 | [(set GR32:$dst, EFLAGS, (X86or_flag GR32:$src1, |
| 2028 | i32immSExt8:$src2))]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2029 | let Constraints = "" in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2030 | def OR8mr : I<0x08, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2031 | "or{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2032 | [(store (or (load addr:$dst), GR8:$src), addr:$dst), |
| 2033 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2034 | def OR16mr : I<0x09, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2035 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2036 | [(store (or (load addr:$dst), GR16:$src), addr:$dst), |
| 2037 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2038 | def OR32mr : I<0x09, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2039 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2040 | [(store (or (load addr:$dst), GR32:$src), addr:$dst), |
| 2041 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2042 | def OR8mi : Ii8<0x80, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2043 | "or{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2044 | [(store (or (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 2045 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2046 | def OR16mi : Ii16<0x81, MRM1m, (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2047 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2048 | [(store (or (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 2049 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2050 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2051 | def OR32mi : Ii32<0x81, MRM1m, (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2052 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2053 | [(store (or (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 2054 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2055 | def OR16mi8 : Ii8<0x83, MRM1m, (outs), (ins i16mem:$dst, i16i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2056 | "or{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2057 | [(store (or (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 2058 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2059 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2060 | def OR32mi8 : Ii8<0x83, MRM1m, (outs), (ins i32mem:$dst, i32i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2061 | "or{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2062 | [(store (or (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 2063 | (implicit EFLAGS)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 2064 | |
| 2065 | def OR8i8 : Ii8 <0x0C, RawFrm, (outs), (ins i8imm:$src), |
| 2066 | "or{b}\t{$src, %al|%al, $src}", []>; |
| 2067 | def OR16i16 : Ii16 <0x0D, RawFrm, (outs), (ins i16imm:$src), |
| 2068 | "or{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2069 | def OR32i32 : Ii32 <0x0D, RawFrm, (outs), (ins i32imm:$src), |
| 2070 | "or{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2071 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2072 | |
| 2073 | |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 2074 | let isCommutable = 1 in { // X = XOR Y, Z --> X = XOR Z, Y |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2075 | def XOR8rr : I<0x30, MRMDestReg, |
| 2076 | (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), |
| 2077 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2078 | [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1, |
| 2079 | GR8:$src2))]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2080 | def XOR16rr : I<0x31, MRMDestReg, |
| 2081 | (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), |
| 2082 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2083 | [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1, |
| 2084 | GR16:$src2))]>, OpSize; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2085 | def XOR32rr : I<0x31, MRMDestReg, |
| 2086 | (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), |
| 2087 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2088 | [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1, |
| 2089 | GR32:$src2))]>; |
Evan Cheng | 359e937 | 2008-06-18 08:13:07 +0000 | [diff] [blame] | 2090 | } // isCommutable = 1 |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2091 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2092 | // XOR instructions with the destination register in REG and the source register |
| 2093 | // in R/M. Included for the disassembler. |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 2094 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2095 | def XOR8rr_REV : I<0x32, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2096 | "xor{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2097 | def XOR16rr_REV : I<0x33, MRMSrcReg, (outs GR16:$dst), |
| 2098 | (ins GR16:$src1, GR16:$src2), |
| 2099 | "xor{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2100 | def XOR32rr_REV : I<0x33, MRMSrcReg, (outs GR32:$dst), |
| 2101 | (ins GR32:$src1, GR32:$src2), |
| 2102 | "xor{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 2103 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2104 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2105 | def XOR8rm : I<0x32, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2106 | (outs GR8 :$dst), (ins GR8:$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2107 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2108 | [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1, |
| 2109 | (load addr:$src2)))]>; |
| 2110 | def XOR16rm : I<0x33, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2111 | (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2112 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2113 | [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1, |
| 2114 | (load addr:$src2)))]>, |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2115 | OpSize; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2116 | def XOR32rm : I<0x33, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2117 | (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2118 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2119 | [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1, |
| 2120 | (load addr:$src2)))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2121 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2122 | def XOR8ri : Ii8<0x80, MRM6r, |
| 2123 | (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 2124 | "xor{b}\t{$src2, $dst|$dst, $src2}", |
| 2125 | [(set GR8:$dst, EFLAGS, (X86xor_flag GR8:$src1, imm:$src2))]>; |
| 2126 | def XOR16ri : Ii16<0x81, MRM6r, |
| 2127 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
| 2128 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
| 2129 | [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1, |
| 2130 | imm:$src2))]>, OpSize; |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2131 | def XOR32ri : Ii32<0x81, MRM6r, |
| 2132 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
| 2133 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2134 | [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1, |
| 2135 | imm:$src2))]>; |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2136 | def XOR16ri8 : Ii8<0x83, MRM6r, |
| 2137 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
| 2138 | "xor{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2139 | [(set GR16:$dst, EFLAGS, (X86xor_flag GR16:$src1, |
| 2140 | i16immSExt8:$src2))]>, |
Bill Wendling | 75cf88f | 2008-05-29 03:46:36 +0000 | [diff] [blame] | 2141 | OpSize; |
| 2142 | def XOR32ri8 : Ii8<0x83, MRM6r, |
| 2143 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
| 2144 | "xor{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2145 | [(set GR32:$dst, EFLAGS, (X86xor_flag GR32:$src1, |
| 2146 | i32immSExt8:$src2))]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2147 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2148 | let Constraints = "" in { |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2149 | def XOR8mr : I<0x30, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2150 | (outs), (ins i8mem :$dst, GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2151 | "xor{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2152 | [(store (xor (load addr:$dst), GR8:$src), addr:$dst), |
| 2153 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2154 | def XOR16mr : I<0x31, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2155 | (outs), (ins i16mem:$dst, GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2156 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2157 | [(store (xor (load addr:$dst), GR16:$src), addr:$dst), |
| 2158 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2159 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2160 | def XOR32mr : I<0x31, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2161 | (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2162 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2163 | [(store (xor (load addr:$dst), GR32:$src), addr:$dst), |
| 2164 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2165 | def XOR8mi : Ii8<0x80, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2166 | (outs), (ins i8mem :$dst, i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2167 | "xor{b}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2168 | [(store (xor (loadi8 addr:$dst), imm:$src), addr:$dst), |
| 2169 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2170 | def XOR16mi : Ii16<0x81, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2171 | (outs), (ins i16mem:$dst, i16imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2172 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2173 | [(store (xor (loadi16 addr:$dst), imm:$src), addr:$dst), |
| 2174 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2175 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2176 | def XOR32mi : Ii32<0x81, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2177 | (outs), (ins i32mem:$dst, i32imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2178 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2179 | [(store (xor (loadi32 addr:$dst), imm:$src), addr:$dst), |
| 2180 | (implicit EFLAGS)]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2181 | def XOR16mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2182 | (outs), (ins i16mem:$dst, i16i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2183 | "xor{w}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2184 | [(store (xor (load addr:$dst), i16immSExt8:$src), addr:$dst), |
| 2185 | (implicit EFLAGS)]>, |
Evan Cheng | 0ef3a77 | 2005-12-13 01:41:36 +0000 | [diff] [blame] | 2186 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2187 | def XOR32mi8 : Ii8<0x83, MRM6m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2188 | (outs), (ins i32mem:$dst, i32i8imm :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2189 | "xor{l}\t{$src, $dst|$dst, $src}", |
Dan Gohman | 09a2609e | 2009-03-03 19:53:46 +0000 | [diff] [blame] | 2190 | [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst), |
| 2191 | (implicit EFLAGS)]>; |
Sean Callanan | 7893ec6 | 2009-09-10 19:52:26 +0000 | [diff] [blame] | 2192 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 2193 | def XOR8i8 : Ii8 <0x34, RawFrm, (outs), (ins i8imm:$src), |
| 2194 | "xor{b}\t{$src, %al|%al, $src}", []>; |
| 2195 | def XOR16i16 : Ii16<0x35, RawFrm, (outs), (ins i16imm:$src), |
| 2196 | "xor{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2197 | def XOR32i32 : Ii32<0x35, RawFrm, (outs), (ins i32imm:$src), |
| 2198 | "xor{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2199 | } // Constraints = "" |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2200 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2201 | |
| 2202 | // Shift instructions |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2203 | let Defs = [EFLAGS] in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2204 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2205 | def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2206 | "shl{b}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2207 | [(set GR8:$dst, (shl GR8:$src1, CL))]>; |
| 2208 | def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2209 | "shl{w}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2210 | [(set GR16:$dst, (shl GR16:$src1, CL))]>, OpSize; |
| 2211 | def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2212 | "shl{l}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2213 | [(set GR32:$dst, (shl GR32:$src1, CL))]>; |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2214 | } // Uses = [CL] |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2215 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2216 | 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] | 2217 | "shl{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2218 | [(set GR8:$dst, (shl GR8:$src1, (i8 imm:$src2)))]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2219 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2220 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2221 | 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] | 2222 | "shl{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2223 | [(set GR16:$dst, (shl GR16:$src1, (i8 imm:$src2)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2224 | 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] | 2225 | "shl{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2226 | [(set GR32:$dst, (shl GR32:$src1, (i8 imm:$src2)))]>; |
Sean Callanan | 13cf8e9 | 2009-09-16 02:28:43 +0000 | [diff] [blame] | 2227 | |
| 2228 | // NOTE: We don't include patterns for shifts of a register by one, because |
| 2229 | // 'add reg,reg' is cheaper. |
| 2230 | |
| 2231 | def SHL8r1 : I<0xD0, MRM4r, (outs GR8:$dst), (ins GR8:$src1), |
| 2232 | "shl{b}\t$dst", []>; |
| 2233 | def SHL16r1 : I<0xD1, MRM4r, (outs GR16:$dst), (ins GR16:$src1), |
| 2234 | "shl{w}\t$dst", []>, OpSize; |
| 2235 | def SHL32r1 : I<0xD1, MRM4r, (outs GR32:$dst), (ins GR32:$src1), |
| 2236 | "shl{l}\t$dst", []>; |
| 2237 | |
Bill Wendling | bd0879d | 2008-05-29 01:02:09 +0000 | [diff] [blame] | 2238 | } // isConvertibleToThreeAddress = 1 |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2239 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2240 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2241 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2242 | def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2243 | "shl{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2244 | [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2245 | def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2246 | "shl{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2247 | [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2248 | def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2249 | "shl{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2250 | [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2251 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2252 | def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2253 | "shl{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2254 | [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2255 | def SHL16mi : Ii8<0xC1, MRM4m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2256 | "shl{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2257 | [(store (shl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2258 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2259 | def SHL32mi : Ii8<0xC1, MRM4m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2260 | "shl{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 763b029 | 2005-12-13 02:34:51 +0000 | [diff] [blame] | 2261 | [(store (shl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2262 | |
| 2263 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2264 | def SHL8m1 : I<0xD0, MRM4m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2265 | "shl{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2266 | [(store (shl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2267 | def SHL16m1 : I<0xD1, MRM4m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2268 | "shl{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2269 | [(store (shl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2270 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2271 | def SHL32m1 : I<0xD1, MRM4m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2272 | "shl{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2273 | [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2274 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2275 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2276 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2277 | def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2278 | "shr{b}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2279 | [(set GR8:$dst, (srl GR8:$src1, CL))]>; |
| 2280 | def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2281 | "shr{w}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2282 | [(set GR16:$dst, (srl GR16:$src1, CL))]>, OpSize; |
| 2283 | def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2284 | "shr{l}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2285 | [(set GR32:$dst, (srl GR32:$src1, CL))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2286 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2287 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2288 | 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] | 2289 | "shr{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2290 | [(set GR8:$dst, (srl GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2291 | 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] | 2292 | "shr{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2293 | [(set GR16:$dst, (srl GR16:$src1, (i8 imm:$src2)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2294 | 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] | 2295 | "shr{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2296 | [(set GR32:$dst, (srl GR32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | f29ed09 | 2004-08-11 05:07:25 +0000 | [diff] [blame] | 2297 | |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2298 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2299 | def SHR8r1 : I<0xD0, MRM5r, (outs GR8:$dst), (ins GR8:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2300 | "shr{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2301 | [(set GR8:$dst, (srl GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2302 | def SHR16r1 : I<0xD1, MRM5r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2303 | "shr{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2304 | [(set GR16:$dst, (srl GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2305 | def SHR32r1 : I<0xD1, MRM5r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2306 | "shr{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2307 | [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>; |
| 2308 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2309 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2310 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2311 | def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2312 | "shr{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2313 | [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2314 | def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2315 | "shr{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2316 | [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2317 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2318 | def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2319 | "shr{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2320 | [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2321 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2322 | def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2323 | "shr{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2324 | [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2325 | def SHR16mi : Ii8<0xC1, MRM5m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2326 | "shr{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2327 | [(store (srl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2328 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2329 | def SHR32mi : Ii8<0xC1, MRM5m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2330 | "shr{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2331 | [(store (srl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2332 | |
| 2333 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2334 | def SHR8m1 : I<0xD0, MRM5m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2335 | "shr{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2336 | [(store (srl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2337 | def SHR16m1 : I<0xD1, MRM5m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2338 | "shr{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2339 | [(store (srl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>,OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2340 | def SHR32m1 : I<0xD1, MRM5m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2341 | "shr{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2342 | [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2343 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2344 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2345 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2346 | def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2347 | "sar{b}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2348 | [(set GR8:$dst, (sra GR8:$src1, CL))]>; |
| 2349 | def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2350 | "sar{w}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2351 | [(set GR16:$dst, (sra GR16:$src1, CL))]>, OpSize; |
| 2352 | def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2353 | "sar{l}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2354 | [(set GR32:$dst, (sra GR32:$src1, CL))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2355 | } |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2356 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2357 | 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] | 2358 | "sar{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2359 | [(set GR8:$dst, (sra GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2360 | 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] | 2361 | "sar{w}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2362 | [(set GR16:$dst, (sra GR16:$src1, (i8 imm:$src2)))]>, |
Chris Lattner | 3d36a9f | 2005-12-05 02:40:25 +0000 | [diff] [blame] | 2363 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2364 | 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] | 2365 | "sar{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2366 | [(set GR32:$dst, (sra GR32:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2367 | |
| 2368 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2369 | def SAR8r1 : I<0xD0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2370 | "sar{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2371 | [(set GR8:$dst, (sra GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2372 | def SAR16r1 : I<0xD1, MRM7r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2373 | "sar{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2374 | [(set GR16:$dst, (sra GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2375 | def SAR32r1 : I<0xD1, MRM7r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2376 | "sar{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2377 | [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>; |
| 2378 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2379 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2380 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2381 | def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2382 | "sar{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2383 | [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2384 | def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2385 | "sar{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2386 | [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2387 | def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2388 | "sar{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2389 | [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2390 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2391 | def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2392 | "sar{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2393 | [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2394 | def SAR16mi : Ii8<0xC1, MRM7m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2395 | "sar{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2396 | [(store (sra (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2397 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2398 | def SAR32mi : Ii8<0xC1, MRM7m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2399 | "sar{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 85dd889 | 2005-12-13 07:24:22 +0000 | [diff] [blame] | 2400 | [(store (sra (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2401 | |
| 2402 | // Shift by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2403 | def SAR8m1 : I<0xD0, MRM7m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2404 | "sar{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2405 | [(store (sra (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2406 | def SAR16m1 : I<0xD1, MRM7m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2407 | "sar{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2408 | [(store (sra (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2409 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2410 | def SAR32m1 : I<0xD1, MRM7m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2411 | "sar{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2412 | [(store (sra (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2413 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2414 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2415 | // Rotate instructions |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2416 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2417 | def RCL8r1 : I<0xD0, MRM2r, (outs GR8:$dst), (ins GR8:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2418 | "rcl{b}\t{1, $dst|$dst, 1}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2419 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2420 | def RCL8rCL : I<0xD2, MRM2r, (outs GR8:$dst), (ins GR8:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2421 | "rcl{b}\t{%cl, $dst|$dst, CL}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2422 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2423 | def RCL8ri : Ii8<0xC0, MRM2r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2424 | "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2425 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2426 | def RCL16r1 : I<0xD1, MRM2r, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2427 | "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2428 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2429 | def RCL16rCL : I<0xD3, MRM2r, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2430 | "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2431 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2432 | def RCL16ri : Ii8<0xC1, MRM2r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2433 | "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2434 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2435 | def RCL32r1 : I<0xD1, MRM2r, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2436 | "rcl{l}\t{1, $dst|$dst, 1}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2437 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2438 | def RCL32rCL : I<0xD3, MRM2r, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2439 | "rcl{l}\t{%cl, $dst|$dst, CL}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2440 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2441 | def RCL32ri : Ii8<0xC1, MRM2r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2442 | "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2443 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2444 | def RCR8r1 : I<0xD0, MRM3r, (outs GR8:$dst), (ins GR8:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2445 | "rcr{b}\t{1, $dst|$dst, 1}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2446 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2447 | def RCR8rCL : I<0xD2, MRM3r, (outs GR8:$dst), (ins GR8:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2448 | "rcr{b}\t{%cl, $dst|$dst, CL}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2449 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2450 | def RCR8ri : Ii8<0xC0, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2451 | "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2452 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2453 | def RCR16r1 : I<0xD1, MRM3r, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2454 | "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2455 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2456 | def RCR16rCL : I<0xD3, MRM3r, (outs GR16:$dst), (ins GR16:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2457 | "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2458 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2459 | def RCR16ri : Ii8<0xC1, MRM3r, (outs GR16:$dst), (ins GR16:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2460 | "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2461 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2462 | def RCR32r1 : I<0xD1, MRM3r, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2463 | "rcr{l}\t{1, $dst|$dst, 1}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2464 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2465 | def RCR32rCL : I<0xD3, MRM3r, (outs GR32:$dst), (ins GR32:$src1), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2466 | "rcr{l}\t{%cl, $dst|$dst, CL}", []>; |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2467 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2468 | def RCR32ri : Ii8<0xC1, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2469 | "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
Daniel Dunbar | ccfa1db | 2010-02-12 01:22:03 +0000 | [diff] [blame] | 2470 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2471 | let Constraints = "" in { |
Daniel Dunbar | ccfa1db | 2010-02-12 01:22:03 +0000 | [diff] [blame] | 2472 | def RCL8m1 : I<0xD0, MRM2m, (outs), (ins i8mem:$dst), |
| 2473 | "rcl{b}\t{1, $dst|$dst, 1}", []>; |
| 2474 | def RCL8mi : Ii8<0xC0, MRM2m, (outs), (ins i8mem:$dst, i8imm:$cnt), |
| 2475 | "rcl{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2476 | def RCL16m1 : I<0xD1, MRM2m, (outs), (ins i16mem:$dst), |
| 2477 | "rcl{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2478 | def RCL16mi : Ii8<0xC1, MRM2m, (outs), (ins i16mem:$dst, i8imm:$cnt), |
| 2479 | "rcl{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
| 2480 | def RCL32m1 : I<0xD1, MRM2m, (outs), (ins i32mem:$dst), |
| 2481 | "rcl{l}\t{1, $dst|$dst, 1}", []>; |
| 2482 | def RCL32mi : Ii8<0xC1, MRM2m, (outs), (ins i32mem:$dst, i8imm:$cnt), |
| 2483 | "rcl{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2484 | def RCR8m1 : I<0xD0, MRM3m, (outs), (ins i8mem:$dst), |
| 2485 | "rcr{b}\t{1, $dst|$dst, 1}", []>; |
| 2486 | def RCR8mi : Ii8<0xC0, MRM3m, (outs), (ins i8mem:$dst, i8imm:$cnt), |
| 2487 | "rcr{b}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2488 | def RCR16m1 : I<0xD1, MRM3m, (outs), (ins i16mem:$dst), |
| 2489 | "rcr{w}\t{1, $dst|$dst, 1}", []>, OpSize; |
| 2490 | def RCR16mi : Ii8<0xC1, MRM3m, (outs), (ins i16mem:$dst, i8imm:$cnt), |
| 2491 | "rcr{w}\t{$cnt, $dst|$dst, $cnt}", []>, OpSize; |
| 2492 | def RCR32m1 : I<0xD1, MRM3m, (outs), (ins i32mem:$dst), |
| 2493 | "rcr{l}\t{1, $dst|$dst, 1}", []>; |
| 2494 | def RCR32mi : Ii8<0xC1, MRM3m, (outs), (ins i32mem:$dst, i8imm:$cnt), |
Sean Callanan | a2dc282 | 2009-09-18 19:35:23 +0000 | [diff] [blame] | 2495 | "rcr{l}\t{$cnt, $dst|$dst, $cnt}", []>; |
| 2496 | |
Daniel Dunbar | ccfa1db | 2010-02-12 01:22:03 +0000 | [diff] [blame] | 2497 | let Uses = [CL] in { |
| 2498 | def RCL8mCL : I<0xD2, MRM2m, (outs), (ins i8mem:$dst), |
| 2499 | "rcl{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2500 | def RCL16mCL : I<0xD3, MRM2m, (outs), (ins i16mem:$dst), |
| 2501 | "rcl{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2502 | def RCL32mCL : I<0xD3, MRM2m, (outs), (ins i32mem:$dst), |
| 2503 | "rcl{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2504 | def RCR8mCL : I<0xD2, MRM3m, (outs), (ins i8mem:$dst), |
| 2505 | "rcr{b}\t{%cl, $dst|$dst, CL}", []>; |
| 2506 | def RCR16mCL : I<0xD3, MRM3m, (outs), (ins i16mem:$dst), |
| 2507 | "rcr{w}\t{%cl, $dst|$dst, CL}", []>, OpSize; |
| 2508 | def RCR32mCL : I<0xD3, MRM3m, (outs), (ins i32mem:$dst), |
| 2509 | "rcr{l}\t{%cl, $dst|$dst, CL}", []>; |
| 2510 | } |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2511 | } // Constraints = "" |
Daniel Dunbar | ccfa1db | 2010-02-12 01:22:03 +0000 | [diff] [blame] | 2512 | |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2513 | // FIXME: provide shorter instructions when imm8 == 1 |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2514 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2515 | def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2516 | "rol{b}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2517 | [(set GR8:$dst, (rotl GR8:$src1, CL))]>; |
| 2518 | def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2519 | "rol{w}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2520 | [(set GR16:$dst, (rotl GR16:$src1, CL))]>, OpSize; |
| 2521 | def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2522 | "rol{l}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2523 | [(set GR32:$dst, (rotl GR32:$src1, CL))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2524 | } |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2525 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2526 | 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] | 2527 | "rol{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2528 | [(set GR8:$dst, (rotl GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2529 | 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] | 2530 | "rol{w}\t{$src2, $dst|$dst, $src2}", |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2531 | [(set GR16:$dst, (rotl GR16:$src1, (i8 imm:$src2)))]>, |
| 2532 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2533 | 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] | 2534 | "rol{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2535 | [(set GR32:$dst, (rotl GR32:$src1, (i8 imm:$src2)))]>; |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2536 | |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2537 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2538 | def ROL8r1 : I<0xD0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2539 | "rol{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2540 | [(set GR8:$dst, (rotl GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2541 | def ROL16r1 : I<0xD1, MRM0r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2542 | "rol{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2543 | [(set GR16:$dst, (rotl GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2544 | def ROL32r1 : I<0xD1, MRM0r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2545 | "rol{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2546 | [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>; |
| 2547 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2548 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2549 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2550 | def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2551 | "rol{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2552 | [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2553 | def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2554 | "rol{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2555 | [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2556 | def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2557 | "rol{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2558 | [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2559 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2560 | def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2561 | "rol{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2562 | [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2563 | def ROL16mi : Ii8<0xC1, MRM0m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2564 | "rol{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2565 | [(store (rotl (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2566 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2567 | def ROL32mi : Ii8<0xC1, MRM0m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2568 | "rol{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2569 | [(store (rotl (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2570 | |
| 2571 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2572 | def ROL8m1 : I<0xD0, MRM0m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2573 | "rol{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2574 | [(store (rotl (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2575 | def ROL16m1 : I<0xD1, MRM0m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2576 | "rol{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2577 | [(store (rotl (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2578 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2579 | def ROL32m1 : I<0xD1, MRM0m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2580 | "rol{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2581 | [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2582 | } // Constraints = "" |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2583 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2584 | let Uses = [CL] in { |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2585 | def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2586 | "ror{b}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2587 | [(set GR8:$dst, (rotr GR8:$src1, CL))]>; |
| 2588 | def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2589 | "ror{w}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2590 | [(set GR16:$dst, (rotr GR16:$src1, CL))]>, OpSize; |
| 2591 | def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src1), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2592 | "ror{l}\t{%cl, $dst|$dst, CL}", |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2593 | [(set GR32:$dst, (rotr GR32:$src1, CL))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2594 | } |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2595 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2596 | 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] | 2597 | "ror{b}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2598 | [(set GR8:$dst, (rotr GR8:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2599 | 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] | 2600 | "ror{w}\t{$src2, $dst|$dst, $src2}", |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2601 | [(set GR16:$dst, (rotr GR16:$src1, (i8 imm:$src2)))]>, |
| 2602 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2603 | 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] | 2604 | "ror{l}\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2605 | [(set GR32:$dst, (rotr GR32:$src1, (i8 imm:$src2)))]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2606 | |
| 2607 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2608 | def ROR8r1 : I<0xD0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2609 | "ror{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2610 | [(set GR8:$dst, (rotr GR8:$src1, (i8 1)))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2611 | def ROR16r1 : I<0xD1, MRM1r, (outs GR16:$dst), (ins GR16:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2612 | "ror{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2613 | [(set GR16:$dst, (rotr GR16:$src1, (i8 1)))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2614 | def ROR32r1 : I<0xD1, MRM1r, (outs GR32:$dst), (ins GR32:$src1), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2615 | "ror{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2616 | [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>; |
| 2617 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2618 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2619 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2620 | def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2621 | "ror{b}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2622 | [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2623 | def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2624 | "ror{w}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2625 | [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2626 | def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2627 | "ror{l}\t{%cl, $dst|$dst, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2628 | [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>; |
| 2629 | } |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2630 | def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2631 | "ror{b}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2632 | [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2633 | def ROR16mi : Ii8<0xC1, MRM1m, (outs), (ins i16mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2634 | "ror{w}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2635 | [(store (rotr (loadi16 addr:$dst), (i8 imm:$src)), addr:$dst)]>, |
| 2636 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2637 | def ROR32mi : Ii8<0xC1, MRM1m, (outs), (ins i32mem:$dst, i8imm:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2638 | "ror{l}\t{$src, $dst|$dst, $src}", |
Evan Cheng | eb422a7 | 2006-01-11 23:20:05 +0000 | [diff] [blame] | 2639 | [(store (rotr (loadi32 addr:$dst), (i8 imm:$src)), addr:$dst)]>; |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2640 | |
| 2641 | // Rotate by 1 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2642 | def ROR8m1 : I<0xD0, MRM1m, (outs), (ins i8mem :$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2643 | "ror{b}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2644 | [(store (rotr (loadi8 addr:$dst), (i8 1)), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2645 | def ROR16m1 : I<0xD1, MRM1m, (outs), (ins i16mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2646 | "ror{w}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2647 | [(store (rotr (loadi16 addr:$dst), (i8 1)), addr:$dst)]>, |
| 2648 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2649 | def ROR32m1 : I<0xD1, MRM1m, (outs), (ins i32mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2650 | "ror{l}\t$dst", |
Evan Cheng | 09c5457 | 2006-06-29 00:36:51 +0000 | [diff] [blame] | 2651 | [(store (rotr (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2652 | } // Constraints = "" |
Chris Lattner | 40ff633 | 2005-01-19 07:50:03 +0000 | [diff] [blame] | 2653 | |
| 2654 | |
| 2655 | // Double shift instructions (generalizations of rotate) |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2656 | let Uses = [CL] in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2657 | def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), |
| 2658 | (ins GR32:$src1, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2659 | "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2660 | [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2661 | def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), |
| 2662 | (ins GR32:$src1, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2663 | "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2664 | [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2665 | def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), |
| 2666 | (ins GR16:$src1, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2667 | "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2668 | [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2669 | TB, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2670 | def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), |
| 2671 | (ins GR16:$src1, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2672 | "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2673 | [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>, |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2674 | TB, OpSize; |
| 2675 | } |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 2676 | |
| 2677 | let isCommutable = 1 in { // These instructions commute to each other. |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2678 | def SHLD32rri8 : Ii8<0xA4, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2679 | (outs GR32:$dst), |
| 2680 | (ins GR32:$src1, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2681 | "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2682 | [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2683 | (i8 imm:$src3)))]>, |
| 2684 | TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2685 | def SHRD32rri8 : Ii8<0xAC, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2686 | (outs GR32:$dst), |
| 2687 | (ins GR32:$src1, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2688 | "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2689 | [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2690 | (i8 imm:$src3)))]>, |
| 2691 | TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2692 | def SHLD16rri8 : Ii8<0xA4, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2693 | (outs GR16:$dst), |
| 2694 | (ins GR16:$src1, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2695 | "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2696 | [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2697 | (i8 imm:$src3)))]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2698 | TB, OpSize; |
| 2699 | def SHRD16rri8 : Ii8<0xAC, MRMDestReg, |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2700 | (outs GR16:$dst), |
| 2701 | (ins GR16:$src1, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2702 | "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2703 | [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2704 | (i8 imm:$src3)))]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2705 | TB, OpSize; |
Chris Lattner | 41e431b | 2005-01-19 07:11:01 +0000 | [diff] [blame] | 2706 | } |
Chris Lattner | 0e967d4 | 2004-08-01 08:13:11 +0000 | [diff] [blame] | 2707 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2708 | let Constraints = "" in { |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2709 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2710 | def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2711 | "shld{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2712 | [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2713 | addr:$dst)]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2714 | def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2715 | "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2716 | [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2717 | addr:$dst)]>, TB; |
| 2718 | } |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2719 | def SHLD32mri8 : Ii8<0xA4, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2720 | (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2721 | "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2722 | [(store (X86shld (loadi32 addr:$dst), GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2723 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 2724 | TB; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 2725 | def SHRD32mri8 : Ii8<0xAC, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2726 | (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2727 | "shrd{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2728 | [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2729 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | f124d5e | 2005-11-18 01:04:42 +0000 | [diff] [blame] | 2730 | TB; |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2731 | |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2732 | let Uses = [CL] in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2733 | def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2734 | "shld{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2735 | [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2736 | addr:$dst)]>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2737 | def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 2738 | "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, CL}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2739 | [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL), |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2740 | addr:$dst)]>, TB, OpSize; |
| 2741 | } |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2742 | def SHLD16mri8 : Ii8<0xA4, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2743 | (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2744 | "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2745 | [(store (X86shld (loadi16 addr:$dst), GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2746 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2747 | TB, OpSize; |
| 2748 | def SHRD16mri8 : Ii8<0xAC, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2749 | (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2750 | "shrd{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 2751 | [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, |
Evan Cheng | e341316 | 2006-01-09 18:33:28 +0000 | [diff] [blame] | 2752 | (i8 imm:$src3)), addr:$dst)]>, |
Chris Lattner | 0df53d2 | 2005-01-19 07:31:24 +0000 | [diff] [blame] | 2753 | TB, OpSize; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2754 | } // Constraints = "" |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2755 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2756 | |
| 2757 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2758 | // Arithmetic. |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 2759 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2760 | let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2761 | // Register-Register Addition |
| 2762 | def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst), |
| 2763 | (ins GR8 :$src1, GR8 :$src2), |
| 2764 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2765 | [(set GR8:$dst, EFLAGS, (X86add_flag GR8:$src1, GR8:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2766 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2767 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2768 | // Register-Register Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2769 | def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst), |
| 2770 | (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2771 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2772 | [(set GR16:$dst, EFLAGS, (X86add_flag GR16:$src1, |
| 2773 | GR16:$src2))]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2774 | def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), |
| 2775 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2776 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2777 | [(set GR32:$dst, EFLAGS, (X86add_flag GR32:$src1, |
| 2778 | GR32:$src2))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2779 | } // end isConvertibleToThreeAddress |
| 2780 | } // end isCommutable |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2781 | |
Daniel Dunbar | f291be3 | 2010-03-09 22:50:46 +0000 | [diff] [blame] | 2782 | // These are alternate spellings for use by the disassembler, we mark them as |
| 2783 | // code gen only to ensure they aren't matched by the assembler. |
| 2784 | let isCodeGenOnly = 1 in { |
| 2785 | def ADD8rr_alt: I<0x02, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2786 | "add{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2787 | def ADD16rr_alt: I<0x03, MRMSrcReg,(outs GR16:$dst),(ins GR16:$src1, GR16:$src2), |
| 2788 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
Evan Cheng | 18ac410 | 2010-04-05 22:21:09 +0000 | [diff] [blame] | 2789 | def ADD32rr_alt: I<0x03, MRMSrcReg,(outs GR32:$dst),(ins GR32:$src1, GR32:$src2), |
Daniel Dunbar | f291be3 | 2010-03-09 22:50:46 +0000 | [diff] [blame] | 2790 | "add{l}\t{$src2, $dst|$dst, $src2}", []>; |
| 2791 | } |
| 2792 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2793 | // Register-Memory Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2794 | def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst), |
| 2795 | (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2796 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2797 | [(set GR8:$dst, EFLAGS, (X86add_flag GR8:$src1, |
| 2798 | (load addr:$src2)))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2799 | def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), |
| 2800 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2801 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2802 | [(set GR16:$dst, EFLAGS, (X86add_flag GR16:$src1, |
| 2803 | (load addr:$src2)))]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2804 | def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), |
| 2805 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2806 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2807 | [(set GR32:$dst, EFLAGS, (X86add_flag GR32:$src1, |
| 2808 | (load addr:$src2)))]>; |
Sean Callanan | 37be590 | 2009-09-15 20:53:57 +0000 | [diff] [blame] | 2809 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2810 | // Register-Integer Addition |
| 2811 | def ADD8ri : Ii8<0x80, MRM0r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 2812 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2813 | [(set GR8:$dst, EFLAGS, |
| 2814 | (X86add_flag GR8:$src1, imm:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2815 | |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 2816 | let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2817 | // Register-Integer Addition |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2818 | def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst), |
| 2819 | (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2820 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2821 | [(set GR16:$dst, EFLAGS, |
| 2822 | (X86add_flag GR16:$src1, imm:$src2))]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2823 | def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst), |
| 2824 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2825 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2826 | [(set GR32:$dst, EFLAGS, |
| 2827 | (X86add_flag GR32:$src1, imm:$src2))]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2828 | def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst), |
| 2829 | (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2830 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2831 | [(set GR16:$dst, EFLAGS, |
| 2832 | (X86add_flag GR16:$src1, i16immSExt8:$src2))]>, OpSize; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2833 | def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst), |
| 2834 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2835 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2836 | [(set GR32:$dst, EFLAGS, |
| 2837 | (X86add_flag GR32:$src1, i32immSExt8:$src2))]>; |
Evan Cheng | 09e3c80 | 2006-05-19 18:40:54 +0000 | [diff] [blame] | 2838 | } |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2839 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2840 | let Constraints = "" in { |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2841 | // Memory-Register Addition |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2842 | def ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2843 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2844 | [(store (add (load addr:$dst), GR8:$src2), addr:$dst), |
| 2845 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2846 | def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2847 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2848 | [(store (add (load addr:$dst), GR16:$src2), addr:$dst), |
| 2849 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2850 | def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2851 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2852 | [(store (add (load addr:$dst), GR32:$src2), addr:$dst), |
| 2853 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2854 | def ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2855 | "add{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2856 | [(store (add (loadi8 addr:$dst), imm:$src2), addr:$dst), |
| 2857 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2858 | def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2859 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2860 | [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst), |
| 2861 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2862 | def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2863 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2864 | [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst), |
| 2865 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2866 | def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2867 | "add{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2868 | [(store (add (load addr:$dst), i16immSExt8:$src2), |
| 2869 | addr:$dst), |
| 2870 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2871 | def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2872 | "add{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2873 | [(store (add (load addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 2874 | addr:$dst), |
| 2875 | (implicit EFLAGS)]>; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2876 | |
| 2877 | // addition to rAX |
| 2878 | def ADD8i8 : Ii8<0x04, RawFrm, (outs), (ins i8imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2879 | "add{b}\t{$src, %al|%al, $src}", []>; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2880 | def ADD16i16 : Ii16<0x05, RawFrm, (outs), (ins i16imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2881 | "add{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
Sean Callanan | b08ae6b | 2009-08-11 21:26:06 +0000 | [diff] [blame] | 2882 | def ADD32i32 : Ii32<0x05, RawFrm, (outs), (ins i32imm:$src), |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 2883 | "add{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2884 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2885 | |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 2886 | let Uses = [EFLAGS] in { |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 2887 | let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2888 | 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] | 2889 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2890 | [(set GR8:$dst, (adde GR8:$src1, GR8:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2891 | def ADC16rr : I<0x11, MRMDestReg, (outs GR16:$dst), |
| 2892 | (ins GR16:$src1, GR16:$src2), |
| 2893 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2894 | [(set GR16:$dst, (adde GR16:$src1, GR16:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2895 | def ADC32rr : I<0x11, MRMDestReg, (outs GR32:$dst), |
| 2896 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2897 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2898 | [(set GR32:$dst, (adde GR32:$src1, GR32:$src2))]>; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 2899 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2900 | |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 2901 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2902 | def ADC8rr_REV : I<0x12, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2903 | "adc{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 2904 | def ADC16rr_REV : I<0x13, MRMSrcReg, (outs GR16:$dst), |
| 2905 | (ins GR16:$src1, GR16:$src2), |
| 2906 | "adc{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 2907 | def ADC32rr_REV : I<0x13, MRMSrcReg, (outs GR32:$dst), |
| 2908 | (ins GR32:$src1, GR32:$src2), |
| 2909 | "adc{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 2910 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2911 | |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2912 | def ADC8rm : I<0x12, MRMSrcMem , (outs GR8:$dst), |
| 2913 | (ins GR8:$src1, i8mem:$src2), |
| 2914 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2915 | [(set GR8:$dst, (adde GR8:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2916 | def ADC16rm : I<0x13, MRMSrcMem , (outs GR16:$dst), |
| 2917 | (ins GR16:$src1, i16mem:$src2), |
| 2918 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2919 | [(set GR16:$dst, (adde GR16:$src1, (load addr:$src2)))]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 2920 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2921 | def ADC32rm : I<0x13, MRMSrcMem , (outs GR32:$dst), |
| 2922 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2923 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2924 | [(set GR32:$dst, (adde GR32:$src1, (load addr:$src2)))]>; |
| 2925 | 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] | 2926 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2927 | [(set GR8:$dst, (adde GR8:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2928 | def ADC16ri : Ii16<0x81, MRM2r, (outs GR16:$dst), |
| 2929 | (ins GR16:$src1, i16imm:$src2), |
| 2930 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2931 | [(set GR16:$dst, (adde GR16:$src1, imm:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2932 | def ADC16ri8 : Ii8<0x83, MRM2r, (outs GR16:$dst), |
| 2933 | (ins GR16:$src1, i16i8imm:$src2), |
| 2934 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2935 | [(set GR16:$dst, (adde GR16:$src1, i16immSExt8:$src2))]>, |
| 2936 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2937 | def ADC32ri : Ii32<0x81, MRM2r, (outs GR32:$dst), |
| 2938 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2939 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2940 | [(set GR32:$dst, (adde GR32:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2941 | def ADC32ri8 : Ii8<0x83, MRM2r, (outs GR32:$dst), |
| 2942 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2943 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2944 | [(set GR32:$dst, (adde GR32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | 57a0230 | 2004-08-11 04:31:00 +0000 | [diff] [blame] | 2945 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2946 | let Constraints = "" in { |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2947 | def ADC8mr : I<0x10, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2948 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2949 | [(store (adde (load addr:$dst), GR8:$src2), addr:$dst)]>; |
| 2950 | def ADC16mr : I<0x11, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2951 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2952 | [(store (adde (load addr:$dst), GR16:$src2), addr:$dst)]>, |
| 2953 | OpSize; |
| 2954 | def ADC32mr : I<0x11, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2955 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2956 | [(store (adde (load addr:$dst), GR32:$src2), addr:$dst)]>; |
| 2957 | def ADC8mi : Ii8<0x80, MRM2m, (outs), (ins i8mem:$dst, i8imm:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2958 | "adc{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2959 | [(store (adde (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
| 2960 | def ADC16mi : Ii16<0x81, MRM2m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2961 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2962 | [(store (adde (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
| 2963 | OpSize; |
| 2964 | def ADC16mi8 : Ii8<0x83, MRM2m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 2965 | "adc{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2966 | [(store (adde (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
| 2967 | OpSize; |
| 2968 | def ADC32mi : Ii32<0x81, MRM2m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2969 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2970 | [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
| 2971 | def ADC32mi8 : Ii8<0x83, MRM2m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2972 | "adc{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 2973 | [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 2974 | |
| 2975 | def ADC8i8 : Ii8<0x14, RawFrm, (outs), (ins i8imm:$src), |
| 2976 | "adc{b}\t{$src, %al|%al, $src}", []>; |
| 2977 | def ADC16i16 : Ii16<0x15, RawFrm, (outs), (ins i16imm:$src), |
| 2978 | "adc{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 2979 | def ADC32i32 : Ii32<0x15, RawFrm, (outs), (ins i32imm:$src), |
| 2980 | "adc{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 2981 | } // Constraints = "" |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 2982 | } // Uses = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 2983 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2984 | // Register-Register Subtraction |
| 2985 | def SUB8rr : I<0x28, MRMDestReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 2986 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2987 | [(set GR8:$dst, EFLAGS, |
| 2988 | (X86sub_flag GR8:$src1, GR8:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2989 | def SUB16rr : I<0x29, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1,GR16:$src2), |
| 2990 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2991 | [(set GR16:$dst, EFLAGS, |
| 2992 | (X86sub_flag GR16:$src1, GR16:$src2))]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2993 | def SUB32rr : I<0x29, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2), |
| 2994 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 2995 | [(set GR32:$dst, EFLAGS, |
| 2996 | (X86sub_flag GR32:$src1, GR32:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 2997 | |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 2998 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2999 | def SUB8rr_REV : I<0x2A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 3000 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 3001 | def SUB16rr_REV : I<0x2B, MRMSrcReg, (outs GR16:$dst), |
| 3002 | (ins GR16:$src1, GR16:$src2), |
| 3003 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 3004 | def SUB32rr_REV : I<0x2B, MRMSrcReg, (outs GR32:$dst), |
| 3005 | (ins GR32:$src1, GR32:$src2), |
| 3006 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 3007 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3008 | |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3009 | // Register-Memory Subtraction |
| 3010 | def SUB8rm : I<0x2A, MRMSrcMem, (outs GR8 :$dst), |
| 3011 | (ins GR8 :$src1, i8mem :$src2), |
| 3012 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3013 | [(set GR8:$dst, EFLAGS, |
| 3014 | (X86sub_flag GR8:$src1, (load addr:$src2)))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3015 | def SUB16rm : I<0x2B, MRMSrcMem, (outs GR16:$dst), |
| 3016 | (ins GR16:$src1, i16mem:$src2), |
| 3017 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3018 | [(set GR16:$dst, EFLAGS, |
| 3019 | (X86sub_flag GR16:$src1, (load addr:$src2)))]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3020 | def SUB32rm : I<0x2B, MRMSrcMem, (outs GR32:$dst), |
| 3021 | (ins GR32:$src1, i32mem:$src2), |
| 3022 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3023 | [(set GR32:$dst, EFLAGS, |
| 3024 | (X86sub_flag GR32:$src1, (load addr:$src2)))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3025 | |
| 3026 | // Register-Integer Subtraction |
| 3027 | def SUB8ri : Ii8 <0x80, MRM5r, (outs GR8:$dst), |
| 3028 | (ins GR8:$src1, i8imm:$src2), |
| 3029 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3030 | [(set GR8:$dst, EFLAGS, |
| 3031 | (X86sub_flag GR8:$src1, imm:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3032 | def SUB16ri : Ii16<0x81, MRM5r, (outs GR16:$dst), |
| 3033 | (ins GR16:$src1, i16imm:$src2), |
| 3034 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3035 | [(set GR16:$dst, EFLAGS, |
| 3036 | (X86sub_flag GR16:$src1, imm:$src2))]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3037 | def SUB32ri : Ii32<0x81, MRM5r, (outs GR32:$dst), |
| 3038 | (ins GR32:$src1, i32imm:$src2), |
| 3039 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3040 | [(set GR32:$dst, EFLAGS, |
| 3041 | (X86sub_flag GR32:$src1, imm:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3042 | def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), |
| 3043 | (ins GR16:$src1, i16i8imm:$src2), |
| 3044 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3045 | [(set GR16:$dst, EFLAGS, |
| 3046 | (X86sub_flag GR16:$src1, i16immSExt8:$src2))]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3047 | def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), |
| 3048 | (ins GR32:$src1, i32i8imm:$src2), |
| 3049 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3050 | [(set GR32:$dst, EFLAGS, |
| 3051 | (X86sub_flag GR32:$src1, i32immSExt8:$src2))]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3052 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 3053 | let Constraints = "" in { |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3054 | // Memory-Register Subtraction |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3055 | def SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3056 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3057 | [(store (sub (load addr:$dst), GR8:$src2), addr:$dst), |
| 3058 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3059 | def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3060 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3061 | [(store (sub (load addr:$dst), GR16:$src2), addr:$dst), |
| 3062 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3063 | def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3064 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3065 | [(store (sub (load addr:$dst), GR32:$src2), addr:$dst), |
| 3066 | (implicit EFLAGS)]>; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3067 | |
| 3068 | // Memory-Integer Subtraction |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3069 | def SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3070 | "sub{b}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3071 | [(store (sub (loadi8 addr:$dst), imm:$src2), addr:$dst), |
| 3072 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3073 | def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3074 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3075 | [(store (sub (loadi16 addr:$dst), imm:$src2),addr:$dst), |
| 3076 | (implicit EFLAGS)]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3077 | def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3078 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3079 | [(store (sub (loadi32 addr:$dst), imm:$src2),addr:$dst), |
| 3080 | (implicit EFLAGS)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3081 | def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3082 | "sub{w}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3083 | [(store (sub (load addr:$dst), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3084 | addr:$dst), |
| 3085 | (implicit EFLAGS)]>, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3086 | def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3087 | "sub{l}\t{$src2, $dst|$dst, $src2}", |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3088 | [(store (sub (load addr:$dst), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3089 | addr:$dst), |
| 3090 | (implicit EFLAGS)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 3091 | |
| 3092 | def SUB8i8 : Ii8<0x2C, RawFrm, (outs), (ins i8imm:$src), |
| 3093 | "sub{b}\t{$src, %al|%al, $src}", []>; |
| 3094 | def SUB16i16 : Ii16<0x2D, RawFrm, (outs), (ins i16imm:$src), |
| 3095 | "sub{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3096 | def SUB32i32 : Ii32<0x2D, RawFrm, (outs), (ins i32imm:$src), |
| 3097 | "sub{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 3098 | } // Constraints = "" |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3099 | |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 3100 | let Uses = [EFLAGS] in { |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3101 | def SBB8rr : I<0x18, MRMDestReg, (outs GR8:$dst), |
| 3102 | (ins GR8:$src1, GR8:$src2), |
| 3103 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3104 | [(set GR8:$dst, (sube GR8:$src1, GR8:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3105 | def SBB16rr : I<0x19, MRMDestReg, (outs GR16:$dst), |
| 3106 | (ins GR16:$src1, GR16:$src2), |
| 3107 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3108 | [(set GR16:$dst, (sube GR16:$src1, GR16:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3109 | def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), |
| 3110 | (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3111 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3112 | [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>; |
Chris Lattner | d93d3b0 | 2004-10-06 04:01:02 +0000 | [diff] [blame] | 3113 | |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 3114 | let Constraints = "" in { |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3115 | def SBB8mr : I<0x18, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
| 3116 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3117 | [(store (sube (load addr:$dst), GR8:$src2), addr:$dst)]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3118 | def SBB16mr : I<0x19, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 3119 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3120 | [(store (sube (load addr:$dst), GR16:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3121 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3122 | def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3123 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3124 | [(store (sube (load addr:$dst), GR32:$src2), addr:$dst)]>; |
Chris Lattner | 8f60e4d | 2010-02-05 22:56:11 +0000 | [diff] [blame] | 3125 | def SBB8mi : Ii8<0x80, MRM3m, (outs), (ins i8mem:$dst, i8imm:$src2), |
| 3126 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3127 | [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3128 | def SBB16mi : Ii16<0x81, MRM3m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 3129 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3130 | [(store (sube (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3131 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3132 | def SBB16mi8 : Ii8<0x83, MRM3m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
| 3133 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3134 | [(store (sube (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3135 | OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3136 | def SBB32mi : Ii32<0x81, MRM3m, (outs), (ins i32mem:$dst, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3137 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3138 | [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3139 | def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3140 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3141 | [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; |
Sean Callanan | d00025a | 2009-09-11 19:01:56 +0000 | [diff] [blame] | 3142 | |
| 3143 | def SBB8i8 : Ii8<0x1C, RawFrm, (outs), (ins i8imm:$src), |
| 3144 | "sbb{b}\t{$src, %al|%al, $src}", []>; |
| 3145 | def SBB16i16 : Ii16<0x1D, RawFrm, (outs), (ins i16imm:$src), |
| 3146 | "sbb{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3147 | def SBB32i32 : Ii32<0x1D, RawFrm, (outs), (ins i32imm:$src), |
| 3148 | "sbb{l}\t{$src, %eax|%eax, $src}", []>; |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 3149 | } // Constraints = "" |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3150 | |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 3151 | let isCodeGenOnly = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3152 | def SBB8rr_REV : I<0x1A, MRMSrcReg, (outs GR8:$dst), (ins GR8:$src1, GR8:$src2), |
| 3153 | "sbb{b}\t{$src2, $dst|$dst, $src2}", []>; |
| 3154 | def SBB16rr_REV : I<0x1B, MRMSrcReg, (outs GR16:$dst), |
| 3155 | (ins GR16:$src1, GR16:$src2), |
| 3156 | "sbb{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize; |
| 3157 | def SBB32rr_REV : I<0x1B, MRMSrcReg, (outs GR32:$dst), |
| 3158 | (ins GR32:$src1, GR32:$src2), |
| 3159 | "sbb{l}\t{$src2, $dst|$dst, $src2}", []>; |
Daniel Dunbar | dcbab9c | 2010-05-26 22:21:28 +0000 | [diff] [blame] | 3160 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3161 | |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3162 | def SBB8rm : I<0x1A, MRMSrcMem, (outs GR8:$dst), (ins GR8:$src1, i8mem:$src2), |
| 3163 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3164 | [(set GR8:$dst, (sube GR8:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3165 | def SBB16rm : I<0x1B, MRMSrcMem, (outs GR16:$dst), |
| 3166 | (ins GR16:$src1, i16mem:$src2), |
| 3167 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3168 | [(set GR16:$dst, (sube GR16:$src1, (load addr:$src2)))]>, |
Dale Johannesen | 94c9cd1 | 2009-05-18 21:41:59 +0000 | [diff] [blame] | 3169 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3170 | def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), |
| 3171 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3172 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3173 | [(set GR32:$dst, (sube GR32:$src1, (load addr:$src2)))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3174 | def SBB8ri : Ii8<0x80, MRM3r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), |
| 3175 | "sbb{b}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3176 | [(set GR8:$dst, (sube GR8:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3177 | def SBB16ri : Ii16<0x81, MRM3r, (outs GR16:$dst), |
| 3178 | (ins GR16:$src1, i16imm:$src2), |
| 3179 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3180 | [(set GR16:$dst, (sube GR16:$src1, imm:$src2))]>, OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3181 | def SBB16ri8 : Ii8<0x83, MRM3r, (outs GR16:$dst), |
| 3182 | (ins GR16:$src1, i16i8imm:$src2), |
| 3183 | "sbb{w}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3184 | [(set GR16:$dst, (sube GR16:$src1, i16immSExt8:$src2))]>, |
| 3185 | OpSize; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3186 | def SBB32ri : Ii32<0x81, MRM3r, (outs GR32:$dst), |
| 3187 | (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3188 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3189 | [(set GR32:$dst, (sube GR32:$src1, imm:$src2))]>; |
Dale Johannesen | ca11dae | 2009-05-18 17:44:15 +0000 | [diff] [blame] | 3190 | def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), |
| 3191 | (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3192 | "sbb{l}\t{$src2, $dst|$dst, $src2}", |
Dale Johannesen | 874ae25 | 2009-06-02 03:12:52 +0000 | [diff] [blame] | 3193 | [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>; |
Evan Cheng | 3154cb6 | 2007-10-05 17:59:57 +0000 | [diff] [blame] | 3194 | } // Uses = [EFLAGS] |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3195 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3196 | |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3197 | let Defs = [EFLAGS] in { |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 3198 | let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3199 | // Register-Register Signed Integer Multiply |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3200 | 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] | 3201 | "imul{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3202 | [(set GR16:$dst, EFLAGS, |
| 3203 | (X86smul_flag GR16:$src1, GR16:$src2))]>, TB, OpSize; |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3204 | 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] | 3205 | "imul{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3206 | [(set GR32:$dst, EFLAGS, |
| 3207 | (X86smul_flag GR32:$src1, GR32:$src2))]>, TB; |
Chris Lattner | 10197ff | 2005-01-03 01:27:59 +0000 | [diff] [blame] | 3208 | } |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3209 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3210 | // Register-Memory Signed Integer Multiply |
Bill Wendling | ab55ebd | 2008-12-12 00:56:36 +0000 | [diff] [blame] | 3211 | def IMUL16rm : I<0xAF, MRMSrcMem, (outs GR16:$dst), |
| 3212 | (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3213 | "imul{w}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3214 | [(set GR16:$dst, EFLAGS, |
| 3215 | (X86smul_flag GR16:$src1, (load addr:$src2)))]>, |
| 3216 | TB, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3217 | def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), |
| 3218 | (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3219 | "imul{l}\t{$src2, $dst|$dst, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3220 | [(set GR32:$dst, EFLAGS, |
| 3221 | (X86smul_flag GR32:$src1, (load addr:$src2)))]>, TB; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3222 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3223 | } // end Two Address instructions |
| 3224 | |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 3225 | // Suprisingly enough, these are not two address instructions! |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3226 | let Defs = [EFLAGS] in { |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3227 | // Register-Integer Signed Integer Multiply |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3228 | def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3229 | (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3230 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3231 | [(set GR16:$dst, EFLAGS, |
| 3232 | (X86smul_flag GR16:$src1, imm:$src2))]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3233 | def IMUL32rri : Ii32<0x69, MRMSrcReg, // GR32 = GR32*I32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3234 | (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3235 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3236 | [(set GR32:$dst, EFLAGS, |
| 3237 | (X86smul_flag GR32:$src1, imm:$src2))]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3238 | def IMUL16rri8 : Ii8<0x6B, MRMSrcReg, // GR16 = GR16*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3239 | (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3240 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3241 | [(set GR16:$dst, EFLAGS, |
| 3242 | (X86smul_flag GR16:$src1, i16immSExt8:$src2))]>, |
| 3243 | OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3244 | def IMUL32rri8 : Ii8<0x6B, MRMSrcReg, // GR32 = GR32*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3245 | (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3246 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3247 | [(set GR32:$dst, EFLAGS, |
| 3248 | (X86smul_flag GR32:$src1, i32immSExt8:$src2))]>; |
Chris Lattner | f5d3a83 | 2004-08-11 05:31:07 +0000 | [diff] [blame] | 3249 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 3250 | // Memory-Integer Signed Integer Multiply |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3251 | def IMUL16rmi : Ii16<0x69, MRMSrcMem, // GR16 = [mem16]*I16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3252 | (outs GR16:$dst), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3253 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3254 | [(set GR16:$dst, EFLAGS, |
| 3255 | (X86smul_flag (load addr:$src1), imm:$src2))]>, |
| 3256 | OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3257 | def IMUL32rmi : Ii32<0x69, MRMSrcMem, // GR32 = [mem32]*I32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3258 | (outs GR32:$dst), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3259 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3260 | [(set GR32:$dst, EFLAGS, |
| 3261 | (X86smul_flag (load addr:$src1), imm:$src2))]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3262 | def IMUL16rmi8 : Ii8<0x6B, MRMSrcMem, // GR16 = [mem16]*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3263 | (outs GR16:$dst), (ins i16mem:$src1, i16i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3264 | "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3265 | [(set GR16:$dst, EFLAGS, |
| 3266 | (X86smul_flag (load addr:$src1), |
| 3267 | i16immSExt8:$src2))]>, OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3268 | def IMUL32rmi8 : Ii8<0x6B, MRMSrcMem, // GR32 = [mem32]*I8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3269 | (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3270 | "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 3271 | [(set GR32:$dst, EFLAGS, |
| 3272 | (X86smul_flag (load addr:$src1), |
| 3273 | i32immSExt8:$src2))]>; |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3274 | } // Defs = [EFLAGS] |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3275 | |
| 3276 | //===----------------------------------------------------------------------===// |
| 3277 | // 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] | 3278 | // |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3279 | let Defs = [EFLAGS] in { |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3280 | let isCommutable = 1 in { // TEST X, Y --> TEST Y, X |
Daniel Dunbar | b93c72c | 2010-03-08 21:10:36 +0000 | [diff] [blame] | 3281 | def TEST8rr : I<0x84, MRMSrcReg, (outs), (ins GR8:$src1, GR8:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3282 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3283 | [(set EFLAGS, (X86cmp (and_su GR8:$src1, GR8:$src2), 0))]>; |
Daniel Dunbar | b93c72c | 2010-03-08 21:10:36 +0000 | [diff] [blame] | 3284 | def TEST16rr : I<0x85, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3285 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3286 | [(set EFLAGS, (X86cmp (and_su GR16:$src1, GR16:$src2), |
| 3287 | 0))]>, |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3288 | OpSize; |
Daniel Dunbar | b93c72c | 2010-03-08 21:10:36 +0000 | [diff] [blame] | 3289 | def TEST32rr : I<0x85, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3290 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3291 | [(set EFLAGS, (X86cmp (and_su GR32:$src1, GR32:$src2), |
| 3292 | 0))]>; |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3293 | } |
Evan Cheng | 734503b | 2006-09-11 02:19:56 +0000 | [diff] [blame] | 3294 | |
Sean Callanan | 4a93b71 | 2009-09-01 18:14:18 +0000 | [diff] [blame] | 3295 | def TEST8i8 : Ii8<0xA8, RawFrm, (outs), (ins i8imm:$src), |
| 3296 | "test{b}\t{$src, %al|%al, $src}", []>; |
| 3297 | def TEST16i16 : Ii16<0xA9, RawFrm, (outs), (ins i16imm:$src), |
| 3298 | "test{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3299 | def TEST32i32 : Ii32<0xA9, RawFrm, (outs), (ins i32imm:$src), |
| 3300 | "test{l}\t{$src, %eax|%eax, $src}", []>; |
| 3301 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3302 | def TEST8rm : I<0x84, MRMSrcMem, (outs), (ins GR8 :$src1, i8mem :$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3303 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3304 | [(set EFLAGS, (X86cmp (and GR8:$src1, (loadi8 addr:$src2)), |
| 3305 | 0))]>; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3306 | def TEST16rm : I<0x85, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3307 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3308 | [(set EFLAGS, (X86cmp (and GR16:$src1, |
| 3309 | (loadi16 addr:$src2)), 0))]>, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3310 | def TEST32rm : I<0x85, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2), |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3311 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3312 | [(set EFLAGS, (X86cmp (and GR32:$src1, |
| 3313 | (loadi32 addr:$src2)), 0))]>; |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3314 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3315 | def TEST8ri : Ii8 <0xF6, MRM0r, // flags = GR8 & imm8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3316 | (outs), (ins GR8:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3317 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3318 | [(set EFLAGS, (X86cmp (and_su GR8:$src1, imm:$src2), 0))]>; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3319 | def TEST16ri : Ii16<0xF7, MRM0r, // flags = GR16 & imm16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3320 | (outs), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3321 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3322 | [(set EFLAGS, (X86cmp (and_su GR16:$src1, imm:$src2), 0))]>, |
| 3323 | OpSize; |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3324 | def TEST32ri : Ii32<0xF7, MRM0r, // flags = GR32 & imm32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3325 | (outs), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3326 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3327 | [(set EFLAGS, (X86cmp (and_su GR32:$src1, imm:$src2), 0))]>; |
Evan Cheng | 734503b | 2006-09-11 02:19:56 +0000 | [diff] [blame] | 3328 | |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3329 | def TEST8mi : Ii8 <0xF6, MRM0m, // flags = [mem8] & imm8 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3330 | (outs), (ins i8mem:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3331 | "test{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3332 | [(set EFLAGS, (X86cmp (and (loadi8 addr:$src1), imm:$src2), |
| 3333 | 0))]>; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3334 | def TEST16mi : Ii16<0xF7, MRM0m, // flags = [mem16] & imm16 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3335 | (outs), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3336 | "test{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3337 | [(set EFLAGS, (X86cmp (and (loadi16 addr:$src1), imm:$src2), |
| 3338 | 0))]>, OpSize; |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3339 | def TEST32mi : Ii32<0xF7, MRM0m, // flags = [mem32] & imm32 |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3340 | (outs), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3341 | "test{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3342 | [(set EFLAGS, (X86cmp (and (loadi32 addr:$src1), imm:$src2), |
| 3343 | 0))]>; |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3344 | } // Defs = [EFLAGS] |
| 3345 | |
| 3346 | |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3347 | // Condition code ops, incl. set if equal/not equal/... |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3348 | let Defs = [EFLAGS], Uses = [AH], neverHasSideEffects = 1 in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 3349 | def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3350 | let Defs = [AH], Uses = [EFLAGS], neverHasSideEffects = 1 in |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 3351 | def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags |
Alkis Evlogimenos | 5ab29b5 | 2004-02-28 22:02:05 +0000 | [diff] [blame] | 3352 | |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3353 | let Uses = [EFLAGS] in { |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3354 | // Use sbb to materialize carry bit. |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3355 | let Defs = [EFLAGS], isCodeGenOnly = 1 in { |
Chris Lattner | c74e333 | 2010-02-05 21:13:48 +0000 | [diff] [blame] | 3356 | // FIXME: These are pseudo ops that should be replaced with Pat<> patterns. |
| 3357 | // However, Pat<> can't replicate the destination reg into the inputs of the |
| 3358 | // result. |
| 3359 | // FIXME: Change these to have encoding Pseudo when X86MCCodeEmitter replaces |
| 3360 | // X86CodeEmitter. |
| 3361 | def SETB_C8r : I<0x18, MRMInitReg, (outs GR8:$dst), (ins), "", |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3362 | [(set GR8:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>; |
Chris Lattner | c74e333 | 2010-02-05 21:13:48 +0000 | [diff] [blame] | 3363 | def SETB_C16r : I<0x19, MRMInitReg, (outs GR16:$dst), (ins), "", |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 3364 | [(set GR16:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>, |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3365 | OpSize; |
Chris Lattner | c74e333 | 2010-02-05 21:13:48 +0000 | [diff] [blame] | 3366 | def SETB_C32r : I<0x19, MRMInitReg, (outs GR32:$dst), (ins), "", |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 3367 | [(set GR32:$dst, (X86setcc_c X86_COND_B, EFLAGS))]>; |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 3368 | } // isCodeGenOnly |
| 3369 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3370 | def SETEr : I<0x94, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3371 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3372 | "sete\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3373 | [(set GR8:$dst, (X86setcc X86_COND_E, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3374 | TB; // GR8 = == |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3375 | def SETEm : I<0x94, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3376 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3377 | "sete\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3378 | [(store (X86setcc X86_COND_E, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3379 | TB; // [mem8] = == |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3380 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3381 | def SETNEr : I<0x95, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3382 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3383 | "setne\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3384 | [(set GR8:$dst, (X86setcc X86_COND_NE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3385 | TB; // GR8 = != |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3386 | def SETNEm : I<0x95, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3387 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3388 | "setne\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3389 | [(store (X86setcc X86_COND_NE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3390 | TB; // [mem8] = != |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3391 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3392 | def SETLr : I<0x9C, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3393 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3394 | "setl\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3395 | [(set GR8:$dst, (X86setcc X86_COND_L, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3396 | TB; // GR8 = < signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3397 | def SETLm : I<0x9C, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3398 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3399 | "setl\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3400 | [(store (X86setcc X86_COND_L, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3401 | TB; // [mem8] = < signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3402 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3403 | def SETGEr : I<0x9D, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3404 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3405 | "setge\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3406 | [(set GR8:$dst, (X86setcc X86_COND_GE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3407 | TB; // GR8 = >= signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3408 | def SETGEm : I<0x9D, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3409 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3410 | "setge\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3411 | [(store (X86setcc X86_COND_GE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3412 | TB; // [mem8] = >= signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3413 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3414 | def SETLEr : I<0x9E, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3415 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3416 | "setle\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3417 | [(set GR8:$dst, (X86setcc X86_COND_LE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3418 | TB; // GR8 = <= signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3419 | def SETLEm : I<0x9E, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3420 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3421 | "setle\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3422 | [(store (X86setcc X86_COND_LE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3423 | TB; // [mem8] = <= signed |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3424 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3425 | def SETGr : I<0x9F, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3426 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3427 | "setg\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3428 | [(set GR8:$dst, (X86setcc X86_COND_G, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3429 | TB; // GR8 = > signed |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3430 | def SETGm : I<0x9F, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3431 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3432 | "setg\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3433 | [(store (X86setcc X86_COND_G, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3434 | TB; // [mem8] = > signed |
| 3435 | |
| 3436 | def SETBr : I<0x92, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3437 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3438 | "setb\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3439 | [(set GR8:$dst, (X86setcc X86_COND_B, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3440 | TB; // GR8 = < unsign |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3441 | def SETBm : I<0x92, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3442 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3443 | "setb\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3444 | [(store (X86setcc X86_COND_B, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3445 | TB; // [mem8] = < unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3446 | |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3447 | def SETAEr : I<0x93, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3448 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3449 | "setae\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3450 | [(set GR8:$dst, (X86setcc X86_COND_AE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3451 | TB; // GR8 = >= unsign |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3452 | def SETAEm : I<0x93, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3453 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3454 | "setae\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3455 | [(store (X86setcc X86_COND_AE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3456 | TB; // [mem8] = >= unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3457 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3458 | def SETBEr : I<0x96, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3459 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3460 | "setbe\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3461 | [(set GR8:$dst, (X86setcc X86_COND_BE, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3462 | TB; // GR8 = <= unsign |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3463 | def SETBEm : I<0x96, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3464 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3465 | "setbe\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3466 | [(store (X86setcc X86_COND_BE, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3467 | TB; // [mem8] = <= unsign |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3468 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3469 | def SETAr : I<0x97, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3470 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3471 | "seta\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3472 | [(set GR8:$dst, (X86setcc X86_COND_A, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3473 | TB; // GR8 = > signed |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3474 | def SETAm : I<0x97, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3475 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3476 | "seta\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3477 | [(store (X86setcc X86_COND_A, EFLAGS), addr:$dst)]>, |
Evan Cheng | d5781fc | 2005-12-21 20:21:51 +0000 | [diff] [blame] | 3478 | TB; // [mem8] = > signed |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3479 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3480 | def SETSr : I<0x98, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3481 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3482 | "sets\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3483 | [(set GR8:$dst, (X86setcc X86_COND_S, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3484 | TB; // GR8 = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3485 | def SETSm : I<0x98, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3486 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3487 | "sets\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3488 | [(store (X86setcc X86_COND_S, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3489 | TB; // [mem8] = <sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3490 | def SETNSr : I<0x99, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3491 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3492 | "setns\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3493 | [(set GR8:$dst, (X86setcc X86_COND_NS, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3494 | TB; // GR8 = !<sign bit> |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3495 | def SETNSm : I<0x99, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3496 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3497 | "setns\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3498 | [(store (X86setcc X86_COND_NS, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3499 | TB; // [mem8] = !<sign bit> |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3500 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3501 | def SETPr : I<0x9A, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3502 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3503 | "setp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3504 | [(set GR8:$dst, (X86setcc X86_COND_P, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3505 | TB; // GR8 = parity |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3506 | def SETPm : I<0x9A, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3507 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3508 | "setp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3509 | [(store (X86setcc X86_COND_P, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3510 | TB; // [mem8] = parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3511 | def SETNPr : I<0x9B, MRM0r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3512 | (outs GR8 :$dst), (ins), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3513 | "setnp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3514 | [(set GR8:$dst, (X86setcc X86_COND_NP, EFLAGS))]>, |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3515 | TB; // GR8 = not parity |
Chris Lattner | cc65bee | 2005-01-02 02:35:46 +0000 | [diff] [blame] | 3516 | def SETNPm : I<0x9B, MRM0m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3517 | (outs), (ins i8mem:$dst), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3518 | "setnp\t$dst", |
Evan Cheng | e5f6204 | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 3519 | [(store (X86setcc X86_COND_NP, EFLAGS), addr:$dst)]>, |
Evan Cheng | d9558e0 | 2006-01-06 00:43:03 +0000 | [diff] [blame] | 3520 | TB; // [mem8] = not parity |
Bill Wendling | 9f24874 | 2008-12-02 00:07:05 +0000 | [diff] [blame] | 3521 | |
| 3522 | def SETOr : I<0x90, MRM0r, |
| 3523 | (outs GR8 :$dst), (ins), |
| 3524 | "seto\t$dst", |
| 3525 | [(set GR8:$dst, (X86setcc X86_COND_O, EFLAGS))]>, |
| 3526 | TB; // GR8 = overflow |
| 3527 | def SETOm : I<0x90, MRM0m, |
| 3528 | (outs), (ins i8mem:$dst), |
| 3529 | "seto\t$dst", |
| 3530 | [(store (X86setcc X86_COND_O, EFLAGS), addr:$dst)]>, |
| 3531 | TB; // [mem8] = overflow |
| 3532 | def SETNOr : I<0x91, MRM0r, |
| 3533 | (outs GR8 :$dst), (ins), |
| 3534 | "setno\t$dst", |
| 3535 | [(set GR8:$dst, (X86setcc X86_COND_NO, EFLAGS))]>, |
| 3536 | TB; // GR8 = not overflow |
| 3537 | def SETNOm : I<0x91, MRM0m, |
| 3538 | (outs), (ins i8mem:$dst), |
| 3539 | "setno\t$dst", |
| 3540 | [(store (X86setcc X86_COND_NO, EFLAGS), addr:$dst)]>, |
| 3541 | TB; // [mem8] = not overflow |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3542 | } // Uses = [EFLAGS] |
| 3543 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 3544 | |
| 3545 | // Integer comparisons |
Evan Cheng | 24f2ea3 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 3546 | let Defs = [EFLAGS] in { |
Sean Callanan | a09caa5 | 2009-09-02 00:55:49 +0000 | [diff] [blame] | 3547 | def CMP8i8 : Ii8<0x3C, RawFrm, (outs), (ins i8imm:$src), |
| 3548 | "cmp{b}\t{$src, %al|%al, $src}", []>; |
| 3549 | def CMP16i16 : Ii16<0x3D, RawFrm, (outs), (ins i16imm:$src), |
| 3550 | "cmp{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3551 | def CMP32i32 : Ii32<0x3D, RawFrm, (outs), (ins i32imm:$src), |
| 3552 | "cmp{l}\t{$src, %eax|%eax, $src}", []>; |
| 3553 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3554 | def CMP8rr : I<0x38, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3555 | (outs), (ins GR8 :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3556 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3557 | [(set EFLAGS, (X86cmp GR8:$src1, GR8:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3558 | def CMP16rr : I<0x39, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3559 | (outs), (ins GR16:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3560 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3561 | [(set EFLAGS, (X86cmp GR16:$src1, GR16:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3562 | def CMP32rr : I<0x39, MRMDestReg, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3563 | (outs), (ins GR32:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3564 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3565 | [(set EFLAGS, (X86cmp GR32:$src1, GR32:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3566 | def CMP8mr : I<0x38, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3567 | (outs), (ins i8mem :$src1, GR8 :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3568 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3569 | [(set EFLAGS, (X86cmp (loadi8 addr:$src1), GR8:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3570 | def CMP16mr : I<0x39, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3571 | (outs), (ins i16mem:$src1, GR16:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3572 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3573 | [(set EFLAGS, (X86cmp (loadi16 addr:$src1), GR16:$src2))]>, |
| 3574 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3575 | def CMP32mr : I<0x39, MRMDestMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3576 | (outs), (ins i32mem:$src1, GR32:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3577 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3578 | [(set EFLAGS, (X86cmp (loadi32 addr:$src1), GR32:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3579 | def CMP8rm : I<0x3A, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3580 | (outs), (ins GR8 :$src1, i8mem :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3581 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3582 | [(set EFLAGS, (X86cmp GR8:$src1, (loadi8 addr:$src2)))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3583 | def CMP16rm : I<0x3B, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3584 | (outs), (ins GR16:$src1, i16mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3585 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3586 | [(set EFLAGS, (X86cmp GR16:$src1, (loadi16 addr:$src2)))]>, |
| 3587 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3588 | def CMP32rm : I<0x3B, MRMSrcMem, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3589 | (outs), (ins GR32:$src1, i32mem:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3590 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3591 | [(set EFLAGS, (X86cmp GR32:$src1, (loadi32 addr:$src2)))]>; |
Daniel Dunbar | 1e8ee89 | 2010-03-09 22:50:40 +0000 | [diff] [blame] | 3592 | |
| 3593 | // These are alternate spellings for use by the disassembler, we mark them as |
| 3594 | // code gen only to ensure they aren't matched by the assembler. |
| 3595 | let isCodeGenOnly = 1 in { |
| 3596 | def CMP8rr_alt : I<0x3A, MRMSrcReg, (outs), (ins GR8:$src1, GR8:$src2), |
| 3597 | "cmp{b}\t{$src2, $src1|$src1, $src2}", []>; |
| 3598 | def CMP16rr_alt : I<0x3B, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3599 | "cmp{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize; |
| 3600 | def CMP32rr_alt : I<0x3B, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3601 | "cmp{l}\t{$src2, $src1|$src1, $src2}", []>; |
| 3602 | } |
| 3603 | |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3604 | def CMP8ri : Ii8<0x80, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3605 | (outs), (ins GR8:$src1, i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3606 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3607 | [(set EFLAGS, (X86cmp GR8:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3608 | def CMP16ri : Ii16<0x81, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3609 | (outs), (ins GR16:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3610 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3611 | [(set EFLAGS, (X86cmp GR16:$src1, imm:$src2))]>, OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3612 | def CMP32ri : Ii32<0x81, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3613 | (outs), (ins GR32:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3614 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3615 | [(set EFLAGS, (X86cmp GR32:$src1, imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3616 | def CMP8mi : Ii8 <0x80, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3617 | (outs), (ins i8mem :$src1, i8imm :$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3618 | "cmp{b}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3619 | [(set EFLAGS, (X86cmp (loadi8 addr:$src1), imm:$src2))]>; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3620 | def CMP16mi : Ii16<0x81, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3621 | (outs), (ins i16mem:$src1, i16imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3622 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3623 | [(set EFLAGS, (X86cmp (loadi16 addr:$src1), imm:$src2))]>, |
| 3624 | OpSize; |
Chris Lattner | 3a173df | 2004-10-03 20:35:00 +0000 | [diff] [blame] | 3625 | def CMP32mi : Ii32<0x81, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3626 | (outs), (ins i32mem:$src1, i32imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3627 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3628 | [(set EFLAGS, (X86cmp (loadi32 addr:$src1), imm:$src2))]>; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3629 | def CMP16ri8 : Ii8<0x83, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3630 | (outs), (ins GR16:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3631 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3632 | [(set EFLAGS, (X86cmp GR16:$src1, i16immSExt8:$src2))]>, |
| 3633 | OpSize; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3634 | def CMP16mi8 : Ii8<0x83, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3635 | (outs), (ins i16mem:$src1, i16i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3636 | "cmp{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3637 | [(set EFLAGS, (X86cmp (loadi16 addr:$src1), |
| 3638 | i16immSExt8:$src2))]>, OpSize; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3639 | def CMP32mi8 : Ii8<0x83, MRM7m, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3640 | (outs), (ins i32mem:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3641 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3642 | [(set EFLAGS, (X86cmp (loadi32 addr:$src1), |
| 3643 | i32immSExt8:$src2))]>; |
Chris Lattner | 29b4dd0 | 2006-03-23 16:13:50 +0000 | [diff] [blame] | 3644 | def CMP32ri8 : Ii8<0x83, MRM7r, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3645 | (outs), (ins GR32:$src1, i32i8imm:$src2), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3646 | "cmp{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3647 | [(set EFLAGS, (X86cmp GR32:$src1, i32immSExt8:$src2))]>; |
Evan Cheng | 0488db9 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 3648 | } // Defs = [EFLAGS] |
| 3649 | |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3650 | // Bit tests. |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3651 | // TODO: BTC, BTR, and BTS |
| 3652 | let Defs = [EFLAGS] in { |
Dan Gohman | 0c89b7e | 2009-01-13 20:32:45 +0000 | [diff] [blame] | 3653 | def BT16rr : I<0xA3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3654 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3655 | [(set EFLAGS, (X86bt GR16:$src1, GR16:$src2))]>, OpSize, TB; |
Dan Gohman | 0c89b7e | 2009-01-13 20:32:45 +0000 | [diff] [blame] | 3656 | def BT32rr : I<0xA3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3657 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3658 | [(set EFLAGS, (X86bt GR32:$src1, GR32:$src2))]>, TB; |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3659 | |
| 3660 | // Unlike with the register+register form, the memory+register form of the |
| 3661 | // 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] | 3662 | // perspective, this is pretty bizarre. Make these instructions disassembly |
| 3663 | // only for now. |
| 3664 | |
| 3665 | def BT16mr : I<0xA3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3666 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3667 | // [(X86bt (loadi16 addr:$src1), GR16:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3668 | // (implicit EFLAGS)] |
| 3669 | [] |
| 3670 | >, OpSize, TB, Requires<[FastBTMem]>; |
| 3671 | def BT32mr : I<0xA3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3672 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
Dan Gohman | f31408d | 2009-01-13 23:23:30 +0000 | [diff] [blame] | 3673 | // [(X86bt (loadi32 addr:$src1), GR32:$src2), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3674 | // (implicit EFLAGS)] |
| 3675 | [] |
| 3676 | >, TB, Requires<[FastBTMem]>; |
Dan Gohman | 4afe15b | 2009-01-13 20:33:23 +0000 | [diff] [blame] | 3677 | |
| 3678 | def BT16ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3679 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3680 | [(set EFLAGS, (X86bt GR16:$src1, i16immSExt8:$src2))]>, |
| 3681 | OpSize, TB; |
Dan Gohman | 4afe15b | 2009-01-13 20:33:23 +0000 | [diff] [blame] | 3682 | def BT32ri8 : Ii8<0xBA, MRM4r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3683 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3684 | [(set EFLAGS, (X86bt GR32:$src1, i32immSExt8:$src2))]>, TB; |
Dan Gohman | 4afe15b | 2009-01-13 20:33:23 +0000 | [diff] [blame] | 3685 | // Note that these instructions don't need FastBTMem because that |
| 3686 | // only applies when the other operand is in a register. When it's |
| 3687 | // an immediate, bt is still fast. |
| 3688 | def BT16mi8 : Ii8<0xBA, MRM4m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3689 | "bt{w}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3690 | [(set EFLAGS, (X86bt (loadi16 addr:$src1), i16immSExt8:$src2)) |
| 3691 | ]>, OpSize, TB; |
Dan Gohman | 4afe15b | 2009-01-13 20:33:23 +0000 | [diff] [blame] | 3692 | def BT32mi8 : Ii8<0xBA, MRM4m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3693 | "bt{l}\t{$src2, $src1|$src1, $src2}", |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 3694 | [(set EFLAGS, (X86bt (loadi32 addr:$src1), i32immSExt8:$src2)) |
| 3695 | ]>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3696 | |
| 3697 | def BTC16rr : I<0xBB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3698 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3699 | def BTC32rr : I<0xBB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3700 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3701 | def BTC16mr : I<0xBB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3702 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3703 | def BTC32mr : I<0xBB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3704 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3705 | def BTC16ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3706 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3707 | def BTC32ri8 : Ii8<0xBA, MRM7r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3708 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3709 | def BTC16mi8 : Ii8<0xBA, MRM7m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3710 | "btc{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3711 | def BTC32mi8 : Ii8<0xBA, MRM7m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3712 | "btc{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3713 | |
| 3714 | def BTR16rr : I<0xB3, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3715 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3716 | def BTR32rr : I<0xB3, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3717 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3718 | def BTR16mr : I<0xB3, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3719 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3720 | def BTR32mr : I<0xB3, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3721 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3722 | def BTR16ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3723 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3724 | def BTR32ri8 : Ii8<0xBA, MRM6r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3725 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3726 | def BTR16mi8 : Ii8<0xBA, MRM6m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3727 | "btr{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3728 | def BTR32mi8 : Ii8<0xBA, MRM6m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3729 | "btr{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3730 | |
| 3731 | def BTS16rr : I<0xAB, MRMDestReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 3732 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3733 | def BTS32rr : I<0xAB, MRMDestReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 3734 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3735 | def BTS16mr : I<0xAB, MRMDestMem, (outs), (ins i16mem:$src1, GR16:$src2), |
| 3736 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3737 | def BTS32mr : I<0xAB, MRMDestMem, (outs), (ins i32mem:$src1, GR32:$src2), |
| 3738 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3739 | def BTS16ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR16:$src1, i16i8imm:$src2), |
| 3740 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3741 | def BTS32ri8 : Ii8<0xBA, MRM5r, (outs), (ins GR32:$src1, i32i8imm:$src2), |
| 3742 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
| 3743 | def BTS16mi8 : Ii8<0xBA, MRM5m, (outs), (ins i16mem:$src1, i16i8imm:$src2), |
| 3744 | "bts{w}\t{$src2, $src1|$src1, $src2}", []>, OpSize, TB; |
| 3745 | def BTS32mi8 : Ii8<0xBA, MRM5m, (outs), (ins i32mem:$src1, i32i8imm:$src2), |
| 3746 | "bts{l}\t{$src2, $src1|$src1, $src2}", []>, TB; |
Dan Gohman | c7a37d4 | 2008-12-23 22:45:23 +0000 | [diff] [blame] | 3747 | } // Defs = [EFLAGS] |
| 3748 | |
Chris Lattner | 1cca5e3 | 2003-08-03 21:54:21 +0000 | [diff] [blame] | 3749 | // Sign/Zero extenders |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 3750 | // Use movsbl intead of movsbw; we don't care about the high 16 bits |
| 3751 | // of the register here. This has a smaller encoding and avoids a |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3752 | // partial-register update. Actual movsbw included for the disassembler. |
| 3753 | def MOVSX16rr8W : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src), |
| 3754 | "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3755 | def MOVSX16rm8W : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src), |
| 3756 | "movs{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3757 | def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3758 | "", [(set GR16:$dst, (sext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3759 | def MOVSX16rm8 : I<0xBE, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3760 | "", [(set GR16:$dst, (sextloadi16i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3761 | def MOVSX32rr8 : I<0xBE, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3762 | "movs{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3763 | [(set GR32:$dst, (sext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3764 | def MOVSX32rm8 : I<0xBE, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3765 | "movs{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3766 | [(set GR32:$dst, (sextloadi32i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3767 | def MOVSX32rr16: I<0xBF, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3768 | "movs{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3769 | [(set GR32:$dst, (sext GR16:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3770 | def MOVSX32rm16: I<0xBF, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3771 | "movs{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3772 | [(set GR32:$dst, (sextloadi32i16 addr:$src))]>, TB; |
Alkis Evlogimenos | a7be982 | 2004-02-17 09:14:23 +0000 | [diff] [blame] | 3773 | |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 3774 | // Use movzbl intead of movzbw; we don't care about the high 16 bits |
| 3775 | // of the register here. This has a smaller encoding and avoids a |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3776 | // partial-register update. Actual movzbw included for the disassembler. |
| 3777 | def MOVZX16rr8W : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8:$src), |
| 3778 | "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3779 | def MOVZX16rm8W : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem:$src), |
| 3780 | "movz{bw|x}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3781 | def MOVZX16rr8 : I<0xB6, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3782 | "", [(set GR16:$dst, (zext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3783 | def MOVZX16rm8 : I<0xB6, MRMSrcMem, (outs GR16:$dst), (ins i8mem :$src), |
Chris Lattner | 172862a | 2009-10-19 19:51:42 +0000 | [diff] [blame] | 3784 | "", [(set GR16:$dst, (zextloadi16i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3785 | def MOVZX32rr8 : I<0xB6, MRMSrcReg, (outs GR32:$dst), (ins GR8 :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3786 | "movz{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3787 | [(set GR32:$dst, (zext GR8:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3788 | def MOVZX32rm8 : I<0xB6, MRMSrcMem, (outs GR32:$dst), (ins i8mem :$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3789 | "movz{bl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3790 | [(set GR32:$dst, (zextloadi32i8 addr:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3791 | def MOVZX32rr16: I<0xB7, MRMSrcReg, (outs GR32:$dst), (ins GR16:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3792 | "movz{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3793 | [(set GR32:$dst, (zext GR16:$src))]>, TB; |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3794 | def MOVZX32rm16: I<0xB7, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3795 | "movz{wl|x}\t{$src, $dst|$dst, $src}", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3796 | [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; |
Evan Cheng | 7a7e837 | 2005-12-14 02:22:27 +0000 | [diff] [blame] | 3797 | |
Dan Gohman | f451cb8 | 2010-02-10 16:03:48 +0000 | [diff] [blame] | 3798 | // These are the same as the regular MOVZX32rr8 and MOVZX32rm8 |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 3799 | // except that they use GR32_NOREX for the output operand register class |
| 3800 | // instead of GR32. This allows them to operate on h registers on x86-64. |
| 3801 | def MOVZX32_NOREXrr8 : I<0xB6, MRMSrcReg, |
| 3802 | (outs GR32_NOREX:$dst), (ins GR8:$src), |
| 3803 | "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX", |
| 3804 | []>, TB; |
Dan Gohman | 78e04d4 | 2009-04-30 03:11:48 +0000 | [diff] [blame] | 3805 | let mayLoad = 1 in |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 3806 | def MOVZX32_NOREXrm8 : I<0xB6, MRMSrcMem, |
| 3807 | (outs GR32_NOREX:$dst), (ins i8mem:$src), |
| 3808 | "movz{bl|x}\t{$src, $dst|$dst, $src} # NOREX", |
| 3809 | []>, TB; |
| 3810 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3811 | let neverHasSideEffects = 1 in { |
| 3812 | let Defs = [AX], Uses = [AL] in |
| 3813 | def CBW : I<0x98, RawFrm, (outs), (ins), |
| 3814 | "{cbtw|cbw}", []>, OpSize; // AX = signext(AL) |
| 3815 | let Defs = [EAX], Uses = [AX] in |
| 3816 | def CWDE : I<0x98, RawFrm, (outs), (ins), |
| 3817 | "{cwtl|cwde}", []>; // EAX = signext(AX) |
Evan Cheng | f91c101 | 2006-05-31 22:05:11 +0000 | [diff] [blame] | 3818 | |
Chris Lattner | ba7e756 | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 3819 | let Defs = [AX,DX], Uses = [AX] in |
| 3820 | def CWD : I<0x99, RawFrm, (outs), (ins), |
| 3821 | "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX) |
| 3822 | let Defs = [EAX,EDX], Uses = [EAX] in |
| 3823 | def CDQ : I<0x99, RawFrm, (outs), (ins), |
| 3824 | "{cltd|cdq}", []>; // EDX:EAX = signext(EAX) |
| 3825 | } |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 3826 | |
Evan Cheng | 747a90d | 2006-02-21 02:24:38 +0000 | [diff] [blame] | 3827 | //===----------------------------------------------------------------------===// |
| 3828 | // Alias Instructions |
| 3829 | //===----------------------------------------------------------------------===// |
| 3830 | |
| 3831 | // Alias instructions that map movr0 to xor. |
| 3832 | // FIXME: remove when we can teach regalloc that xor reg, reg is ok. |
Chris Lattner | 35e0e84 | 2010-02-05 21:21:06 +0000 | [diff] [blame] | 3833 | // FIXME: Set encoding to pseudo. |
Daniel Dunbar | 7417b76 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 3834 | let Defs = [EFLAGS], isReMaterializable = 1, isAsCheapAsAMove = 1, |
| 3835 | isCodeGenOnly = 1 in { |
Chris Lattner | 35e0e84 | 2010-02-05 21:21:06 +0000 | [diff] [blame] | 3836 | def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), "", |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 3837 | [(set GR8:$dst, 0)]>; |
Dan Gohman | f1b4d26 | 2010-01-12 04:42:54 +0000 | [diff] [blame] | 3838 | |
| 3839 | // We want to rewrite MOV16r0 in terms of MOV32r0, because it's a smaller |
| 3840 | // encoding and avoids a partial-register update sometimes, but doing so |
| 3841 | // at isel time interferes with rematerialization in the current register |
| 3842 | // allocator. For now, this is rewritten when the instruction is lowered |
| 3843 | // to an MCInst. |
| 3844 | def MOV16r0 : I<0x31, MRMInitReg, (outs GR16:$dst), (ins), |
| 3845 | "", |
| 3846 | [(set GR16:$dst, 0)]>, OpSize; |
Chris Lattner | 6a38182 | 2009-12-23 01:30:26 +0000 | [diff] [blame] | 3847 | |
Chris Lattner | 35e0e84 | 2010-02-05 21:21:06 +0000 | [diff] [blame] | 3848 | // FIXME: Set encoding to pseudo. |
| 3849 | def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), "", |
Chris Lattner | ac105c4 | 2009-12-23 01:46:40 +0000 | [diff] [blame] | 3850 | [(set GR32:$dst, 0)]>; |
| 3851 | } |
Chris Lattner | 6a38182 | 2009-12-23 01:30:26 +0000 | [diff] [blame] | 3852 | |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 3853 | //===----------------------------------------------------------------------===// |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3854 | // Thread Local Storage Instructions |
| 3855 | // |
| 3856 | |
Eric Christopher | 37106af | 2010-06-24 02:07:57 +0000 | [diff] [blame] | 3857 | // ELF TLS Support |
Rafael Espindola | 15f1b66 | 2009-04-24 12:59:40 +0000 | [diff] [blame] | 3858 | // All calls clobber the non-callee saved registers. ESP is marked as |
| 3859 | // a use to prevent stack-pointer assignments that appear immediately |
| 3860 | // before calls from potentially appearing dead. |
| 3861 | let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, |
| 3862 | MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, |
| 3863 | XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, |
| 3864 | XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 3865 | Uses = [ESP] in |
Chris Lattner | 599b531 | 2010-07-08 23:46:44 +0000 | [diff] [blame] | 3866 | def TLS_addr32 : I<0, Pseudo, (outs), (ins i32mem:$sym), |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 3867 | "leal\t$sym, %eax; " |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3868 | "call\t___tls_get_addr@PLT", |
Chris Lattner | 5c0b16d | 2009-06-20 20:38:48 +0000 | [diff] [blame] | 3869 | [(X86tlsaddr tls32addr:$sym)]>, |
Rafael Espindola | 2ee3db3 | 2009-04-17 14:35:58 +0000 | [diff] [blame] | 3870 | Requires<[In32BitMode]>; |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3871 | |
Eric Christopher | 37106af | 2010-06-24 02:07:57 +0000 | [diff] [blame] | 3872 | // Darwin TLS Support |
Eric Christopher | 18ebf74 | 2010-06-23 08:01:49 +0000 | [diff] [blame] | 3873 | // For i386, the address of the thunk is passed on the stack, on return the |
| 3874 | // address of the variable is in %eax. %ecx is trashed during the function |
Eric Christopher | 749bb7e | 2010-06-23 20:49:35 +0000 | [diff] [blame] | 3875 | // call. All other registers are preserved. |
| 3876 | let Defs = [EAX, ECX], |
| 3877 | Uses = [ESP], |
Eric Christopher | 30ef0e5 | 2010-06-03 04:07:48 +0000 | [diff] [blame] | 3878 | usesCustomInserter = 1 in |
Eric Christopher | 5441536 | 2010-06-08 22:04:25 +0000 | [diff] [blame] | 3879 | def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym), |
Eric Christopher | 749bb7e | 2010-06-23 20:49:35 +0000 | [diff] [blame] | 3880 | "# TLSCall_32", |
Eric Christopher | 5441536 | 2010-06-08 22:04:25 +0000 | [diff] [blame] | 3881 | [(X86TLSCall addr:$sym)]>, |
Eric Christopher | 30ef0e5 | 2010-06-03 04:07:48 +0000 | [diff] [blame] | 3882 | Requires<[In32BitMode]>; |
| 3883 | |
Daniel Dunbar | 0c420fc | 2009-08-11 22:24:40 +0000 | [diff] [blame] | 3884 | let AddedComplexity = 5, isCodeGenOnly = 1 in |
Nate Begeman | 51a0437 | 2009-01-26 01:24:32 +0000 | [diff] [blame] | 3885 | def GS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 3886 | "movl\t%gs:$src, $dst", |
| 3887 | [(set GR32:$dst, (gsload addr:$src))]>, SegGS; |
| 3888 | |
Daniel Dunbar | 0c420fc | 2009-08-11 22:24:40 +0000 | [diff] [blame] | 3889 | let AddedComplexity = 5, isCodeGenOnly = 1 in |
Chris Lattner | 1777d0c | 2009-05-05 18:52:19 +0000 | [diff] [blame] | 3890 | def FS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 3891 | "movl\t%fs:$src, $dst", |
| 3892 | [(set GR32:$dst, (fsload addr:$src))]>, SegFS; |
| 3893 | |
Lauro Ramos Venancio | b3a0417 | 2007-04-20 21:38:10 +0000 | [diff] [blame] | 3894 | //===----------------------------------------------------------------------===// |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 3895 | // EH Pseudo Instructions |
| 3896 | // |
| 3897 | let isTerminator = 1, isReturn = 1, isBarrier = 1, |
Daniel Dunbar | 1ca3a0b | 2009-08-27 07:58:05 +0000 | [diff] [blame] | 3898 | hasCtrlDep = 1, isCodeGenOnly = 1 in { |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 3899 | def EH_RETURN : I<0xC3, RawFrm, (outs), (ins GR32:$addr), |
Dan Gohman | b1576f5 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 3900 | "ret\t#eh_return, addr: $addr", |
Anton Korobeynikov | 2365f51 | 2007-07-14 14:06:15 +0000 | [diff] [blame] | 3901 | [(X86ehret GR32:$addr)]>; |
| 3902 | |
| 3903 | } |
| 3904 | |
| 3905 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | ab0b949 | 2008-02-21 06:45:13 +0000 | [diff] [blame] | 3906 | // Atomic support |
| 3907 | // |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3908 | |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3909 | // Atomic swap. These are just normal xchg instructions. But since a memory |
| 3910 | // operand is referenced, the atomicity is ensured. |
Dan Gohman | 165660e | 2008-08-06 15:52:50 +0000 | [diff] [blame] | 3911 | let Constraints = "$val = $dst" in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3912 | def XCHG32rm : I<0x87, MRMSrcMem, (outs GR32:$dst), |
| 3913 | (ins GR32:$val, i32mem:$ptr), |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3914 | "xchg{l}\t{$val, $ptr|$ptr, $val}", |
| 3915 | [(set GR32:$dst, (atomic_swap_32 addr:$ptr, GR32:$val))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3916 | def XCHG16rm : I<0x87, MRMSrcMem, (outs GR16:$dst), |
| 3917 | (ins GR16:$val, i16mem:$ptr), |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3918 | "xchg{w}\t{$val, $ptr|$ptr, $val}", |
| 3919 | [(set GR16:$dst, (atomic_swap_16 addr:$ptr, GR16:$val))]>, |
| 3920 | OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3921 | 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] | 3922 | "xchg{b}\t{$val, $ptr|$ptr, $val}", |
| 3923 | [(set GR8:$dst, (atomic_swap_8 addr:$ptr, GR8:$val))]>; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3924 | |
| 3925 | def XCHG32rr : I<0x87, MRMSrcReg, (outs GR32:$dst), (ins GR32:$val, GR32:$src), |
| 3926 | "xchg{l}\t{$val, $src|$src, $val}", []>; |
| 3927 | def XCHG16rr : I<0x87, MRMSrcReg, (outs GR16:$dst), (ins GR16:$val, GR16:$src), |
| 3928 | "xchg{w}\t{$val, $src|$src, $val}", []>, OpSize; |
| 3929 | def XCHG8rr : I<0x86, MRMSrcReg, (outs GR8:$dst), (ins GR8:$val, GR8:$src), |
| 3930 | "xchg{b}\t{$val, $src|$src, $val}", []>; |
Evan Cheng | bb6939d | 2008-04-19 01:20:30 +0000 | [diff] [blame] | 3931 | } |
| 3932 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3933 | def XCHG16ar : I<0x90, AddRegFrm, (outs), (ins GR16:$src), |
| 3934 | "xchg{w}\t{$src, %ax|%ax, $src}", []>, OpSize; |
| 3935 | def XCHG32ar : I<0x90, AddRegFrm, (outs), (ins GR32:$src), |
| 3936 | "xchg{l}\t{$src, %eax|%eax, $src}", []>; |
| 3937 | |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3938 | // Atomic compare and swap. |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3939 | let Defs = [EAX, EFLAGS], Uses = [EAX] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3940 | def LCMPXCHG32 : I<0xB1, MRMDestMem, (outs), (ins i32mem:$ptr, GR32:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3941 | "lock\n\t" |
| 3942 | "cmpxchg{l}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3943 | [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3944 | } |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 3945 | let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { |
Evan Cheng | b093bd0 | 2010-01-08 01:29:19 +0000 | [diff] [blame] | 3946 | def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i64mem:$ptr), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3947 | "lock\n\t" |
| 3948 | "cmpxchg8b\t$ptr", |
Andrew Lenharth | d19189e | 2008-03-05 01:15:49 +0000 | [diff] [blame] | 3949 | [(X86cas8 addr:$ptr)]>, TB, LOCK; |
| 3950 | } |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3951 | |
| 3952 | let Defs = [AX, EFLAGS], Uses = [AX] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3953 | def LCMPXCHG16 : I<0xB1, MRMDestMem, (outs), (ins i16mem:$ptr, GR16:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3954 | "lock\n\t" |
| 3955 | "cmpxchg{w}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3956 | [(X86cas addr:$ptr, GR16:$swap, 2)]>, TB, OpSize, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3957 | } |
Andrew Lenharth | 26ed869 | 2008-03-01 21:52:34 +0000 | [diff] [blame] | 3958 | let Defs = [AL, EFLAGS], Uses = [AL] in { |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3959 | def LCMPXCHG8 : I<0xB0, MRMDestMem, (outs), (ins i8mem:$ptr, GR8:$swap), |
Dan Gohman | 4d47b9b | 2009-04-27 15:13:28 +0000 | [diff] [blame] | 3960 | "lock\n\t" |
| 3961 | "cmpxchg{b}\t{$swap, $ptr|$ptr, $swap}", |
Evan Cheng | 32967d2 | 2008-03-04 03:20:06 +0000 | [diff] [blame] | 3962 | [(X86cas addr:$ptr, GR8:$swap, 1)]>, TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3963 | } |
| 3964 | |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3965 | // Atomic exchange and add |
| 3966 | let Constraints = "$val = $dst", Defs = [EFLAGS] in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3967 | 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] | 3968 | "lock\n\t" |
| 3969 | "xadd{l}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3970 | [(set GR32:$dst, (atomic_load_add_32 addr:$ptr, GR32:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3971 | TB, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3972 | 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] | 3973 | "lock\n\t" |
| 3974 | "xadd{w}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3975 | [(set GR16:$dst, (atomic_load_add_16 addr:$ptr, GR16:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3976 | TB, OpSize, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3977 | 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] | 3978 | "lock\n\t" |
| 3979 | "xadd{b}\t{$val, $ptr|$ptr, $val}", |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 3980 | [(set GR8:$dst, (atomic_load_add_8 addr:$ptr, GR8:$val))]>, |
Evan Cheng | 7e03280 | 2008-04-18 20:55:36 +0000 | [diff] [blame] | 3981 | TB, LOCK; |
Andrew Lenharth | ea7da50 | 2008-03-01 13:37:02 +0000 | [diff] [blame] | 3982 | } |
| 3983 | |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3984 | def XADD8rr : I<0xC0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src), |
| 3985 | "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3986 | def XADD16rr : I<0xC1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
| 3987 | "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3988 | def XADD32rr : I<0xC1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 3989 | "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3990 | |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 3991 | let mayLoad = 1, mayStore = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3992 | def XADD8rm : I<0xC0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
| 3993 | "xadd{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 3994 | def XADD16rm : I<0xC1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
| 3995 | "xadd{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 3996 | def XADD32rm : I<0xC1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 3997 | "xadd{l}\t{$src, $dst|$dst, $src}", []>, TB; |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 3998 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3999 | |
| 4000 | def CMPXCHG8rr : I<0xB0, MRMDestReg, (outs GR8:$dst), (ins GR8:$src), |
| 4001 | "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4002 | def CMPXCHG16rr : I<0xB1, MRMDestReg, (outs GR16:$dst), (ins GR16:$src), |
| 4003 | "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4004 | def CMPXCHG32rr : I<0xB1, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 4005 | "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4006 | |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 4007 | let mayLoad = 1, mayStore = 1 in { |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4008 | def CMPXCHG8rm : I<0xB0, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src), |
| 4009 | "cmpxchg{b}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4010 | def CMPXCHG16rm : I<0xB1, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src), |
| 4011 | "cmpxchg{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4012 | def CMPXCHG32rm : I<0xB1, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 4013 | "cmpxchg{l}\t{$src, $dst|$dst, $src}", []>, TB; |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 4014 | } |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4015 | |
Evan Cheng | b093bd0 | 2010-01-08 01:29:19 +0000 | [diff] [blame] | 4016 | let Defs = [EAX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4017 | def CMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i64mem:$dst), |
| 4018 | "cmpxchg8b\t$dst", []>, TB; |
| 4019 | |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 4020 | // Optimized codegen when the non-memory output is not used. |
| 4021 | // FIXME: Use normal add / sub instructions and add lock prefix dynamically. |
Dan Gohman | 7f357ec | 2010-05-14 16:34:55 +0000 | [diff] [blame] | 4022 | let Defs = [EFLAGS], mayLoad = 1, mayStore = 1 in { |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 4023 | def LOCK_ADD8mr : I<0x00, MRMDestMem, (outs), (ins i8mem:$dst, GR8:$src2), |
| 4024 | "lock\n\t" |
| 4025 | "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4026 | def LOCK_ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 4027 | "lock\n\t" |
| 4028 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 4029 | def LOCK_ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
| 4030 | "lock\n\t" |
| 4031 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4032 | def LOCK_ADD8mi : Ii8<0x80, MRM0m, (outs), (ins i8mem :$dst, i8imm :$src2), |
| 4033 | "lock\n\t" |
| 4034 | "add{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4035 | def LOCK_ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 4036 | "lock\n\t" |
| 4037 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4038 | def LOCK_ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2), |
| 4039 | "lock\n\t" |
| 4040 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4041 | def LOCK_ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
| 4042 | "lock\n\t" |
| 4043 | "add{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 4044 | def LOCK_ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
| 4045 | "lock\n\t" |
| 4046 | "add{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4047 | |
| 4048 | def LOCK_INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), |
| 4049 | "lock\n\t" |
| 4050 | "inc{b}\t$dst", []>, LOCK; |
| 4051 | def LOCK_INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), |
| 4052 | "lock\n\t" |
| 4053 | "inc{w}\t$dst", []>, OpSize, LOCK; |
| 4054 | def LOCK_INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), |
| 4055 | "lock\n\t" |
| 4056 | "inc{l}\t$dst", []>, LOCK; |
| 4057 | |
| 4058 | def LOCK_SUB8mr : I<0x28, MRMDestMem, (outs), (ins i8mem :$dst, GR8 :$src2), |
| 4059 | "lock\n\t" |
| 4060 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4061 | def LOCK_SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), |
| 4062 | "lock\n\t" |
| 4063 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 4064 | def LOCK_SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), |
| 4065 | "lock\n\t" |
| 4066 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4067 | def LOCK_SUB8mi : Ii8<0x80, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src2), |
| 4068 | "lock\n\t" |
| 4069 | "sub{b}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4070 | def LOCK_SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2), |
| 4071 | "lock\n\t" |
| 4072 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 4073 | def LOCK_SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2), |
| 4074 | "lock\n\t" |
| 4075 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4076 | def LOCK_SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2), |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 4077 | "lock\n\t" |
| 4078 | "sub{w}\t{$src2, $dst|$dst, $src2}", []>, OpSize, LOCK; |
| 4079 | def LOCK_SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2), |
| 4080 | "lock\n\t" |
| 4081 | "sub{l}\t{$src2, $dst|$dst, $src2}", []>, LOCK; |
| 4082 | |
| 4083 | def LOCK_DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), |
| 4084 | "lock\n\t" |
| 4085 | "dec{b}\t$dst", []>, LOCK; |
| 4086 | def LOCK_DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), |
| 4087 | "lock\n\t" |
| 4088 | "dec{w}\t$dst", []>, OpSize, LOCK; |
| 4089 | def LOCK_DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), |
| 4090 | "lock\n\t" |
| 4091 | "dec{l}\t$dst", []>, LOCK; |
Dan Gohman | bab42bd | 2009-10-20 18:14:49 +0000 | [diff] [blame] | 4092 | } |
Evan Cheng | 37b7387 | 2009-07-30 08:33:02 +0000 | [diff] [blame] | 4093 | |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4094 | // Atomic exchange, and, or, xor |
Mon P Wang | 63307c3 | 2008-05-05 19:05:59 +0000 | [diff] [blame] | 4095 | let Constraints = "$val = $dst", Defs = [EFLAGS], |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 4096 | usesCustomInserter = 1 in { |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4097 | 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] | 4098 | "#ATOMAND32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4099 | [(set GR32:$dst, (atomic_load_and_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4100 | 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] | 4101 | "#ATOMOR32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4102 | [(set GR32:$dst, (atomic_load_or_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4103 | 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] | 4104 | "#ATOMXOR32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4105 | [(set GR32:$dst, (atomic_load_xor_32 addr:$ptr, GR32:$val))]>; |
Andrew Lenharth | 507a58a | 2008-06-14 05:48:15 +0000 | [diff] [blame] | 4106 | 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] | 4107 | "#ATOMNAND32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4108 | [(set GR32:$dst, (atomic_load_nand_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4109 | 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] | 4110 | "#ATOMMIN32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4111 | [(set GR32:$dst, (atomic_load_min_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4112 | 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] | 4113 | "#ATOMMAX32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4114 | [(set GR32:$dst, (atomic_load_max_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4115 | 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] | 4116 | "#ATOMUMIN32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4117 | [(set GR32:$dst, (atomic_load_umin_32 addr:$ptr, GR32:$val))]>; |
Dan Gohman | 9499b71 | 2008-05-12 20:22:45 +0000 | [diff] [blame] | 4118 | 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] | 4119 | "#ATOMUMAX32 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4120 | [(set GR32:$dst, (atomic_load_umax_32 addr:$ptr, GR32:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4121 | |
| 4122 | 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] | 4123 | "#ATOMAND16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4124 | [(set GR16:$dst, (atomic_load_and_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4125 | 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] | 4126 | "#ATOMOR16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4127 | [(set GR16:$dst, (atomic_load_or_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4128 | 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] | 4129 | "#ATOMXOR16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4130 | [(set GR16:$dst, (atomic_load_xor_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4131 | 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] | 4132 | "#ATOMNAND16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4133 | [(set GR16:$dst, (atomic_load_nand_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4134 | 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] | 4135 | "#ATOMMIN16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4136 | [(set GR16:$dst, (atomic_load_min_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4137 | 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] | 4138 | "#ATOMMAX16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4139 | [(set GR16:$dst, (atomic_load_max_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4140 | 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] | 4141 | "#ATOMUMIN16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4142 | [(set GR16:$dst, (atomic_load_umin_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4143 | 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] | 4144 | "#ATOMUMAX16 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4145 | [(set GR16:$dst, (atomic_load_umax_16 addr:$ptr, GR16:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4146 | |
| 4147 | 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] | 4148 | "#ATOMAND8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4149 | [(set GR8:$dst, (atomic_load_and_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4150 | 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] | 4151 | "#ATOMOR8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4152 | [(set GR8:$dst, (atomic_load_or_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4153 | 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] | 4154 | "#ATOMXOR8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4155 | [(set GR8:$dst, (atomic_load_xor_8 addr:$ptr, GR8:$val))]>; |
Dale Johannesen | 140be2d | 2008-08-19 18:47:28 +0000 | [diff] [blame] | 4156 | 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] | 4157 | "#ATOMNAND8 PSEUDO!", |
Dale Johannesen | e00a8a2 | 2008-08-28 02:44:49 +0000 | [diff] [blame] | 4158 | [(set GR8:$dst, (atomic_load_nand_8 addr:$ptr, GR8:$val))]>; |
Mon P Wang | 63307c3 | 2008-05-05 19:05:59 +0000 | [diff] [blame] | 4159 | } |
| 4160 | |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4161 | let Constraints = "$val1 = $dst1, $val2 = $dst2", |
| 4162 | Defs = [EFLAGS, EAX, EBX, ECX, EDX], |
| 4163 | Uses = [EAX, EBX, ECX, EDX], |
Dale Johannesen | 1b54c7f | 2008-10-03 19:41:08 +0000 | [diff] [blame] | 4164 | mayLoad = 1, mayStore = 1, |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 4165 | usesCustomInserter = 1 in { |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4166 | def ATOMAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4167 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4168 | "#ATOMAND6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4169 | def ATOMOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4170 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4171 | "#ATOMOR6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4172 | def ATOMXOR6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4173 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4174 | "#ATOMXOR6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4175 | def ATOMNAND6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4176 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4177 | "#ATOMNAND6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4178 | def ATOMADD6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4179 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4180 | "#ATOMADD6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4181 | def ATOMSUB6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4182 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4183 | "#ATOMSUB6432 PSEUDO!", []>; |
Dale Johannesen | 880ae36 | 2008-10-03 22:25:52 +0000 | [diff] [blame] | 4184 | def ATOMSWAP6432 : I<0, Pseudo, (outs GR32:$dst1, GR32:$dst2), |
| 4185 | (ins i64mem:$ptr, GR32:$val1, GR32:$val2), |
Nick Lewycky | 6ecf5ce | 2008-12-07 03:49:52 +0000 | [diff] [blame] | 4186 | "#ATOMSWAP6432 PSEUDO!", []>; |
Dale Johannesen | 48c1bc2 | 2008-10-02 18:53:47 +0000 | [diff] [blame] | 4187 | } |
| 4188 | |
Sean Callanan | 358f1ef | 2009-09-16 21:55:34 +0000 | [diff] [blame] | 4189 | // Segmentation support instructions. |
| 4190 | |
| 4191 | def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 4192 | "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4193 | def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 4194 | "lar{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4195 | |
| 4196 | // i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo. |
| 4197 | def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
| 4198 | "lar{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4199 | def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4200 | "lar{l}\t{$src, $dst|$dst, $src}", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4201 | |
| 4202 | def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 4203 | "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4204 | def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 4205 | "lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4206 | def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 4207 | "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4208 | def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4209 | "lsl{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4210 | |
Sean Callanan | 95a5a7d | 2010-02-13 01:48:34 +0000 | [diff] [blame] | 4211 | def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4212 | |
| 4213 | def STRr : I<0x00, MRM1r, (outs GR16:$dst), (ins), |
| 4214 | "str{w}\t{$dst}", []>, TB; |
| 4215 | def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins), |
| 4216 | "str{w}\t{$dst}", []>, TB; |
| 4217 | def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src), |
| 4218 | "ltr{w}\t{$src}", []>, TB; |
| 4219 | def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src), |
| 4220 | "ltr{w}\t{$src}", []>, TB; |
| 4221 | |
| 4222 | def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins), |
| 4223 | "push{w}\t%fs", []>, OpSize, TB; |
| 4224 | def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins), |
| 4225 | "push{l}\t%fs", []>, TB; |
| 4226 | def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins), |
| 4227 | "push{w}\t%gs", []>, OpSize, TB; |
| 4228 | def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins), |
| 4229 | "push{l}\t%gs", []>, TB; |
| 4230 | |
| 4231 | def POPFS16 : I<0xa1, RawFrm, (outs), (ins), |
| 4232 | "pop{w}\t%fs", []>, OpSize, TB; |
| 4233 | def POPFS32 : I<0xa1, RawFrm, (outs), (ins), |
| 4234 | "pop{l}\t%fs", []>, TB; |
| 4235 | def POPGS16 : I<0xa9, RawFrm, (outs), (ins), |
| 4236 | "pop{w}\t%gs", []>, OpSize, TB; |
| 4237 | def POPGS32 : I<0xa9, RawFrm, (outs), (ins), |
| 4238 | "pop{l}\t%gs", []>, TB; |
| 4239 | |
| 4240 | def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4241 | "lds{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 4242 | def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4243 | "lds{l}\t{$src, $dst|$dst, $src}", []>; |
| 4244 | def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4245 | "lss{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4246 | def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4247 | "lss{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4248 | def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4249 | "les{w}\t{$src, $dst|$dst, $src}", []>, OpSize; |
| 4250 | def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4251 | "les{l}\t{$src, $dst|$dst, $src}", []>; |
| 4252 | def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4253 | "lfs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4254 | def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4255 | "lfs{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4256 | def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
| 4257 | "lgs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize; |
| 4258 | def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
| 4259 | "lgs{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4260 | |
| 4261 | def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg), |
| 4262 | "verr\t$seg", []>, TB; |
| 4263 | def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg), |
| 4264 | "verr\t$seg", []>, TB; |
| 4265 | def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg), |
| 4266 | "verw\t$seg", []>, TB; |
| 4267 | def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg), |
| 4268 | "verw\t$seg", []>, TB; |
| 4269 | |
| 4270 | // Descriptor-table support instructions |
| 4271 | |
| 4272 | def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins), |
| 4273 | "sgdt\t$dst", []>, TB; |
| 4274 | def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins), |
| 4275 | "sidt\t$dst", []>, TB; |
| 4276 | def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins), |
| 4277 | "sldt{w}\t$dst", []>, TB; |
| 4278 | def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins), |
| 4279 | "sldt{w}\t$dst", []>, TB; |
| 4280 | def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src), |
| 4281 | "lgdt\t$src", []>, TB; |
| 4282 | def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src), |
| 4283 | "lidt\t$src", []>, TB; |
| 4284 | def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src), |
| 4285 | "lldt{w}\t$src", []>, TB; |
| 4286 | def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src), |
| 4287 | "lldt{w}\t$src", []>, TB; |
Sean Callanan | 9a86f10 | 2009-09-16 22:59:28 +0000 | [diff] [blame] | 4288 | |
Kevin Enderby | 12ce0de | 2010-02-03 21:04:42 +0000 | [diff] [blame] | 4289 | // Lock instruction prefix |
| 4290 | def LOCK_PREFIX : I<0xF0, RawFrm, (outs), (ins), "lock", []>; |
| 4291 | |
| 4292 | // Repeat string operation instruction prefixes |
| 4293 | // These uses the DF flag in the EFLAGS register to inc or dec ECX |
| 4294 | let Defs = [ECX], Uses = [ECX,EFLAGS] in { |
| 4295 | // Repeat (used with INS, OUTS, MOVS, LODS and STOS) |
| 4296 | def REP_PREFIX : I<0xF3, RawFrm, (outs), (ins), "rep", []>; |
| 4297 | // Repeat while not equal (used with CMPS and SCAS) |
| 4298 | def REPNE_PREFIX : I<0xF2, RawFrm, (outs), (ins), "repne", []>; |
| 4299 | } |
| 4300 | |
| 4301 | // Segment override instruction prefixes |
| 4302 | def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>; |
| 4303 | def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>; |
| 4304 | def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>; |
| 4305 | def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>; |
| 4306 | def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>; |
| 4307 | def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>; |
| 4308 | |
Sean Callanan | 9a86f10 | 2009-09-16 22:59:28 +0000 | [diff] [blame] | 4309 | // String manipulation instructions |
| 4310 | |
| 4311 | def LODSB : I<0xAC, RawFrm, (outs), (ins), "lodsb", []>; |
| 4312 | def LODSW : I<0xAD, RawFrm, (outs), (ins), "lodsw", []>, OpSize; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4313 | def LODSD : I<0xAD, RawFrm, (outs), (ins), "lods{l|d}", []>; |
| 4314 | |
| 4315 | def OUTSB : I<0x6E, RawFrm, (outs), (ins), "outsb", []>; |
| 4316 | def OUTSW : I<0x6F, RawFrm, (outs), (ins), "outsw", []>, OpSize; |
| 4317 | def OUTSD : I<0x6F, RawFrm, (outs), (ins), "outs{l|d}", []>; |
| 4318 | |
| 4319 | // CPU flow control instructions |
| 4320 | |
| 4321 | def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", []>; |
| 4322 | def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", []>, TB; |
| 4323 | |
| 4324 | // FPU control instructions |
| 4325 | |
| 4326 | def FNINIT : I<0xE3, RawFrm, (outs), (ins), "fninit", []>, DB; |
| 4327 | |
| 4328 | // Flag instructions |
| 4329 | |
| 4330 | def CLC : I<0xF8, RawFrm, (outs), (ins), "clc", []>; |
| 4331 | def STC : I<0xF9, RawFrm, (outs), (ins), "stc", []>; |
| 4332 | def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", []>; |
| 4333 | def STI : I<0xFB, RawFrm, (outs), (ins), "sti", []>; |
| 4334 | def CLD : I<0xFC, RawFrm, (outs), (ins), "cld", []>; |
| 4335 | def STD : I<0xFD, RawFrm, (outs), (ins), "std", []>; |
| 4336 | def CMC : I<0xF5, RawFrm, (outs), (ins), "cmc", []>; |
| 4337 | |
| 4338 | def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", []>, TB; |
| 4339 | |
| 4340 | // Table lookup instructions |
| 4341 | |
| 4342 | def XLAT : I<0xD7, RawFrm, (outs), (ins), "xlatb", []>; |
| 4343 | |
| 4344 | // Specialized register support |
| 4345 | |
| 4346 | def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB; |
| 4347 | def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB; |
| 4348 | def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", []>, TB; |
| 4349 | |
| 4350 | def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins), |
| 4351 | "smsw{w}\t$dst", []>, OpSize, TB; |
| 4352 | def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins), |
| 4353 | "smsw{l}\t$dst", []>, TB; |
| 4354 | // For memory operands, there is only a 16-bit form |
| 4355 | def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins), |
| 4356 | "smsw{w}\t$dst", []>, TB; |
| 4357 | |
| 4358 | def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src), |
| 4359 | "lmsw{w}\t$src", []>, TB; |
| 4360 | def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src), |
| 4361 | "lmsw{w}\t$src", []>, TB; |
| 4362 | |
| 4363 | def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", []>, TB; |
| 4364 | |
| 4365 | // Cache instructions |
| 4366 | |
| 4367 | def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB; |
| 4368 | def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", []>, TB; |
| 4369 | |
| 4370 | // VMX instructions |
| 4371 | |
| 4372 | // 66 0F 38 80 |
Sean Callanan | 95a5a7d | 2010-02-13 01:48:34 +0000 | [diff] [blame] | 4373 | def INVEPT : I<0x80, RawFrm, (outs), (ins), "invept", []>, OpSize, T8; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4374 | // 66 0F 38 81 |
Sean Callanan | 95a5a7d | 2010-02-13 01:48:34 +0000 | [diff] [blame] | 4375 | def INVVPID : I<0x81, RawFrm, (outs), (ins), "invvpid", []>, OpSize, T8; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4376 | // 0F 01 C1 |
Chris Lattner | fdfeb69 | 2010-02-12 20:49:41 +0000 | [diff] [blame] | 4377 | def VMCALL : I<0x01, MRM_C1, (outs), (ins), "vmcall", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4378 | def VMCLEARm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs), |
| 4379 | "vmclear\t$vmcs", []>, OpSize, TB; |
| 4380 | // 0F 01 C2 |
Chris Lattner | a599de2 | 2010-02-13 00:41:14 +0000 | [diff] [blame] | 4381 | def VMLAUNCH : I<0x01, MRM_C2, (outs), (ins), "vmlaunch", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4382 | // 0F 01 C3 |
Chris Lattner | a599de2 | 2010-02-13 00:41:14 +0000 | [diff] [blame] | 4383 | def VMRESUME : I<0x01, MRM_C3, (outs), (ins), "vmresume", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4384 | def VMPTRLDm : I<0xC7, MRM6m, (outs), (ins i64mem:$vmcs), |
| 4385 | "vmptrld\t$vmcs", []>, TB; |
| 4386 | def VMPTRSTm : I<0xC7, MRM7m, (outs i64mem:$vmcs), (ins), |
| 4387 | "vmptrst\t$vmcs", []>, TB; |
| 4388 | def VMREAD64rm : I<0x78, MRMDestMem, (outs i64mem:$dst), (ins GR64:$src), |
| 4389 | "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4390 | def VMREAD64rr : I<0x78, MRMDestReg, (outs GR64:$dst), (ins GR64:$src), |
| 4391 | "vmread{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4392 | def VMREAD32rm : I<0x78, MRMDestMem, (outs i32mem:$dst), (ins GR32:$src), |
| 4393 | "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4394 | def VMREAD32rr : I<0x78, MRMDestReg, (outs GR32:$dst), (ins GR32:$src), |
| 4395 | "vmread{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4396 | def VMWRITE64rm : I<0x79, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), |
| 4397 | "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4398 | def VMWRITE64rr : I<0x79, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), |
| 4399 | "vmwrite{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4400 | def VMWRITE32rm : I<0x79, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
| 4401 | "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4402 | def VMWRITE32rr : I<0x79, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 4403 | "vmwrite{l}\t{$src, $dst|$dst, $src}", []>, TB; |
| 4404 | // 0F 01 C4 |
Chris Lattner | a599de2 | 2010-02-13 00:41:14 +0000 | [diff] [blame] | 4405 | def VMXOFF : I<0x01, MRM_C4, (outs), (ins), "vmxoff", []>, TB; |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4406 | def VMXON : I<0xC7, MRM6m, (outs), (ins i64mem:$vmxon), |
Kevin Enderby | 0e82240 | 2010-03-08 22:17:26 +0000 | [diff] [blame] | 4407 | "vmxon\t{$vmxon}", []>, XS; |
Sean Callanan | 358f1ef | 2009-09-16 21:55:34 +0000 | [diff] [blame] | 4408 | |
Andrew Lenharth | ab0b949 | 2008-02-21 06:45:13 +0000 | [diff] [blame] | 4409 | //===----------------------------------------------------------------------===// |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4410 | // Non-Instruction Patterns |
| 4411 | //===----------------------------------------------------------------------===// |
| 4412 | |
Bill Wendling | 056292f | 2008-09-16 21:48:12 +0000 | [diff] [blame] | 4413 | // ConstantPool GlobalAddress, ExternalSymbol, and JumpTable |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4414 | def : Pat<(i32 (X86Wrapper tconstpool :$dst)), (MOV32ri tconstpool :$dst)>; |
Nate Begeman | 37efe67 | 2006-04-22 18:53:45 +0000 | [diff] [blame] | 4415 | def : Pat<(i32 (X86Wrapper tjumptable :$dst)), (MOV32ri tjumptable :$dst)>; |
Nate Begeman | 6795ebb | 2008-04-12 00:47:57 +0000 | [diff] [blame] | 4416 | def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4417 | def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>; |
| 4418 | def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4419 | def : Pat<(i32 (X86Wrapper tblockaddress:$dst)), (MOV32ri tblockaddress:$dst)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4420 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4421 | def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)), |
| 4422 | (ADD32ri GR32:$src1, tconstpool:$src2)>; |
| 4423 | def : Pat<(add GR32:$src1, (X86Wrapper tjumptable:$src2)), |
| 4424 | (ADD32ri GR32:$src1, tjumptable:$src2)>; |
| 4425 | def : Pat<(add GR32:$src1, (X86Wrapper tglobaladdr :$src2)), |
| 4426 | (ADD32ri GR32:$src1, tglobaladdr:$src2)>; |
| 4427 | def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)), |
| 4428 | (ADD32ri GR32:$src1, texternalsym:$src2)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4429 | def : Pat<(add GR32:$src1, (X86Wrapper tblockaddress:$src2)), |
| 4430 | (ADD32ri GR32:$src1, tblockaddress:$src2)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4431 | |
Evan Cheng | fc8feb1 | 2006-05-19 07:30:36 +0000 | [diff] [blame] | 4432 | def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst), |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4433 | (MOV32mi addr:$dst, tglobaladdr:$src)>; |
Evan Cheng | fc8feb1 | 2006-05-19 07:30:36 +0000 | [diff] [blame] | 4434 | def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst), |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4435 | (MOV32mi addr:$dst, texternalsym:$src)>; |
Dan Gohman | f705adb | 2009-10-30 01:28:02 +0000 | [diff] [blame] | 4436 | def : Pat<(store (i32 (X86Wrapper tblockaddress:$src)), addr:$dst), |
| 4437 | (MOV32mi addr:$dst, tblockaddress:$src)>; |
Evan Cheng | 71fb834 | 2006-02-25 10:02:21 +0000 | [diff] [blame] | 4438 | |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4439 | // Calls |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 4440 | // tailcall stuff |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 4441 | def : Pat<(X86tcret GR32_TC:$dst, imm:$off), |
| 4442 | (TCRETURNri GR32_TC:$dst, imm:$off)>, |
| 4443 | Requires<[In32BitMode]>; |
| 4444 | |
Evan Cheng | cb0f06e | 2010-03-25 00:10:31 +0000 | [diff] [blame] | 4445 | // FIXME: This is disabled for 32-bit PIC mode because the global base |
| 4446 | // register which is part of the address mode may be assigned a |
| 4447 | // callee-saved register. |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 4448 | def : Pat<(X86tcret (load addr:$dst), imm:$off), |
| 4449 | (TCRETURNmi addr:$dst, imm:$off)>, |
Evan Cheng | cb0f06e | 2010-03-25 00:10:31 +0000 | [diff] [blame] | 4450 | Requires<[In32BitMode, IsNotPIC]>; |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 4451 | |
| 4452 | def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 4453 | (TCRETURNdi texternalsym:$dst, imm:$off)>, |
| 4454 | Requires<[In32BitMode]>; |
Arnold Schwaighofer | c85e171 | 2007-10-11 19:40:01 +0000 | [diff] [blame] | 4455 | |
| 4456 | def : Pat<(X86tcret (i32 texternalsym:$dst), imm:$off), |
Evan Cheng | f48ef03 | 2010-03-14 03:48:46 +0000 | [diff] [blame] | 4457 | (TCRETURNdi texternalsym:$dst, imm:$off)>, |
| 4458 | Requires<[In32BitMode]>; |
Evan Cheng | fea89c1 | 2006-04-27 08:40:39 +0000 | [diff] [blame] | 4459 | |
Dan Gohman | cadb226 | 2009-08-02 16:10:01 +0000 | [diff] [blame] | 4460 | // Normal calls, with various flavors of addresses. |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 4461 | def : Pat<(X86call (i32 tglobaladdr:$dst)), |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4462 | (CALLpcrel32 tglobaladdr:$dst)>; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 4463 | def : Pat<(X86call (i32 texternalsym:$dst)), |
Evan Cheng | 8700e14 | 2006-01-11 06:09:51 +0000 | [diff] [blame] | 4464 | (CALLpcrel32 texternalsym:$dst)>; |
Evan Cheng | d7f666a | 2009-05-20 04:53:57 +0000 | [diff] [blame] | 4465 | def : Pat<(X86call (i32 imm:$dst)), |
| 4466 | (CALLpcrel32 imm:$dst)>, Requires<[CallImmAddr]>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4467 | |
| 4468 | // X86 specific add which produces a flag. |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4469 | def : Pat<(addc GR32:$src1, GR32:$src2), |
| 4470 | (ADD32rr GR32:$src1, GR32:$src2)>; |
| 4471 | def : Pat<(addc GR32:$src1, (load addr:$src2)), |
| 4472 | (ADD32rm GR32:$src1, addr:$src2)>; |
| 4473 | def : Pat<(addc GR32:$src1, imm:$src2), |
| 4474 | (ADD32ri GR32:$src1, imm:$src2)>; |
| 4475 | def : Pat<(addc GR32:$src1, i32immSExt8:$src2), |
| 4476 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4477 | |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4478 | def : Pat<(subc GR32:$src1, GR32:$src2), |
| 4479 | (SUB32rr GR32:$src1, GR32:$src2)>; |
| 4480 | def : Pat<(subc GR32:$src1, (load addr:$src2)), |
| 4481 | (SUB32rm GR32:$src1, addr:$src2)>; |
| 4482 | def : Pat<(subc GR32:$src1, imm:$src2), |
| 4483 | (SUB32ri GR32:$src1, imm:$src2)>; |
| 4484 | def : Pat<(subc GR32:$src1, i32immSExt8:$src2), |
| 4485 | (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4486 | |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4487 | // Comparisons. |
| 4488 | |
| 4489 | // TEST R,R is smaller than CMP R,0 |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 4490 | def : Pat<(X86cmp GR8:$src1, 0), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4491 | (TEST8rr GR8:$src1, GR8:$src1)>; |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 4492 | def : Pat<(X86cmp GR16:$src1, 0), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4493 | (TEST16rr GR16:$src1, GR16:$src1)>; |
Chris Lattner | e3486a4 | 2010-03-19 00:01:11 +0000 | [diff] [blame] | 4494 | def : Pat<(X86cmp GR32:$src1, 0), |
Chris Lattner | ffc0b26 | 2006-09-07 20:33:45 +0000 | [diff] [blame] | 4495 | (TEST32rr GR32:$src1, GR32:$src1)>; |
| 4496 | |
Dan Gohman | fbb7486 | 2009-01-07 01:00:24 +0000 | [diff] [blame] | 4497 | // Conditional moves with folded loads with operands swapped and conditions |
| 4498 | // inverted. |
| 4499 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_B, EFLAGS), |
| 4500 | (CMOVAE16rm GR16:$src2, addr:$src1)>; |
| 4501 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_B, EFLAGS), |
| 4502 | (CMOVAE32rm GR32:$src2, addr:$src1)>; |
| 4503 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_AE, EFLAGS), |
| 4504 | (CMOVB16rm GR16:$src2, addr:$src1)>; |
| 4505 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_AE, EFLAGS), |
| 4506 | (CMOVB32rm GR32:$src2, addr:$src1)>; |
| 4507 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_E, EFLAGS), |
| 4508 | (CMOVNE16rm GR16:$src2, addr:$src1)>; |
| 4509 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_E, EFLAGS), |
| 4510 | (CMOVNE32rm GR32:$src2, addr:$src1)>; |
| 4511 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NE, EFLAGS), |
| 4512 | (CMOVE16rm GR16:$src2, addr:$src1)>; |
| 4513 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NE, EFLAGS), |
| 4514 | (CMOVE32rm GR32:$src2, addr:$src1)>; |
| 4515 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_BE, EFLAGS), |
| 4516 | (CMOVA16rm GR16:$src2, addr:$src1)>; |
| 4517 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_BE, EFLAGS), |
| 4518 | (CMOVA32rm GR32:$src2, addr:$src1)>; |
| 4519 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_A, EFLAGS), |
| 4520 | (CMOVBE16rm GR16:$src2, addr:$src1)>; |
| 4521 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_A, EFLAGS), |
| 4522 | (CMOVBE32rm GR32:$src2, addr:$src1)>; |
| 4523 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_L, EFLAGS), |
| 4524 | (CMOVGE16rm GR16:$src2, addr:$src1)>; |
| 4525 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_L, EFLAGS), |
| 4526 | (CMOVGE32rm GR32:$src2, addr:$src1)>; |
| 4527 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_GE, EFLAGS), |
| 4528 | (CMOVL16rm GR16:$src2, addr:$src1)>; |
| 4529 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_GE, EFLAGS), |
| 4530 | (CMOVL32rm GR32:$src2, addr:$src1)>; |
| 4531 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_LE, EFLAGS), |
| 4532 | (CMOVG16rm GR16:$src2, addr:$src1)>; |
| 4533 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_LE, EFLAGS), |
| 4534 | (CMOVG32rm GR32:$src2, addr:$src1)>; |
| 4535 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_G, EFLAGS), |
| 4536 | (CMOVLE16rm GR16:$src2, addr:$src1)>; |
| 4537 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_G, EFLAGS), |
| 4538 | (CMOVLE32rm GR32:$src2, addr:$src1)>; |
| 4539 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_P, EFLAGS), |
| 4540 | (CMOVNP16rm GR16:$src2, addr:$src1)>; |
| 4541 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_P, EFLAGS), |
| 4542 | (CMOVNP32rm GR32:$src2, addr:$src1)>; |
| 4543 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NP, EFLAGS), |
| 4544 | (CMOVP16rm GR16:$src2, addr:$src1)>; |
| 4545 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NP, EFLAGS), |
| 4546 | (CMOVP32rm GR32:$src2, addr:$src1)>; |
| 4547 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_S, EFLAGS), |
| 4548 | (CMOVNS16rm GR16:$src2, addr:$src1)>; |
| 4549 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_S, EFLAGS), |
| 4550 | (CMOVNS32rm GR32:$src2, addr:$src1)>; |
| 4551 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NS, EFLAGS), |
| 4552 | (CMOVS16rm GR16:$src2, addr:$src1)>; |
| 4553 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NS, EFLAGS), |
| 4554 | (CMOVS32rm GR32:$src2, addr:$src1)>; |
| 4555 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_O, EFLAGS), |
| 4556 | (CMOVNO16rm GR16:$src2, addr:$src1)>; |
| 4557 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_O, EFLAGS), |
| 4558 | (CMOVNO32rm GR32:$src2, addr:$src1)>; |
| 4559 | def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, X86_COND_NO, EFLAGS), |
| 4560 | (CMOVO16rm GR16:$src2, addr:$src1)>; |
| 4561 | def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, X86_COND_NO, EFLAGS), |
| 4562 | (CMOVO32rm GR32:$src2, addr:$src1)>; |
| 4563 | |
Duncan Sands | f9c98e6 | 2008-01-23 20:39:46 +0000 | [diff] [blame] | 4564 | // zextload bool -> zextload byte |
Evan Cheng | e5d9343 | 2006-01-17 07:02:46 +0000 | [diff] [blame] | 4565 | def : Pat<(zextloadi8i1 addr:$src), (MOV8rm addr:$src)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4566 | def : Pat<(zextloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; |
| 4567 | def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; |
| 4568 | |
| 4569 | // extload bool -> extload byte |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4570 | def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4571 | def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4572 | def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4573 | def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>; |
Evan Cheng | 4713724 | 2006-05-05 08:23:07 +0000 | [diff] [blame] | 4574 | def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>; |
| 4575 | def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>; |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4576 | |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4577 | // anyext. Define these to do an explicit zero-extend to |
| 4578 | // avoid partial-register updates. |
| 4579 | def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>; |
| 4580 | def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>; |
Evan Cheng | 5528e7b | 2010-04-21 01:47:12 +0000 | [diff] [blame] | 4581 | |
Evan Cheng | 2bce5f4b | 2010-04-28 08:30:49 +0000 | [diff] [blame] | 4582 | // Except for i16 -> i32 since isel expect i16 ops to be promoted to i32. |
Evan Cheng | 5528e7b | 2010-04-21 01:47:12 +0000 | [diff] [blame] | 4583 | def : Pat<(i32 (anyext GR16:$src)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4584 | (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR16:$src, sub_16bit)>; |
Evan Cheng | 5528e7b | 2010-04-21 01:47:12 +0000 | [diff] [blame] | 4585 | |
Evan Cheng | 510e478 | 2006-01-09 23:10:28 +0000 | [diff] [blame] | 4586 | |
Evan Cheng | cfa260b | 2006-01-06 02:31:59 +0000 | [diff] [blame] | 4587 | //===----------------------------------------------------------------------===// |
| 4588 | // Some peepholes |
| 4589 | //===----------------------------------------------------------------------===// |
| 4590 | |
Dan Gohman | 63f9720 | 2008-10-17 01:33:43 +0000 | [diff] [blame] | 4591 | // Odd encoding trick: -128 fits into an 8-bit immediate field while |
| 4592 | // +128 doesn't, so in this special case use a sub instead of an add. |
| 4593 | def : Pat<(add GR16:$src1, 128), |
| 4594 | (SUB16ri8 GR16:$src1, -128)>; |
| 4595 | def : Pat<(store (add (loadi16 addr:$dst), 128), addr:$dst), |
| 4596 | (SUB16mi8 addr:$dst, -128)>; |
| 4597 | def : Pat<(add GR32:$src1, 128), |
| 4598 | (SUB32ri8 GR32:$src1, -128)>; |
| 4599 | def : Pat<(store (add (loadi32 addr:$dst), 128), addr:$dst), |
| 4600 | (SUB32mi8 addr:$dst, -128)>; |
| 4601 | |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 4602 | // r & (2^16-1) ==> movz |
| 4603 | def : Pat<(and GR32:$src1, 0xffff), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4604 | (MOVZX32rr16 (EXTRACT_SUBREG GR32:$src1, sub_16bit))>; |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4605 | // r & (2^8-1) ==> movz |
| 4606 | def : Pat<(and GR32:$src1, 0xff), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4607 | (MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src1, |
| 4608 | GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4609 | sub_8bit))>, |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4610 | Requires<[In32BitMode]>; |
| 4611 | // r & (2^8-1) ==> movz |
| 4612 | def : Pat<(and GR16:$src1, 0xff), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4613 | (MOVZX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src1, |
| 4614 | GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4615 | sub_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4616 | Requires<[In32BitMode]>; |
| 4617 | |
| 4618 | // sext_inreg patterns |
| 4619 | def : Pat<(sext_inreg GR32:$src, i16), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4620 | (MOVSX32rr16 (EXTRACT_SUBREG GR32:$src, sub_16bit))>; |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4621 | def : Pat<(sext_inreg GR32:$src, i8), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4622 | (MOVSX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, |
| 4623 | GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4624 | sub_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4625 | Requires<[In32BitMode]>; |
| 4626 | def : Pat<(sext_inreg GR16:$src, i8), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4627 | (MOVSX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4628 | GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4629 | sub_8bit))>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4630 | Requires<[In32BitMode]>; |
| 4631 | |
| 4632 | // trunc patterns |
| 4633 | def : Pat<(i16 (trunc GR32:$src)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4634 | (EXTRACT_SUBREG GR32:$src, sub_16bit)>; |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4635 | def : Pat<(i8 (trunc GR32:$src)), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4636 | (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4637 | sub_8bit)>, |
Dan Gohman | 0bfa1bf | 2008-08-20 21:27:32 +0000 | [diff] [blame] | 4638 | Requires<[In32BitMode]>; |
| 4639 | def : Pat<(i8 (trunc GR16:$src)), |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4640 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4641 | sub_8bit)>, |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4642 | Requires<[In32BitMode]>; |
| 4643 | |
| 4644 | // h-register tricks |
| 4645 | def : Pat<(i8 (trunc (srl_su GR16:$src, (i8 8)))), |
Evan Cheng | 1c45acf | 2010-04-27 21:46:03 +0000 | [diff] [blame] | 4646 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4647 | sub_8bit_hi)>, |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4648 | Requires<[In32BitMode]>; |
| 4649 | def : Pat<(i8 (trunc (srl_su GR32:$src, (i8 8)))), |
Evan Cheng | 1c45acf | 2010-04-27 21:46:03 +0000 | [diff] [blame] | 4650 | (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4651 | sub_8bit_hi)>, |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4652 | Requires<[In32BitMode]>; |
Dan Gohman | 7e0d64a | 2010-01-11 17:21:05 +0000 | [diff] [blame] | 4653 | def : Pat<(srl GR16:$src, (i8 8)), |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4654 | (EXTRACT_SUBREG |
| 4655 | (MOVZX32rr8 |
Anton Korobeynikov | 3a639a0 | 2009-11-02 00:11:39 +0000 | [diff] [blame] | 4656 | (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4657 | sub_8bit_hi)), |
| 4658 | sub_16bit)>, |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4659 | Requires<[In32BitMode]>; |
Evan Cheng | cb219f0 | 2009-05-29 01:44:43 +0000 | [diff] [blame] | 4660 | def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4661 | (MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4662 | GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4663 | sub_8bit_hi))>, |
Evan Cheng | cb219f0 | 2009-05-29 01:44:43 +0000 | [diff] [blame] | 4664 | Requires<[In32BitMode]>; |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4665 | def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4666 | (MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, |
| 4667 | GR16_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4668 | sub_8bit_hi))>, |
Dan Gohman | af70e5c | 2009-08-26 14:59:13 +0000 | [diff] [blame] | 4669 | Requires<[In32BitMode]>; |
Dan Gohman | 21e3dfb | 2009-04-13 16:09:41 +0000 | [diff] [blame] | 4670 | def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)), |
Sean Callanan | 108934c | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 4671 | (MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, |
| 4672 | GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4673 | sub_8bit_hi))>, |
Dan Gohman | 8a1510d | 2008-08-06 18:27:21 +0000 | [diff] [blame] | 4674 | Requires<[In32BitMode]>; |
Evan Cheng | 2bce5f4b | 2010-04-28 08:30:49 +0000 | [diff] [blame] | 4675 | def : Pat<(srl (and_su GR32:$src, 0xff00), (i8 8)), |
| 4676 | (MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, |
| 4677 | GR32_ABCD)), |
Jakob Stoklund Olesen | 3458e9e | 2010-05-24 14:48:17 +0000 | [diff] [blame] | 4678 | sub_8bit_hi))>, |
Evan Cheng | 2bce5f4b | 2010-04-28 08:30:49 +0000 | [diff] [blame] | 4679 | Requires<[In32BitMode]>; |
Dan Gohman | 11ba3b1 | 2008-07-30 18:09:17 +0000 | [diff] [blame] | 4680 | |
Evan Cheng | cfa260b | 2006-01-06 02:31:59 +0000 | [diff] [blame] | 4681 | // (shl x, 1) ==> (add x, x) |
Evan Cheng | 069287d | 2006-05-16 07:21:53 +0000 | [diff] [blame] | 4682 | def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr GR8 :$src1, GR8 :$src1)>; |
| 4683 | def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>; |
| 4684 | def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>; |
Evan Cheng | 68b951a | 2006-01-19 01:56:29 +0000 | [diff] [blame] | 4685 | |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4686 | // (shl x (and y, 31)) ==> (shl x, y) |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4687 | def : Pat<(shl GR8:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4688 | (SHL8rCL GR8:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4689 | def : Pat<(shl GR16:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4690 | (SHL16rCL GR16:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4691 | def : Pat<(shl GR32:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4692 | (SHL32rCL GR32:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4693 | def : Pat<(store (shl (loadi8 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4694 | (SHL8mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4695 | def : Pat<(store (shl (loadi16 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4696 | (SHL16mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4697 | def : Pat<(store (shl (loadi32 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4698 | (SHL32mCL addr:$dst)>; |
| 4699 | |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4700 | def : Pat<(srl GR8:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4701 | (SHR8rCL GR8:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4702 | def : Pat<(srl GR16:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4703 | (SHR16rCL GR16:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4704 | def : Pat<(srl GR32:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4705 | (SHR32rCL GR32:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4706 | def : Pat<(store (srl (loadi8 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4707 | (SHR8mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4708 | def : Pat<(store (srl (loadi16 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4709 | (SHR16mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4710 | def : Pat<(store (srl (loadi32 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4711 | (SHR32mCL addr:$dst)>; |
| 4712 | |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4713 | def : Pat<(sra GR8:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4714 | (SAR8rCL GR8:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4715 | def : Pat<(sra GR16:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4716 | (SAR16rCL GR16:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4717 | def : Pat<(sra GR32:$src1, (and CL, 31)), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4718 | (SAR32rCL GR32:$src1)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4719 | def : Pat<(store (sra (loadi8 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4720 | (SAR8mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4721 | def : Pat<(store (sra (loadi16 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4722 | (SAR16mCL addr:$dst)>; |
Chris Lattner | 6d9f86b | 2010-02-23 06:54:29 +0000 | [diff] [blame] | 4723 | def : Pat<(store (sra (loadi32 addr:$dst), (and CL, 31)), addr:$dst), |
Evan Cheng | eb9f892 | 2008-08-30 02:03:58 +0000 | [diff] [blame] | 4724 | (SAR32mCL addr:$dst)>; |
| 4725 | |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 4726 | // (anyext (setcc_carry)) -> (setcc_carry) |
| 4727 | def : Pat<(i16 (anyext (i8 (X86setcc_c X86_COND_B, EFLAGS)))), |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 4728 | (SETB_C16r)>; |
Evan Cheng | 2e489c4 | 2009-12-16 00:53:11 +0000 | [diff] [blame] | 4729 | def : Pat<(i32 (anyext (i8 (X86setcc_c X86_COND_B, EFLAGS)))), |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 4730 | (SETB_C32r)>; |
Evan Cheng | e5b51ac | 2010-04-17 06:13:15 +0000 | [diff] [blame] | 4731 | def : Pat<(i32 (anyext (i16 (X86setcc_c X86_COND_B, EFLAGS)))), |
| 4732 | (SETB_C32r)>; |
Evan Cheng | ad9c0a3 | 2009-12-15 00:53:42 +0000 | [diff] [blame] | 4733 | |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 4734 | // (or x1, x2) -> (add x1, x2) if two operands are known not to share bits. |
Evan Cheng | 3bda201 | 2010-01-12 18:31:19 +0000 | [diff] [blame] | 4735 | let AddedComplexity = 5 in { // Try this before the selecting to OR |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4736 | def : Pat<(or_is_add GR16:$src1, imm:$src2), |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4737 | (ADD16ri GR16:$src1, imm:$src2)>; |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4738 | def : Pat<(or_is_add GR32:$src1, imm:$src2), |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4739 | (ADD32ri GR32:$src1, imm:$src2)>; |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4740 | def : Pat<(or_is_add GR16:$src1, i16immSExt8:$src2), |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4741 | (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4742 | def : Pat<(or_is_add GR32:$src1, i32immSExt8:$src2), |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4743 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4744 | def : Pat<(or_is_add GR16:$src1, GR16:$src2), |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 4745 | (ADD16rr GR16:$src1, GR16:$src2)>; |
Chris Lattner | a0f7017 | 2010-03-24 00:15:23 +0000 | [diff] [blame] | 4746 | def : Pat<(or_is_add GR32:$src1, GR32:$src2), |
Evan Cheng | 199c424 | 2010-01-11 22:03:29 +0000 | [diff] [blame] | 4747 | (ADD32rr GR32:$src1, GR32:$src2)>; |
Evan Cheng | 3bda201 | 2010-01-12 18:31:19 +0000 | [diff] [blame] | 4748 | } // AddedComplexity |
Evan Cheng | 4b0345b | 2010-01-11 17:03:47 +0000 | [diff] [blame] | 4749 | |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 4750 | //===----------------------------------------------------------------------===// |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4751 | // EFLAGS-defining Patterns |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4752 | //===----------------------------------------------------------------------===// |
| 4753 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4754 | // add reg, reg |
| 4755 | def : Pat<(add GR8 :$src1, GR8 :$src2), (ADD8rr GR8 :$src1, GR8 :$src2)>; |
| 4756 | def : Pat<(add GR16:$src1, GR16:$src2), (ADD16rr GR16:$src1, GR16:$src2)>; |
| 4757 | def : Pat<(add GR32:$src1, GR32:$src2), (ADD32rr GR32:$src1, GR32:$src2)>; |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4758 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4759 | // add reg, mem |
| 4760 | def : Pat<(add GR8:$src1, (loadi8 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4761 | (ADD8rm GR8:$src1, addr:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4762 | def : Pat<(add GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4763 | (ADD16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4764 | def : Pat<(add GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4765 | (ADD32rm GR32:$src1, addr:$src2)>; |
| 4766 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4767 | // add reg, imm |
| 4768 | def : Pat<(add GR8 :$src1, imm:$src2), (ADD8ri GR8:$src1 , imm:$src2)>; |
| 4769 | def : Pat<(add GR16:$src1, imm:$src2), (ADD16ri GR16:$src1, imm:$src2)>; |
| 4770 | def : Pat<(add GR32:$src1, imm:$src2), (ADD32ri GR32:$src1, imm:$src2)>; |
| 4771 | def : Pat<(add GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4772 | (ADD16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4773 | def : Pat<(add GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4774 | (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4775 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4776 | // sub reg, reg |
| 4777 | def : Pat<(sub GR8 :$src1, GR8 :$src2), (SUB8rr GR8 :$src1, GR8 :$src2)>; |
| 4778 | def : Pat<(sub GR16:$src1, GR16:$src2), (SUB16rr GR16:$src1, GR16:$src2)>; |
| 4779 | def : Pat<(sub GR32:$src1, GR32:$src2), (SUB32rr GR32:$src1, GR32:$src2)>; |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4780 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4781 | // sub reg, mem |
| 4782 | def : Pat<(sub GR8:$src1, (loadi8 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4783 | (SUB8rm GR8:$src1, addr:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4784 | def : Pat<(sub GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4785 | (SUB16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4786 | def : Pat<(sub GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4787 | (SUB32rm GR32:$src1, addr:$src2)>; |
| 4788 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4789 | // sub reg, imm |
| 4790 | def : Pat<(sub GR8:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4791 | (SUB8ri GR8:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4792 | def : Pat<(sub GR16:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4793 | (SUB16ri GR16:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4794 | def : Pat<(sub GR32:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4795 | (SUB32ri GR32:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4796 | def : Pat<(sub GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4797 | (SUB16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4798 | def : Pat<(sub GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4799 | (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4800 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4801 | // mul reg, reg |
| 4802 | def : Pat<(mul GR16:$src1, GR16:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4803 | (IMUL16rr GR16:$src1, GR16:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4804 | def : Pat<(mul GR32:$src1, GR32:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4805 | (IMUL32rr GR32:$src1, GR32:$src2)>; |
| 4806 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4807 | // mul reg, mem |
| 4808 | def : Pat<(mul GR16:$src1, (loadi16 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4809 | (IMUL16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4810 | def : Pat<(mul GR32:$src1, (loadi32 addr:$src2)), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4811 | (IMUL32rm GR32:$src1, addr:$src2)>; |
| 4812 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4813 | // mul reg, imm |
| 4814 | def : Pat<(mul GR16:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4815 | (IMUL16rri GR16:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4816 | def : Pat<(mul GR32:$src1, imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4817 | (IMUL32rri GR32:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4818 | def : Pat<(mul GR16:$src1, i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4819 | (IMUL16rri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4820 | def : Pat<(mul GR32:$src1, i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4821 | (IMUL32rri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4822 | |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4823 | // reg = mul mem, imm |
| 4824 | def : Pat<(mul (loadi16 addr:$src1), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4825 | (IMUL16rmi addr:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4826 | def : Pat<(mul (loadi32 addr:$src1), imm:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4827 | (IMUL32rmi addr:$src1, imm:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4828 | def : Pat<(mul (loadi16 addr:$src1), i16immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4829 | (IMUL16rmi8 addr:$src1, i16immSExt8:$src2)>; |
Chris Lattner | ec85680 | 2010-03-27 00:45:04 +0000 | [diff] [blame] | 4830 | def : Pat<(mul (loadi32 addr:$src1), i32immSExt8:$src2), |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4831 | (IMUL32rmi8 addr:$src1, i32immSExt8:$src2)>; |
| 4832 | |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4833 | // Optimize multiply by 2 with EFLAGS result. |
Evan Cheng | 6a86bd7 | 2009-01-27 03:30:42 +0000 | [diff] [blame] | 4834 | let AddedComplexity = 2 in { |
Chris Lattner | baba4bb | 2010-03-27 02:47:14 +0000 | [diff] [blame] | 4835 | def : Pat<(X86smul_flag GR16:$src1, 2), (ADD16rr GR16:$src1, GR16:$src1)>; |
| 4836 | def : Pat<(X86smul_flag GR32:$src1, 2), (ADD32rr GR32:$src1, GR32:$src1)>; |
Evan Cheng | 6a86bd7 | 2009-01-27 03:30:42 +0000 | [diff] [blame] | 4837 | } |
| 4838 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4839 | // Patterns for nodes that do not produce flags, for instructions that do. |
Chris Lattner | c54a2f1 | 2010-03-24 01:02:12 +0000 | [diff] [blame] | 4840 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4841 | // Increment reg. |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 4842 | def : Pat<(add GR8:$src1 , 1), (INC8r GR8:$src1)>; |
| 4843 | def : Pat<(add GR16:$src1, 1), (INC16r GR16:$src1)>, Requires<[In32BitMode]>; |
| 4844 | def : Pat<(add GR32:$src1, 1), (INC32r GR32:$src1)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4845 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4846 | // Decrement reg. |
Eric Christopher | a938cfb | 2010-06-19 00:37:40 +0000 | [diff] [blame] | 4847 | def : Pat<(add GR8:$src1 , -1), (DEC8r GR8:$src1)>; |
| 4848 | def : Pat<(add GR16:$src1, -1), (DEC16r GR16:$src1)>, Requires<[In32BitMode]>; |
| 4849 | def : Pat<(add GR32:$src1, -1), (DEC32r GR32:$src1)>, Requires<[In32BitMode]>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4850 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4851 | // or reg/reg. |
| 4852 | def : Pat<(or GR8 :$src1, GR8 :$src2), (OR8rr GR8 :$src1, GR8 :$src2)>; |
| 4853 | def : Pat<(or GR16:$src1, GR16:$src2), (OR16rr GR16:$src1, GR16:$src2)>; |
| 4854 | def : Pat<(or GR32:$src1, GR32:$src2), (OR32rr GR32:$src1, GR32:$src2)>; |
Dan Gohman | 076aee3 | 2009-03-04 19:44:21 +0000 | [diff] [blame] | 4855 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4856 | // or reg/mem |
| 4857 | def : Pat<(or GR8:$src1, (loadi8 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4858 | (OR8rm GR8:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4859 | def : Pat<(or GR16:$src1, (loadi16 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4860 | (OR16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4861 | def : Pat<(or GR32:$src1, (loadi32 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4862 | (OR32rm GR32:$src1, addr:$src2)>; |
| 4863 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4864 | // or reg/imm |
| 4865 | def : Pat<(or GR8:$src1 , imm:$src2), (OR8ri GR8 :$src1, imm:$src2)>; |
| 4866 | def : Pat<(or GR16:$src1, imm:$src2), (OR16ri GR16:$src1, imm:$src2)>; |
| 4867 | def : Pat<(or GR32:$src1, imm:$src2), (OR32ri GR32:$src1, imm:$src2)>; |
| 4868 | def : Pat<(or GR16:$src1, i16immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4869 | (OR16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4870 | def : Pat<(or GR32:$src1, i32immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4871 | (OR32ri8 GR32:$src1, i32immSExt8:$src2)>; |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4872 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4873 | // xor reg/reg |
| 4874 | def : Pat<(xor GR8 :$src1, GR8 :$src2), (XOR8rr GR8 :$src1, GR8 :$src2)>; |
| 4875 | def : Pat<(xor GR16:$src1, GR16:$src2), (XOR16rr GR16:$src1, GR16:$src2)>; |
| 4876 | def : Pat<(xor GR32:$src1, GR32:$src2), (XOR32rr GR32:$src1, GR32:$src2)>; |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4877 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4878 | // xor reg/mem |
| 4879 | def : Pat<(xor GR8:$src1, (loadi8 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4880 | (XOR8rm GR8:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4881 | def : Pat<(xor GR16:$src1, (loadi16 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4882 | (XOR16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4883 | def : Pat<(xor GR32:$src1, (loadi32 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4884 | (XOR32rm GR32:$src1, addr:$src2)>; |
| 4885 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4886 | // xor reg/imm |
| 4887 | def : Pat<(xor GR8:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4888 | (XOR8ri GR8:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4889 | def : Pat<(xor GR16:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4890 | (XOR16ri GR16:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4891 | def : Pat<(xor GR32:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4892 | (XOR32ri GR32:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4893 | def : Pat<(xor GR16:$src1, i16immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4894 | (XOR16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4895 | def : Pat<(xor GR32:$src1, i32immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4896 | (XOR32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4897 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4898 | // and reg/reg |
| 4899 | def : Pat<(and GR8 :$src1, GR8 :$src2), (AND8rr GR8 :$src1, GR8 :$src2)>; |
| 4900 | def : Pat<(and GR16:$src1, GR16:$src2), (AND16rr GR16:$src1, GR16:$src2)>; |
| 4901 | def : Pat<(and GR32:$src1, GR32:$src2), (AND32rr GR32:$src1, GR32:$src2)>; |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4902 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4903 | // and reg/mem |
| 4904 | def : Pat<(and GR8:$src1, (loadi8 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4905 | (AND8rm GR8:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4906 | def : Pat<(and GR16:$src1, (loadi16 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4907 | (AND16rm GR16:$src1, addr:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4908 | def : Pat<(and GR32:$src1, (loadi32 addr:$src2)), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4909 | (AND32rm GR32:$src1, addr:$src2)>; |
| 4910 | |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4911 | // and reg/imm |
| 4912 | def : Pat<(and GR8:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4913 | (AND8ri GR8:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4914 | def : Pat<(and GR16:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4915 | (AND16ri GR16:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4916 | def : Pat<(and GR32:$src1, imm:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4917 | (AND32ri GR32:$src1, imm:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4918 | def : Pat<(and GR16:$src1, i16immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4919 | (AND16ri8 GR16:$src1, i16immSExt8:$src2)>; |
Chris Lattner | 589ad5d | 2010-03-25 05:44:01 +0000 | [diff] [blame] | 4920 | def : Pat<(and GR32:$src1, i32immSExt8:$src2), |
Dan Gohman | e220c4b | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 4921 | (AND32ri8 GR32:$src1, i32immSExt8:$src2)>; |
| 4922 | |
Bill Wendling | d350e02 | 2008-12-12 21:15:41 +0000 | [diff] [blame] | 4923 | //===----------------------------------------------------------------------===// |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 4924 | // Floating Point Stack Support |
| 4925 | //===----------------------------------------------------------------------===// |
| 4926 | |
| 4927 | include "X86InstrFPStack.td" |
| 4928 | |
| 4929 | //===----------------------------------------------------------------------===// |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 4930 | // X86-64 Support |
| 4931 | //===----------------------------------------------------------------------===// |
| 4932 | |
Chris Lattner | 36fe6d2 | 2008-01-10 05:50:42 +0000 | [diff] [blame] | 4933 | include "X86Instr64bit.td" |
Evan Cheng | c64a1a9 | 2007-07-31 08:04:03 +0000 | [diff] [blame] | 4934 | |
| 4935 | //===----------------------------------------------------------------------===// |
David Greene | 51898d7 | 2010-02-09 23:52:19 +0000 | [diff] [blame] | 4936 | // SIMD support (SSE, MMX and AVX) |
| 4937 | //===----------------------------------------------------------------------===// |
| 4938 | |
| 4939 | include "X86InstrFragmentsSIMD.td" |
| 4940 | |
| 4941 | //===----------------------------------------------------------------------===// |
Evan Cheng | 4e4c71e | 2006-02-21 20:00:20 +0000 | [diff] [blame] | 4942 | // XMM Floating point support (requires SSE / SSE2) |
| 4943 | //===----------------------------------------------------------------------===// |
| 4944 | |
| 4945 | include "X86InstrSSE.td" |
Evan Cheng | 80f5404 | 2008-04-25 18:19:54 +0000 | [diff] [blame] | 4946 | |
| 4947 | //===----------------------------------------------------------------------===// |
| 4948 | // MMX and XMM Packed Integer support (requires MMX, SSE, and SSE2) |
| 4949 | //===----------------------------------------------------------------------===// |
| 4950 | |
| 4951 | include "X86InstrMMX.td" |