| 1 |
//===-- PPCInstrInfo.td - The PowerPC Instruction Set ------*- tablegen -*-===// |
| 2 |
// |
| 3 |
// The LLVM Compiler Infrastructure |
| 4 |
// |
| 5 |
// This file is distributed under the University of Illinois Open Source |
| 6 |
// License. See LICENSE.TXT for details. |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
// |
| 10 |
// This file describes the subset of the 32-bit PowerPC instruction set, as used |
| 11 |
// by the PowerPC instruction selector. |
| 12 |
// |
| 13 |
//===----------------------------------------------------------------------===// |
| 14 |
|
| 15 |
include "PPCInstrFormats.td" |
| 16 |
|
| 17 |
//===----------------------------------------------------------------------===// |
| 18 |
// PowerPC specific type constraints. |
| 19 |
// |
| 20 |
def SDT_PPCstfiwx : SDTypeProfile<0, 2, [ // stfiwx |
| 21 |
SDTCisVT<0, f64>, SDTCisPtrTy<1> |
| 22 |
]>; |
| 23 |
def SDT_PPClfiwx : SDTypeProfile<1, 1, [ // lfiw[az]x |
| 24 |
SDTCisVT<0, f64>, SDTCisPtrTy<1> |
| 25 |
]>; |
| 26 |
def SDT_PPCLxsizx : SDTypeProfile<1, 2, [ |
| 27 |
SDTCisVT<0, f64>, SDTCisPtrTy<1>, SDTCisPtrTy<2> |
| 28 |
]>; |
| 29 |
def SDT_PPCstxsix : SDTypeProfile<0, 3, [ |
| 30 |
SDTCisVT<0, f64>, SDTCisPtrTy<1>, SDTCisPtrTy<2> |
| 31 |
]>; |
| 32 |
def SDT_PPCcv_fp_to_int : SDTypeProfile<1, 1, [ |
| 33 |
SDTCisFP<0>, SDTCisFP<1> |
| 34 |
]>; |
| 35 |
def SDT_PPCstore_scal_int_from_vsr : SDTypeProfile<0, 3, [ |
| 36 |
SDTCisVT<0, f64>, SDTCisPtrTy<1>, SDTCisPtrTy<2> |
| 37 |
]>; |
| 38 |
def SDT_PPCVexts : SDTypeProfile<1, 2, [ |
| 39 |
SDTCisVT<0, f64>, SDTCisVT<1, f64>, SDTCisPtrTy<2> |
| 40 |
]>; |
| 41 |
def SDT_PPCSExtVElems : SDTypeProfile<1, 1, [ |
| 42 |
SDTCisVec<0>, SDTCisVec<1> |
| 43 |
]>; |
| 44 |
|
| 45 |
def SDT_PPCCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32>, |
| 46 |
SDTCisVT<1, i32> ]>; |
| 47 |
def SDT_PPCCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, |
| 48 |
SDTCisVT<1, i32> ]>; |
| 49 |
def SDT_PPCvperm : SDTypeProfile<1, 3, [ |
| 50 |
SDTCisVT<3, v16i8>, SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2> |
| 51 |
]>; |
| 52 |
|
| 53 |
def SDT_PPCVecSplat : SDTypeProfile<1, 2, [ SDTCisVec<0>, |
| 54 |
SDTCisVec<1>, SDTCisInt<2> |
| 55 |
]>; |
| 56 |
|
| 57 |
def SDT_PPCVecShift : SDTypeProfile<1, 3, [ SDTCisVec<0>, |
| 58 |
SDTCisVec<1>, SDTCisVec<2>, SDTCisPtrTy<3> |
| 59 |
]>; |
| 60 |
|
| 61 |
def SDT_PPCVecInsert : SDTypeProfile<1, 3, [ SDTCisVec<0>, |
| 62 |
SDTCisVec<1>, SDTCisVec<2>, SDTCisInt<3> |
| 63 |
]>; |
| 64 |
|
| 65 |
def SDT_PPCVecReverse: SDTypeProfile<1, 1, [ SDTCisVec<0>, |
| 66 |
SDTCisVec<1> |
| 67 |
]>; |
| 68 |
|
| 69 |
def SDT_PPCxxpermdi: SDTypeProfile<1, 3, [ SDTCisVec<0>, |
| 70 |
SDTCisVec<1>, SDTCisVec<2>, SDTCisInt<3> |
| 71 |
]>; |
| 72 |
|
| 73 |
def SDT_PPCvcmp : SDTypeProfile<1, 3, [ |
| 74 |
SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisVT<3, i32> |
| 75 |
]>; |
| 76 |
|
| 77 |
def SDT_PPCcondbr : SDTypeProfile<0, 3, [ |
| 78 |
SDTCisVT<0, i32>, SDTCisVT<2, OtherVT> |
| 79 |
]>; |
| 80 |
|
| 81 |
def SDT_PPClbrx : SDTypeProfile<1, 2, [ |
| 82 |
SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT> |
| 83 |
]>; |
| 84 |
def SDT_PPCstbrx : SDTypeProfile<0, 3, [ |
| 85 |
SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT> |
| 86 |
]>; |
| 87 |
|
| 88 |
def SDT_PPCTC_ret : SDTypeProfile<0, 2, [ |
| 89 |
SDTCisPtrTy<0>, SDTCisVT<1, i32> |
| 90 |
]>; |
| 91 |
|
| 92 |
def tocentry32 : Operand<iPTR> { |
| 93 |
let MIOperandInfo = (ops i32imm:$imm); |
| 94 |
} |
| 95 |
|
| 96 |
def SDT_PPCqvfperm : SDTypeProfile<1, 3, [ |
| 97 |
SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisVec<3> |
| 98 |
]>; |
| 99 |
def SDT_PPCqvgpci : SDTypeProfile<1, 1, [ |
| 100 |
SDTCisVec<0>, SDTCisInt<1> |
| 101 |
]>; |
| 102 |
def SDT_PPCqvaligni : SDTypeProfile<1, 3, [ |
| 103 |
SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<3> |
| 104 |
]>; |
| 105 |
def SDT_PPCqvesplati : SDTypeProfile<1, 2, [ |
| 106 |
SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisInt<2> |
| 107 |
]>; |
| 108 |
|
| 109 |
def SDT_PPCqbflt : SDTypeProfile<1, 1, [ |
| 110 |
SDTCisVec<0>, SDTCisVec<1> |
| 111 |
]>; |
| 112 |
|
| 113 |
def SDT_PPCqvlfsb : SDTypeProfile<1, 1, [ |
| 114 |
SDTCisVec<0>, SDTCisPtrTy<1> |
| 115 |
]>; |
| 116 |
|
| 117 |
//===----------------------------------------------------------------------===// |
| 118 |
// PowerPC specific DAG Nodes. |
| 119 |
// |
| 120 |
|
| 121 |
def PPCfre : SDNode<"PPCISD::FRE", SDTFPUnaryOp, []>; |
| 122 |
def PPCfrsqrte: SDNode<"PPCISD::FRSQRTE", SDTFPUnaryOp, []>; |
| 123 |
|
| 124 |
def PPCfcfid : SDNode<"PPCISD::FCFID", SDTFPUnaryOp, []>; |
| 125 |
def PPCfcfidu : SDNode<"PPCISD::FCFIDU", SDTFPUnaryOp, []>; |
| 126 |
def PPCfcfids : SDNode<"PPCISD::FCFIDS", SDTFPRoundOp, []>; |
| 127 |
def PPCfcfidus: SDNode<"PPCISD::FCFIDUS", SDTFPRoundOp, []>; |
| 128 |
def PPCfctidz : SDNode<"PPCISD::FCTIDZ", SDTFPUnaryOp, []>; |
| 129 |
def PPCfctiwz : SDNode<"PPCISD::FCTIWZ", SDTFPUnaryOp, []>; |
| 130 |
def PPCfctiduz: SDNode<"PPCISD::FCTIDUZ",SDTFPUnaryOp, []>; |
| 131 |
def PPCfctiwuz: SDNode<"PPCISD::FCTIWUZ",SDTFPUnaryOp, []>; |
| 132 |
|
| 133 |
def PPCcv_fp_to_uint_in_vsr: |
| 134 |
SDNode<"PPCISD::FP_TO_UINT_IN_VSR", SDT_PPCcv_fp_to_int, []>; |
| 135 |
def PPCcv_fp_to_sint_in_vsr: |
| 136 |
SDNode<"PPCISD::FP_TO_SINT_IN_VSR", SDT_PPCcv_fp_to_int, []>; |
| 137 |
def PPCstore_scal_int_from_vsr: |
| 138 |
SDNode<"PPCISD::ST_VSR_SCAL_INT", SDT_PPCstore_scal_int_from_vsr, |
| 139 |
[SDNPHasChain, SDNPMayStore]>; |
| 140 |
def PPCstfiwx : SDNode<"PPCISD::STFIWX", SDT_PPCstfiwx, |
| 141 |
[SDNPHasChain, SDNPMayStore]>; |
| 142 |
def PPClfiwax : SDNode<"PPCISD::LFIWAX", SDT_PPClfiwx, |
| 143 |
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; |
| 144 |
def PPClfiwzx : SDNode<"PPCISD::LFIWZX", SDT_PPClfiwx, |
| 145 |
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; |
| 146 |
def PPClxsizx : SDNode<"PPCISD::LXSIZX", SDT_PPCLxsizx, |
| 147 |
[SDNPHasChain, SDNPMayLoad]>; |
| 148 |
def PPCstxsix : SDNode<"PPCISD::STXSIX", SDT_PPCstxsix, |
| 149 |
[SDNPHasChain, SDNPMayStore]>; |
| 150 |
def PPCVexts : SDNode<"PPCISD::VEXTS", SDT_PPCVexts, []>; |
| 151 |
def PPCSExtVElems : SDNode<"PPCISD::SExtVElems", SDT_PPCSExtVElems, []>; |
| 152 |
|
| 153 |
// Extract FPSCR (not modeled at the DAG level). |
| 154 |
def PPCmffs : SDNode<"PPCISD::MFFS", |
| 155 |
SDTypeProfile<1, 0, [SDTCisVT<0, f64>]>, []>; |
| 156 |
|
| 157 |
// Perform FADD in round-to-zero mode. |
| 158 |
def PPCfaddrtz: SDNode<"PPCISD::FADDRTZ", SDTFPBinOp, []>; |
| 159 |
|
| 160 |
|
| 161 |
def PPCfsel : SDNode<"PPCISD::FSEL", |
| 162 |
// Type constraint for fsel. |
| 163 |
SDTypeProfile<1, 3, [SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, |
| 164 |
SDTCisFP<0>, SDTCisVT<1, f64>]>, []>; |
| 165 |
|
| 166 |
def PPChi : SDNode<"PPCISD::Hi", SDTIntBinOp, []>; |
| 167 |
def PPClo : SDNode<"PPCISD::Lo", SDTIntBinOp, []>; |
| 168 |
def PPCtoc_entry: SDNode<"PPCISD::TOC_ENTRY", SDTIntBinOp, |
| 169 |
[SDNPMayLoad, SDNPMemOperand]>; |
| 170 |
def PPCvmaddfp : SDNode<"PPCISD::VMADDFP", SDTFPTernaryOp, []>; |
| 171 |
def PPCvnmsubfp : SDNode<"PPCISD::VNMSUBFP", SDTFPTernaryOp, []>; |
| 172 |
|
| 173 |
def PPCppc32GOT : SDNode<"PPCISD::PPC32_GOT", SDTIntLeaf, []>; |
| 174 |
|
| 175 |
def PPCaddisGotTprelHA : SDNode<"PPCISD::ADDIS_GOT_TPREL_HA", SDTIntBinOp>; |
| 176 |
def PPCldGotTprelL : SDNode<"PPCISD::LD_GOT_TPREL_L", SDTIntBinOp, |
| 177 |
[SDNPMayLoad]>; |
| 178 |
def PPCaddTls : SDNode<"PPCISD::ADD_TLS", SDTIntBinOp, []>; |
| 179 |
def PPCaddisTlsgdHA : SDNode<"PPCISD::ADDIS_TLSGD_HA", SDTIntBinOp>; |
| 180 |
def PPCaddiTlsgdL : SDNode<"PPCISD::ADDI_TLSGD_L", SDTIntBinOp>; |
| 181 |
def PPCgetTlsAddr : SDNode<"PPCISD::GET_TLS_ADDR", SDTIntBinOp>; |
| 182 |
def PPCaddiTlsgdLAddr : SDNode<"PPCISD::ADDI_TLSGD_L_ADDR", |
| 183 |
SDTypeProfile<1, 3, [ |
| 184 |
SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, |
| 185 |
SDTCisSameAs<0, 3>, SDTCisInt<0> ]>>; |
| 186 |
def PPCaddisTlsldHA : SDNode<"PPCISD::ADDIS_TLSLD_HA", SDTIntBinOp>; |
| 187 |
def PPCaddiTlsldL : SDNode<"PPCISD::ADDI_TLSLD_L", SDTIntBinOp>; |
| 188 |
def PPCgetTlsldAddr : SDNode<"PPCISD::GET_TLSLD_ADDR", SDTIntBinOp>; |
| 189 |
def PPCaddiTlsldLAddr : SDNode<"PPCISD::ADDI_TLSLD_L_ADDR", |
| 190 |
SDTypeProfile<1, 3, [ |
| 191 |
SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, |
| 192 |
SDTCisSameAs<0, 3>, SDTCisInt<0> ]>>; |
| 193 |
def PPCaddisDtprelHA : SDNode<"PPCISD::ADDIS_DTPREL_HA", SDTIntBinOp>; |
| 194 |
def PPCaddiDtprelL : SDNode<"PPCISD::ADDI_DTPREL_L", SDTIntBinOp>; |
| 195 |
|
| 196 |
def PPCvperm : SDNode<"PPCISD::VPERM", SDT_PPCvperm, []>; |
| 197 |
def PPCxxsplt : SDNode<"PPCISD::XXSPLT", SDT_PPCVecSplat, []>; |
| 198 |
def PPCvecinsert : SDNode<"PPCISD::VECINSERT", SDT_PPCVecInsert, []>; |
| 199 |
def PPCxxreverse : SDNode<"PPCISD::XXREVERSE", SDT_PPCVecReverse, []>; |
| 200 |
def PPCxxpermdi : SDNode<"PPCISD::XXPERMDI", SDT_PPCxxpermdi, []>; |
| 201 |
def PPCvecshl : SDNode<"PPCISD::VECSHL", SDT_PPCVecShift, []>; |
| 202 |
|
| 203 |
def PPCqvfperm : SDNode<"PPCISD::QVFPERM", SDT_PPCqvfperm, []>; |
| 204 |
def PPCqvgpci : SDNode<"PPCISD::QVGPCI", SDT_PPCqvgpci, []>; |
| 205 |
def PPCqvaligni : SDNode<"PPCISD::QVALIGNI", SDT_PPCqvaligni, []>; |
| 206 |
def PPCqvesplati : SDNode<"PPCISD::QVESPLATI", SDT_PPCqvesplati, []>; |
| 207 |
|
| 208 |
def PPCqbflt : SDNode<"PPCISD::QBFLT", SDT_PPCqbflt, []>; |
| 209 |
|
| 210 |
def PPCqvlfsb : SDNode<"PPCISD::QVLFSb", SDT_PPCqvlfsb, |
| 211 |
[SDNPHasChain, SDNPMayLoad]>; |
| 212 |
|
| 213 |
def PPCcmpb : SDNode<"PPCISD::CMPB", SDTIntBinOp, []>; |
| 214 |
|
| 215 |
// These nodes represent the 32-bit PPC shifts that operate on 6-bit shift |
| 216 |
// amounts. These nodes are generated by the multi-precision shift code. |
| 217 |
def PPCsrl : SDNode<"PPCISD::SRL" , SDTIntShiftOp>; |
| 218 |
def PPCsra : SDNode<"PPCISD::SRA" , SDTIntShiftOp>; |
| 219 |
def PPCshl : SDNode<"PPCISD::SHL" , SDTIntShiftOp>; |
| 220 |
|
| 221 |
// Move 2 i64 values into a VSX register |
| 222 |
def PPCbuild_fp128: SDNode<"PPCISD::BUILD_FP128", |
| 223 |
SDTypeProfile<1, 2, |
| 224 |
[SDTCisFP<0>, SDTCisSameSizeAs<1,2>, |
| 225 |
SDTCisSameAs<1,2>]>, |
| 226 |
[]>; |
| 227 |
|
| 228 |
// These are target-independent nodes, but have target-specific formats. |
| 229 |
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_PPCCallSeqStart, |
| 230 |
[SDNPHasChain, SDNPOutGlue]>; |
| 231 |
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_PPCCallSeqEnd, |
| 232 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; |
| 233 |
|
| 234 |
def SDT_PPCCall : SDTypeProfile<0, -1, [SDTCisInt<0>]>; |
| 235 |
def PPCcall : SDNode<"PPCISD::CALL", SDT_PPCCall, |
| 236 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, |
| 237 |
SDNPVariadic]>; |
| 238 |
def PPCcall_nop : SDNode<"PPCISD::CALL_NOP", SDT_PPCCall, |
| 239 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, |
| 240 |
SDNPVariadic]>; |
| 241 |
def PPCmtctr : SDNode<"PPCISD::MTCTR", SDT_PPCCall, |
| 242 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; |
| 243 |
def PPCbctrl : SDNode<"PPCISD::BCTRL", SDTNone, |
| 244 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, |
| 245 |
SDNPVariadic]>; |
| 246 |
def PPCbctrl_load_toc : SDNode<"PPCISD::BCTRL_LOAD_TOC", |
| 247 |
SDTypeProfile<0, 1, []>, |
| 248 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, |
| 249 |
SDNPVariadic]>; |
| 250 |
|
| 251 |
def retflag : SDNode<"PPCISD::RET_FLAG", SDTNone, |
| 252 |
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; |
| 253 |
|
| 254 |
def PPCtc_return : SDNode<"PPCISD::TC_RETURN", SDT_PPCTC_ret, |
| 255 |
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; |
| 256 |
|
| 257 |
def PPCeh_sjlj_setjmp : SDNode<"PPCISD::EH_SJLJ_SETJMP", |
| 258 |
SDTypeProfile<1, 1, [SDTCisInt<0>, |
| 259 |
SDTCisPtrTy<1>]>, |
| 260 |
[SDNPHasChain, SDNPSideEffect]>; |
| 261 |
def PPCeh_sjlj_longjmp : SDNode<"PPCISD::EH_SJLJ_LONGJMP", |
| 262 |
SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>, |
| 263 |
[SDNPHasChain, SDNPSideEffect]>; |
| 264 |
|
| 265 |
def SDT_PPCsc : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
| 266 |
def PPCsc : SDNode<"PPCISD::SC", SDT_PPCsc, |
| 267 |
[SDNPHasChain, SDNPSideEffect]>; |
| 268 |
|
| 269 |
def PPCclrbhrb : SDNode<"PPCISD::CLRBHRB", SDTNone, |
| 270 |
[SDNPHasChain, SDNPSideEffect]>; |
| 271 |
def PPCmfbhrbe : SDNode<"PPCISD::MFBHRBE", SDTIntBinOp, [SDNPHasChain]>; |
| 272 |
def PPCrfebb : SDNode<"PPCISD::RFEBB", SDT_PPCsc, |
| 273 |
[SDNPHasChain, SDNPSideEffect]>; |
| 274 |
|
| 275 |
def PPCvcmp : SDNode<"PPCISD::VCMP" , SDT_PPCvcmp, []>; |
| 276 |
def PPCvcmp_o : SDNode<"PPCISD::VCMPo", SDT_PPCvcmp, [SDNPOutGlue]>; |
| 277 |
|
| 278 |
def PPCcondbranch : SDNode<"PPCISD::COND_BRANCH", SDT_PPCcondbr, |
| 279 |
[SDNPHasChain, SDNPOptInGlue]>; |
| 280 |
|
| 281 |
// PPC-specific atomic operations. |
| 282 |
def PPCatomicCmpSwap_8 : |
| 283 |
SDNode<"PPCISD::ATOMIC_CMP_SWAP_8", SDTAtomic3, |
| 284 |
[SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; |
| 285 |
def PPCatomicCmpSwap_16 : |
| 286 |
SDNode<"PPCISD::ATOMIC_CMP_SWAP_16", SDTAtomic3, |
| 287 |
[SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; |
| 288 |
def PPClbrx : SDNode<"PPCISD::LBRX", SDT_PPClbrx, |
| 289 |
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; |
| 290 |
def PPCstbrx : SDNode<"PPCISD::STBRX", SDT_PPCstbrx, |
| 291 |
[SDNPHasChain, SDNPMayStore]>; |
| 292 |
|
| 293 |
// Instructions to set/unset CR bit 6 for SVR4 vararg calls |
| 294 |
def PPCcr6set : SDNode<"PPCISD::CR6SET", SDTNone, |
| 295 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; |
| 296 |
def PPCcr6unset : SDNode<"PPCISD::CR6UNSET", SDTNone, |
| 297 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; |
| 298 |
|
| 299 |
// Instructions to support dynamic alloca. |
| 300 |
def SDTDynOp : SDTypeProfile<1, 2, []>; |
| 301 |
def SDTDynAreaOp : SDTypeProfile<1, 1, []>; |
| 302 |
def PPCdynalloc : SDNode<"PPCISD::DYNALLOC", SDTDynOp, [SDNPHasChain]>; |
| 303 |
def PPCdynareaoffset : SDNode<"PPCISD::DYNAREAOFFSET", SDTDynAreaOp, [SDNPHasChain]>; |
| 304 |
|
| 305 |
//===----------------------------------------------------------------------===// |
| 306 |
// PowerPC specific transformation functions and pattern fragments. |
| 307 |
// |
| 308 |
|
| 309 |
def SHL32 : SDNodeXForm<imm, [{ |
| 310 |
// Transformation function: 31 - imm |
| 311 |
return getI32Imm(31 - N->getZExtValue(), SDLoc(N)); |
| 312 |
}]>; |
| 313 |
|
| 314 |
def SRL32 : SDNodeXForm<imm, [{ |
| 315 |
// Transformation function: 32 - imm |
| 316 |
return N->getZExtValue() ? getI32Imm(32 - N->getZExtValue(), SDLoc(N)) |
| 317 |
: getI32Imm(0, SDLoc(N)); |
| 318 |
}]>; |
| 319 |
|
| 320 |
def LO16 : SDNodeXForm<imm, [{ |
| 321 |
// Transformation function: get the low 16 bits. |
| 322 |
return getI32Imm((unsigned short)N->getZExtValue(), SDLoc(N)); |
| 323 |
}]>; |
| 324 |
|
| 325 |
def HI16 : SDNodeXForm<imm, [{ |
| 326 |
// Transformation function: shift the immediate value down into the low bits. |
| 327 |
return getI32Imm((unsigned)N->getZExtValue() >> 16, SDLoc(N)); |
| 328 |
}]>; |
| 329 |
|
| 330 |
def HA16 : SDNodeXForm<imm, [{ |
| 331 |
// Transformation function: shift the immediate value down into the low bits. |
| 332 |
long Val = N->getZExtValue(); |
| 333 |
return getI32Imm((Val - (signed short)Val) >> 16, SDLoc(N)); |
| 334 |
}]>; |
| 335 |
def MB : SDNodeXForm<imm, [{ |
| 336 |
// Transformation function: get the start bit of a mask |
| 337 |
unsigned mb = 0, me; |
| 338 |
(void)isRunOfOnes((unsigned)N->getZExtValue(), mb, me); |
| 339 |
return getI32Imm(mb, SDLoc(N)); |
| 340 |
}]>; |
| 341 |
|
| 342 |
def ME : SDNodeXForm<imm, [{ |
| 343 |
// Transformation function: get the end bit of a mask |
| 344 |
unsigned mb, me = 0; |
| 345 |
(void)isRunOfOnes((unsigned)N->getZExtValue(), mb, me); |
| 346 |
return getI32Imm(me, SDLoc(N)); |
| 347 |
}]>; |
| 348 |
def maskimm32 : PatLeaf<(imm), [{ |
| 349 |
// maskImm predicate - True if immediate is a run of ones. |
| 350 |
unsigned mb, me; |
| 351 |
if (N->getValueType(0) == MVT::i32) |
| 352 |
return isRunOfOnes((unsigned)N->getZExtValue(), mb, me); |
| 353 |
else |
| 354 |
return false; |
| 355 |
}]>; |
| 356 |
|
| 357 |
def imm32SExt16 : Operand<i32>, ImmLeaf<i32, [{ |
| 358 |
// imm32SExt16 predicate - True if the i32 immediate fits in a 16-bit |
| 359 |
// sign extended field. Used by instructions like 'addi'. |
| 360 |
return (int32_t)Imm == (short)Imm; |
| 361 |
}]>; |
| 362 |
def imm64SExt16 : Operand<i64>, ImmLeaf<i64, [{ |
| 363 |
// imm64SExt16 predicate - True if the i64 immediate fits in a 16-bit |
| 364 |
// sign extended field. Used by instructions like 'addi'. |
| 365 |
return (int64_t)Imm == (short)Imm; |
| 366 |
}]>; |
| 367 |
def immZExt16 : PatLeaf<(imm), [{ |
| 368 |
// immZExt16 predicate - True if the immediate fits in a 16-bit zero extended |
| 369 |
// field. Used by instructions like 'ori'. |
| 370 |
return (uint64_t)N->getZExtValue() == (unsigned short)N->getZExtValue(); |
| 371 |
}], LO16>; |
| 372 |
def immAnyExt8 : ImmLeaf<i32, [{ return isInt<8>(Imm) || isUInt<8>(Imm); }]>; |
| 373 |
def immSExt5NonZero : ImmLeaf<i32, [{ return Imm && isInt<5>(Imm); }]>; |
| 374 |
|
| 375 |
// imm16Shifted* - These match immediates where the low 16-bits are zero. There |
| 376 |
// are two forms: imm16ShiftedSExt and imm16ShiftedZExt. These two forms are |
| 377 |
// identical in 32-bit mode, but in 64-bit mode, they return true if the |
| 378 |
// immediate fits into a sign/zero extended 32-bit immediate (with the low bits |
| 379 |
// clear). |
| 380 |
def imm16ShiftedZExt : PatLeaf<(imm), [{ |
| 381 |
// imm16ShiftedZExt predicate - True if only bits in the top 16-bits of the |
| 382 |
// immediate are set. Used by instructions like 'xoris'. |
| 383 |
return (N->getZExtValue() & ~uint64_t(0xFFFF0000)) == 0; |
| 384 |
}], HI16>; |
| 385 |
|
| 386 |
def imm16ShiftedSExt : PatLeaf<(imm), [{ |
| 387 |
// imm16ShiftedSExt predicate - True if only bits in the top 16-bits of the |
| 388 |
// immediate are set. Used by instructions like 'addis'. Identical to |
| 389 |
// imm16ShiftedZExt in 32-bit mode. |
| 390 |
if (N->getZExtValue() & 0xFFFF) return false; |
| 391 |
if (N->getValueType(0) == MVT::i32) |
| 392 |
return true; |
| 393 |
// For 64-bit, make sure it is sext right. |
| 394 |
return N->getZExtValue() == (uint64_t)(int)N->getZExtValue(); |
| 395 |
}], HI16>; |
| 396 |
|
| 397 |
def imm64ZExt32 : Operand<i64>, ImmLeaf<i64, [{ |
| 398 |
// imm64ZExt32 predicate - True if the i64 immediate fits in a 32-bit |
| 399 |
// zero extended field. |
| 400 |
return isUInt<32>(Imm); |
| 401 |
}]>; |
| 402 |
|
| 403 |
// Some r+i load/store instructions (such as LD, STD, LDU, etc.) that require |
| 404 |
// restricted memrix (4-aligned) constants are alignment sensitive. If these |
| 405 |
// offsets are hidden behind TOC entries than the values of the lower-order |
| 406 |
// bits cannot be checked directly. As a result, we need to also incorporate |
| 407 |
// an alignment check into the relevant patterns. |
| 408 |
|
| 409 |
def aligned4load : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 410 |
return cast<LoadSDNode>(N)->getAlignment() >= 4; |
| 411 |
}]>; |
| 412 |
def aligned4store : PatFrag<(ops node:$val, node:$ptr), |
| 413 |
(store node:$val, node:$ptr), [{ |
| 414 |
return cast<StoreSDNode>(N)->getAlignment() >= 4; |
| 415 |
}]>; |
| 416 |
def aligned4sextloadi32 : PatFrag<(ops node:$ptr), (sextloadi32 node:$ptr), [{ |
| 417 |
return cast<LoadSDNode>(N)->getAlignment() >= 4; |
| 418 |
}]>; |
| 419 |
def aligned4pre_store : PatFrag< |
| 420 |
(ops node:$val, node:$base, node:$offset), |
| 421 |
(pre_store node:$val, node:$base, node:$offset), [{ |
| 422 |
return cast<StoreSDNode>(N)->getAlignment() >= 4; |
| 423 |
}]>; |
| 424 |
|
| 425 |
def unaligned4load : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 426 |
return cast<LoadSDNode>(N)->getAlignment() < 4; |
| 427 |
}]>; |
| 428 |
def unaligned4store : PatFrag<(ops node:$val, node:$ptr), |
| 429 |
(store node:$val, node:$ptr), [{ |
| 430 |
return cast<StoreSDNode>(N)->getAlignment() < 4; |
| 431 |
}]>; |
| 432 |
def unaligned4sextloadi32 : PatFrag<(ops node:$ptr), (sextloadi32 node:$ptr), [{ |
| 433 |
return cast<LoadSDNode>(N)->getAlignment() < 4; |
| 434 |
}]>; |
| 435 |
|
| 436 |
// This is a somewhat weaker condition than actually checking for 16-byte |
| 437 |
// alignment. It is simply checking that the displacement can be represented |
| 438 |
// as an immediate that is a multiple of 16 (i.e. the requirements for DQ-Form |
| 439 |
// instructions). |
| 440 |
def quadwOffsetLoad : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 441 |
return isOffsetMultipleOf(N, 16); |
| 442 |
}]>; |
| 443 |
def quadwOffsetStore : PatFrag<(ops node:$val, node:$ptr), |
| 444 |
(store node:$val, node:$ptr), [{ |
| 445 |
return isOffsetMultipleOf(N, 16); |
| 446 |
}]>; |
| 447 |
def nonQuadwOffsetLoad : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 448 |
return !isOffsetMultipleOf(N, 16); |
| 449 |
}]>; |
| 450 |
def nonQuadwOffsetStore : PatFrag<(ops node:$val, node:$ptr), |
| 451 |
(store node:$val, node:$ptr), [{ |
| 452 |
return !isOffsetMultipleOf(N, 16); |
| 453 |
}]>; |
| 454 |
|
| 455 |
//===----------------------------------------------------------------------===// |
| 456 |
// PowerPC Flag Definitions. |
| 457 |
|
| 458 |
class isPPC64 { bit PPC64 = 1; } |
| 459 |
class isDOT { bit RC = 1; } |
| 460 |
|
| 461 |
class RegConstraint<string C> { |
| 462 |
string Constraints = C; |
| 463 |
} |
| 464 |
class NoEncode<string E> { |
| 465 |
string DisableEncoding = E; |
| 466 |
} |
| 467 |
|
| 468 |
|
| 469 |
//===----------------------------------------------------------------------===// |
| 470 |
// PowerPC Operand Definitions. |
| 471 |
|
| 472 |
// In the default PowerPC assembler syntax, registers are specified simply |
| 473 |
// by number, so they cannot be distinguished from immediate values (without |
| 474 |
// looking at the opcode). This means that the default operand matching logic |
| 475 |
// for the asm parser does not work, and we need to specify custom matchers. |
| 476 |
// Since those can only be specified with RegisterOperand classes and not |
| 477 |
// directly on the RegisterClass, all instructions patterns used by the asm |
| 478 |
// parser need to use a RegisterOperand (instead of a RegisterClass) for |
| 479 |
// all their register operands. |
| 480 |
// For this purpose, we define one RegisterOperand for each RegisterClass, |
| 481 |
// using the same name as the class, just in lower case. |
| 482 |
|
| 483 |
def PPCRegGPRCAsmOperand : AsmOperandClass { |
| 484 |
let Name = "RegGPRC"; let PredicateMethod = "isRegNumber"; |
| 485 |
} |
| 486 |
def gprc : RegisterOperand<GPRC> { |
| 487 |
let ParserMatchClass = PPCRegGPRCAsmOperand; |
| 488 |
} |
| 489 |
def PPCRegG8RCAsmOperand : AsmOperandClass { |
| 490 |
let Name = "RegG8RC"; let PredicateMethod = "isRegNumber"; |
| 491 |
} |
| 492 |
def g8rc : RegisterOperand<G8RC> { |
| 493 |
let ParserMatchClass = PPCRegG8RCAsmOperand; |
| 494 |
} |
| 495 |
def PPCRegGPRCNoR0AsmOperand : AsmOperandClass { |
| 496 |
let Name = "RegGPRCNoR0"; let PredicateMethod = "isRegNumber"; |
| 497 |
} |
| 498 |
def gprc_nor0 : RegisterOperand<GPRC_NOR0> { |
| 499 |
let ParserMatchClass = PPCRegGPRCNoR0AsmOperand; |
| 500 |
} |
| 501 |
def PPCRegG8RCNoX0AsmOperand : AsmOperandClass { |
| 502 |
let Name = "RegG8RCNoX0"; let PredicateMethod = "isRegNumber"; |
| 503 |
} |
| 504 |
def g8rc_nox0 : RegisterOperand<G8RC_NOX0> { |
| 505 |
let ParserMatchClass = PPCRegG8RCNoX0AsmOperand; |
| 506 |
} |
| 507 |
def PPCRegF8RCAsmOperand : AsmOperandClass { |
| 508 |
let Name = "RegF8RC"; let PredicateMethod = "isRegNumber"; |
| 509 |
} |
| 510 |
def f8rc : RegisterOperand<F8RC> { |
| 511 |
let ParserMatchClass = PPCRegF8RCAsmOperand; |
| 512 |
} |
| 513 |
def PPCRegF4RCAsmOperand : AsmOperandClass { |
| 514 |
let Name = "RegF4RC"; let PredicateMethod = "isRegNumber"; |
| 515 |
} |
| 516 |
def f4rc : RegisterOperand<F4RC> { |
| 517 |
let ParserMatchClass = PPCRegF4RCAsmOperand; |
| 518 |
} |
| 519 |
def PPCRegVRRCAsmOperand : AsmOperandClass { |
| 520 |
let Name = "RegVRRC"; let PredicateMethod = "isRegNumber"; |
| 521 |
} |
| 522 |
def vrrc : RegisterOperand<VRRC> { |
| 523 |
let ParserMatchClass = PPCRegVRRCAsmOperand; |
| 524 |
} |
| 525 |
def PPCRegVFRCAsmOperand : AsmOperandClass { |
| 526 |
let Name = "RegVFRC"; let PredicateMethod = "isRegNumber"; |
| 527 |
} |
| 528 |
def vfrc : RegisterOperand<VFRC> { |
| 529 |
let ParserMatchClass = PPCRegVFRCAsmOperand; |
| 530 |
} |
| 531 |
def PPCRegCRBITRCAsmOperand : AsmOperandClass { |
| 532 |
let Name = "RegCRBITRC"; let PredicateMethod = "isCRBitNumber"; |
| 533 |
} |
| 534 |
def crbitrc : RegisterOperand<CRBITRC> { |
| 535 |
let ParserMatchClass = PPCRegCRBITRCAsmOperand; |
| 536 |
} |
| 537 |
def PPCRegCRRCAsmOperand : AsmOperandClass { |
| 538 |
let Name = "RegCRRC"; let PredicateMethod = "isCCRegNumber"; |
| 539 |
} |
| 540 |
def crrc : RegisterOperand<CRRC> { |
| 541 |
let ParserMatchClass = PPCRegCRRCAsmOperand; |
| 542 |
} |
| 543 |
def PPCRegSPERCAsmOperand : AsmOperandClass { |
| 544 |
let Name = "RegSPERC"; let PredicateMethod = "isRegNumber"; |
| 545 |
} |
| 546 |
def sperc : RegisterOperand<SPERC> { |
| 547 |
let ParserMatchClass = PPCRegSPERCAsmOperand; |
| 548 |
} |
| 549 |
def PPCRegSPE4RCAsmOperand : AsmOperandClass { |
| 550 |
let Name = "RegSPE4RC"; let PredicateMethod = "isRegNumber"; |
| 551 |
} |
| 552 |
def spe4rc : RegisterOperand<SPE4RC> { |
| 553 |
let ParserMatchClass = PPCRegSPE4RCAsmOperand; |
| 554 |
} |
| 555 |
|
| 556 |
def PPCU1ImmAsmOperand : AsmOperandClass { |
| 557 |
let Name = "U1Imm"; let PredicateMethod = "isU1Imm"; |
| 558 |
let RenderMethod = "addImmOperands"; |
| 559 |
} |
| 560 |
def u1imm : Operand<i32> { |
| 561 |
let PrintMethod = "printU1ImmOperand"; |
| 562 |
let ParserMatchClass = PPCU1ImmAsmOperand; |
| 563 |
} |
| 564 |
|
| 565 |
def PPCU2ImmAsmOperand : AsmOperandClass { |
| 566 |
let Name = "U2Imm"; let PredicateMethod = "isU2Imm"; |
| 567 |
let RenderMethod = "addImmOperands"; |
| 568 |
} |
| 569 |
def u2imm : Operand<i32> { |
| 570 |
let PrintMethod = "printU2ImmOperand"; |
| 571 |
let ParserMatchClass = PPCU2ImmAsmOperand; |
| 572 |
} |
| 573 |
|
| 574 |
def PPCATBitsAsHintAsmOperand : AsmOperandClass { |
| 575 |
let Name = "ATBitsAsHint"; let PredicateMethod = "isATBitsAsHint"; |
| 576 |
let RenderMethod = "addImmOperands"; // Irrelevant, predicate always fails. |
| 577 |
} |
| 578 |
def atimm : Operand<i32> { |
| 579 |
let PrintMethod = "printATBitsAsHint"; |
| 580 |
let ParserMatchClass = PPCATBitsAsHintAsmOperand; |
| 581 |
} |
| 582 |
|
| 583 |
def PPCU3ImmAsmOperand : AsmOperandClass { |
| 584 |
let Name = "U3Imm"; let PredicateMethod = "isU3Imm"; |
| 585 |
let RenderMethod = "addImmOperands"; |
| 586 |
} |
| 587 |
def u3imm : Operand<i32> { |
| 588 |
let PrintMethod = "printU3ImmOperand"; |
| 589 |
let ParserMatchClass = PPCU3ImmAsmOperand; |
| 590 |
} |
| 591 |
|
| 592 |
def PPCU4ImmAsmOperand : AsmOperandClass { |
| 593 |
let Name = "U4Imm"; let PredicateMethod = "isU4Imm"; |
| 594 |
let RenderMethod = "addImmOperands"; |
| 595 |
} |
| 596 |
def u4imm : Operand<i32> { |
| 597 |
let PrintMethod = "printU4ImmOperand"; |
| 598 |
let ParserMatchClass = PPCU4ImmAsmOperand; |
| 599 |
} |
| 600 |
def PPCS5ImmAsmOperand : AsmOperandClass { |
| 601 |
let Name = "S5Imm"; let PredicateMethod = "isS5Imm"; |
| 602 |
let RenderMethod = "addImmOperands"; |
| 603 |
} |
| 604 |
def s5imm : Operand<i32> { |
| 605 |
let PrintMethod = "printS5ImmOperand"; |
| 606 |
let ParserMatchClass = PPCS5ImmAsmOperand; |
| 607 |
let DecoderMethod = "decodeSImmOperand<5>"; |
| 608 |
} |
| 609 |
def PPCU5ImmAsmOperand : AsmOperandClass { |
| 610 |
let Name = "U5Imm"; let PredicateMethod = "isU5Imm"; |
| 611 |
let RenderMethod = "addImmOperands"; |
| 612 |
} |
| 613 |
def u5imm : Operand<i32> { |
| 614 |
let PrintMethod = "printU5ImmOperand"; |
| 615 |
let ParserMatchClass = PPCU5ImmAsmOperand; |
| 616 |
let DecoderMethod = "decodeUImmOperand<5>"; |
| 617 |
} |
| 618 |
def PPCU6ImmAsmOperand : AsmOperandClass { |
| 619 |
let Name = "U6Imm"; let PredicateMethod = "isU6Imm"; |
| 620 |
let RenderMethod = "addImmOperands"; |
| 621 |
} |
| 622 |
def u6imm : Operand<i32> { |
| 623 |
let PrintMethod = "printU6ImmOperand"; |
| 624 |
let ParserMatchClass = PPCU6ImmAsmOperand; |
| 625 |
let DecoderMethod = "decodeUImmOperand<6>"; |
| 626 |
} |
| 627 |
def PPCU7ImmAsmOperand : AsmOperandClass { |
| 628 |
let Name = "U7Imm"; let PredicateMethod = "isU7Imm"; |
| 629 |
let RenderMethod = "addImmOperands"; |
| 630 |
} |
| 631 |
def u7imm : Operand<i32> { |
| 632 |
let PrintMethod = "printU7ImmOperand"; |
| 633 |
let ParserMatchClass = PPCU7ImmAsmOperand; |
| 634 |
let DecoderMethod = "decodeUImmOperand<7>"; |
| 635 |
} |
| 636 |
def PPCU8ImmAsmOperand : AsmOperandClass { |
| 637 |
let Name = "U8Imm"; let PredicateMethod = "isU8Imm"; |
| 638 |
let RenderMethod = "addImmOperands"; |
| 639 |
} |
| 640 |
def u8imm : Operand<i32> { |
| 641 |
let PrintMethod = "printU8ImmOperand"; |
| 642 |
let ParserMatchClass = PPCU8ImmAsmOperand; |
| 643 |
let DecoderMethod = "decodeUImmOperand<8>"; |
| 644 |
} |
| 645 |
def PPCU10ImmAsmOperand : AsmOperandClass { |
| 646 |
let Name = "U10Imm"; let PredicateMethod = "isU10Imm"; |
| 647 |
let RenderMethod = "addImmOperands"; |
| 648 |
} |
| 649 |
def u10imm : Operand<i32> { |
| 650 |
let PrintMethod = "printU10ImmOperand"; |
| 651 |
let ParserMatchClass = PPCU10ImmAsmOperand; |
| 652 |
let DecoderMethod = "decodeUImmOperand<10>"; |
| 653 |
} |
| 654 |
def PPCU12ImmAsmOperand : AsmOperandClass { |
| 655 |
let Name = "U12Imm"; let PredicateMethod = "isU12Imm"; |
| 656 |
let RenderMethod = "addImmOperands"; |
| 657 |
} |
| 658 |
def u12imm : Operand<i32> { |
| 659 |
let PrintMethod = "printU12ImmOperand"; |
| 660 |
let ParserMatchClass = PPCU12ImmAsmOperand; |
| 661 |
let DecoderMethod = "decodeUImmOperand<12>"; |
| 662 |
} |
| 663 |
def PPCS16ImmAsmOperand : AsmOperandClass { |
| 664 |
let Name = "S16Imm"; let PredicateMethod = "isS16Imm"; |
| 665 |
let RenderMethod = "addS16ImmOperands"; |
| 666 |
} |
| 667 |
def s16imm : Operand<i32> { |
| 668 |
let PrintMethod = "printS16ImmOperand"; |
| 669 |
let EncoderMethod = "getImm16Encoding"; |
| 670 |
let ParserMatchClass = PPCS16ImmAsmOperand; |
| 671 |
let DecoderMethod = "decodeSImmOperand<16>"; |
| 672 |
} |
| 673 |
def PPCU16ImmAsmOperand : AsmOperandClass { |
| 674 |
let Name = "U16Imm"; let PredicateMethod = "isU16Imm"; |
| 675 |
let RenderMethod = "addU16ImmOperands"; |
| 676 |
} |
| 677 |
def u16imm : Operand<i32> { |
| 678 |
let PrintMethod = "printU16ImmOperand"; |
| 679 |
let EncoderMethod = "getImm16Encoding"; |
| 680 |
let ParserMatchClass = PPCU16ImmAsmOperand; |
| 681 |
let DecoderMethod = "decodeUImmOperand<16>"; |
| 682 |
} |
| 683 |
def PPCS17ImmAsmOperand : AsmOperandClass { |
| 684 |
let Name = "S17Imm"; let PredicateMethod = "isS17Imm"; |
| 685 |
let RenderMethod = "addS16ImmOperands"; |
| 686 |
} |
| 687 |
def s17imm : Operand<i32> { |
| 688 |
// This operand type is used for addis/lis to allow the assembler parser |
| 689 |
// to accept immediates in the range -65536..65535 for compatibility with |
| 690 |
// the GNU assembler. The operand is treated as 16-bit otherwise. |
| 691 |
let PrintMethod = "printS16ImmOperand"; |
| 692 |
let EncoderMethod = "getImm16Encoding"; |
| 693 |
let ParserMatchClass = PPCS17ImmAsmOperand; |
| 694 |
let DecoderMethod = "decodeSImmOperand<16>"; |
| 695 |
} |
| 696 |
|
| 697 |
def fpimm0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(+0.0); }]>; |
| 698 |
|
| 699 |
def PPCDirectBrAsmOperand : AsmOperandClass { |
| 700 |
let Name = "DirectBr"; let PredicateMethod = "isDirectBr"; |
| 701 |
let RenderMethod = "addBranchTargetOperands"; |
| 702 |
} |
| 703 |
def directbrtarget : Operand<OtherVT> { |
| 704 |
let PrintMethod = "printBranchOperand"; |
| 705 |
let EncoderMethod = "getDirectBrEncoding"; |
| 706 |
let ParserMatchClass = PPCDirectBrAsmOperand; |
| 707 |
} |
| 708 |
def absdirectbrtarget : Operand<OtherVT> { |
| 709 |
let PrintMethod = "printAbsBranchOperand"; |
| 710 |
let EncoderMethod = "getAbsDirectBrEncoding"; |
| 711 |
let ParserMatchClass = PPCDirectBrAsmOperand; |
| 712 |
} |
| 713 |
def PPCCondBrAsmOperand : AsmOperandClass { |
| 714 |
let Name = "CondBr"; let PredicateMethod = "isCondBr"; |
| 715 |
let RenderMethod = "addBranchTargetOperands"; |
| 716 |
} |
| 717 |
def condbrtarget : Operand<OtherVT> { |
| 718 |
let PrintMethod = "printBranchOperand"; |
| 719 |
let EncoderMethod = "getCondBrEncoding"; |
| 720 |
let ParserMatchClass = PPCCondBrAsmOperand; |
| 721 |
} |
| 722 |
def abscondbrtarget : Operand<OtherVT> { |
| 723 |
let PrintMethod = "printAbsBranchOperand"; |
| 724 |
let EncoderMethod = "getAbsCondBrEncoding"; |
| 725 |
let ParserMatchClass = PPCCondBrAsmOperand; |
| 726 |
} |
| 727 |
def calltarget : Operand<iPTR> { |
| 728 |
let PrintMethod = "printBranchOperand"; |
| 729 |
let EncoderMethod = "getDirectBrEncoding"; |
| 730 |
let ParserMatchClass = PPCDirectBrAsmOperand; |
| 731 |
} |
| 732 |
def abscalltarget : Operand<iPTR> { |
| 733 |
let PrintMethod = "printAbsBranchOperand"; |
| 734 |
let EncoderMethod = "getAbsDirectBrEncoding"; |
| 735 |
let ParserMatchClass = PPCDirectBrAsmOperand; |
| 736 |
} |
| 737 |
def PPCCRBitMaskOperand : AsmOperandClass { |
| 738 |
let Name = "CRBitMask"; let PredicateMethod = "isCRBitMask"; |
| 739 |
} |
| 740 |
def crbitm: Operand<i8> { |
| 741 |
let PrintMethod = "printcrbitm"; |
| 742 |
let EncoderMethod = "get_crbitm_encoding"; |
| 743 |
let DecoderMethod = "decodeCRBitMOperand"; |
| 744 |
let ParserMatchClass = PPCCRBitMaskOperand; |
| 745 |
} |
| 746 |
// Address operands |
| 747 |
// A version of ptr_rc which excludes R0 (or X0 in 64-bit mode). |
| 748 |
def PPCRegGxRCNoR0Operand : AsmOperandClass { |
| 749 |
let Name = "RegGxRCNoR0"; let PredicateMethod = "isRegNumber"; |
| 750 |
} |
| 751 |
def ptr_rc_nor0 : Operand<iPTR>, PointerLikeRegClass<1> { |
| 752 |
let ParserMatchClass = PPCRegGxRCNoR0Operand; |
| 753 |
} |
| 754 |
// A version of ptr_rc usable with the asm parser. |
| 755 |
def PPCRegGxRCOperand : AsmOperandClass { |
| 756 |
let Name = "RegGxRC"; let PredicateMethod = "isRegNumber"; |
| 757 |
} |
| 758 |
def ptr_rc_idx : Operand<iPTR>, PointerLikeRegClass<0> { |
| 759 |
let ParserMatchClass = PPCRegGxRCOperand; |
| 760 |
} |
| 761 |
|
| 762 |
def PPCDispRIOperand : AsmOperandClass { |
| 763 |
let Name = "DispRI"; let PredicateMethod = "isS16Imm"; |
| 764 |
let RenderMethod = "addS16ImmOperands"; |
| 765 |
} |
| 766 |
def dispRI : Operand<iPTR> { |
| 767 |
let ParserMatchClass = PPCDispRIOperand; |
| 768 |
} |
| 769 |
def PPCDispRIXOperand : AsmOperandClass { |
| 770 |
let Name = "DispRIX"; let PredicateMethod = "isS16ImmX4"; |
| 771 |
let RenderMethod = "addImmOperands"; |
| 772 |
} |
| 773 |
def dispRIX : Operand<iPTR> { |
| 774 |
let ParserMatchClass = PPCDispRIXOperand; |
| 775 |
} |
| 776 |
def PPCDispRIX16Operand : AsmOperandClass { |
| 777 |
let Name = "DispRIX16"; let PredicateMethod = "isS16ImmX16"; |
| 778 |
let RenderMethod = "addImmOperands"; |
| 779 |
} |
| 780 |
def dispRIX16 : Operand<iPTR> { |
| 781 |
let ParserMatchClass = PPCDispRIX16Operand; |
| 782 |
} |
| 783 |
def PPCDispSPE8Operand : AsmOperandClass { |
| 784 |
let Name = "DispSPE8"; let PredicateMethod = "isU8ImmX8"; |
| 785 |
let RenderMethod = "addImmOperands"; |
| 786 |
} |
| 787 |
def dispSPE8 : Operand<iPTR> { |
| 788 |
let ParserMatchClass = PPCDispSPE8Operand; |
| 789 |
} |
| 790 |
def PPCDispSPE4Operand : AsmOperandClass { |
| 791 |
let Name = "DispSPE4"; let PredicateMethod = "isU7ImmX4"; |
| 792 |
let RenderMethod = "addImmOperands"; |
| 793 |
} |
| 794 |
def dispSPE4 : Operand<iPTR> { |
| 795 |
let ParserMatchClass = PPCDispSPE4Operand; |
| 796 |
} |
| 797 |
def PPCDispSPE2Operand : AsmOperandClass { |
| 798 |
let Name = "DispSPE2"; let PredicateMethod = "isU6ImmX2"; |
| 799 |
let RenderMethod = "addImmOperands"; |
| 800 |
} |
| 801 |
def dispSPE2 : Operand<iPTR> { |
| 802 |
let ParserMatchClass = PPCDispSPE2Operand; |
| 803 |
} |
| 804 |
def PPCDispRID12Operand : AsmOperandClass { |
| 805 |
let Name = "DispRID12"; let PredicateMethod = "isS12Imm"; |
| 806 |
let RenderMethod = "addImmOperands"; |
| 807 |
} |
| 808 |
def dispRID12 : Operand<iPTR> { |
| 809 |
let ParserMatchClass = PPCDispRID12Operand; |
| 810 |
} |
| 811 |
|
| 812 |
def memri : Operand<iPTR> { |
| 813 |
let PrintMethod = "printMemRegImm"; |
| 814 |
let MIOperandInfo = (ops dispRI:$imm, ptr_rc_nor0:$reg); |
| 815 |
let EncoderMethod = "getMemRIEncoding"; |
| 816 |
let DecoderMethod = "decodeMemRIOperands"; |
| 817 |
} |
| 818 |
def memrr : Operand<iPTR> { |
| 819 |
let PrintMethod = "printMemRegReg"; |
| 820 |
let MIOperandInfo = (ops ptr_rc_nor0:$ptrreg, ptr_rc_idx:$offreg); |
| 821 |
} |
| 822 |
def memrix : Operand<iPTR> { // memri where the imm is 4-aligned. |
| 823 |
let PrintMethod = "printMemRegImm"; |
| 824 |
let MIOperandInfo = (ops dispRIX:$imm, ptr_rc_nor0:$reg); |
| 825 |
let EncoderMethod = "getMemRIXEncoding"; |
| 826 |
let DecoderMethod = "decodeMemRIXOperands"; |
| 827 |
} |
| 828 |
def memrix16 : Operand<iPTR> { // memri, imm is 16-aligned, 12-bit, Inst{16:27} |
| 829 |
let PrintMethod = "printMemRegImm"; |
| 830 |
let MIOperandInfo = (ops dispRIX16:$imm, ptr_rc_nor0:$reg); |
| 831 |
let EncoderMethod = "getMemRIX16Encoding"; |
| 832 |
let DecoderMethod = "decodeMemRIX16Operands"; |
| 833 |
} |
| 834 |
def spe8dis : Operand<iPTR> { // SPE displacement where the imm is 8-aligned. |
| 835 |
let PrintMethod = "printMemRegImm"; |
| 836 |
let MIOperandInfo = (ops dispSPE8:$imm, ptr_rc_nor0:$reg); |
| 837 |
let EncoderMethod = "getSPE8DisEncoding"; |
| 838 |
let DecoderMethod = "decodeSPE8Operands"; |
| 839 |
} |
| 840 |
def spe4dis : Operand<iPTR> { // SPE displacement where the imm is 4-aligned. |
| 841 |
let PrintMethod = "printMemRegImm"; |
| 842 |
let MIOperandInfo = (ops dispSPE4:$imm, ptr_rc_nor0:$reg); |
| 843 |
let EncoderMethod = "getSPE4DisEncoding"; |
| 844 |
let DecoderMethod = "decodeSPE4Operands"; |
| 845 |
} |
| 846 |
def spe2dis : Operand<iPTR> { // SPE displacement where the imm is 2-aligned. |
| 847 |
let PrintMethod = "printMemRegImm"; |
| 848 |
let MIOperandInfo = (ops dispSPE2:$imm, ptr_rc_nor0:$reg); |
| 849 |
let EncoderMethod = "getSPE2DisEncoding"; |
| 850 |
let DecoderMethod = "decodeSPE2Operands"; |
| 851 |
} |
| 852 |
def memrid12 : Operand<iPTR> { // Paired Single displacement where imm is 12 bits. |
| 853 |
let PrintMethod = "printPSMemRegImm"; |
| 854 |
let MIOperandInfo = (ops dispRID12:$imm, ptr_rc_nor0:$reg); |
| 855 |
} |
| 856 |
|
| 857 |
// A single-register address. This is used with the SjLj |
| 858 |
// pseudo-instructions which tranlates to LD/LWZ. These instructions requires |
| 859 |
// G8RC_NOX0 registers. |
| 860 |
def memr : Operand<iPTR> { |
| 861 |
let MIOperandInfo = (ops ptr_rc_nor0:$ptrreg); |
| 862 |
} |
| 863 |
def PPCTLSRegOperand : AsmOperandClass { |
| 864 |
let Name = "TLSReg"; let PredicateMethod = "isTLSReg"; |
| 865 |
let RenderMethod = "addTLSRegOperands"; |
| 866 |
} |
| 867 |
def tlsreg32 : Operand<i32> { |
| 868 |
let EncoderMethod = "getTLSRegEncoding"; |
| 869 |
let ParserMatchClass = PPCTLSRegOperand; |
| 870 |
} |
| 871 |
def tlsgd32 : Operand<i32> {} |
| 872 |
def tlscall32 : Operand<i32> { |
| 873 |
let PrintMethod = "printTLSCall"; |
| 874 |
let MIOperandInfo = (ops calltarget:$func, tlsgd32:$sym); |
| 875 |
let EncoderMethod = "getTLSCallEncoding"; |
| 876 |
} |
| 877 |
|
| 878 |
// PowerPC Predicate operand. |
| 879 |
def pred : Operand<OtherVT> { |
| 880 |
let PrintMethod = "printPredicateOperand"; |
| 881 |
let MIOperandInfo = (ops i32imm:$bibo, crrc:$reg); |
| 882 |
} |
| 883 |
|
| 884 |
// Define PowerPC specific addressing mode. |
| 885 |
def iaddr : ComplexPattern<iPTR, 2, "SelectAddrImm", [], []>; |
| 886 |
def xaddr : ComplexPattern<iPTR, 2, "SelectAddrIdx", [], []>; |
| 887 |
def xoaddr : ComplexPattern<iPTR, 2, "SelectAddrIdxOnly",[], []>; |
| 888 |
def ixaddr : ComplexPattern<iPTR, 2, "SelectAddrImmX4", [], []>; // "std" |
| 889 |
def iqaddr : ComplexPattern<iPTR, 2, "SelectAddrImmX16", [], []>; // "stxv" |
| 890 |
|
| 891 |
// The address in a single register. This is used with the SjLj |
| 892 |
// pseudo-instructions. |
| 893 |
def addr : ComplexPattern<iPTR, 1, "SelectAddr",[], []>; |
| 894 |
|
| 895 |
/// This is just the offset part of iaddr, used for preinc. |
| 896 |
def iaddroff : ComplexPattern<iPTR, 1, "SelectAddrImmOffs", [], []>; |
| 897 |
|
| 898 |
//===----------------------------------------------------------------------===// |
| 899 |
// PowerPC Instruction Predicate Definitions. |
| 900 |
def In32BitMode : Predicate<"!PPCSubTarget->isPPC64()">; |
| 901 |
def In64BitMode : Predicate<"PPCSubTarget->isPPC64()">; |
| 902 |
def IsBookE : Predicate<"PPCSubTarget->isBookE()">; |
| 903 |
def IsNotBookE : Predicate<"!PPCSubTarget->isBookE()">; |
| 904 |
def HasOnlyMSYNC : Predicate<"PPCSubTarget->hasOnlyMSYNC()">; |
| 905 |
def HasSYNC : Predicate<"!PPCSubTarget->hasOnlyMSYNC()">; |
| 906 |
def IsPPC4xx : Predicate<"PPCSubTarget->isPPC4xx()">; |
| 907 |
def IsPPC6xx : Predicate<"PPCSubTarget->isPPC6xx()">; |
| 908 |
def IsE500 : Predicate<"PPCSubTarget->isE500()">; |
| 909 |
def HasSPE : Predicate<"PPCSubTarget->hasSPE()">; |
| 910 |
def HasICBT : Predicate<"PPCSubTarget->hasICBT()">; |
| 911 |
def HasPartwordAtomics : Predicate<"PPCSubTarget->hasPartwordAtomics()">; |
| 912 |
def NoNaNsFPMath : Predicate<"TM.Options.NoNaNsFPMath">; |
| 913 |
def NaNsFPMath : Predicate<"!TM.Options.NoNaNsFPMath">; |
| 914 |
def HasBPERMD : Predicate<"PPCSubTarget->hasBPERMD()">; |
| 915 |
def HasExtDiv : Predicate<"PPCSubTarget->hasExtDiv()">; |
| 916 |
def IsISA3_0 : Predicate<"PPCSubTarget->isISA3_0()">; |
| 917 |
def HasFPU : Predicate<"PPCSubTarget->hasFPU()">; |
| 918 |
|
| 919 |
//===----------------------------------------------------------------------===// |
| 920 |
// PowerPC Multiclass Definitions. |
| 921 |
|
| 922 |
multiclass XForm_6r<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 923 |
string asmbase, string asmstr, InstrItinClass itin, |
| 924 |
list<dag> pattern> { |
| 925 |
let BaseName = asmbase in { |
| 926 |
def NAME : XForm_6<opcode, xo, OOL, IOL, |
| 927 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 928 |
pattern>, RecFormRel; |
| 929 |
let Defs = [CR0] in |
| 930 |
def o : XForm_6<opcode, xo, OOL, IOL, |
| 931 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 932 |
[]>, isDOT, RecFormRel; |
| 933 |
} |
| 934 |
} |
| 935 |
|
| 936 |
multiclass XForm_6rc<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 937 |
string asmbase, string asmstr, InstrItinClass itin, |
| 938 |
list<dag> pattern> { |
| 939 |
let BaseName = asmbase in { |
| 940 |
let Defs = [CARRY] in |
| 941 |
def NAME : XForm_6<opcode, xo, OOL, IOL, |
| 942 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 943 |
pattern>, RecFormRel; |
| 944 |
let Defs = [CARRY, CR0] in |
| 945 |
def o : XForm_6<opcode, xo, OOL, IOL, |
| 946 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 947 |
[]>, isDOT, RecFormRel; |
| 948 |
} |
| 949 |
} |
| 950 |
|
| 951 |
multiclass XForm_10rc<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 952 |
string asmbase, string asmstr, InstrItinClass itin, |
| 953 |
list<dag> pattern> { |
| 954 |
let BaseName = asmbase in { |
| 955 |
let Defs = [CARRY] in |
| 956 |
def NAME : XForm_10<opcode, xo, OOL, IOL, |
| 957 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 958 |
pattern>, RecFormRel; |
| 959 |
let Defs = [CARRY, CR0] in |
| 960 |
def o : XForm_10<opcode, xo, OOL, IOL, |
| 961 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 962 |
[]>, isDOT, RecFormRel; |
| 963 |
} |
| 964 |
} |
| 965 |
|
| 966 |
multiclass XForm_11r<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 967 |
string asmbase, string asmstr, InstrItinClass itin, |
| 968 |
list<dag> pattern> { |
| 969 |
let BaseName = asmbase in { |
| 970 |
def NAME : XForm_11<opcode, xo, OOL, IOL, |
| 971 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 972 |
pattern>, RecFormRel; |
| 973 |
let Defs = [CR0] in |
| 974 |
def o : XForm_11<opcode, xo, OOL, IOL, |
| 975 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 976 |
[]>, isDOT, RecFormRel; |
| 977 |
} |
| 978 |
} |
| 979 |
|
| 980 |
multiclass XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, |
| 981 |
string asmbase, string asmstr, InstrItinClass itin, |
| 982 |
list<dag> pattern> { |
| 983 |
let BaseName = asmbase in { |
| 984 |
def NAME : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 985 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 986 |
pattern>, RecFormRel; |
| 987 |
let Defs = [CR0] in |
| 988 |
def o : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 989 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 990 |
[]>, isDOT, RecFormRel; |
| 991 |
} |
| 992 |
} |
| 993 |
|
| 994 |
// Multiclass for instructions for which the non record form is not cracked |
| 995 |
// and the record form is cracked (i.e. divw, mullw, etc.) |
| 996 |
multiclass XOForm_1rcr<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, |
| 997 |
string asmbase, string asmstr, InstrItinClass itin, |
| 998 |
list<dag> pattern> { |
| 999 |
let BaseName = asmbase in { |
| 1000 |
def NAME : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 1001 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1002 |
pattern>, RecFormRel; |
| 1003 |
let Defs = [CR0] in |
| 1004 |
def o : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 1005 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1006 |
[]>, isDOT, RecFormRel, PPC970_DGroup_First, |
| 1007 |
PPC970_DGroup_Cracked; |
| 1008 |
} |
| 1009 |
} |
| 1010 |
|
| 1011 |
multiclass XOForm_1rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, |
| 1012 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1013 |
list<dag> pattern> { |
| 1014 |
let BaseName = asmbase in { |
| 1015 |
let Defs = [CARRY] in |
| 1016 |
def NAME : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 1017 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1018 |
pattern>, RecFormRel; |
| 1019 |
let Defs = [CARRY, CR0] in |
| 1020 |
def o : XOForm_1<opcode, xo, oe, OOL, IOL, |
| 1021 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1022 |
[]>, isDOT, RecFormRel; |
| 1023 |
} |
| 1024 |
} |
| 1025 |
|
| 1026 |
multiclass XOForm_3r<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, |
| 1027 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1028 |
list<dag> pattern> { |
| 1029 |
let BaseName = asmbase in { |
| 1030 |
def NAME : XOForm_3<opcode, xo, oe, OOL, IOL, |
| 1031 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1032 |
pattern>, RecFormRel; |
| 1033 |
let Defs = [CR0] in |
| 1034 |
def o : XOForm_3<opcode, xo, oe, OOL, IOL, |
| 1035 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1036 |
[]>, isDOT, RecFormRel; |
| 1037 |
} |
| 1038 |
} |
| 1039 |
|
| 1040 |
multiclass XOForm_3rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, |
| 1041 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1042 |
list<dag> pattern> { |
| 1043 |
let BaseName = asmbase in { |
| 1044 |
let Defs = [CARRY] in |
| 1045 |
def NAME : XOForm_3<opcode, xo, oe, OOL, IOL, |
| 1046 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1047 |
pattern>, RecFormRel; |
| 1048 |
let Defs = [CARRY, CR0] in |
| 1049 |
def o : XOForm_3<opcode, xo, oe, OOL, IOL, |
| 1050 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1051 |
[]>, isDOT, RecFormRel; |
| 1052 |
} |
| 1053 |
} |
| 1054 |
|
| 1055 |
multiclass MForm_2r<bits<6> opcode, dag OOL, dag IOL, |
| 1056 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1057 |
list<dag> pattern> { |
| 1058 |
let BaseName = asmbase in { |
| 1059 |
def NAME : MForm_2<opcode, OOL, IOL, |
| 1060 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1061 |
pattern>, RecFormRel; |
| 1062 |
let Defs = [CR0] in |
| 1063 |
def o : MForm_2<opcode, OOL, IOL, |
| 1064 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1065 |
[]>, isDOT, RecFormRel; |
| 1066 |
} |
| 1067 |
} |
| 1068 |
|
| 1069 |
multiclass MDForm_1r<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, |
| 1070 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1071 |
list<dag> pattern> { |
| 1072 |
let BaseName = asmbase in { |
| 1073 |
def NAME : MDForm_1<opcode, xo, OOL, IOL, |
| 1074 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1075 |
pattern>, RecFormRel; |
| 1076 |
let Defs = [CR0] in |
| 1077 |
def o : MDForm_1<opcode, xo, OOL, IOL, |
| 1078 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1079 |
[]>, isDOT, RecFormRel; |
| 1080 |
} |
| 1081 |
} |
| 1082 |
|
| 1083 |
multiclass MDSForm_1r<bits<6> opcode, bits<4> xo, dag OOL, dag IOL, |
| 1084 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1085 |
list<dag> pattern> { |
| 1086 |
let BaseName = asmbase in { |
| 1087 |
def NAME : MDSForm_1<opcode, xo, OOL, IOL, |
| 1088 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1089 |
pattern>, RecFormRel; |
| 1090 |
let Defs = [CR0] in |
| 1091 |
def o : MDSForm_1<opcode, xo, OOL, IOL, |
| 1092 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1093 |
[]>, isDOT, RecFormRel; |
| 1094 |
} |
| 1095 |
} |
| 1096 |
|
| 1097 |
multiclass XSForm_1rc<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, |
| 1098 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1099 |
list<dag> pattern> { |
| 1100 |
let BaseName = asmbase in { |
| 1101 |
let Defs = [CARRY] in |
| 1102 |
def NAME : XSForm_1<opcode, xo, OOL, IOL, |
| 1103 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1104 |
pattern>, RecFormRel; |
| 1105 |
let Defs = [CARRY, CR0] in |
| 1106 |
def o : XSForm_1<opcode, xo, OOL, IOL, |
| 1107 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1108 |
[]>, isDOT, RecFormRel; |
| 1109 |
} |
| 1110 |
} |
| 1111 |
|
| 1112 |
multiclass XSForm_1r<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, |
| 1113 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1114 |
list<dag> pattern> { |
| 1115 |
let BaseName = asmbase in { |
| 1116 |
def NAME : XSForm_1<opcode, xo, OOL, IOL, |
| 1117 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1118 |
pattern>, RecFormRel; |
| 1119 |
let Defs = [CR0] in |
| 1120 |
def o : XSForm_1<opcode, xo, OOL, IOL, |
| 1121 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1122 |
[]>, isDOT, RecFormRel; |
| 1123 |
} |
| 1124 |
} |
| 1125 |
|
| 1126 |
multiclass XForm_26r<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 1127 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1128 |
list<dag> pattern> { |
| 1129 |
let BaseName = asmbase in { |
| 1130 |
def NAME : XForm_26<opcode, xo, OOL, IOL, |
| 1131 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1132 |
pattern>, RecFormRel; |
| 1133 |
let Defs = [CR1] in |
| 1134 |
def o : XForm_26<opcode, xo, OOL, IOL, |
| 1135 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1136 |
[]>, isDOT, RecFormRel; |
| 1137 |
} |
| 1138 |
} |
| 1139 |
|
| 1140 |
multiclass XForm_28r<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, |
| 1141 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1142 |
list<dag> pattern> { |
| 1143 |
let BaseName = asmbase in { |
| 1144 |
def NAME : XForm_28<opcode, xo, OOL, IOL, |
| 1145 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1146 |
pattern>, RecFormRel; |
| 1147 |
let Defs = [CR1] in |
| 1148 |
def o : XForm_28<opcode, xo, OOL, IOL, |
| 1149 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1150 |
[]>, isDOT, RecFormRel; |
| 1151 |
} |
| 1152 |
} |
| 1153 |
|
| 1154 |
multiclass AForm_1r<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, |
| 1155 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1156 |
list<dag> pattern> { |
| 1157 |
let BaseName = asmbase in { |
| 1158 |
def NAME : AForm_1<opcode, xo, OOL, IOL, |
| 1159 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1160 |
pattern>, RecFormRel; |
| 1161 |
let Defs = [CR1] in |
| 1162 |
def o : AForm_1<opcode, xo, OOL, IOL, |
| 1163 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1164 |
[]>, isDOT, RecFormRel; |
| 1165 |
} |
| 1166 |
} |
| 1167 |
|
| 1168 |
multiclass AForm_2r<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, |
| 1169 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1170 |
list<dag> pattern> { |
| 1171 |
let BaseName = asmbase in { |
| 1172 |
def NAME : AForm_2<opcode, xo, OOL, IOL, |
| 1173 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1174 |
pattern>, RecFormRel; |
| 1175 |
let Defs = [CR1] in |
| 1176 |
def o : AForm_2<opcode, xo, OOL, IOL, |
| 1177 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1178 |
[]>, isDOT, RecFormRel; |
| 1179 |
} |
| 1180 |
} |
| 1181 |
|
| 1182 |
multiclass AForm_3r<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, |
| 1183 |
string asmbase, string asmstr, InstrItinClass itin, |
| 1184 |
list<dag> pattern> { |
| 1185 |
let BaseName = asmbase in { |
| 1186 |
def NAME : AForm_3<opcode, xo, OOL, IOL, |
| 1187 |
!strconcat(asmbase, !strconcat(" ", asmstr)), itin, |
| 1188 |
pattern>, RecFormRel; |
| 1189 |
let Defs = [CR1] in |
| 1190 |
def o : AForm_3<opcode, xo, OOL, IOL, |
| 1191 |
!strconcat(asmbase, !strconcat(". ", asmstr)), itin, |
| 1192 |
[]>, isDOT, RecFormRel; |
| 1193 |
} |
| 1194 |
} |
| 1195 |
|
| 1196 |
//===----------------------------------------------------------------------===// |
| 1197 |
// PowerPC Instruction Definitions. |
| 1198 |
|
| 1199 |
// Pseudo-instructions: |
| 1200 |
|
| 1201 |
let hasCtrlDep = 1 in { |
| 1202 |
let Defs = [R1], Uses = [R1] in { |
| 1203 |
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins u16imm:$amt1, u16imm:$amt2), |
| 1204 |
"#ADJCALLSTACKDOWN $amt1 $amt2", |
| 1205 |
[(callseq_start timm:$amt1, timm:$amt2)]>; |
| 1206 |
def ADJCALLSTACKUP : Pseudo<(outs), (ins u16imm:$amt1, u16imm:$amt2), |
| 1207 |
"#ADJCALLSTACKUP $amt1 $amt2", |
| 1208 |
[(callseq_end timm:$amt1, timm:$amt2)]>; |
| 1209 |
} |
| 1210 |
|
| 1211 |
def UPDATE_VRSAVE : Pseudo<(outs gprc:$rD), (ins gprc:$rS), |
| 1212 |
"UPDATE_VRSAVE $rD, $rS", []>; |
| 1213 |
} |
| 1214 |
|
| 1215 |
let Defs = [R1], Uses = [R1] in |
| 1216 |
def DYNALLOC : Pseudo<(outs gprc:$result), (ins gprc:$negsize, memri:$fpsi), "#DYNALLOC", |
| 1217 |
[(set i32:$result, |
| 1218 |
(PPCdynalloc i32:$negsize, iaddr:$fpsi))]>; |
| 1219 |
def DYNAREAOFFSET : Pseudo<(outs i32imm:$result), (ins memri:$fpsi), "#DYNAREAOFFSET", |
| 1220 |
[(set i32:$result, (PPCdynareaoffset iaddr:$fpsi))]>; |
| 1221 |
|
| 1222 |
// SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded after |
| 1223 |
// instruction selection into a branch sequence. |
| 1224 |
let usesCustomInserter = 1, // Expanded after instruction selection. |
| 1225 |
PPC970_Single = 1 in { |
| 1226 |
// Note that SELECT_CC_I4 and SELECT_CC_I8 use the no-r0 register classes |
| 1227 |
// because either operand might become the first operand in an isel, and |
| 1228 |
// that operand cannot be r0. |
| 1229 |
def SELECT_CC_I4 : Pseudo<(outs gprc:$dst), (ins crrc:$cond, |
| 1230 |
gprc_nor0:$T, gprc_nor0:$F, |
| 1231 |
i32imm:$BROPC), "#SELECT_CC_I4", |
| 1232 |
[]>; |
| 1233 |
def SELECT_CC_I8 : Pseudo<(outs g8rc:$dst), (ins crrc:$cond, |
| 1234 |
g8rc_nox0:$T, g8rc_nox0:$F, |
| 1235 |
i32imm:$BROPC), "#SELECT_CC_I8", |
| 1236 |
[]>; |
| 1237 |
def SELECT_CC_F4 : Pseudo<(outs f4rc:$dst), (ins crrc:$cond, f4rc:$T, f4rc:$F, |
| 1238 |
i32imm:$BROPC), "#SELECT_CC_F4", |
| 1239 |
[]>; |
| 1240 |
def SELECT_CC_F8 : Pseudo<(outs f8rc:$dst), (ins crrc:$cond, f8rc:$T, f8rc:$F, |
| 1241 |
i32imm:$BROPC), "#SELECT_CC_F8", |
| 1242 |
[]>; |
| 1243 |
def SELECT_CC_F16 : Pseudo<(outs vrrc:$dst), (ins crrc:$cond, vrrc:$T, vrrc:$F, |
| 1244 |
i32imm:$BROPC), "#SELECT_CC_F16", |
| 1245 |
[]>; |
| 1246 |
def SELECT_CC_VRRC: Pseudo<(outs vrrc:$dst), (ins crrc:$cond, vrrc:$T, vrrc:$F, |
| 1247 |
i32imm:$BROPC), "#SELECT_CC_VRRC", |
| 1248 |
[]>; |
| 1249 |
|
| 1250 |
// SELECT_* pseudo instructions, like SELECT_CC_* but taking condition |
| 1251 |
// register bit directly. |
| 1252 |
def SELECT_I4 : Pseudo<(outs gprc:$dst), (ins crbitrc:$cond, |
| 1253 |
gprc_nor0:$T, gprc_nor0:$F), "#SELECT_I4", |
| 1254 |
[(set i32:$dst, (select i1:$cond, i32:$T, i32:$F))]>; |
| 1255 |
def SELECT_I8 : Pseudo<(outs g8rc:$dst), (ins crbitrc:$cond, |
| 1256 |
g8rc_nox0:$T, g8rc_nox0:$F), "#SELECT_I8", |
| 1257 |
[(set i64:$dst, (select i1:$cond, i64:$T, i64:$F))]>; |
| 1258 |
let Predicates = [HasFPU] in { |
| 1259 |
def SELECT_F4 : Pseudo<(outs f4rc:$dst), (ins crbitrc:$cond, |
| 1260 |
f4rc:$T, f4rc:$F), "#SELECT_F4", |
| 1261 |
[(set f32:$dst, (select i1:$cond, f32:$T, f32:$F))]>; |
| 1262 |
def SELECT_F8 : Pseudo<(outs f8rc:$dst), (ins crbitrc:$cond, |
| 1263 |
f8rc:$T, f8rc:$F), "#SELECT_F8", |
| 1264 |
[(set f64:$dst, (select i1:$cond, f64:$T, f64:$F))]>; |
| 1265 |
def SELECT_F16 : Pseudo<(outs vrrc:$dst), (ins crbitrc:$cond, |
| 1266 |
vrrc:$T, vrrc:$F), "#SELECT_F16", |
| 1267 |
[(set f128:$dst, (select i1:$cond, f128:$T, f128:$F))]>; |
| 1268 |
} |
| 1269 |
def SELECT_VRRC: Pseudo<(outs vrrc:$dst), (ins crbitrc:$cond, |
| 1270 |
vrrc:$T, vrrc:$F), "#SELECT_VRRC", |
| 1271 |
[(set v4i32:$dst, |
| 1272 |
(select i1:$cond, v4i32:$T, v4i32:$F))]>; |
| 1273 |
} |
| 1274 |
|
| 1275 |
// SPILL_CR - Indicate that we're dumping the CR register, so we'll need to |
| 1276 |
// scavenge a register for it. |
| 1277 |
let mayStore = 1 in { |
| 1278 |
def SPILL_CR : Pseudo<(outs), (ins crrc:$cond, memri:$F), |
| 1279 |
"#SPILL_CR", []>; |
| 1280 |
def SPILL_CRBIT : Pseudo<(outs), (ins crbitrc:$cond, memri:$F), |
| 1281 |
"#SPILL_CRBIT", []>; |
| 1282 |
} |
| 1283 |
|
| 1284 |
// RESTORE_CR - Indicate that we're restoring the CR register (previously |
| 1285 |
// spilled), so we'll need to scavenge a register for it. |
| 1286 |
let mayLoad = 1 in { |
| 1287 |
def RESTORE_CR : Pseudo<(outs crrc:$cond), (ins memri:$F), |
| 1288 |
"#RESTORE_CR", []>; |
| 1289 |
def RESTORE_CRBIT : Pseudo<(outs crbitrc:$cond), (ins memri:$F), |
| 1290 |
"#RESTORE_CRBIT", []>; |
| 1291 |
} |
| 1292 |
|
| 1293 |
let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7 in { |
| 1294 |
let isReturn = 1, Uses = [LR, RM] in |
| 1295 |
def BLR : XLForm_2_ext<19, 16, 20, 0, 0, (outs), (ins), "blr", IIC_BrB, |
| 1296 |
[(retflag)]>, Requires<[In32BitMode]>; |
| 1297 |
let isBranch = 1, isIndirectBranch = 1, Uses = [CTR] in { |
| 1298 |
def BCTR : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", IIC_BrB, |
| 1299 |
[]>; |
| 1300 |
|
| 1301 |
let isCodeGenOnly = 1 in { |
| 1302 |
def BCCCTR : XLForm_2_br<19, 528, 0, (outs), (ins pred:$cond), |
| 1303 |
"b${cond:cc}ctr${cond:pm} ${cond:reg}", IIC_BrB, |
| 1304 |
[]>; |
| 1305 |
|
| 1306 |
def BCCTR : XLForm_2_br2<19, 528, 12, 0, (outs), (ins crbitrc:$bi), |
| 1307 |
"bcctr 12, $bi, 0", IIC_BrB, []>; |
| 1308 |
def BCCTRn : XLForm_2_br2<19, 528, 4, 0, (outs), (ins crbitrc:$bi), |
| 1309 |
"bcctr 4, $bi, 0", IIC_BrB, []>; |
| 1310 |
} |
| 1311 |
} |
| 1312 |
} |
| 1313 |
|
| 1314 |
let Defs = [LR] in |
| 1315 |
def MovePCtoLR : Pseudo<(outs), (ins), "#MovePCtoLR", []>, |
| 1316 |
PPC970_Unit_BRU; |
| 1317 |
let Defs = [LR] in |
| 1318 |
def MoveGOTtoLR : Pseudo<(outs), (ins), "#MoveGOTtoLR", []>, |
| 1319 |
PPC970_Unit_BRU; |
| 1320 |
|
| 1321 |
let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7 in { |
| 1322 |
let isBarrier = 1 in { |
| 1323 |
def B : IForm<18, 0, 0, (outs), (ins directbrtarget:$dst), |
| 1324 |
"b $dst", IIC_BrB, |
| 1325 |
[(br bb:$dst)]>; |
| 1326 |
def BA : IForm<18, 1, 0, (outs), (ins absdirectbrtarget:$dst), |
| 1327 |
"ba $dst", IIC_BrB, []>; |
| 1328 |
} |
| 1329 |
|
| 1330 |
// BCC represents an arbitrary conditional branch on a predicate. |
| 1331 |
// FIXME: should be able to write a pattern for PPCcondbranch, but can't use |
| 1332 |
// a two-value operand where a dag node expects two operands. :( |
| 1333 |
let isCodeGenOnly = 1 in { |
| 1334 |
class BCC_class : BForm<16, 0, 0, (outs), (ins pred:$cond, condbrtarget:$dst), |
| 1335 |
"b${cond:cc}${cond:pm} ${cond:reg}, $dst" |
| 1336 |
/*[(PPCcondbranch crrc:$crS, imm:$opc, bb:$dst)]*/>; |
| 1337 |
def BCC : BCC_class; |
| 1338 |
|
| 1339 |
// The same as BCC, except that it's not a terminator. Used for introducing |
| 1340 |
// control flow dependency without creating new blocks. |
| 1341 |
let isTerminator = 0 in def CTRL_DEP : BCC_class; |
| 1342 |
|
| 1343 |
def BCCA : BForm<16, 1, 0, (outs), (ins pred:$cond, abscondbrtarget:$dst), |
| 1344 |
"b${cond:cc}a${cond:pm} ${cond:reg}, $dst">; |
| 1345 |
|
| 1346 |
let isReturn = 1, Uses = [LR, RM] in |
| 1347 |
def BCCLR : XLForm_2_br<19, 16, 0, (outs), (ins pred:$cond), |
| 1348 |
"b${cond:cc}lr${cond:pm} ${cond:reg}", IIC_BrB, []>; |
| 1349 |
} |
| 1350 |
|
| 1351 |
let isCodeGenOnly = 1 in { |
| 1352 |
let Pattern = [(brcond i1:$bi, bb:$dst)] in |
| 1353 |
def BC : BForm_4<16, 12, 0, 0, (outs), (ins crbitrc:$bi, condbrtarget:$dst), |
| 1354 |
"bc 12, $bi, $dst">; |
| 1355 |
|
| 1356 |
let Pattern = [(brcond (not i1:$bi), bb:$dst)] in |
| 1357 |
def BCn : BForm_4<16, 4, 0, 0, (outs), (ins crbitrc:$bi, condbrtarget:$dst), |
| 1358 |
"bc 4, $bi, $dst">; |
| 1359 |
|
| 1360 |
let isReturn = 1, Uses = [LR, RM] in |
| 1361 |
def BCLR : XLForm_2_br2<19, 16, 12, 0, (outs), (ins crbitrc:$bi), |
| 1362 |
"bclr 12, $bi, 0", IIC_BrB, []>; |
| 1363 |
def BCLRn : XLForm_2_br2<19, 16, 4, 0, (outs), (ins crbitrc:$bi), |
| 1364 |
"bclr 4, $bi, 0", IIC_BrB, []>; |
| 1365 |
} |
| 1366 |
|
| 1367 |
let isReturn = 1, Defs = [CTR], Uses = [CTR, LR, RM] in { |
| 1368 |
def BDZLR : XLForm_2_ext<19, 16, 18, 0, 0, (outs), (ins), |
| 1369 |
"bdzlr", IIC_BrB, []>; |
| 1370 |
def BDNZLR : XLForm_2_ext<19, 16, 16, 0, 0, (outs), (ins), |
| 1371 |
"bdnzlr", IIC_BrB, []>; |
| 1372 |
def BDZLRp : XLForm_2_ext<19, 16, 27, 0, 0, (outs), (ins), |
| 1373 |
"bdzlr+", IIC_BrB, []>; |
| 1374 |
def BDNZLRp: XLForm_2_ext<19, 16, 25, 0, 0, (outs), (ins), |
| 1375 |
"bdnzlr+", IIC_BrB, []>; |
| 1376 |
def BDZLRm : XLForm_2_ext<19, 16, 26, 0, 0, (outs), (ins), |
| 1377 |
"bdzlr-", IIC_BrB, []>; |
| 1378 |
def BDNZLRm: XLForm_2_ext<19, 16, 24, 0, 0, (outs), (ins), |
| 1379 |
"bdnzlr-", IIC_BrB, []>; |
| 1380 |
} |
| 1381 |
|
| 1382 |
let Defs = [CTR], Uses = [CTR] in { |
| 1383 |
def BDZ : BForm_1<16, 18, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1384 |
"bdz $dst">; |
| 1385 |
def BDNZ : BForm_1<16, 16, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1386 |
"bdnz $dst">; |
| 1387 |
def BDZA : BForm_1<16, 18, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1388 |
"bdza $dst">; |
| 1389 |
def BDNZA : BForm_1<16, 16, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1390 |
"bdnza $dst">; |
| 1391 |
def BDZp : BForm_1<16, 27, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1392 |
"bdz+ $dst">; |
| 1393 |
def BDNZp: BForm_1<16, 25, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1394 |
"bdnz+ $dst">; |
| 1395 |
def BDZAp : BForm_1<16, 27, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1396 |
"bdza+ $dst">; |
| 1397 |
def BDNZAp: BForm_1<16, 25, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1398 |
"bdnza+ $dst">; |
| 1399 |
def BDZm : BForm_1<16, 26, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1400 |
"bdz- $dst">; |
| 1401 |
def BDNZm: BForm_1<16, 24, 0, 0, (outs), (ins condbrtarget:$dst), |
| 1402 |
"bdnz- $dst">; |
| 1403 |
def BDZAm : BForm_1<16, 26, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1404 |
"bdza- $dst">; |
| 1405 |
def BDNZAm: BForm_1<16, 24, 1, 0, (outs), (ins abscondbrtarget:$dst), |
| 1406 |
"bdnza- $dst">; |
| 1407 |
} |
| 1408 |
} |
| 1409 |
|
| 1410 |
// The unconditional BCL used by the SjLj setjmp code. |
| 1411 |
let isCall = 1, hasCtrlDep = 1, isCodeGenOnly = 1, PPC970_Unit = 7 in { |
| 1412 |
let Defs = [LR], Uses = [RM] in { |
| 1413 |
def BCLalways : BForm_2<16, 20, 31, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1414 |
"bcl 20, 31, $dst">; |
| 1415 |
} |
| 1416 |
} |
| 1417 |
|
| 1418 |
let isCall = 1, PPC970_Unit = 7, Defs = [LR] in { |
| 1419 |
// Convenient aliases for call instructions |
| 1420 |
let Uses = [RM] in { |
| 1421 |
def BL : IForm<18, 0, 1, (outs), (ins calltarget:$func), |
| 1422 |
"bl $func", IIC_BrB, []>; // See Pat patterns below. |
| 1423 |
def BLA : IForm<18, 1, 1, (outs), (ins abscalltarget:$func), |
| 1424 |
"bla $func", IIC_BrB, [(PPCcall (i32 imm:$func))]>; |
| 1425 |
|
| 1426 |
let isCodeGenOnly = 1 in { |
| 1427 |
def BL_TLS : IForm<18, 0, 1, (outs), (ins tlscall32:$func), |
| 1428 |
"bl $func", IIC_BrB, []>; |
| 1429 |
def BCCL : BForm<16, 0, 1, (outs), (ins pred:$cond, condbrtarget:$dst), |
| 1430 |
"b${cond:cc}l${cond:pm} ${cond:reg}, $dst">; |
| 1431 |
def BCCLA : BForm<16, 1, 1, (outs), (ins pred:$cond, abscondbrtarget:$dst), |
| 1432 |
"b${cond:cc}la${cond:pm} ${cond:reg}, $dst">; |
| 1433 |
|
| 1434 |
def BCL : BForm_4<16, 12, 0, 1, (outs), |
| 1435 |
(ins crbitrc:$bi, condbrtarget:$dst), |
| 1436 |
"bcl 12, $bi, $dst">; |
| 1437 |
def BCLn : BForm_4<16, 4, 0, 1, (outs), |
| 1438 |
(ins crbitrc:$bi, condbrtarget:$dst), |
| 1439 |
"bcl 4, $bi, $dst">; |
| 1440 |
} |
| 1441 |
} |
| 1442 |
let Uses = [CTR, RM] in { |
| 1443 |
def BCTRL : XLForm_2_ext<19, 528, 20, 0, 1, (outs), (ins), |
| 1444 |
"bctrl", IIC_BrB, [(PPCbctrl)]>, |
| 1445 |
Requires<[In32BitMode]>; |
| 1446 |
|
| 1447 |
let isCodeGenOnly = 1 in { |
| 1448 |
def BCCCTRL : XLForm_2_br<19, 528, 1, (outs), (ins pred:$cond), |
| 1449 |
"b${cond:cc}ctrl${cond:pm} ${cond:reg}", IIC_BrB, |
| 1450 |
[]>; |
| 1451 |
|
| 1452 |
def BCCTRL : XLForm_2_br2<19, 528, 12, 1, (outs), (ins crbitrc:$bi), |
| 1453 |
"bcctrl 12, $bi, 0", IIC_BrB, []>; |
| 1454 |
def BCCTRLn : XLForm_2_br2<19, 528, 4, 1, (outs), (ins crbitrc:$bi), |
| 1455 |
"bcctrl 4, $bi, 0", IIC_BrB, []>; |
| 1456 |
} |
| 1457 |
} |
| 1458 |
let Uses = [LR, RM] in { |
| 1459 |
def BLRL : XLForm_2_ext<19, 16, 20, 0, 1, (outs), (ins), |
| 1460 |
"blrl", IIC_BrB, []>; |
| 1461 |
|
| 1462 |
let isCodeGenOnly = 1 in { |
| 1463 |
def BCCLRL : XLForm_2_br<19, 16, 1, (outs), (ins pred:$cond), |
| 1464 |
"b${cond:cc}lrl${cond:pm} ${cond:reg}", IIC_BrB, |
| 1465 |
[]>; |
| 1466 |
|
| 1467 |
def BCLRL : XLForm_2_br2<19, 16, 12, 1, (outs), (ins crbitrc:$bi), |
| 1468 |
"bclrl 12, $bi, 0", IIC_BrB, []>; |
| 1469 |
def BCLRLn : XLForm_2_br2<19, 16, 4, 1, (outs), (ins crbitrc:$bi), |
| 1470 |
"bclrl 4, $bi, 0", IIC_BrB, []>; |
| 1471 |
} |
| 1472 |
} |
| 1473 |
let Defs = [CTR], Uses = [CTR, RM] in { |
| 1474 |
def BDZL : BForm_1<16, 18, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1475 |
"bdzl $dst">; |
| 1476 |
def BDNZL : BForm_1<16, 16, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1477 |
"bdnzl $dst">; |
| 1478 |
def BDZLA : BForm_1<16, 18, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1479 |
"bdzla $dst">; |
| 1480 |
def BDNZLA : BForm_1<16, 16, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1481 |
"bdnzla $dst">; |
| 1482 |
def BDZLp : BForm_1<16, 27, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1483 |
"bdzl+ $dst">; |
| 1484 |
def BDNZLp: BForm_1<16, 25, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1485 |
"bdnzl+ $dst">; |
| 1486 |
def BDZLAp : BForm_1<16, 27, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1487 |
"bdzla+ $dst">; |
| 1488 |
def BDNZLAp: BForm_1<16, 25, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1489 |
"bdnzla+ $dst">; |
| 1490 |
def BDZLm : BForm_1<16, 26, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1491 |
"bdzl- $dst">; |
| 1492 |
def BDNZLm: BForm_1<16, 24, 0, 1, (outs), (ins condbrtarget:$dst), |
| 1493 |
"bdnzl- $dst">; |
| 1494 |
def BDZLAm : BForm_1<16, 26, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1495 |
"bdzla- $dst">; |
| 1496 |
def BDNZLAm: BForm_1<16, 24, 1, 1, (outs), (ins abscondbrtarget:$dst), |
| 1497 |
"bdnzla- $dst">; |
| 1498 |
} |
| 1499 |
let Defs = [CTR], Uses = [CTR, LR, RM] in { |
| 1500 |
def BDZLRL : XLForm_2_ext<19, 16, 18, 0, 1, (outs), (ins), |
| 1501 |
"bdzlrl", IIC_BrB, []>; |
| 1502 |
def BDNZLRL : XLForm_2_ext<19, 16, 16, 0, 1, (outs), (ins), |
| 1503 |
"bdnzlrl", IIC_BrB, []>; |
| 1504 |
def BDZLRLp : XLForm_2_ext<19, 16, 27, 0, 1, (outs), (ins), |
| 1505 |
"bdzlrl+", IIC_BrB, []>; |
| 1506 |
def BDNZLRLp: XLForm_2_ext<19, 16, 25, 0, 1, (outs), (ins), |
| 1507 |
"bdnzlrl+", IIC_BrB, []>; |
| 1508 |
def BDZLRLm : XLForm_2_ext<19, 16, 26, 0, 1, (outs), (ins), |
| 1509 |
"bdzlrl-", IIC_BrB, []>; |
| 1510 |
def BDNZLRLm: XLForm_2_ext<19, 16, 24, 0, 1, (outs), (ins), |
| 1511 |
"bdnzlrl-", IIC_BrB, []>; |
| 1512 |
} |
| 1513 |
} |
| 1514 |
|
| 1515 |
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
| 1516 |
def TCRETURNdi :Pseudo< (outs), |
| 1517 |
(ins calltarget:$dst, i32imm:$offset), |
| 1518 |
"#TC_RETURNd $dst $offset", |
| 1519 |
[]>; |
| 1520 |
|
| 1521 |
|
| 1522 |
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
| 1523 |
def TCRETURNai :Pseudo<(outs), (ins abscalltarget:$func, i32imm:$offset), |
| 1524 |
"#TC_RETURNa $func $offset", |
| 1525 |
[(PPCtc_return (i32 imm:$func), imm:$offset)]>; |
| 1526 |
|
| 1527 |
let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [RM] in |
| 1528 |
def TCRETURNri : Pseudo<(outs), (ins CTRRC:$dst, i32imm:$offset), |
| 1529 |
"#TC_RETURNr $dst $offset", |
| 1530 |
[]>; |
| 1531 |
|
| 1532 |
|
| 1533 |
let isCodeGenOnly = 1 in { |
| 1534 |
|
| 1535 |
let isTerminator = 1, isBarrier = 1, PPC970_Unit = 7, isBranch = 1, |
| 1536 |
isIndirectBranch = 1, isCall = 1, isReturn = 1, Uses = [CTR, RM] in |
| 1537 |
def TAILBCTR : XLForm_2_ext<19, 528, 20, 0, 0, (outs), (ins), "bctr", IIC_BrB, |
| 1538 |
[]>, Requires<[In32BitMode]>; |
| 1539 |
|
| 1540 |
let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, |
| 1541 |
isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in |
| 1542 |
def TAILB : IForm<18, 0, 0, (outs), (ins calltarget:$dst), |
| 1543 |
"b $dst", IIC_BrB, |
| 1544 |
[]>; |
| 1545 |
|
| 1546 |
let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, PPC970_Unit = 7, |
| 1547 |
isBarrier = 1, isCall = 1, isReturn = 1, Uses = [RM] in |
| 1548 |
def TAILBA : IForm<18, 0, 0, (outs), (ins abscalltarget:$dst), |
| 1549 |
"ba $dst", IIC_BrB, |
| 1550 |
[]>; |
| 1551 |
|
| 1552 |
} |
| 1553 |
|
| 1554 |
let hasSideEffects = 1, isBarrier = 1, usesCustomInserter = 1 in { |
| 1555 |
let Defs = [CTR] in |
| 1556 |
def EH_SjLj_SetJmp32 : Pseudo<(outs gprc:$dst), (ins memr:$buf), |
| 1557 |
"#EH_SJLJ_SETJMP32", |
| 1558 |
[(set i32:$dst, (PPCeh_sjlj_setjmp addr:$buf))]>, |
| 1559 |
Requires<[In32BitMode]>; |
| 1560 |
let isTerminator = 1 in |
| 1561 |
def EH_SjLj_LongJmp32 : Pseudo<(outs), (ins memr:$buf), |
| 1562 |
"#EH_SJLJ_LONGJMP32", |
| 1563 |
[(PPCeh_sjlj_longjmp addr:$buf)]>, |
| 1564 |
Requires<[In32BitMode]>; |
| 1565 |
} |
| 1566 |
|
| 1567 |
// This pseudo is never removed from the function, as it serves as |
| 1568 |
// a terminator. Size is set to 0 to prevent the builtin assembler |
| 1569 |
// from emitting it. |
| 1570 |
let isBranch = 1, isTerminator = 1, Size = 0 in { |
| 1571 |
def EH_SjLj_Setup : Pseudo<(outs), (ins directbrtarget:$dst), |
| 1572 |
"#EH_SjLj_Setup\t$dst", []>; |
| 1573 |
} |
| 1574 |
|
| 1575 |
// System call. |
| 1576 |
let PPC970_Unit = 7 in { |
| 1577 |
def SC : SCForm<17, 1, (outs), (ins i32imm:$lev), |
| 1578 |
"sc $lev", IIC_BrB, [(PPCsc (i32 imm:$lev))]>; |
| 1579 |
} |
| 1580 |
|
| 1581 |
// Branch history rolling buffer. |
| 1582 |
def CLRBHRB : XForm_0<31, 430, (outs), (ins), "clrbhrb", IIC_BrB, |
| 1583 |
[(PPCclrbhrb)]>, |
| 1584 |
PPC970_DGroup_Single; |
| 1585 |
// The $dmy argument used for MFBHRBE is not needed; however, including |
| 1586 |
// it avoids automatic generation of PPCFastISel::fastEmit_i(), which |
| 1587 |
// interferes with necessary special handling (see PPCFastISel.cpp). |
| 1588 |
def MFBHRBE : XFXForm_3p<31, 302, (outs gprc:$rD), |
| 1589 |
(ins u10imm:$imm, u10imm:$dmy), |
| 1590 |
"mfbhrbe $rD, $imm", IIC_BrB, |
| 1591 |
[(set i32:$rD, |
| 1592 |
(PPCmfbhrbe imm:$imm, imm:$dmy))]>, |
| 1593 |
PPC970_DGroup_First; |
| 1594 |
|
| 1595 |
def RFEBB : XLForm_S<19, 146, (outs), (ins u1imm:$imm), "rfebb $imm", |
| 1596 |
IIC_BrB, [(PPCrfebb (i32 imm:$imm))]>, |
| 1597 |
PPC970_DGroup_Single; |
| 1598 |
|
| 1599 |
// DCB* instructions. |
| 1600 |
def DCBA : DCB_Form<758, 0, (outs), (ins memrr:$dst), "dcba $dst", |
| 1601 |
IIC_LdStDCBF, [(int_ppc_dcba xoaddr:$dst)]>, |
| 1602 |
PPC970_DGroup_Single; |
| 1603 |
def DCBI : DCB_Form<470, 0, (outs), (ins memrr:$dst), "dcbi $dst", |
| 1604 |
IIC_LdStDCBF, [(int_ppc_dcbi xoaddr:$dst)]>, |
| 1605 |
PPC970_DGroup_Single; |
| 1606 |
def DCBST : DCB_Form<54, 0, (outs), (ins memrr:$dst), "dcbst $dst", |
| 1607 |
IIC_LdStDCBF, [(int_ppc_dcbst xoaddr:$dst)]>, |
| 1608 |
PPC970_DGroup_Single; |
| 1609 |
def DCBZ : DCB_Form<1014, 0, (outs), (ins memrr:$dst), "dcbz $dst", |
| 1610 |
IIC_LdStDCBF, [(int_ppc_dcbz xoaddr:$dst)]>, |
| 1611 |
PPC970_DGroup_Single; |
| 1612 |
def DCBZL : DCB_Form<1014, 1, (outs), (ins memrr:$dst), "dcbzl $dst", |
| 1613 |
IIC_LdStDCBF, [(int_ppc_dcbzl xoaddr:$dst)]>, |
| 1614 |
PPC970_DGroup_Single; |
| 1615 |
|
| 1616 |
def DCBF : DCB_Form_hint<86, (outs), (ins u5imm:$TH, memrr:$dst), |
| 1617 |
"dcbf $dst, $TH", IIC_LdStDCBF, []>, |
| 1618 |
PPC970_DGroup_Single; |
| 1619 |
|
| 1620 |
let hasSideEffects = 0, mayLoad = 1, mayStore = 1 in { |
| 1621 |
def DCBT : DCB_Form_hint<278, (outs), (ins u5imm:$TH, memrr:$dst), |
| 1622 |
"dcbt $dst, $TH", IIC_LdStDCBF, []>, |
| 1623 |
PPC970_DGroup_Single; |
| 1624 |
def DCBTST : DCB_Form_hint<246, (outs), (ins u5imm:$TH, memrr:$dst), |
| 1625 |
"dcbtst $dst, $TH", IIC_LdStDCBF, []>, |
| 1626 |
PPC970_DGroup_Single; |
| 1627 |
} // hasSideEffects = 0 |
| 1628 |
|
| 1629 |
def ICBLC : XForm_icbt<31, 230, (outs), (ins u4imm:$CT, memrr:$src), |
| 1630 |
"icblc $CT, $src", IIC_LdStStore>, Requires<[HasICBT]>; |
| 1631 |
def ICBLQ : XForm_icbt<31, 198, (outs), (ins u4imm:$CT, memrr:$src), |
| 1632 |
"icblq. $CT, $src", IIC_LdStLoad>, Requires<[HasICBT]>; |
| 1633 |
def ICBT : XForm_icbt<31, 22, (outs), (ins u4imm:$CT, memrr:$src), |
| 1634 |
"icbt $CT, $src", IIC_LdStLoad>, Requires<[HasICBT]>; |
| 1635 |
def ICBTLS : XForm_icbt<31, 486, (outs), (ins u4imm:$CT, memrr:$src), |
| 1636 |
"icbtls $CT, $src", IIC_LdStLoad>, Requires<[HasICBT]>; |
| 1637 |
|
| 1638 |
def : Pat<(int_ppc_dcbt xoaddr:$dst), |
| 1639 |
(DCBT 0, xoaddr:$dst)>; |
| 1640 |
def : Pat<(int_ppc_dcbtst xoaddr:$dst), |
| 1641 |
(DCBTST 0, xoaddr:$dst)>; |
| 1642 |
def : Pat<(int_ppc_dcbf xoaddr:$dst), |
| 1643 |
(DCBF 0, xoaddr:$dst)>; |
| 1644 |
|
| 1645 |
def : Pat<(prefetch xoaddr:$dst, (i32 0), imm, (i32 1)), |
| 1646 |
(DCBT 0, xoaddr:$dst)>; // data prefetch for loads |
| 1647 |
def : Pat<(prefetch xoaddr:$dst, (i32 1), imm, (i32 1)), |
| 1648 |
(DCBTST 0, xoaddr:$dst)>; // data prefetch for stores |
| 1649 |
def : Pat<(prefetch xoaddr:$dst, (i32 0), imm, (i32 0)), |
| 1650 |
(ICBT 0, xoaddr:$dst)>, Requires<[HasICBT]>; // inst prefetch (for read) |
| 1651 |
|
| 1652 |
// Atomic operations |
| 1653 |
// FIXME: some of these might be used with constant operands. This will result |
| 1654 |
// in constant materialization instructions that may be redundant. We currently |
| 1655 |
// clean this up in PPCMIPeephole with calls to |
| 1656 |
// PPCInstrInfo::convertToImmediateForm() but we should probably not emit them |
| 1657 |
// in the first place. |
| 1658 |
let usesCustomInserter = 1 in { |
| 1659 |
let Defs = [CR0] in { |
| 1660 |
def ATOMIC_LOAD_ADD_I8 : Pseudo< |
| 1661 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_ADD_I8", |
| 1662 |
[(set i32:$dst, (atomic_load_add_8 xoaddr:$ptr, i32:$incr))]>; |
| 1663 |
def ATOMIC_LOAD_SUB_I8 : Pseudo< |
| 1664 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_SUB_I8", |
| 1665 |
[(set i32:$dst, (atomic_load_sub_8 xoaddr:$ptr, i32:$incr))]>; |
| 1666 |
def ATOMIC_LOAD_AND_I8 : Pseudo< |
| 1667 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_AND_I8", |
| 1668 |
[(set i32:$dst, (atomic_load_and_8 xoaddr:$ptr, i32:$incr))]>; |
| 1669 |
def ATOMIC_LOAD_OR_I8 : Pseudo< |
| 1670 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_OR_I8", |
| 1671 |
[(set i32:$dst, (atomic_load_or_8 xoaddr:$ptr, i32:$incr))]>; |
| 1672 |
def ATOMIC_LOAD_XOR_I8 : Pseudo< |
| 1673 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "ATOMIC_LOAD_XOR_I8", |
| 1674 |
[(set i32:$dst, (atomic_load_xor_8 xoaddr:$ptr, i32:$incr))]>; |
| 1675 |
def ATOMIC_LOAD_NAND_I8 : Pseudo< |
| 1676 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I8", |
| 1677 |
[(set i32:$dst, (atomic_load_nand_8 xoaddr:$ptr, i32:$incr))]>; |
| 1678 |
def ATOMIC_LOAD_MIN_I8 : Pseudo< |
| 1679 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I8", |
| 1680 |
[(set i32:$dst, (atomic_load_min_8 xoaddr:$ptr, i32:$incr))]>; |
| 1681 |
def ATOMIC_LOAD_MAX_I8 : Pseudo< |
| 1682 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I8", |
| 1683 |
[(set i32:$dst, (atomic_load_max_8 xoaddr:$ptr, i32:$incr))]>; |
| 1684 |
def ATOMIC_LOAD_UMIN_I8 : Pseudo< |
| 1685 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I8", |
| 1686 |
[(set i32:$dst, (atomic_load_umin_8 xoaddr:$ptr, i32:$incr))]>; |
| 1687 |
def ATOMIC_LOAD_UMAX_I8 : Pseudo< |
| 1688 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I8", |
| 1689 |
[(set i32:$dst, (atomic_load_umax_8 xoaddr:$ptr, i32:$incr))]>; |
| 1690 |
def ATOMIC_LOAD_ADD_I16 : Pseudo< |
| 1691 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_ADD_I16", |
| 1692 |
[(set i32:$dst, (atomic_load_add_16 xoaddr:$ptr, i32:$incr))]>; |
| 1693 |
def ATOMIC_LOAD_SUB_I16 : Pseudo< |
| 1694 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_SUB_I16", |
| 1695 |
[(set i32:$dst, (atomic_load_sub_16 xoaddr:$ptr, i32:$incr))]>; |
| 1696 |
def ATOMIC_LOAD_AND_I16 : Pseudo< |
| 1697 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_AND_I16", |
| 1698 |
[(set i32:$dst, (atomic_load_and_16 xoaddr:$ptr, i32:$incr))]>; |
| 1699 |
def ATOMIC_LOAD_OR_I16 : Pseudo< |
| 1700 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_OR_I16", |
| 1701 |
[(set i32:$dst, (atomic_load_or_16 xoaddr:$ptr, i32:$incr))]>; |
| 1702 |
def ATOMIC_LOAD_XOR_I16 : Pseudo< |
| 1703 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_XOR_I16", |
| 1704 |
[(set i32:$dst, (atomic_load_xor_16 xoaddr:$ptr, i32:$incr))]>; |
| 1705 |
def ATOMIC_LOAD_NAND_I16 : Pseudo< |
| 1706 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I16", |
| 1707 |
[(set i32:$dst, (atomic_load_nand_16 xoaddr:$ptr, i32:$incr))]>; |
| 1708 |
def ATOMIC_LOAD_MIN_I16 : Pseudo< |
| 1709 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I16", |
| 1710 |
[(set i32:$dst, (atomic_load_min_16 xoaddr:$ptr, i32:$incr))]>; |
| 1711 |
def ATOMIC_LOAD_MAX_I16 : Pseudo< |
| 1712 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I16", |
| 1713 |
[(set i32:$dst, (atomic_load_max_16 xoaddr:$ptr, i32:$incr))]>; |
| 1714 |
def ATOMIC_LOAD_UMIN_I16 : Pseudo< |
| 1715 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I16", |
| 1716 |
[(set i32:$dst, (atomic_load_umin_16 xoaddr:$ptr, i32:$incr))]>; |
| 1717 |
def ATOMIC_LOAD_UMAX_I16 : Pseudo< |
| 1718 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I16", |
| 1719 |
[(set i32:$dst, (atomic_load_umax_16 xoaddr:$ptr, i32:$incr))]>; |
| 1720 |
def ATOMIC_LOAD_ADD_I32 : Pseudo< |
| 1721 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_ADD_I32", |
| 1722 |
[(set i32:$dst, (atomic_load_add_32 xoaddr:$ptr, i32:$incr))]>; |
| 1723 |
def ATOMIC_LOAD_SUB_I32 : Pseudo< |
| 1724 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_SUB_I32", |
| 1725 |
[(set i32:$dst, (atomic_load_sub_32 xoaddr:$ptr, i32:$incr))]>; |
| 1726 |
def ATOMIC_LOAD_AND_I32 : Pseudo< |
| 1727 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_AND_I32", |
| 1728 |
[(set i32:$dst, (atomic_load_and_32 xoaddr:$ptr, i32:$incr))]>; |
| 1729 |
def ATOMIC_LOAD_OR_I32 : Pseudo< |
| 1730 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_OR_I32", |
| 1731 |
[(set i32:$dst, (atomic_load_or_32 xoaddr:$ptr, i32:$incr))]>; |
| 1732 |
def ATOMIC_LOAD_XOR_I32 : Pseudo< |
| 1733 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_XOR_I32", |
| 1734 |
[(set i32:$dst, (atomic_load_xor_32 xoaddr:$ptr, i32:$incr))]>; |
| 1735 |
def ATOMIC_LOAD_NAND_I32 : Pseudo< |
| 1736 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_NAND_I32", |
| 1737 |
[(set i32:$dst, (atomic_load_nand_32 xoaddr:$ptr, i32:$incr))]>; |
| 1738 |
def ATOMIC_LOAD_MIN_I32 : Pseudo< |
| 1739 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MIN_I32", |
| 1740 |
[(set i32:$dst, (atomic_load_min_32 xoaddr:$ptr, i32:$incr))]>; |
| 1741 |
def ATOMIC_LOAD_MAX_I32 : Pseudo< |
| 1742 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_MAX_I32", |
| 1743 |
[(set i32:$dst, (atomic_load_max_32 xoaddr:$ptr, i32:$incr))]>; |
| 1744 |
def ATOMIC_LOAD_UMIN_I32 : Pseudo< |
| 1745 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMIN_I32", |
| 1746 |
[(set i32:$dst, (atomic_load_umin_32 xoaddr:$ptr, i32:$incr))]>; |
| 1747 |
def ATOMIC_LOAD_UMAX_I32 : Pseudo< |
| 1748 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$incr), "#ATOMIC_LOAD_UMAX_I32", |
| 1749 |
[(set i32:$dst, (atomic_load_umax_32 xoaddr:$ptr, i32:$incr))]>; |
| 1750 |
|
| 1751 |
def ATOMIC_CMP_SWAP_I8 : Pseudo< |
| 1752 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$old, gprc:$new), "#ATOMIC_CMP_SWAP_I8", |
| 1753 |
[(set i32:$dst, (atomic_cmp_swap_8 xoaddr:$ptr, i32:$old, i32:$new))]>; |
| 1754 |
def ATOMIC_CMP_SWAP_I16 : Pseudo< |
| 1755 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$old, gprc:$new), "#ATOMIC_CMP_SWAP_I16 $dst $ptr $old $new", |
| 1756 |
[(set i32:$dst, (atomic_cmp_swap_16 xoaddr:$ptr, i32:$old, i32:$new))]>; |
| 1757 |
def ATOMIC_CMP_SWAP_I32 : Pseudo< |
| 1758 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$old, gprc:$new), "#ATOMIC_CMP_SWAP_I32 $dst $ptr $old $new", |
| 1759 |
[(set i32:$dst, (atomic_cmp_swap_32 xoaddr:$ptr, i32:$old, i32:$new))]>; |
| 1760 |
|
| 1761 |
def ATOMIC_SWAP_I8 : Pseudo< |
| 1762 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$new), "#ATOMIC_SWAP_i8", |
| 1763 |
[(set i32:$dst, (atomic_swap_8 xoaddr:$ptr, i32:$new))]>; |
| 1764 |
def ATOMIC_SWAP_I16 : Pseudo< |
| 1765 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$new), "#ATOMIC_SWAP_I16", |
| 1766 |
[(set i32:$dst, (atomic_swap_16 xoaddr:$ptr, i32:$new))]>; |
| 1767 |
def ATOMIC_SWAP_I32 : Pseudo< |
| 1768 |
(outs gprc:$dst), (ins memrr:$ptr, gprc:$new), "#ATOMIC_SWAP_I32", |
| 1769 |
[(set i32:$dst, (atomic_swap_32 xoaddr:$ptr, i32:$new))]>; |
| 1770 |
} |
| 1771 |
} |
| 1772 |
|
| 1773 |
def : Pat<(PPCatomicCmpSwap_8 xoaddr:$ptr, i32:$old, i32:$new), |
| 1774 |
(ATOMIC_CMP_SWAP_I8 xoaddr:$ptr, i32:$old, i32:$new)>; |
| 1775 |
def : Pat<(PPCatomicCmpSwap_16 xoaddr:$ptr, i32:$old, i32:$new), |
| 1776 |
(ATOMIC_CMP_SWAP_I16 xoaddr:$ptr, i32:$old, i32:$new)>; |
| 1777 |
|
| 1778 |
// Instructions to support atomic operations |
| 1779 |
let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in { |
| 1780 |
def LBARX : XForm_1_memOp<31, 52, (outs gprc:$rD), (ins memrr:$src), |
| 1781 |
"lbarx $rD, $src", IIC_LdStLWARX, []>, |
| 1782 |
Requires<[HasPartwordAtomics]>; |
| 1783 |
|
| 1784 |
def LHARX : XForm_1_memOp<31, 116, (outs gprc:$rD), (ins memrr:$src), |
| 1785 |
"lharx $rD, $src", IIC_LdStLWARX, []>, |
| 1786 |
Requires<[HasPartwordAtomics]>; |
| 1787 |
|
| 1788 |
def LWARX : XForm_1_memOp<31, 20, (outs gprc:$rD), (ins memrr:$src), |
| 1789 |
"lwarx $rD, $src", IIC_LdStLWARX, []>; |
| 1790 |
|
| 1791 |
// Instructions to support lock versions of atomics |
| 1792 |
// (EH=1 - see Power ISA 2.07 Book II 4.4.2) |
| 1793 |
def LBARXL : XForm_1_memOp<31, 52, (outs gprc:$rD), (ins memrr:$src), |
| 1794 |
"lbarx $rD, $src, 1", IIC_LdStLWARX, []>, isDOT, |
| 1795 |
Requires<[HasPartwordAtomics]>; |
| 1796 |
|
| 1797 |
def LHARXL : XForm_1_memOp<31, 116, (outs gprc:$rD), (ins memrr:$src), |
| 1798 |
"lharx $rD, $src, 1", IIC_LdStLWARX, []>, isDOT, |
| 1799 |
Requires<[HasPartwordAtomics]>; |
| 1800 |
|
| 1801 |
def LWARXL : XForm_1_memOp<31, 20, (outs gprc:$rD), (ins memrr:$src), |
| 1802 |
"lwarx $rD, $src, 1", IIC_LdStLWARX, []>, isDOT; |
| 1803 |
|
| 1804 |
// The atomic instructions use the destination register as well as the next one |
| 1805 |
// or two registers in order (modulo 31). |
| 1806 |
let hasExtraSrcRegAllocReq = 1 in |
| 1807 |
def LWAT : X_RD5_RS5_IM5<31, 582, (outs gprc:$rD), (ins gprc:$rA, u5imm:$FC), |
| 1808 |
"lwat $rD, $rA, $FC", IIC_LdStLoad>, |
| 1809 |
Requires<[IsISA3_0]>; |
| 1810 |
} |
| 1811 |
|
| 1812 |
let Defs = [CR0], mayStore = 1, mayLoad = 0, hasSideEffects = 0 in { |
| 1813 |
def STBCX : XForm_1_memOp<31, 694, (outs), (ins gprc:$rS, memrr:$dst), |
| 1814 |
"stbcx. $rS, $dst", IIC_LdStSTWCX, []>, |
| 1815 |
isDOT, Requires<[HasPartwordAtomics]>; |
| 1816 |
|
| 1817 |
def STHCX : XForm_1_memOp<31, 726, (outs), (ins gprc:$rS, memrr:$dst), |
| 1818 |
"sthcx. $rS, $dst", IIC_LdStSTWCX, []>, |
| 1819 |
isDOT, Requires<[HasPartwordAtomics]>; |
| 1820 |
|
| 1821 |
def STWCX : XForm_1_memOp<31, 150, (outs), (ins gprc:$rS, memrr:$dst), |
| 1822 |
"stwcx. $rS, $dst", IIC_LdStSTWCX, []>, isDOT; |
| 1823 |
} |
| 1824 |
|
| 1825 |
let mayStore = 1, mayLoad = 0, hasSideEffects = 0 in |
| 1826 |
def STWAT : X_RD5_RS5_IM5<31, 710, (outs), (ins gprc:$rS, gprc:$rA, u5imm:$FC), |
| 1827 |
"stwat $rS, $rA, $FC", IIC_LdStStore>, |
| 1828 |
Requires<[IsISA3_0]>; |
| 1829 |
|
| 1830 |
let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in |
| 1831 |
def TRAP : XForm_24<31, 4, (outs), (ins), "trap", IIC_LdStLoad, [(trap)]>; |
| 1832 |
|
| 1833 |
def TWI : DForm_base<3, (outs), (ins u5imm:$to, gprc:$rA, s16imm:$imm), |
| 1834 |
"twi $to, $rA, $imm", IIC_IntTrapW, []>; |
| 1835 |
def TW : XForm_1<31, 4, (outs), (ins u5imm:$to, gprc:$rA, gprc:$rB), |
| 1836 |
"tw $to, $rA, $rB", IIC_IntTrapW, []>; |
| 1837 |
def TDI : DForm_base<2, (outs), (ins u5imm:$to, g8rc:$rA, s16imm:$imm), |
| 1838 |
"tdi $to, $rA, $imm", IIC_IntTrapD, []>; |
| 1839 |
def TD : XForm_1<31, 68, (outs), (ins u5imm:$to, g8rc:$rA, g8rc:$rB), |
| 1840 |
"td $to, $rA, $rB", IIC_IntTrapD, []>; |
| 1841 |
|
| 1842 |
//===----------------------------------------------------------------------===// |
| 1843 |
// PPC32 Load Instructions. |
| 1844 |
// |
| 1845 |
|
| 1846 |
// Unindexed (r+i) Loads. |
| 1847 |
let PPC970_Unit = 2 in { |
| 1848 |
def LBZ : DForm_1<34, (outs gprc:$rD), (ins memri:$src), |
| 1849 |
"lbz $rD, $src", IIC_LdStLoad, |
| 1850 |
[(set i32:$rD, (zextloadi8 iaddr:$src))]>; |
| 1851 |
def LHA : DForm_1<42, (outs gprc:$rD), (ins memri:$src), |
| 1852 |
"lha $rD, $src", IIC_LdStLHA, |
| 1853 |
[(set i32:$rD, (sextloadi16 iaddr:$src))]>, |
| 1854 |
PPC970_DGroup_Cracked; |
| 1855 |
def LHZ : DForm_1<40, (outs gprc:$rD), (ins memri:$src), |
| 1856 |
"lhz $rD, $src", IIC_LdStLoad, |
| 1857 |
[(set i32:$rD, (zextloadi16 iaddr:$src))]>; |
| 1858 |
def LWZ : DForm_1<32, (outs gprc:$rD), (ins memri:$src), |
| 1859 |
"lwz $rD, $src", IIC_LdStLoad, |
| 1860 |
[(set i32:$rD, (load iaddr:$src))]>; |
| 1861 |
|
| 1862 |
let Predicates = [HasFPU] in { |
| 1863 |
def LFS : DForm_1<48, (outs f4rc:$rD), (ins memri:$src), |
| 1864 |
"lfs $rD, $src", IIC_LdStLFD, |
| 1865 |
[(set f32:$rD, (load iaddr:$src))]>; |
| 1866 |
def LFD : DForm_1<50, (outs f8rc:$rD), (ins memri:$src), |
| 1867 |
"lfd $rD, $src", IIC_LdStLFD, |
| 1868 |
[(set f64:$rD, (load iaddr:$src))]>; |
| 1869 |
} |
| 1870 |
|
| 1871 |
|
| 1872 |
// Unindexed (r+i) Loads with Update (preinc). |
| 1873 |
let mayLoad = 1, mayStore = 0, hasSideEffects = 0 in { |
| 1874 |
def LBZU : DForm_1<35, (outs gprc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1875 |
"lbzu $rD, $addr", IIC_LdStLoadUpd, |
| 1876 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1877 |
NoEncode<"$ea_result">; |
| 1878 |
|
| 1879 |
def LHAU : DForm_1<43, (outs gprc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1880 |
"lhau $rD, $addr", IIC_LdStLHAU, |
| 1881 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1882 |
NoEncode<"$ea_result">; |
| 1883 |
|
| 1884 |
def LHZU : DForm_1<41, (outs gprc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1885 |
"lhzu $rD, $addr", IIC_LdStLoadUpd, |
| 1886 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1887 |
NoEncode<"$ea_result">; |
| 1888 |
|
| 1889 |
def LWZU : DForm_1<33, (outs gprc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1890 |
"lwzu $rD, $addr", IIC_LdStLoadUpd, |
| 1891 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1892 |
NoEncode<"$ea_result">; |
| 1893 |
|
| 1894 |
let Predicates = [HasFPU] in { |
| 1895 |
def LFSU : DForm_1<49, (outs f4rc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1896 |
"lfsu $rD, $addr", IIC_LdStLFDU, |
| 1897 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1898 |
NoEncode<"$ea_result">; |
| 1899 |
|
| 1900 |
def LFDU : DForm_1<51, (outs f8rc:$rD, ptr_rc_nor0:$ea_result), (ins memri:$addr), |
| 1901 |
"lfdu $rD, $addr", IIC_LdStLFDU, |
| 1902 |
[]>, RegConstraint<"$addr.reg = $ea_result">, |
| 1903 |
NoEncode<"$ea_result">; |
| 1904 |
} |
| 1905 |
|
| 1906 |
|
| 1907 |
// Indexed (r+r) Loads with Update (preinc). |
| 1908 |
def LBZUX : XForm_1_memOp<31, 119, (outs gprc:$rD, ptr_rc_nor0:$ea_result), |
| 1909 |
(ins memrr:$addr), |
| 1910 |
"lbzux $rD, $addr", IIC_LdStLoadUpdX, |
| 1911 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1912 |
NoEncode<"$ea_result">; |
| 1913 |
|
| 1914 |
def LHAUX : XForm_1_memOp<31, 375, (outs gprc:$rD, ptr_rc_nor0:$ea_result), |
| 1915 |
(ins memrr:$addr), |
| 1916 |
"lhaux $rD, $addr", IIC_LdStLHAUX, |
| 1917 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1918 |
NoEncode<"$ea_result">; |
| 1919 |
|
| 1920 |
def LHZUX : XForm_1_memOp<31, 311, (outs gprc:$rD, ptr_rc_nor0:$ea_result), |
| 1921 |
(ins memrr:$addr), |
| 1922 |
"lhzux $rD, $addr", IIC_LdStLoadUpdX, |
| 1923 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1924 |
NoEncode<"$ea_result">; |
| 1925 |
|
| 1926 |
def LWZUX : XForm_1_memOp<31, 55, (outs gprc:$rD, ptr_rc_nor0:$ea_result), |
| 1927 |
(ins memrr:$addr), |
| 1928 |
"lwzux $rD, $addr", IIC_LdStLoadUpdX, |
| 1929 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1930 |
NoEncode<"$ea_result">; |
| 1931 |
|
| 1932 |
let Predicates = [HasFPU] in { |
| 1933 |
def LFSUX : XForm_1_memOp<31, 567, (outs f4rc:$rD, ptr_rc_nor0:$ea_result), |
| 1934 |
(ins memrr:$addr), |
| 1935 |
"lfsux $rD, $addr", IIC_LdStLFDUX, |
| 1936 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1937 |
NoEncode<"$ea_result">; |
| 1938 |
|
| 1939 |
def LFDUX : XForm_1_memOp<31, 631, (outs f8rc:$rD, ptr_rc_nor0:$ea_result), |
| 1940 |
(ins memrr:$addr), |
| 1941 |
"lfdux $rD, $addr", IIC_LdStLFDUX, |
| 1942 |
[]>, RegConstraint<"$addr.ptrreg = $ea_result">, |
| 1943 |
NoEncode<"$ea_result">; |
| 1944 |
} |
| 1945 |
} |
| 1946 |
} |
| 1947 |
|
| 1948 |
// Indexed (r+r) Loads. |
| 1949 |
// |
| 1950 |
let PPC970_Unit = 2, mayLoad = 1, mayStore = 0 in { |
| 1951 |
def LBZX : XForm_1_memOp<31, 87, (outs gprc:$rD), (ins memrr:$src), |
| 1952 |
"lbzx $rD, $src", IIC_LdStLoad, |
| 1953 |
[(set i32:$rD, (zextloadi8 xaddr:$src))]>; |
| 1954 |
def LHAX : XForm_1_memOp<31, 343, (outs gprc:$rD), (ins memrr:$src), |
| 1955 |
"lhax $rD, $src", IIC_LdStLHA, |
| 1956 |
[(set i32:$rD, (sextloadi16 xaddr:$src))]>, |
| 1957 |
PPC970_DGroup_Cracked; |
| 1958 |
def LHZX : XForm_1_memOp<31, 279, (outs gprc:$rD), (ins memrr:$src), |
| 1959 |
"lhzx $rD, $src", IIC_LdStLoad, |
| 1960 |
[(set i32:$rD, (zextloadi16 xaddr:$src))]>; |
| 1961 |
def LWZX : XForm_1_memOp<31, 23, (outs gprc:$rD), (ins memrr:$src), |
| 1962 |
"lwzx $rD, $src", IIC_LdStLoad, |
| 1963 |
[(set i32:$rD, (load xaddr:$src))]>; |
| 1964 |
def LHBRX : XForm_1_memOp<31, 790, (outs gprc:$rD), (ins memrr:$src), |
| 1965 |
"lhbrx $rD, $src", IIC_LdStLoad, |
| 1966 |
[(set i32:$rD, (PPClbrx xoaddr:$src, i16))]>; |
| 1967 |
def LWBRX : XForm_1_memOp<31, 534, (outs gprc:$rD), (ins memrr:$src), |
| 1968 |
"lwbrx $rD, $src", IIC_LdStLoad, |
| 1969 |
[(set i32:$rD, (PPClbrx xoaddr:$src, i32))]>; |
| 1970 |
|
| 1971 |
let Predicates = [HasFPU] in { |
| 1972 |
def LFSX : XForm_25_memOp<31, 535, (outs f4rc:$frD), (ins memrr:$src), |
| 1973 |
"lfsx $frD, $src", IIC_LdStLFD, |
| 1974 |
[(set f32:$frD, (load xaddr:$src))]>; |
| 1975 |
def LFDX : XForm_25_memOp<31, 599, (outs f8rc:$frD), (ins memrr:$src), |
| 1976 |
"lfdx $frD, $src", IIC_LdStLFD, |
| 1977 |
[(set f64:$frD, (load xaddr:$src))]>; |
| 1978 |
|
| 1979 |
def LFIWAX : XForm_25_memOp<31, 855, (outs f8rc:$frD), (ins memrr:$src), |
| 1980 |
"lfiwax $frD, $src", IIC_LdStLFD, |
| 1981 |
[(set f64:$frD, (PPClfiwax xoaddr:$src))]>; |
| 1982 |
def LFIWZX : XForm_25_memOp<31, 887, (outs f8rc:$frD), (ins memrr:$src), |
| 1983 |
"lfiwzx $frD, $src", IIC_LdStLFD, |
| 1984 |
[(set f64:$frD, (PPClfiwzx xoaddr:$src))]>; |
| 1985 |
} |
| 1986 |
} |
| 1987 |
|
| 1988 |
// Load Multiple |
| 1989 |
def LMW : DForm_1<46, (outs gprc:$rD), (ins memri:$src), |
| 1990 |
"lmw $rD, $src", IIC_LdStLMW, []>; |
| 1991 |
|
| 1992 |
//===----------------------------------------------------------------------===// |
| 1993 |
// PPC32 Store Instructions. |
| 1994 |
// |
| 1995 |
|
| 1996 |
// Unindexed (r+i) Stores. |
| 1997 |
let PPC970_Unit = 2, mayStore = 1, mayLoad = 0 in { |
| 1998 |
def STB : DForm_1<38, (outs), (ins gprc:$rS, memri:$src), |
| 1999 |
"stb $rS, $src", IIC_LdStStore, |
| 2000 |
[(truncstorei8 i32:$rS, iaddr:$src)]>; |
| 2001 |
def STH : DForm_1<44, (outs), (ins gprc:$rS, memri:$src), |
| 2002 |
"sth $rS, $src", IIC_LdStStore, |
| 2003 |
[(truncstorei16 i32:$rS, iaddr:$src)]>; |
| 2004 |
def STW : DForm_1<36, (outs), (ins gprc:$rS, memri:$src), |
| 2005 |
"stw $rS, $src", IIC_LdStStore, |
| 2006 |
[(store i32:$rS, iaddr:$src)]>; |
| 2007 |
let Predicates = [HasFPU] in { |
| 2008 |
def STFS : DForm_1<52, (outs), (ins f4rc:$rS, memri:$dst), |
| 2009 |
"stfs $rS, $dst", IIC_LdStSTFD, |
| 2010 |
[(store f32:$rS, iaddr:$dst)]>; |
| 2011 |
def STFD : DForm_1<54, (outs), (ins f8rc:$rS, memri:$dst), |
| 2012 |
"stfd $rS, $dst", IIC_LdStSTFD, |
| 2013 |
[(store f64:$rS, iaddr:$dst)]>; |
| 2014 |
} |
| 2015 |
} |
| 2016 |
|
| 2017 |
// Unindexed (r+i) Stores with Update (preinc). |
| 2018 |
let PPC970_Unit = 2, mayStore = 1, mayLoad = 0 in { |
| 2019 |
def STBU : DForm_1<39, (outs ptr_rc_nor0:$ea_res), (ins gprc:$rS, memri:$dst), |
| 2020 |
"stbu $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2021 |
RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
| 2022 |
def STHU : DForm_1<45, (outs ptr_rc_nor0:$ea_res), (ins gprc:$rS, memri:$dst), |
| 2023 |
"sthu $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2024 |
RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
| 2025 |
def STWU : DForm_1<37, (outs ptr_rc_nor0:$ea_res), (ins gprc:$rS, memri:$dst), |
| 2026 |
"stwu $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2027 |
RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
| 2028 |
let Predicates = [HasFPU] in { |
| 2029 |
def STFSU : DForm_1<53, (outs ptr_rc_nor0:$ea_res), (ins f4rc:$rS, memri:$dst), |
| 2030 |
"stfsu $rS, $dst", IIC_LdStSTFDU, []>, |
| 2031 |
RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
| 2032 |
def STFDU : DForm_1<55, (outs ptr_rc_nor0:$ea_res), (ins f8rc:$rS, memri:$dst), |
| 2033 |
"stfdu $rS, $dst", IIC_LdStSTFDU, []>, |
| 2034 |
RegConstraint<"$dst.reg = $ea_res">, NoEncode<"$ea_res">; |
| 2035 |
} |
| 2036 |
} |
| 2037 |
|
| 2038 |
// Patterns to match the pre-inc stores. We can't put the patterns on |
| 2039 |
// the instruction definitions directly as ISel wants the address base |
| 2040 |
// and offset to be separate operands, not a single complex operand. |
| 2041 |
def : Pat<(pre_truncsti8 i32:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 2042 |
(STBU $rS, iaddroff:$ptroff, $ptrreg)>; |
| 2043 |
def : Pat<(pre_truncsti16 i32:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 2044 |
(STHU $rS, iaddroff:$ptroff, $ptrreg)>; |
| 2045 |
def : Pat<(pre_store i32:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 2046 |
(STWU $rS, iaddroff:$ptroff, $ptrreg)>; |
| 2047 |
def : Pat<(pre_store f32:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 2048 |
(STFSU $rS, iaddroff:$ptroff, $ptrreg)>; |
| 2049 |
def : Pat<(pre_store f64:$rS, iPTR:$ptrreg, iaddroff:$ptroff), |
| 2050 |
(STFDU $rS, iaddroff:$ptroff, $ptrreg)>; |
| 2051 |
|
| 2052 |
// Indexed (r+r) Stores. |
| 2053 |
let PPC970_Unit = 2 in { |
| 2054 |
def STBX : XForm_8_memOp<31, 215, (outs), (ins gprc:$rS, memrr:$dst), |
| 2055 |
"stbx $rS, $dst", IIC_LdStStore, |
| 2056 |
[(truncstorei8 i32:$rS, xaddr:$dst)]>, |
| 2057 |
PPC970_DGroup_Cracked; |
| 2058 |
def STHX : XForm_8_memOp<31, 407, (outs), (ins gprc:$rS, memrr:$dst), |
| 2059 |
"sthx $rS, $dst", IIC_LdStStore, |
| 2060 |
[(truncstorei16 i32:$rS, xaddr:$dst)]>, |
| 2061 |
PPC970_DGroup_Cracked; |
| 2062 |
def STWX : XForm_8_memOp<31, 151, (outs), (ins gprc:$rS, memrr:$dst), |
| 2063 |
"stwx $rS, $dst", IIC_LdStStore, |
| 2064 |
[(store i32:$rS, xaddr:$dst)]>, |
| 2065 |
PPC970_DGroup_Cracked; |
| 2066 |
|
| 2067 |
def STHBRX: XForm_8_memOp<31, 918, (outs), (ins gprc:$rS, memrr:$dst), |
| 2068 |
"sthbrx $rS, $dst", IIC_LdStStore, |
| 2069 |
[(PPCstbrx i32:$rS, xoaddr:$dst, i16)]>, |
| 2070 |
PPC970_DGroup_Cracked; |
| 2071 |
def STWBRX: XForm_8_memOp<31, 662, (outs), (ins gprc:$rS, memrr:$dst), |
| 2072 |
"stwbrx $rS, $dst", IIC_LdStStore, |
| 2073 |
[(PPCstbrx i32:$rS, xoaddr:$dst, i32)]>, |
| 2074 |
PPC970_DGroup_Cracked; |
| 2075 |
|
| 2076 |
let Predicates = [HasFPU] in { |
| 2077 |
def STFIWX: XForm_28_memOp<31, 983, (outs), (ins f8rc:$frS, memrr:$dst), |
| 2078 |
"stfiwx $frS, $dst", IIC_LdStSTFD, |
| 2079 |
[(PPCstfiwx f64:$frS, xoaddr:$dst)]>; |
| 2080 |
|
| 2081 |
def STFSX : XForm_28_memOp<31, 663, (outs), (ins f4rc:$frS, memrr:$dst), |
| 2082 |
"stfsx $frS, $dst", IIC_LdStSTFD, |
| 2083 |
[(store f32:$frS, xaddr:$dst)]>; |
| 2084 |
def STFDX : XForm_28_memOp<31, 727, (outs), (ins f8rc:$frS, memrr:$dst), |
| 2085 |
"stfdx $frS, $dst", IIC_LdStSTFD, |
| 2086 |
[(store f64:$frS, xaddr:$dst)]>; |
| 2087 |
} |
| 2088 |
} |
| 2089 |
|
| 2090 |
// Indexed (r+r) Stores with Update (preinc). |
| 2091 |
let PPC970_Unit = 2, mayStore = 1, mayLoad = 0 in { |
| 2092 |
def STBUX : XForm_8_memOp<31, 247, (outs ptr_rc_nor0:$ea_res), |
| 2093 |
(ins gprc:$rS, memrr:$dst), |
| 2094 |
"stbux $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2095 |
RegConstraint<"$dst.ptrreg = $ea_res">, |
| 2096 |
NoEncode<"$ea_res">, |
| 2097 |
PPC970_DGroup_Cracked; |
| 2098 |
def STHUX : XForm_8_memOp<31, 439, (outs ptr_rc_nor0:$ea_res), |
| 2099 |
(ins gprc:$rS, memrr:$dst), |
| 2100 |
"sthux $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2101 |
RegConstraint<"$dst.ptrreg = $ea_res">, |
| 2102 |
NoEncode<"$ea_res">, |
| 2103 |
PPC970_DGroup_Cracked; |
| 2104 |
def STWUX : XForm_8_memOp<31, 183, (outs ptr_rc_nor0:$ea_res), |
| 2105 |
(ins gprc:$rS, memrr:$dst), |
| 2106 |
"stwux $rS, $dst", IIC_LdStStoreUpd, []>, |
| 2107 |
RegConstraint<"$dst.ptrreg = $ea_res">, |
| 2108 |
NoEncode<"$ea_res">, |
| 2109 |
PPC970_DGroup_Cracked; |
| 2110 |
let Predicates = [HasFPU] in { |
| 2111 |
def STFSUX: XForm_8_memOp<31, 695, (outs ptr_rc_nor0:$ea_res), |
| 2112 |
(ins f4rc:$rS, memrr:$dst), |
| 2113 |
"stfsux $rS, $dst", IIC_LdStSTFDU, []>, |
| 2114 |
RegConstraint<"$dst.ptrreg = $ea_res">, |
| 2115 |
NoEncode<"$ea_res">, |
| 2116 |
PPC970_DGroup_Cracked; |
| 2117 |
def STFDUX: XForm_8_memOp<31, 759, (outs ptr_rc_nor0:$ea_res), |
| 2118 |
(ins f8rc:$rS, memrr:$dst), |
| 2119 |
"stfdux $rS, $dst", IIC_LdStSTFDU, []>, |
| 2120 |
RegConstraint<"$dst.ptrreg = $ea_res">, |
| 2121 |
NoEncode<"$ea_res">, |
| 2122 |
PPC970_DGroup_Cracked; |
| 2123 |
} |
| 2124 |
} |
| 2125 |
|
| 2126 |
// Patterns to match the pre-inc stores. We can't put the patterns on |
| 2127 |
// the instruction definitions directly as ISel wants the address base |
| 2128 |
// and offset to be separate operands, not a single complex operand. |
| 2129 |
def : Pat<(pre_truncsti8 i32:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 2130 |
(STBUX $rS, $ptrreg, $ptroff)>; |
| 2131 |
def : Pat<(pre_truncsti16 i32:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 2132 |
(STHUX $rS, $ptrreg, $ptroff)>; |
| 2133 |
def : Pat<(pre_store i32:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 2134 |
(STWUX $rS, $ptrreg, $ptroff)>; |
| 2135 |
let Predicates = [HasFPU] in { |
| 2136 |
def : Pat<(pre_store f32:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 2137 |
(STFSUX $rS, $ptrreg, $ptroff)>; |
| 2138 |
def : Pat<(pre_store f64:$rS, iPTR:$ptrreg, iPTR:$ptroff), |
| 2139 |
(STFDUX $rS, $ptrreg, $ptroff)>; |
| 2140 |
} |
| 2141 |
|
| 2142 |
// Store Multiple |
| 2143 |
def STMW : DForm_1<47, (outs), (ins gprc:$rS, memri:$dst), |
| 2144 |
"stmw $rS, $dst", IIC_LdStLMW, []>; |
| 2145 |
|
| 2146 |
def SYNC : XForm_24_sync<31, 598, (outs), (ins i32imm:$L), |
| 2147 |
"sync $L", IIC_LdStSync, []>; |
| 2148 |
|
| 2149 |
let isCodeGenOnly = 1 in { |
| 2150 |
def MSYNC : XForm_24_sync<31, 598, (outs), (ins), |
| 2151 |
"msync", IIC_LdStSync, []> { |
| 2152 |
let L = 0; |
| 2153 |
} |
| 2154 |
} |
| 2155 |
|
| 2156 |
def : Pat<(int_ppc_sync), (SYNC 0)>, Requires<[HasSYNC]>; |
| 2157 |
def : Pat<(int_ppc_lwsync), (SYNC 1)>, Requires<[HasSYNC]>; |
| 2158 |
def : Pat<(int_ppc_sync), (MSYNC)>, Requires<[HasOnlyMSYNC]>; |
| 2159 |
def : Pat<(int_ppc_lwsync), (MSYNC)>, Requires<[HasOnlyMSYNC]>; |
| 2160 |
|
| 2161 |
//===----------------------------------------------------------------------===// |
| 2162 |
// PPC32 Arithmetic Instructions. |
| 2163 |
// |
| 2164 |
|
| 2165 |
let PPC970_Unit = 1 in { // FXU Operations. |
| 2166 |
def ADDI : DForm_2<14, (outs gprc:$rD), (ins gprc_nor0:$rA, s16imm:$imm), |
| 2167 |
"addi $rD, $rA, $imm", IIC_IntSimple, |
| 2168 |
[(set i32:$rD, (add i32:$rA, imm32SExt16:$imm))]>; |
| 2169 |
let BaseName = "addic" in { |
| 2170 |
let Defs = [CARRY] in |
| 2171 |
def ADDIC : DForm_2<12, (outs gprc:$rD), (ins gprc:$rA, s16imm:$imm), |
| 2172 |
"addic $rD, $rA, $imm", IIC_IntGeneral, |
| 2173 |
[(set i32:$rD, (addc i32:$rA, imm32SExt16:$imm))]>, |
| 2174 |
RecFormRel, PPC970_DGroup_Cracked; |
| 2175 |
let Defs = [CARRY, CR0] in |
| 2176 |
def ADDICo : DForm_2<13, (outs gprc:$rD), (ins gprc:$rA, s16imm:$imm), |
| 2177 |
"addic. $rD, $rA, $imm", IIC_IntGeneral, |
| 2178 |
[]>, isDOT, RecFormRel; |
| 2179 |
} |
| 2180 |
def ADDIS : DForm_2<15, (outs gprc:$rD), (ins gprc_nor0:$rA, s17imm:$imm), |
| 2181 |
"addis $rD, $rA, $imm", IIC_IntSimple, |
| 2182 |
[(set i32:$rD, (add i32:$rA, imm16ShiftedSExt:$imm))]>; |
| 2183 |
let isCodeGenOnly = 1 in |
| 2184 |
def LA : DForm_2<14, (outs gprc:$rD), (ins gprc_nor0:$rA, s16imm:$sym), |
| 2185 |
"la $rD, $sym($rA)", IIC_IntGeneral, |
| 2186 |
[(set i32:$rD, (add i32:$rA, |
| 2187 |
(PPClo tglobaladdr:$sym, 0)))]>; |
| 2188 |
def MULLI : DForm_2< 7, (outs gprc:$rD), (ins gprc:$rA, s16imm:$imm), |
| 2189 |
"mulli $rD, $rA, $imm", IIC_IntMulLI, |
| 2190 |
[(set i32:$rD, (mul i32:$rA, imm32SExt16:$imm))]>; |
| 2191 |
let Defs = [CARRY] in |
| 2192 |
def SUBFIC : DForm_2< 8, (outs gprc:$rD), (ins gprc:$rA, s16imm:$imm), |
| 2193 |
"subfic $rD, $rA, $imm", IIC_IntGeneral, |
| 2194 |
[(set i32:$rD, (subc imm32SExt16:$imm, i32:$rA))]>; |
| 2195 |
|
| 2196 |
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in { |
| 2197 |
def LI : DForm_2_r0<14, (outs gprc:$rD), (ins s16imm:$imm), |
| 2198 |
"li $rD, $imm", IIC_IntSimple, |
| 2199 |
[(set i32:$rD, imm32SExt16:$imm)]>; |
| 2200 |
def LIS : DForm_2_r0<15, (outs gprc:$rD), (ins s17imm:$imm), |
| 2201 |
"lis $rD, $imm", IIC_IntSimple, |
| 2202 |
[(set i32:$rD, imm16ShiftedSExt:$imm)]>; |
| 2203 |
} |
| 2204 |
} |
| 2205 |
|
| 2206 |
let PPC970_Unit = 1 in { // FXU Operations. |
| 2207 |
let Defs = [CR0] in { |
| 2208 |
def ANDIo : DForm_4<28, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2209 |
"andi. $dst, $src1, $src2", IIC_IntGeneral, |
| 2210 |
[(set i32:$dst, (and i32:$src1, immZExt16:$src2))]>, |
| 2211 |
isDOT; |
| 2212 |
def ANDISo : DForm_4<29, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2213 |
"andis. $dst, $src1, $src2", IIC_IntGeneral, |
| 2214 |
[(set i32:$dst, (and i32:$src1, imm16ShiftedZExt:$src2))]>, |
| 2215 |
isDOT; |
| 2216 |
} |
| 2217 |
def ORI : DForm_4<24, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2218 |
"ori $dst, $src1, $src2", IIC_IntSimple, |
| 2219 |
[(set i32:$dst, (or i32:$src1, immZExt16:$src2))]>; |
| 2220 |
def ORIS : DForm_4<25, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2221 |
"oris $dst, $src1, $src2", IIC_IntSimple, |
| 2222 |
[(set i32:$dst, (or i32:$src1, imm16ShiftedZExt:$src2))]>; |
| 2223 |
def XORI : DForm_4<26, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2224 |
"xori $dst, $src1, $src2", IIC_IntSimple, |
| 2225 |
[(set i32:$dst, (xor i32:$src1, immZExt16:$src2))]>; |
| 2226 |
def XORIS : DForm_4<27, (outs gprc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2227 |
"xoris $dst, $src1, $src2", IIC_IntSimple, |
| 2228 |
[(set i32:$dst, (xor i32:$src1, imm16ShiftedZExt:$src2))]>; |
| 2229 |
|
| 2230 |
def NOP : DForm_4_zero<24, (outs), (ins), "nop", IIC_IntSimple, |
| 2231 |
[]>; |
| 2232 |
let isCodeGenOnly = 1 in { |
| 2233 |
// The POWER6 and POWER7 have special group-terminating nops. |
| 2234 |
def NOP_GT_PWR6 : DForm_4_fixedreg_zero<24, 1, (outs), (ins), |
| 2235 |
"ori 1, 1, 0", IIC_IntSimple, []>; |
| 2236 |
def NOP_GT_PWR7 : DForm_4_fixedreg_zero<24, 2, (outs), (ins), |
| 2237 |
"ori 2, 2, 0", IIC_IntSimple, []>; |
| 2238 |
} |
| 2239 |
|
| 2240 |
let isCompare = 1, hasSideEffects = 0 in { |
| 2241 |
def CMPWI : DForm_5_ext<11, (outs crrc:$crD), (ins gprc:$rA, s16imm:$imm), |
| 2242 |
"cmpwi $crD, $rA, $imm", IIC_IntCompare>; |
| 2243 |
def CMPLWI : DForm_6_ext<10, (outs crrc:$dst), (ins gprc:$src1, u16imm:$src2), |
| 2244 |
"cmplwi $dst, $src1, $src2", IIC_IntCompare>; |
| 2245 |
def CMPRB : X_BF3_L1_RS5_RS5<31, 192, (outs crbitrc:$BF), |
| 2246 |
(ins u1imm:$L, g8rc:$rA, g8rc:$rB), |
| 2247 |
"cmprb $BF, $L, $rA, $rB", IIC_IntCompare, []>, |
| 2248 |
Requires<[IsISA3_0]>; |
| 2249 |
} |
| 2250 |
} |
| 2251 |
|
| 2252 |
let PPC970_Unit = 1, hasSideEffects = 0 in { // FXU Operations. |
| 2253 |
let isCommutable = 1 in { |
| 2254 |
defm NAND : XForm_6r<31, 476, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2255 |
"nand", "$rA, $rS, $rB", IIC_IntSimple, |
| 2256 |
[(set i32:$rA, (not (and i32:$rS, i32:$rB)))]>; |
| 2257 |
defm AND : XForm_6r<31, 28, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2258 |
"and", "$rA, $rS, $rB", IIC_IntSimple, |
| 2259 |
[(set i32:$rA, (and i32:$rS, i32:$rB))]>; |
| 2260 |
} // isCommutable |
| 2261 |
defm ANDC : XForm_6r<31, 60, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2262 |
"andc", "$rA, $rS, $rB", IIC_IntSimple, |
| 2263 |
[(set i32:$rA, (and i32:$rS, (not i32:$rB)))]>; |
| 2264 |
let isCommutable = 1 in { |
| 2265 |
defm OR : XForm_6r<31, 444, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2266 |
"or", "$rA, $rS, $rB", IIC_IntSimple, |
| 2267 |
[(set i32:$rA, (or i32:$rS, i32:$rB))]>; |
| 2268 |
defm NOR : XForm_6r<31, 124, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2269 |
"nor", "$rA, $rS, $rB", IIC_IntSimple, |
| 2270 |
[(set i32:$rA, (not (or i32:$rS, i32:$rB)))]>; |
| 2271 |
} // isCommutable |
| 2272 |
defm ORC : XForm_6r<31, 412, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2273 |
"orc", "$rA, $rS, $rB", IIC_IntSimple, |
| 2274 |
[(set i32:$rA, (or i32:$rS, (not i32:$rB)))]>; |
| 2275 |
let isCommutable = 1 in { |
| 2276 |
defm EQV : XForm_6r<31, 284, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2277 |
"eqv", "$rA, $rS, $rB", IIC_IntSimple, |
| 2278 |
[(set i32:$rA, (not (xor i32:$rS, i32:$rB)))]>; |
| 2279 |
defm XOR : XForm_6r<31, 316, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2280 |
"xor", "$rA, $rS, $rB", IIC_IntSimple, |
| 2281 |
[(set i32:$rA, (xor i32:$rS, i32:$rB))]>; |
| 2282 |
} // isCommutable |
| 2283 |
defm SLW : XForm_6r<31, 24, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2284 |
"slw", "$rA, $rS, $rB", IIC_IntGeneral, |
| 2285 |
[(set i32:$rA, (PPCshl i32:$rS, i32:$rB))]>; |
| 2286 |
defm SRW : XForm_6r<31, 536, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2287 |
"srw", "$rA, $rS, $rB", IIC_IntGeneral, |
| 2288 |
[(set i32:$rA, (PPCsrl i32:$rS, i32:$rB))]>; |
| 2289 |
defm SRAW : XForm_6rc<31, 792, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2290 |
"sraw", "$rA, $rS, $rB", IIC_IntShift, |
| 2291 |
[(set i32:$rA, (PPCsra i32:$rS, i32:$rB))]>; |
| 2292 |
} |
| 2293 |
|
| 2294 |
let PPC970_Unit = 1 in { // FXU Operations. |
| 2295 |
let hasSideEffects = 0 in { |
| 2296 |
defm SRAWI : XForm_10rc<31, 824, (outs gprc:$rA), (ins gprc:$rS, u5imm:$SH), |
| 2297 |
"srawi", "$rA, $rS, $SH", IIC_IntShift, |
| 2298 |
[(set i32:$rA, (sra i32:$rS, (i32 imm:$SH)))]>; |
| 2299 |
defm CNTLZW : XForm_11r<31, 26, (outs gprc:$rA), (ins gprc:$rS), |
| 2300 |
"cntlzw", "$rA, $rS", IIC_IntGeneral, |
| 2301 |
[(set i32:$rA, (ctlz i32:$rS))]>; |
| 2302 |
defm CNTTZW : XForm_11r<31, 538, (outs gprc:$rA), (ins gprc:$rS), |
| 2303 |
"cnttzw", "$rA, $rS", IIC_IntGeneral, |
| 2304 |
[(set i32:$rA, (cttz i32:$rS))]>, Requires<[IsISA3_0]>; |
| 2305 |
defm EXTSB : XForm_11r<31, 954, (outs gprc:$rA), (ins gprc:$rS), |
| 2306 |
"extsb", "$rA, $rS", IIC_IntSimple, |
| 2307 |
[(set i32:$rA, (sext_inreg i32:$rS, i8))]>; |
| 2308 |
defm EXTSH : XForm_11r<31, 922, (outs gprc:$rA), (ins gprc:$rS), |
| 2309 |
"extsh", "$rA, $rS", IIC_IntSimple, |
| 2310 |
[(set i32:$rA, (sext_inreg i32:$rS, i16))]>; |
| 2311 |
|
| 2312 |
let isCommutable = 1 in |
| 2313 |
def CMPB : XForm_6<31, 508, (outs gprc:$rA), (ins gprc:$rS, gprc:$rB), |
| 2314 |
"cmpb $rA, $rS, $rB", IIC_IntGeneral, |
| 2315 |
[(set i32:$rA, (PPCcmpb i32:$rS, i32:$rB))]>; |
| 2316 |
} |
| 2317 |
let isCompare = 1, hasSideEffects = 0 in { |
| 2318 |
def CMPW : XForm_16_ext<31, 0, (outs crrc:$crD), (ins gprc:$rA, gprc:$rB), |
| 2319 |
"cmpw $crD, $rA, $rB", IIC_IntCompare>; |
| 2320 |
def CMPLW : XForm_16_ext<31, 32, (outs crrc:$crD), (ins gprc:$rA, gprc:$rB), |
| 2321 |
"cmplw $crD, $rA, $rB", IIC_IntCompare>; |
| 2322 |
} |
| 2323 |
} |
| 2324 |
let PPC970_Unit = 3, Predicates = [HasFPU] in { // FPU Operations. |
| 2325 |
//def FCMPO : XForm_17<63, 32, (outs CRRC:$crD), (ins FPRC:$fA, FPRC:$fB), |
| 2326 |
// "fcmpo $crD, $fA, $fB", IIC_FPCompare>; |
| 2327 |
let isCompare = 1, hasSideEffects = 0 in { |
| 2328 |
def FCMPUS : XForm_17<63, 0, (outs crrc:$crD), (ins f4rc:$fA, f4rc:$fB), |
| 2329 |
"fcmpu $crD, $fA, $fB", IIC_FPCompare>; |
| 2330 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2331 |
def FCMPUD : XForm_17<63, 0, (outs crrc:$crD), (ins f8rc:$fA, f8rc:$fB), |
| 2332 |
"fcmpu $crD, $fA, $fB", IIC_FPCompare>; |
| 2333 |
} |
| 2334 |
|
| 2335 |
def FTDIV: XForm_17<63, 128, (outs crrc:$crD), (ins f8rc:$fA, f8rc:$fB), |
| 2336 |
"ftdiv $crD, $fA, $fB", IIC_FPCompare>; |
| 2337 |
def FTSQRT: XForm_17a<63, 160, (outs crrc:$crD), (ins f8rc:$fB), |
| 2338 |
"ftsqrt $crD, $fB", IIC_FPCompare>; |
| 2339 |
|
| 2340 |
let Uses = [RM] in { |
| 2341 |
let hasSideEffects = 0 in { |
| 2342 |
defm FCTIW : XForm_26r<63, 14, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2343 |
"fctiw", "$frD, $frB", IIC_FPGeneral, |
| 2344 |
[]>; |
| 2345 |
defm FCTIWU : XForm_26r<63, 142, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2346 |
"fctiwu", "$frD, $frB", IIC_FPGeneral, |
| 2347 |
[]>; |
| 2348 |
defm FCTIWZ : XForm_26r<63, 15, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2349 |
"fctiwz", "$frD, $frB", IIC_FPGeneral, |
| 2350 |
[(set f64:$frD, (PPCfctiwz f64:$frB))]>; |
| 2351 |
|
| 2352 |
defm FRSP : XForm_26r<63, 12, (outs f4rc:$frD), (ins f8rc:$frB), |
| 2353 |
"frsp", "$frD, $frB", IIC_FPGeneral, |
| 2354 |
[(set f32:$frD, (fpround f64:$frB))]>; |
| 2355 |
|
| 2356 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2357 |
defm FRIND : XForm_26r<63, 392, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2358 |
"frin", "$frD, $frB", IIC_FPGeneral, |
| 2359 |
[(set f64:$frD, (fround f64:$frB))]>; |
| 2360 |
defm FRINS : XForm_26r<63, 392, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2361 |
"frin", "$frD, $frB", IIC_FPGeneral, |
| 2362 |
[(set f32:$frD, (fround f32:$frB))]>; |
| 2363 |
} |
| 2364 |
|
| 2365 |
let hasSideEffects = 0 in { |
| 2366 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2367 |
defm FRIPD : XForm_26r<63, 456, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2368 |
"frip", "$frD, $frB", IIC_FPGeneral, |
| 2369 |
[(set f64:$frD, (fceil f64:$frB))]>; |
| 2370 |
defm FRIPS : XForm_26r<63, 456, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2371 |
"frip", "$frD, $frB", IIC_FPGeneral, |
| 2372 |
[(set f32:$frD, (fceil f32:$frB))]>; |
| 2373 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2374 |
defm FRIZD : XForm_26r<63, 424, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2375 |
"friz", "$frD, $frB", IIC_FPGeneral, |
| 2376 |
[(set f64:$frD, (ftrunc f64:$frB))]>; |
| 2377 |
defm FRIZS : XForm_26r<63, 424, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2378 |
"friz", "$frD, $frB", IIC_FPGeneral, |
| 2379 |
[(set f32:$frD, (ftrunc f32:$frB))]>; |
| 2380 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2381 |
defm FRIMD : XForm_26r<63, 488, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2382 |
"frim", "$frD, $frB", IIC_FPGeneral, |
| 2383 |
[(set f64:$frD, (ffloor f64:$frB))]>; |
| 2384 |
defm FRIMS : XForm_26r<63, 488, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2385 |
"frim", "$frD, $frB", IIC_FPGeneral, |
| 2386 |
[(set f32:$frD, (ffloor f32:$frB))]>; |
| 2387 |
|
| 2388 |
defm FSQRT : XForm_26r<63, 22, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2389 |
"fsqrt", "$frD, $frB", IIC_FPSqrtD, |
| 2390 |
[(set f64:$frD, (fsqrt f64:$frB))]>; |
| 2391 |
defm FSQRTS : XForm_26r<59, 22, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2392 |
"fsqrts", "$frD, $frB", IIC_FPSqrtS, |
| 2393 |
[(set f32:$frD, (fsqrt f32:$frB))]>; |
| 2394 |
} |
| 2395 |
} |
| 2396 |
} |
| 2397 |
|
| 2398 |
/// Note that FMR is defined as pseudo-ops on the PPC970 because they are |
| 2399 |
/// often coalesced away and we don't want the dispatch group builder to think |
| 2400 |
/// that they will fill slots (which could cause the load of a LSU reject to |
| 2401 |
/// sneak into a d-group with a store). |
| 2402 |
let hasSideEffects = 0, Predicates = [HasFPU] in |
| 2403 |
defm FMR : XForm_26r<63, 72, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2404 |
"fmr", "$frD, $frB", IIC_FPGeneral, |
| 2405 |
[]>, // (set f32:$frD, f32:$frB) |
| 2406 |
PPC970_Unit_Pseudo; |
| 2407 |
|
| 2408 |
let PPC970_Unit = 3, hasSideEffects = 0, Predicates = [HasFPU] in { // FPU Operations. |
| 2409 |
// These are artificially split into two different forms, for 4/8 byte FP. |
| 2410 |
defm FABSS : XForm_26r<63, 264, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2411 |
"fabs", "$frD, $frB", IIC_FPGeneral, |
| 2412 |
[(set f32:$frD, (fabs f32:$frB))]>; |
| 2413 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2414 |
defm FABSD : XForm_26r<63, 264, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2415 |
"fabs", "$frD, $frB", IIC_FPGeneral, |
| 2416 |
[(set f64:$frD, (fabs f64:$frB))]>; |
| 2417 |
defm FNABSS : XForm_26r<63, 136, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2418 |
"fnabs", "$frD, $frB", IIC_FPGeneral, |
| 2419 |
[(set f32:$frD, (fneg (fabs f32:$frB)))]>; |
| 2420 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2421 |
defm FNABSD : XForm_26r<63, 136, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2422 |
"fnabs", "$frD, $frB", IIC_FPGeneral, |
| 2423 |
[(set f64:$frD, (fneg (fabs f64:$frB)))]>; |
| 2424 |
defm FNEGS : XForm_26r<63, 40, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2425 |
"fneg", "$frD, $frB", IIC_FPGeneral, |
| 2426 |
[(set f32:$frD, (fneg f32:$frB))]>; |
| 2427 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2428 |
defm FNEGD : XForm_26r<63, 40, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2429 |
"fneg", "$frD, $frB", IIC_FPGeneral, |
| 2430 |
[(set f64:$frD, (fneg f64:$frB))]>; |
| 2431 |
|
| 2432 |
defm FCPSGNS : XForm_28r<63, 8, (outs f4rc:$frD), (ins f4rc:$frA, f4rc:$frB), |
| 2433 |
"fcpsgn", "$frD, $frA, $frB", IIC_FPGeneral, |
| 2434 |
[(set f32:$frD, (fcopysign f32:$frB, f32:$frA))]>; |
| 2435 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2436 |
defm FCPSGND : XForm_28r<63, 8, (outs f8rc:$frD), (ins f8rc:$frA, f8rc:$frB), |
| 2437 |
"fcpsgn", "$frD, $frA, $frB", IIC_FPGeneral, |
| 2438 |
[(set f64:$frD, (fcopysign f64:$frB, f64:$frA))]>; |
| 2439 |
|
| 2440 |
// Reciprocal estimates. |
| 2441 |
defm FRE : XForm_26r<63, 24, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2442 |
"fre", "$frD, $frB", IIC_FPGeneral, |
| 2443 |
[(set f64:$frD, (PPCfre f64:$frB))]>; |
| 2444 |
defm FRES : XForm_26r<59, 24, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2445 |
"fres", "$frD, $frB", IIC_FPGeneral, |
| 2446 |
[(set f32:$frD, (PPCfre f32:$frB))]>; |
| 2447 |
defm FRSQRTE : XForm_26r<63, 26, (outs f8rc:$frD), (ins f8rc:$frB), |
| 2448 |
"frsqrte", "$frD, $frB", IIC_FPGeneral, |
| 2449 |
[(set f64:$frD, (PPCfrsqrte f64:$frB))]>; |
| 2450 |
defm FRSQRTES : XForm_26r<59, 26, (outs f4rc:$frD), (ins f4rc:$frB), |
| 2451 |
"frsqrtes", "$frD, $frB", IIC_FPGeneral, |
| 2452 |
[(set f32:$frD, (PPCfrsqrte f32:$frB))]>; |
| 2453 |
} |
| 2454 |
|
| 2455 |
// XL-Form instructions. condition register logical ops. |
| 2456 |
// |
| 2457 |
let hasSideEffects = 0 in |
| 2458 |
def MCRF : XLForm_3<19, 0, (outs crrc:$BF), (ins crrc:$BFA), |
| 2459 |
"mcrf $BF, $BFA", IIC_BrMCR>, |
| 2460 |
PPC970_DGroup_First, PPC970_Unit_CRU; |
| 2461 |
|
| 2462 |
// FIXME: According to the ISA (section 2.5.1 of version 2.06), the |
| 2463 |
// condition-register logical instructions have preferred forms. Specifically, |
| 2464 |
// it is preferred that the bit specified by the BT field be in the same |
| 2465 |
// condition register as that specified by the bit BB. We might want to account |
| 2466 |
// for this via hinting the register allocator and anti-dep breakers, or we |
| 2467 |
// could constrain the register class to force this constraint and then loosen |
| 2468 |
// it during register allocation via convertToThreeAddress or some similar |
| 2469 |
// mechanism. |
| 2470 |
|
| 2471 |
let isCommutable = 1 in { |
| 2472 |
def CRAND : XLForm_1<19, 257, (outs crbitrc:$CRD), |
| 2473 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2474 |
"crand $CRD, $CRA, $CRB", IIC_BrCR, |
| 2475 |
[(set i1:$CRD, (and i1:$CRA, i1:$CRB))]>; |
| 2476 |
|
| 2477 |
def CRNAND : XLForm_1<19, 225, (outs crbitrc:$CRD), |
| 2478 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2479 |
"crnand $CRD, $CRA, $CRB", IIC_BrCR, |
| 2480 |
[(set i1:$CRD, (not (and i1:$CRA, i1:$CRB)))]>; |
| 2481 |
|
| 2482 |
def CROR : XLForm_1<19, 449, (outs crbitrc:$CRD), |
| 2483 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2484 |
"cror $CRD, $CRA, $CRB", IIC_BrCR, |
| 2485 |
[(set i1:$CRD, (or i1:$CRA, i1:$CRB))]>; |
| 2486 |
|
| 2487 |
def CRXOR : XLForm_1<19, 193, (outs crbitrc:$CRD), |
| 2488 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2489 |
"crxor $CRD, $CRA, $CRB", IIC_BrCR, |
| 2490 |
[(set i1:$CRD, (xor i1:$CRA, i1:$CRB))]>; |
| 2491 |
|
| 2492 |
def CRNOR : XLForm_1<19, 33, (outs crbitrc:$CRD), |
| 2493 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2494 |
"crnor $CRD, $CRA, $CRB", IIC_BrCR, |
| 2495 |
[(set i1:$CRD, (not (or i1:$CRA, i1:$CRB)))]>; |
| 2496 |
|
| 2497 |
def CREQV : XLForm_1<19, 289, (outs crbitrc:$CRD), |
| 2498 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2499 |
"creqv $CRD, $CRA, $CRB", IIC_BrCR, |
| 2500 |
[(set i1:$CRD, (not (xor i1:$CRA, i1:$CRB)))]>; |
| 2501 |
} // isCommutable |
| 2502 |
|
| 2503 |
def CRANDC : XLForm_1<19, 129, (outs crbitrc:$CRD), |
| 2504 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2505 |
"crandc $CRD, $CRA, $CRB", IIC_BrCR, |
| 2506 |
[(set i1:$CRD, (and i1:$CRA, (not i1:$CRB)))]>; |
| 2507 |
|
| 2508 |
def CRORC : XLForm_1<19, 417, (outs crbitrc:$CRD), |
| 2509 |
(ins crbitrc:$CRA, crbitrc:$CRB), |
| 2510 |
"crorc $CRD, $CRA, $CRB", IIC_BrCR, |
| 2511 |
[(set i1:$CRD, (or i1:$CRA, (not i1:$CRB)))]>; |
| 2512 |
|
| 2513 |
let isCodeGenOnly = 1 in { |
| 2514 |
def CRSET : XLForm_1_ext<19, 289, (outs crbitrc:$dst), (ins), |
| 2515 |
"creqv $dst, $dst, $dst", IIC_BrCR, |
| 2516 |
[(set i1:$dst, 1)]>; |
| 2517 |
|
| 2518 |
def CRUNSET: XLForm_1_ext<19, 193, (outs crbitrc:$dst), (ins), |
| 2519 |
"crxor $dst, $dst, $dst", IIC_BrCR, |
| 2520 |
[(set i1:$dst, 0)]>; |
| 2521 |
|
| 2522 |
let Defs = [CR1EQ], CRD = 6 in { |
| 2523 |
def CR6SET : XLForm_1_ext<19, 289, (outs), (ins), |
| 2524 |
"creqv 6, 6, 6", IIC_BrCR, |
| 2525 |
[(PPCcr6set)]>; |
| 2526 |
|
| 2527 |
def CR6UNSET: XLForm_1_ext<19, 193, (outs), (ins), |
| 2528 |
"crxor 6, 6, 6", IIC_BrCR, |
| 2529 |
[(PPCcr6unset)]>; |
| 2530 |
} |
| 2531 |
} |
| 2532 |
|
| 2533 |
// XFX-Form instructions. Instructions that deal with SPRs. |
| 2534 |
// |
| 2535 |
|
| 2536 |
def MFSPR : XFXForm_1<31, 339, (outs gprc:$RT), (ins i32imm:$SPR), |
| 2537 |
"mfspr $RT, $SPR", IIC_SprMFSPR>; |
| 2538 |
def MTSPR : XFXForm_1<31, 467, (outs), (ins i32imm:$SPR, gprc:$RT), |
| 2539 |
"mtspr $SPR, $RT", IIC_SprMTSPR>; |
| 2540 |
|
| 2541 |
def MFTB : XFXForm_1<31, 371, (outs gprc:$RT), (ins i32imm:$SPR), |
| 2542 |
"mftb $RT, $SPR", IIC_SprMFTB>; |
| 2543 |
|
| 2544 |
def MFPMR : XFXForm_1<31, 334, (outs gprc:$RT), (ins i32imm:$SPR), |
| 2545 |
"mfpmr $RT, $SPR", IIC_SprMFPMR>; |
| 2546 |
|
| 2547 |
def MTPMR : XFXForm_1<31, 462, (outs), (ins i32imm:$SPR, gprc:$RT), |
| 2548 |
"mtpmr $SPR, $RT", IIC_SprMTPMR>; |
| 2549 |
|
| 2550 |
|
| 2551 |
// A pseudo-instruction used to implement the read of the 64-bit cycle counter |
| 2552 |
// on a 32-bit target. |
| 2553 |
let hasSideEffects = 1, usesCustomInserter = 1 in |
| 2554 |
def ReadTB : Pseudo<(outs gprc:$lo, gprc:$hi), (ins), |
| 2555 |
"#ReadTB", []>; |
| 2556 |
|
| 2557 |
let Uses = [CTR] in { |
| 2558 |
def MFCTR : XFXForm_1_ext<31, 339, 9, (outs gprc:$rT), (ins), |
| 2559 |
"mfctr $rT", IIC_SprMFSPR>, |
| 2560 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2561 |
} |
| 2562 |
let Defs = [CTR], Pattern = [(PPCmtctr i32:$rS)] in { |
| 2563 |
def MTCTR : XFXForm_7_ext<31, 467, 9, (outs), (ins gprc:$rS), |
| 2564 |
"mtctr $rS", IIC_SprMTSPR>, |
| 2565 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2566 |
} |
| 2567 |
let hasSideEffects = 1, isCodeGenOnly = 1, Defs = [CTR] in { |
| 2568 |
let Pattern = [(int_ppc_mtctr i32:$rS)] in |
| 2569 |
def MTCTRloop : XFXForm_7_ext<31, 467, 9, (outs), (ins gprc:$rS), |
| 2570 |
"mtctr $rS", IIC_SprMTSPR>, |
| 2571 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2572 |
} |
| 2573 |
|
| 2574 |
let Defs = [LR] in { |
| 2575 |
def MTLR : XFXForm_7_ext<31, 467, 8, (outs), (ins gprc:$rS), |
| 2576 |
"mtlr $rS", IIC_SprMTSPR>, |
| 2577 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2578 |
} |
| 2579 |
let Uses = [LR] in { |
| 2580 |
def MFLR : XFXForm_1_ext<31, 339, 8, (outs gprc:$rT), (ins), |
| 2581 |
"mflr $rT", IIC_SprMFSPR>, |
| 2582 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2583 |
} |
| 2584 |
|
| 2585 |
let isCodeGenOnly = 1 in { |
| 2586 |
// Move to/from VRSAVE: despite being a SPR, the VRSAVE register is renamed |
| 2587 |
// like a GPR on the PPC970. As such, copies in and out have the same |
| 2588 |
// performance characteristics as an OR instruction. |
| 2589 |
def MTVRSAVE : XFXForm_7_ext<31, 467, 256, (outs), (ins gprc:$rS), |
| 2590 |
"mtspr 256, $rS", IIC_IntGeneral>, |
| 2591 |
PPC970_DGroup_Single, PPC970_Unit_FXU; |
| 2592 |
def MFVRSAVE : XFXForm_1_ext<31, 339, 256, (outs gprc:$rT), (ins), |
| 2593 |
"mfspr $rT, 256", IIC_IntGeneral>, |
| 2594 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2595 |
|
| 2596 |
def MTVRSAVEv : XFXForm_7_ext<31, 467, 256, |
| 2597 |
(outs VRSAVERC:$reg), (ins gprc:$rS), |
| 2598 |
"mtspr 256, $rS", IIC_IntGeneral>, |
| 2599 |
PPC970_DGroup_Single, PPC970_Unit_FXU; |
| 2600 |
def MFVRSAVEv : XFXForm_1_ext<31, 339, 256, (outs gprc:$rT), |
| 2601 |
(ins VRSAVERC:$reg), |
| 2602 |
"mfspr $rT, 256", IIC_IntGeneral>, |
| 2603 |
PPC970_DGroup_First, PPC970_Unit_FXU; |
| 2604 |
} |
| 2605 |
|
| 2606 |
// Aliases for mtvrsave/mfvrsave to mfspr/mtspr. |
| 2607 |
def : InstAlias<"mtvrsave $rS", (MTVRSAVE gprc:$rS)>; |
| 2608 |
def : InstAlias<"mfvrsave $rS", (MFVRSAVE gprc:$rS)>; |
| 2609 |
|
| 2610 |
// SPILL_VRSAVE - Indicate that we're dumping the VRSAVE register, |
| 2611 |
// so we'll need to scavenge a register for it. |
| 2612 |
let mayStore = 1 in |
| 2613 |
def SPILL_VRSAVE : Pseudo<(outs), (ins VRSAVERC:$vrsave, memri:$F), |
| 2614 |
"#SPILL_VRSAVE", []>; |
| 2615 |
|
| 2616 |
// RESTORE_VRSAVE - Indicate that we're restoring the VRSAVE register (previously |
| 2617 |
// spilled), so we'll need to scavenge a register for it. |
| 2618 |
let mayLoad = 1 in |
| 2619 |
def RESTORE_VRSAVE : Pseudo<(outs VRSAVERC:$vrsave), (ins memri:$F), |
| 2620 |
"#RESTORE_VRSAVE", []>; |
| 2621 |
|
| 2622 |
let hasSideEffects = 0 in { |
| 2623 |
// mtocrf's input needs to be prepared by shifting by an amount dependent |
| 2624 |
// on the cr register selected. Thus, post-ra anti-dep breaking must not |
| 2625 |
// later change that register assignment. |
| 2626 |
let hasExtraDefRegAllocReq = 1 in { |
| 2627 |
def MTOCRF: XFXForm_5a<31, 144, (outs crbitm:$FXM), (ins gprc:$ST), |
| 2628 |
"mtocrf $FXM, $ST", IIC_BrMCRX>, |
| 2629 |
PPC970_DGroup_First, PPC970_Unit_CRU; |
| 2630 |
|
| 2631 |
// Similarly to mtocrf, the mask for mtcrf must be prepared in a way that |
| 2632 |
// is dependent on the cr fields being set. |
| 2633 |
def MTCRF : XFXForm_5<31, 144, (outs), (ins i32imm:$FXM, gprc:$rS), |
| 2634 |
"mtcrf $FXM, $rS", IIC_BrMCRX>, |
| 2635 |
PPC970_MicroCode, PPC970_Unit_CRU; |
| 2636 |
} // hasExtraDefRegAllocReq = 1 |
| 2637 |
|
| 2638 |
// mfocrf's input needs to be prepared by shifting by an amount dependent |
| 2639 |
// on the cr register selected. Thus, post-ra anti-dep breaking must not |
| 2640 |
// later change that register assignment. |
| 2641 |
let hasExtraSrcRegAllocReq = 1 in { |
| 2642 |
def MFOCRF: XFXForm_5a<31, 19, (outs gprc:$rT), (ins crbitm:$FXM), |
| 2643 |
"mfocrf $rT, $FXM", IIC_SprMFCRF>, |
| 2644 |
PPC970_DGroup_First, PPC970_Unit_CRU; |
| 2645 |
|
| 2646 |
// Similarly to mfocrf, the mask for mfcrf must be prepared in a way that |
| 2647 |
// is dependent on the cr fields being copied. |
| 2648 |
def MFCR : XFXForm_3<31, 19, (outs gprc:$rT), (ins), |
| 2649 |
"mfcr $rT", IIC_SprMFCR>, |
| 2650 |
PPC970_MicroCode, PPC970_Unit_CRU; |
| 2651 |
} // hasExtraSrcRegAllocReq = 1 |
| 2652 |
|
| 2653 |
def MCRXRX : X_BF3<31, 576, (outs crrc:$BF), (ins), |
| 2654 |
"mcrxrx $BF", IIC_BrMCRX>, Requires<[IsISA3_0]>; |
| 2655 |
} // hasSideEffects = 0 |
| 2656 |
|
| 2657 |
let Predicates = [HasFPU] in { |
| 2658 |
// Pseudo instruction to perform FADD in round-to-zero mode. |
| 2659 |
let usesCustomInserter = 1, Uses = [RM] in { |
| 2660 |
def FADDrtz: Pseudo<(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRB), "", |
| 2661 |
[(set f64:$FRT, (PPCfaddrtz f64:$FRA, f64:$FRB))]>; |
| 2662 |
} |
| 2663 |
|
| 2664 |
// The above pseudo gets expanded to make use of the following instructions |
| 2665 |
// to manipulate FPSCR. Note that FPSCR is not modeled at the DAG level. |
| 2666 |
let Uses = [RM], Defs = [RM] in { |
| 2667 |
def MTFSB0 : XForm_43<63, 70, (outs), (ins u5imm:$FM), |
| 2668 |
"mtfsb0 $FM", IIC_IntMTFSB0, []>, |
| 2669 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2670 |
def MTFSB1 : XForm_43<63, 38, (outs), (ins u5imm:$FM), |
| 2671 |
"mtfsb1 $FM", IIC_IntMTFSB0, []>, |
| 2672 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2673 |
let isCodeGenOnly = 1 in |
| 2674 |
def MTFSFb : XFLForm<63, 711, (outs), (ins i32imm:$FM, f8rc:$rT), |
| 2675 |
"mtfsf $FM, $rT", IIC_IntMTFSB0, []>, |
| 2676 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2677 |
} |
| 2678 |
let Uses = [RM] in { |
| 2679 |
def MFFS : XForm_42<63, 583, (outs f8rc:$rT), (ins), |
| 2680 |
"mffs $rT", IIC_IntMFFS, |
| 2681 |
[(set f64:$rT, (PPCmffs))]>, |
| 2682 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2683 |
|
| 2684 |
let Defs = [CR1] in |
| 2685 |
def MFFSo : XForm_42<63, 583, (outs f8rc:$rT), (ins), |
| 2686 |
"mffs. $rT", IIC_IntMFFS, []>, isDOT; |
| 2687 |
|
| 2688 |
def MFFSCE : X_FRT5_XO2_XO3_XO10<63, 0, 1, 583, (outs f8rc:$rT), (ins), |
| 2689 |
"mffsce $rT", IIC_IntMFFS, []>, |
| 2690 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2691 |
|
| 2692 |
def MFFSCDRN : X_FRT5_XO2_XO3_FRB5_XO10<63, 2, 4, 583, (outs f8rc:$rT), |
| 2693 |
(ins f8rc:$FRB), "mffscdrn $rT, $FRB", |
| 2694 |
IIC_IntMFFS, []>, |
| 2695 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2696 |
|
| 2697 |
def MFFSCDRNI : X_FRT5_XO2_XO3_DRM3_XO10<63, 2, 5, 583, (outs f8rc:$rT), |
| 2698 |
(ins u3imm:$DRM), |
| 2699 |
"mffscdrni $rT, $DRM", |
| 2700 |
IIC_IntMFFS, []>, |
| 2701 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2702 |
|
| 2703 |
def MFFSCRN : X_FRT5_XO2_XO3_FRB5_XO10<63, 2, 6, 583, (outs f8rc:$rT), |
| 2704 |
(ins f8rc:$FRB), "mffscrn $rT, $FRB", |
| 2705 |
IIC_IntMFFS, []>, |
| 2706 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2707 |
|
| 2708 |
def MFFSCRNI : X_FRT5_XO2_XO3_RM2_X10<63, 2, 7, 583, (outs f8rc:$rT), |
| 2709 |
(ins u2imm:$RM), "mffscrni $rT, $RM", |
| 2710 |
IIC_IntMFFS, []>, |
| 2711 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2712 |
|
| 2713 |
def MFFSL : X_FRT5_XO2_XO3_XO10<63, 3, 0, 583, (outs f8rc:$rT), (ins), |
| 2714 |
"mffsl $rT", IIC_IntMFFS, []>, |
| 2715 |
PPC970_DGroup_Single, PPC970_Unit_FPU; |
| 2716 |
} |
| 2717 |
} |
| 2718 |
|
| 2719 |
let Predicates = [IsISA3_0] in { |
| 2720 |
def MODSW : XForm_8<31, 779, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2721 |
"modsw $rT, $rA, $rB", IIC_IntDivW, |
| 2722 |
[(set i32:$rT, (srem i32:$rA, i32:$rB))]>; |
| 2723 |
def MODUW : XForm_8<31, 267, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2724 |
"moduw $rT, $rA, $rB", IIC_IntDivW, |
| 2725 |
[(set i32:$rT, (urem i32:$rA, i32:$rB))]>; |
| 2726 |
} |
| 2727 |
|
| 2728 |
let PPC970_Unit = 1, hasSideEffects = 0 in { // FXU Operations. |
| 2729 |
// XO-Form instructions. Arithmetic instructions that can set overflow bit |
| 2730 |
let isCommutable = 1 in |
| 2731 |
defm ADD4 : XOForm_1r<31, 266, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2732 |
"add", "$rT, $rA, $rB", IIC_IntSimple, |
| 2733 |
[(set i32:$rT, (add i32:$rA, i32:$rB))]>; |
| 2734 |
let isCodeGenOnly = 1 in |
| 2735 |
def ADD4TLS : XOForm_1<31, 266, 0, (outs gprc:$rT), (ins gprc:$rA, tlsreg32:$rB), |
| 2736 |
"add $rT, $rA, $rB", IIC_IntSimple, |
| 2737 |
[(set i32:$rT, (add i32:$rA, tglobaltlsaddr:$rB))]>; |
| 2738 |
let isCommutable = 1 in |
| 2739 |
defm ADDC : XOForm_1rc<31, 10, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2740 |
"addc", "$rT, $rA, $rB", IIC_IntGeneral, |
| 2741 |
[(set i32:$rT, (addc i32:$rA, i32:$rB))]>, |
| 2742 |
PPC970_DGroup_Cracked; |
| 2743 |
|
| 2744 |
defm DIVW : XOForm_1rcr<31, 491, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2745 |
"divw", "$rT, $rA, $rB", IIC_IntDivW, |
| 2746 |
[(set i32:$rT, (sdiv i32:$rA, i32:$rB))]>; |
| 2747 |
defm DIVWU : XOForm_1rcr<31, 459, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2748 |
"divwu", "$rT, $rA, $rB", IIC_IntDivW, |
| 2749 |
[(set i32:$rT, (udiv i32:$rA, i32:$rB))]>; |
| 2750 |
def DIVWE : XOForm_1<31, 427, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2751 |
"divwe $rT, $rA, $rB", IIC_IntDivW, |
| 2752 |
[(set i32:$rT, (int_ppc_divwe gprc:$rA, gprc:$rB))]>, |
| 2753 |
Requires<[HasExtDiv]>; |
| 2754 |
let Defs = [CR0] in |
| 2755 |
def DIVWEo : XOForm_1<31, 427, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2756 |
"divwe. $rT, $rA, $rB", IIC_IntDivW, |
| 2757 |
[]>, isDOT, PPC970_DGroup_Cracked, PPC970_DGroup_First, |
| 2758 |
Requires<[HasExtDiv]>; |
| 2759 |
def DIVWEU : XOForm_1<31, 395, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2760 |
"divweu $rT, $rA, $rB", IIC_IntDivW, |
| 2761 |
[(set i32:$rT, (int_ppc_divweu gprc:$rA, gprc:$rB))]>, |
| 2762 |
Requires<[HasExtDiv]>; |
| 2763 |
let Defs = [CR0] in |
| 2764 |
def DIVWEUo : XOForm_1<31, 395, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2765 |
"divweu. $rT, $rA, $rB", IIC_IntDivW, |
| 2766 |
[]>, isDOT, PPC970_DGroup_Cracked, PPC970_DGroup_First, |
| 2767 |
Requires<[HasExtDiv]>; |
| 2768 |
let isCommutable = 1 in { |
| 2769 |
defm MULHW : XOForm_1r<31, 75, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2770 |
"mulhw", "$rT, $rA, $rB", IIC_IntMulHW, |
| 2771 |
[(set i32:$rT, (mulhs i32:$rA, i32:$rB))]>; |
| 2772 |
defm MULHWU : XOForm_1r<31, 11, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2773 |
"mulhwu", "$rT, $rA, $rB", IIC_IntMulHWU, |
| 2774 |
[(set i32:$rT, (mulhu i32:$rA, i32:$rB))]>; |
| 2775 |
defm MULLW : XOForm_1r<31, 235, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2776 |
"mullw", "$rT, $rA, $rB", IIC_IntMulHW, |
| 2777 |
[(set i32:$rT, (mul i32:$rA, i32:$rB))]>; |
| 2778 |
} // isCommutable |
| 2779 |
defm SUBF : XOForm_1r<31, 40, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2780 |
"subf", "$rT, $rA, $rB", IIC_IntGeneral, |
| 2781 |
[(set i32:$rT, (sub i32:$rB, i32:$rA))]>; |
| 2782 |
defm SUBFC : XOForm_1rc<31, 8, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2783 |
"subfc", "$rT, $rA, $rB", IIC_IntGeneral, |
| 2784 |
[(set i32:$rT, (subc i32:$rB, i32:$rA))]>, |
| 2785 |
PPC970_DGroup_Cracked; |
| 2786 |
defm NEG : XOForm_3r<31, 104, 0, (outs gprc:$rT), (ins gprc:$rA), |
| 2787 |
"neg", "$rT, $rA", IIC_IntSimple, |
| 2788 |
[(set i32:$rT, (ineg i32:$rA))]>; |
| 2789 |
let Uses = [CARRY] in { |
| 2790 |
let isCommutable = 1 in |
| 2791 |
defm ADDE : XOForm_1rc<31, 138, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2792 |
"adde", "$rT, $rA, $rB", IIC_IntGeneral, |
| 2793 |
[(set i32:$rT, (adde i32:$rA, i32:$rB))]>; |
| 2794 |
defm ADDME : XOForm_3rc<31, 234, 0, (outs gprc:$rT), (ins gprc:$rA), |
| 2795 |
"addme", "$rT, $rA", IIC_IntGeneral, |
| 2796 |
[(set i32:$rT, (adde i32:$rA, -1))]>; |
| 2797 |
defm ADDZE : XOForm_3rc<31, 202, 0, (outs gprc:$rT), (ins gprc:$rA), |
| 2798 |
"addze", "$rT, $rA", IIC_IntGeneral, |
| 2799 |
[(set i32:$rT, (adde i32:$rA, 0))]>; |
| 2800 |
defm SUBFE : XOForm_1rc<31, 136, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB), |
| 2801 |
"subfe", "$rT, $rA, $rB", IIC_IntGeneral, |
| 2802 |
[(set i32:$rT, (sube i32:$rB, i32:$rA))]>; |
| 2803 |
defm SUBFME : XOForm_3rc<31, 232, 0, (outs gprc:$rT), (ins gprc:$rA), |
| 2804 |
"subfme", "$rT, $rA", IIC_IntGeneral, |
| 2805 |
[(set i32:$rT, (sube -1, i32:$rA))]>; |
| 2806 |
defm SUBFZE : XOForm_3rc<31, 200, 0, (outs gprc:$rT), (ins gprc:$rA), |
| 2807 |
"subfze", "$rT, $rA", IIC_IntGeneral, |
| 2808 |
[(set i32:$rT, (sube 0, i32:$rA))]>; |
| 2809 |
} |
| 2810 |
} |
| 2811 |
|
| 2812 |
// A-Form instructions. Most of the instructions executed in the FPU are of |
| 2813 |
// this type. |
| 2814 |
// |
| 2815 |
let PPC970_Unit = 3, hasSideEffects = 0, Predicates = [HasFPU] in { // FPU Operations. |
| 2816 |
let Uses = [RM] in { |
| 2817 |
let isCommutable = 1 in { |
| 2818 |
defm FMADD : AForm_1r<63, 29, |
| 2819 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC, f8rc:$FRB), |
| 2820 |
"fmadd", "$FRT, $FRA, $FRC, $FRB", IIC_FPFused, |
| 2821 |
[(set f64:$FRT, (fma f64:$FRA, f64:$FRC, f64:$FRB))]>; |
| 2822 |
defm FMADDS : AForm_1r<59, 29, |
| 2823 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRC, f4rc:$FRB), |
| 2824 |
"fmadds", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2825 |
[(set f32:$FRT, (fma f32:$FRA, f32:$FRC, f32:$FRB))]>; |
| 2826 |
defm FMSUB : AForm_1r<63, 28, |
| 2827 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC, f8rc:$FRB), |
| 2828 |
"fmsub", "$FRT, $FRA, $FRC, $FRB", IIC_FPFused, |
| 2829 |
[(set f64:$FRT, |
| 2830 |
(fma f64:$FRA, f64:$FRC, (fneg f64:$FRB)))]>; |
| 2831 |
defm FMSUBS : AForm_1r<59, 28, |
| 2832 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRC, f4rc:$FRB), |
| 2833 |
"fmsubs", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2834 |
[(set f32:$FRT, |
| 2835 |
(fma f32:$FRA, f32:$FRC, (fneg f32:$FRB)))]>; |
| 2836 |
defm FNMADD : AForm_1r<63, 31, |
| 2837 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC, f8rc:$FRB), |
| 2838 |
"fnmadd", "$FRT, $FRA, $FRC, $FRB", IIC_FPFused, |
| 2839 |
[(set f64:$FRT, |
| 2840 |
(fneg (fma f64:$FRA, f64:$FRC, f64:$FRB)))]>; |
| 2841 |
defm FNMADDS : AForm_1r<59, 31, |
| 2842 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRC, f4rc:$FRB), |
| 2843 |
"fnmadds", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2844 |
[(set f32:$FRT, |
| 2845 |
(fneg (fma f32:$FRA, f32:$FRC, f32:$FRB)))]>; |
| 2846 |
defm FNMSUB : AForm_1r<63, 30, |
| 2847 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC, f8rc:$FRB), |
| 2848 |
"fnmsub", "$FRT, $FRA, $FRC, $FRB", IIC_FPFused, |
| 2849 |
[(set f64:$FRT, (fneg (fma f64:$FRA, f64:$FRC, |
| 2850 |
(fneg f64:$FRB))))]>; |
| 2851 |
defm FNMSUBS : AForm_1r<59, 30, |
| 2852 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRC, f4rc:$FRB), |
| 2853 |
"fnmsubs", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2854 |
[(set f32:$FRT, (fneg (fma f32:$FRA, f32:$FRC, |
| 2855 |
(fneg f32:$FRB))))]>; |
| 2856 |
} // isCommutable |
| 2857 |
} |
| 2858 |
// FSEL is artificially split into 4 and 8-byte forms for the result. To avoid |
| 2859 |
// having 4 of these, force the comparison to always be an 8-byte double (code |
| 2860 |
// should use an FMRSD if the input comparison value really wants to be a float) |
| 2861 |
// and 4/8 byte forms for the result and operand type.. |
| 2862 |
let Interpretation64Bit = 1, isCodeGenOnly = 1 in |
| 2863 |
defm FSELD : AForm_1r<63, 23, |
| 2864 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC, f8rc:$FRB), |
| 2865 |
"fsel", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2866 |
[(set f64:$FRT, (PPCfsel f64:$FRA, f64:$FRC, f64:$FRB))]>; |
| 2867 |
defm FSELS : AForm_1r<63, 23, |
| 2868 |
(outs f4rc:$FRT), (ins f8rc:$FRA, f4rc:$FRC, f4rc:$FRB), |
| 2869 |
"fsel", "$FRT, $FRA, $FRC, $FRB", IIC_FPGeneral, |
| 2870 |
[(set f32:$FRT, (PPCfsel f64:$FRA, f32:$FRC, f32:$FRB))]>; |
| 2871 |
let Uses = [RM] in { |
| 2872 |
let isCommutable = 1 in { |
| 2873 |
defm FADD : AForm_2r<63, 21, |
| 2874 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRB), |
| 2875 |
"fadd", "$FRT, $FRA, $FRB", IIC_FPAddSub, |
| 2876 |
[(set f64:$FRT, (fadd f64:$FRA, f64:$FRB))]>; |
| 2877 |
defm FADDS : AForm_2r<59, 21, |
| 2878 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRB), |
| 2879 |
"fadds", "$FRT, $FRA, $FRB", IIC_FPGeneral, |
| 2880 |
[(set f32:$FRT, (fadd f32:$FRA, f32:$FRB))]>; |
| 2881 |
} // isCommutable |
| 2882 |
defm FDIV : AForm_2r<63, 18, |
| 2883 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRB), |
| 2884 |
"fdiv", "$FRT, $FRA, $FRB", IIC_FPDivD, |
| 2885 |
[(set f64:$FRT, (fdiv f64:$FRA, f64:$FRB))]>; |
| 2886 |
defm FDIVS : AForm_2r<59, 18, |
| 2887 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRB), |
| 2888 |
"fdivs", "$FRT, $FRA, $FRB", IIC_FPDivS, |
| 2889 |
[(set f32:$FRT, (fdiv f32:$FRA, f32:$FRB))]>; |
| 2890 |
let isCommutable = 1 in { |
| 2891 |
defm FMUL : AForm_3r<63, 25, |
| 2892 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRC), |
| 2893 |
"fmul", "$FRT, $FRA, $FRC", IIC_FPFused, |
| 2894 |
[(set f64:$FRT, (fmul f64:$FRA, f64:$FRC))]>; |
| 2895 |
defm FMULS : AForm_3r<59, 25, |
| 2896 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRC), |
| 2897 |
"fmuls", "$FRT, $FRA, $FRC", IIC_FPGeneral, |
| 2898 |
[(set f32:$FRT, (fmul f32:$FRA, f32:$FRC))]>; |
| 2899 |
} // isCommutable |
| 2900 |
defm FSUB : AForm_2r<63, 20, |
| 2901 |
(outs f8rc:$FRT), (ins f8rc:$FRA, f8rc:$FRB), |
| 2902 |
"fsub", "$FRT, $FRA, $FRB", IIC_FPAddSub, |
| 2903 |
[(set f64:$FRT, (fsub f64:$FRA, f64:$FRB))]>; |
| 2904 |
defm FSUBS : AForm_2r<59, 20, |
| 2905 |
(outs f4rc:$FRT), (ins f4rc:$FRA, f4rc:$FRB), |
| 2906 |
"fsubs", "$FRT, $FRA, $FRB", IIC_FPGeneral, |
| 2907 |
[(set f32:$FRT, (fsub f32:$FRA, f32:$FRB))]>; |
| 2908 |
} |
| 2909 |
} |
| 2910 |
|
| 2911 |
let hasSideEffects = 0 in { |
| 2912 |
let PPC970_Unit = 1 in { // FXU Operations. |
| 2913 |
let isSelect = 1 in |
| 2914 |
def ISEL : AForm_4<31, 15, |
| 2915 |
(outs gprc:$rT), (ins gprc_nor0:$rA, gprc:$rB, crbitrc:$cond), |
| 2916 |
"isel $rT, $rA, $rB, $cond", IIC_IntISEL, |
| 2917 |
[]>; |
| 2918 |
} |
| 2919 |
|
| 2920 |
let PPC970_Unit = 1 in { // FXU Operations. |
| 2921 |
// M-Form instructions. rotate and mask instructions. |
| 2922 |
// |
| 2923 |
let isCommutable = 1 in { |
| 2924 |
// RLWIMI can be commuted if the rotate amount is zero. |
| 2925 |
defm RLWIMI : MForm_2r<20, (outs gprc:$rA), |
| 2926 |
(ins gprc:$rSi, gprc:$rS, u5imm:$SH, u5imm:$MB, |
| 2927 |
u5imm:$ME), "rlwimi", "$rA, $rS, $SH, $MB, $ME", |
| 2928 |
IIC_IntRotate, []>, PPC970_DGroup_Cracked, |
| 2929 |
RegConstraint<"$rSi = $rA">, NoEncode<"$rSi">; |
| 2930 |
} |
| 2931 |
let BaseName = "rlwinm" in { |
| 2932 |
def RLWINM : MForm_2<21, |
| 2933 |
(outs gprc:$rA), (ins gprc:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME), |
| 2934 |
"rlwinm $rA, $rS, $SH, $MB, $ME", IIC_IntGeneral, |
| 2935 |
[]>, RecFormRel; |
| 2936 |
let Defs = [CR0] in |
| 2937 |
def RLWINMo : MForm_2<21, |
| 2938 |
(outs gprc:$rA), (ins gprc:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME), |
| 2939 |
"rlwinm. $rA, $rS, $SH, $MB, $ME", IIC_IntGeneral, |
| 2940 |
[]>, isDOT, RecFormRel, PPC970_DGroup_Cracked; |
| 2941 |
} |
| 2942 |
defm RLWNM : MForm_2r<23, (outs gprc:$rA), |
| 2943 |
(ins gprc:$rS, gprc:$rB, u5imm:$MB, u5imm:$ME), |
| 2944 |
"rlwnm", "$rA, $rS, $rB, $MB, $ME", IIC_IntGeneral, |
| 2945 |
[]>; |
| 2946 |
} |
| 2947 |
} // hasSideEffects = 0 |
| 2948 |
|
| 2949 |
//===----------------------------------------------------------------------===// |
| 2950 |
// PowerPC Instruction Patterns |
| 2951 |
// |
| 2952 |
|
| 2953 |
// Arbitrary immediate support. Implement in terms of LIS/ORI. |
| 2954 |
def : Pat<(i32 imm:$imm), |
| 2955 |
(ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))>; |
| 2956 |
|
| 2957 |
// Implement the 'not' operation with the NOR instruction. |
| 2958 |
def i32not : OutPatFrag<(ops node:$in), |
| 2959 |
(NOR $in, $in)>; |
| 2960 |
def : Pat<(not i32:$in), |
| 2961 |
(i32not $in)>; |
| 2962 |
|
| 2963 |
// ADD an arbitrary immediate. |
| 2964 |
def : Pat<(add i32:$in, imm:$imm), |
| 2965 |
(ADDIS (ADDI $in, (LO16 imm:$imm)), (HA16 imm:$imm))>; |
| 2966 |
// OR an arbitrary immediate. |
| 2967 |
def : Pat<(or i32:$in, imm:$imm), |
| 2968 |
(ORIS (ORI $in, (LO16 imm:$imm)), (HI16 imm:$imm))>; |
| 2969 |
// XOR an arbitrary immediate. |
| 2970 |
def : Pat<(xor i32:$in, imm:$imm), |
| 2971 |
(XORIS (XORI $in, (LO16 imm:$imm)), (HI16 imm:$imm))>; |
| 2972 |
// SUBFIC |
| 2973 |
def : Pat<(sub imm32SExt16:$imm, i32:$in), |
| 2974 |
(SUBFIC $in, imm:$imm)>; |
| 2975 |
|
| 2976 |
// SHL/SRL |
| 2977 |
def : Pat<(shl i32:$in, (i32 imm:$imm)), |
| 2978 |
(RLWINM $in, imm:$imm, 0, (SHL32 imm:$imm))>; |
| 2979 |
def : Pat<(srl i32:$in, (i32 imm:$imm)), |
| 2980 |
(RLWINM $in, (SRL32 imm:$imm), imm:$imm, 31)>; |
| 2981 |
|
| 2982 |
// ROTL |
| 2983 |
def : Pat<(rotl i32:$in, i32:$sh), |
| 2984 |
(RLWNM $in, $sh, 0, 31)>; |
| 2985 |
def : Pat<(rotl i32:$in, (i32 imm:$imm)), |
| 2986 |
(RLWINM $in, imm:$imm, 0, 31)>; |
| 2987 |
|
| 2988 |
// RLWNM |
| 2989 |
def : Pat<(and (rotl i32:$in, i32:$sh), maskimm32:$imm), |
| 2990 |
(RLWNM $in, $sh, (MB maskimm32:$imm), (ME maskimm32:$imm))>; |
| 2991 |
|
| 2992 |
// Calls |
| 2993 |
def : Pat<(PPCcall (i32 tglobaladdr:$dst)), |
| 2994 |
(BL tglobaladdr:$dst)>; |
| 2995 |
def : Pat<(PPCcall (i32 texternalsym:$dst)), |
| 2996 |
(BL texternalsym:$dst)>; |
| 2997 |
|
| 2998 |
def : Pat<(PPCtc_return (i32 tglobaladdr:$dst), imm:$imm), |
| 2999 |
(TCRETURNdi tglobaladdr:$dst, imm:$imm)>; |
| 3000 |
|
| 3001 |
def : Pat<(PPCtc_return (i32 texternalsym:$dst), imm:$imm), |
| 3002 |
(TCRETURNdi texternalsym:$dst, imm:$imm)>; |
| 3003 |
|
| 3004 |
def : Pat<(PPCtc_return CTRRC:$dst, imm:$imm), |
| 3005 |
(TCRETURNri CTRRC:$dst, imm:$imm)>; |
| 3006 |
|
| 3007 |
|
| 3008 |
|
| 3009 |
// Hi and Lo for Darwin Global Addresses. |
| 3010 |
def : Pat<(PPChi tglobaladdr:$in, 0), (LIS tglobaladdr:$in)>; |
| 3011 |
def : Pat<(PPClo tglobaladdr:$in, 0), (LI tglobaladdr:$in)>; |
| 3012 |
def : Pat<(PPChi tconstpool:$in, 0), (LIS tconstpool:$in)>; |
| 3013 |
def : Pat<(PPClo tconstpool:$in, 0), (LI tconstpool:$in)>; |
| 3014 |
def : Pat<(PPChi tjumptable:$in, 0), (LIS tjumptable:$in)>; |
| 3015 |
def : Pat<(PPClo tjumptable:$in, 0), (LI tjumptable:$in)>; |
| 3016 |
def : Pat<(PPChi tblockaddress:$in, 0), (LIS tblockaddress:$in)>; |
| 3017 |
def : Pat<(PPClo tblockaddress:$in, 0), (LI tblockaddress:$in)>; |
| 3018 |
def : Pat<(PPChi tglobaltlsaddr:$g, i32:$in), |
| 3019 |
(ADDIS $in, tglobaltlsaddr:$g)>; |
| 3020 |
def : Pat<(PPClo tglobaltlsaddr:$g, i32:$in), |
| 3021 |
(ADDI $in, tglobaltlsaddr:$g)>; |
| 3022 |
def : Pat<(add i32:$in, (PPChi tglobaladdr:$g, 0)), |
| 3023 |
(ADDIS $in, tglobaladdr:$g)>; |
| 3024 |
def : Pat<(add i32:$in, (PPChi tconstpool:$g, 0)), |
| 3025 |
(ADDIS $in, tconstpool:$g)>; |
| 3026 |
def : Pat<(add i32:$in, (PPChi tjumptable:$g, 0)), |
| 3027 |
(ADDIS $in, tjumptable:$g)>; |
| 3028 |
def : Pat<(add i32:$in, (PPChi tblockaddress:$g, 0)), |
| 3029 |
(ADDIS $in, tblockaddress:$g)>; |
| 3030 |
|
| 3031 |
// Support for thread-local storage. |
| 3032 |
def PPC32GOT: Pseudo<(outs gprc:$rD), (ins), "#PPC32GOT", |
| 3033 |
[(set i32:$rD, (PPCppc32GOT))]>; |
| 3034 |
|
| 3035 |
// Get the _GLOBAL_OFFSET_TABLE_ in PIC mode. |
| 3036 |
// This uses two output registers, the first as the real output, the second as a |
| 3037 |
// temporary register, used internally in code generation. |
| 3038 |
def PPC32PICGOT: Pseudo<(outs gprc:$rD, gprc:$rT), (ins), "#PPC32PICGOT", |
| 3039 |
[]>, NoEncode<"$rT">; |
| 3040 |
|
| 3041 |
def LDgotTprelL32: Pseudo<(outs gprc:$rD), (ins s16imm:$disp, gprc_nor0:$reg), |
| 3042 |
"#LDgotTprelL32", |
| 3043 |
[(set i32:$rD, |
| 3044 |
(PPCldGotTprelL tglobaltlsaddr:$disp, i32:$reg))]>; |
| 3045 |
def : Pat<(PPCaddTls i32:$in, tglobaltlsaddr:$g), |
| 3046 |
(ADD4TLS $in, tglobaltlsaddr:$g)>; |
| 3047 |
|
| 3048 |
def ADDItlsgdL32 : Pseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, s16imm:$disp), |
| 3049 |
"#ADDItlsgdL32", |
| 3050 |
[(set i32:$rD, |
| 3051 |
(PPCaddiTlsgdL i32:$reg, tglobaltlsaddr:$disp))]>; |
| 3052 |
// LR is a true define, while the rest of the Defs are clobbers. R3 is |
| 3053 |
// explicitly defined when this op is created, so not mentioned here. |
| 3054 |
let hasExtraSrcRegAllocReq = 1, hasExtraDefRegAllocReq = 1, |
| 3055 |
Defs = [R0,R4,R5,R6,R7,R8,R9,R10,R11,R12,LR,CTR,CR0,CR1,CR5,CR6,CR7] in |
| 3056 |
def GETtlsADDR32 : Pseudo<(outs gprc:$rD), (ins gprc:$reg, tlsgd32:$sym), |
| 3057 |
"GETtlsADDR32", |
| 3058 |
[(set i32:$rD, |
| 3059 |
(PPCgetTlsAddr i32:$reg, tglobaltlsaddr:$sym))]>; |
| 3060 |
// Combined op for ADDItlsgdL32 and GETtlsADDR32, late expanded. R3 and LR |
| 3061 |
// are true defines while the rest of the Defs are clobbers. |
| 3062 |
let hasExtraSrcRegAllocReq = 1, hasExtraDefRegAllocReq = 1, |
| 3063 |
Defs = [R0,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,LR,CTR,CR0,CR1,CR5,CR6,CR7] in |
| 3064 |
def ADDItlsgdLADDR32 : Pseudo<(outs gprc:$rD), |
| 3065 |
(ins gprc_nor0:$reg, s16imm:$disp, tlsgd32:$sym), |
| 3066 |
"#ADDItlsgdLADDR32", |
| 3067 |
[(set i32:$rD, |
| 3068 |
(PPCaddiTlsgdLAddr i32:$reg, |
| 3069 |
tglobaltlsaddr:$disp, |
| 3070 |
tglobaltlsaddr:$sym))]>; |
| 3071 |
def ADDItlsldL32 : Pseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, s16imm:$disp), |
| 3072 |
"#ADDItlsldL32", |
| 3073 |
[(set i32:$rD, |
| 3074 |
(PPCaddiTlsldL i32:$reg, tglobaltlsaddr:$disp))]>; |
| 3075 |
// LR is a true define, while the rest of the Defs are clobbers. R3 is |
| 3076 |
// explicitly defined when this op is created, so not mentioned here. |
| 3077 |
let hasExtraSrcRegAllocReq = 1, hasExtraDefRegAllocReq = 1, |
| 3078 |
Defs = [R0,R4,R5,R6,R7,R8,R9,R10,R11,R12,LR,CTR,CR0,CR1,CR5,CR6,CR7] in |
| 3079 |
def GETtlsldADDR32 : Pseudo<(outs gprc:$rD), (ins gprc:$reg, tlsgd32:$sym), |
| 3080 |
"GETtlsldADDR32", |
| 3081 |
[(set i32:$rD, |
| 3082 |
(PPCgetTlsldAddr i32:$reg, |
| 3083 |
tglobaltlsaddr:$sym))]>; |
| 3084 |
// Combined op for ADDItlsldL32 and GETtlsADDR32, late expanded. R3 and LR |
| 3085 |
// are true defines while the rest of the Defs are clobbers. |
| 3086 |
let hasExtraSrcRegAllocReq = 1, hasExtraDefRegAllocReq = 1, |
| 3087 |
Defs = [R0,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,LR,CTR,CR0,CR1,CR5,CR6,CR7] in |
| 3088 |
def ADDItlsldLADDR32 : Pseudo<(outs gprc:$rD), |
| 3089 |
(ins gprc_nor0:$reg, s16imm:$disp, tlsgd32:$sym), |
| 3090 |
"#ADDItlsldLADDR32", |
| 3091 |
[(set i32:$rD, |
| 3092 |
(PPCaddiTlsldLAddr i32:$reg, |
| 3093 |
tglobaltlsaddr:$disp, |
| 3094 |
tglobaltlsaddr:$sym))]>; |
| 3095 |
def ADDIdtprelL32 : Pseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, s16imm:$disp), |
| 3096 |
"#ADDIdtprelL32", |
| 3097 |
[(set i32:$rD, |
| 3098 |
(PPCaddiDtprelL i32:$reg, tglobaltlsaddr:$disp))]>; |
| 3099 |
def ADDISdtprelHA32 : Pseudo<(outs gprc:$rD), (ins gprc_nor0:$reg, s16imm:$disp), |
| 3100 |
"#ADDISdtprelHA32", |
| 3101 |
[(set i32:$rD, |
| 3102 |
(PPCaddisDtprelHA i32:$reg, |
| 3103 |
tglobaltlsaddr:$disp))]>; |
| 3104 |
|
| 3105 |
// Support for Position-independent code |
| 3106 |
def LWZtoc : Pseudo<(outs gprc:$rD), (ins tocentry32:$disp, gprc:$reg), |
| 3107 |
"#LWZtoc", |
| 3108 |
[(set i32:$rD, |
| 3109 |
(PPCtoc_entry tglobaladdr:$disp, i32:$reg))]>; |
| 3110 |
// Get Global (GOT) Base Register offset, from the word immediately preceding |
| 3111 |
// the function label. |
| 3112 |
def UpdateGBR : Pseudo<(outs gprc:$rD, gprc:$rT), (ins gprc:$rI), "#UpdateGBR", []>; |
| 3113 |
|
| 3114 |
|
| 3115 |
// Standard shifts. These are represented separately from the real shifts above |
| 3116 |
// so that we can distinguish between shifts that allow 5-bit and 6-bit shift |
| 3117 |
// amounts. |
| 3118 |
def : Pat<(sra i32:$rS, i32:$rB), |
| 3119 |
(SRAW $rS, $rB)>; |
| 3120 |
def : Pat<(srl i32:$rS, i32:$rB), |
| 3121 |
(SRW $rS, $rB)>; |
| 3122 |
def : Pat<(shl i32:$rS, i32:$rB), |
| 3123 |
(SLW $rS, $rB)>; |
| 3124 |
|
| 3125 |
def : Pat<(zextloadi1 iaddr:$src), |
| 3126 |
(LBZ iaddr:$src)>; |
| 3127 |
def : Pat<(zextloadi1 xaddr:$src), |
| 3128 |
(LBZX xaddr:$src)>; |
| 3129 |
def : Pat<(extloadi1 iaddr:$src), |
| 3130 |
(LBZ iaddr:$src)>; |
| 3131 |
def : Pat<(extloadi1 xaddr:$src), |
| 3132 |
(LBZX xaddr:$src)>; |
| 3133 |
def : Pat<(extloadi8 iaddr:$src), |
| 3134 |
(LBZ iaddr:$src)>; |
| 3135 |
def : Pat<(extloadi8 xaddr:$src), |
| 3136 |
(LBZX xaddr:$src)>; |
| 3137 |
def : Pat<(extloadi16 iaddr:$src), |
| 3138 |
(LHZ iaddr:$src)>; |
| 3139 |
def : Pat<(extloadi16 xaddr:$src), |
| 3140 |
(LHZX xaddr:$src)>; |
| 3141 |
let Predicates = [HasFPU] in { |
| 3142 |
def : Pat<(f64 (extloadf32 iaddr:$src)), |
| 3143 |
(COPY_TO_REGCLASS (LFS iaddr:$src), F8RC)>; |
| 3144 |
def : Pat<(f64 (extloadf32 xaddr:$src)), |
| 3145 |
(COPY_TO_REGCLASS (LFSX xaddr:$src), F8RC)>; |
| 3146 |
|
| 3147 |
def : Pat<(f64 (fpextend f32:$src)), |
| 3148 |
(COPY_TO_REGCLASS $src, F8RC)>; |
| 3149 |
} |
| 3150 |
|
| 3151 |
// Only seq_cst fences require the heavyweight sync (SYNC 0). |
| 3152 |
// All others can use the lightweight sync (SYNC 1). |
| 3153 |
// source: http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html |
| 3154 |
// The rule for seq_cst is duplicated to work with both 64 bits and 32 bits |
| 3155 |
// versions of Power. |
| 3156 |
def : Pat<(atomic_fence (i64 7), (imm)), (SYNC 0)>, Requires<[HasSYNC]>; |
| 3157 |
def : Pat<(atomic_fence (i32 7), (imm)), (SYNC 0)>, Requires<[HasSYNC]>; |
| 3158 |
def : Pat<(atomic_fence (imm), (imm)), (SYNC 1)>, Requires<[HasSYNC]>; |
| 3159 |
def : Pat<(atomic_fence (imm), (imm)), (MSYNC)>, Requires<[HasOnlyMSYNC]>; |
| 3160 |
|
| 3161 |
let Predicates = [HasFPU] in { |
| 3162 |
// Additional FNMSUB patterns: -a*c + b == -(a*c - b) |
| 3163 |
def : Pat<(fma (fneg f64:$A), f64:$C, f64:$B), |
| 3164 |
(FNMSUB $A, $C, $B)>; |
| 3165 |
def : Pat<(fma f64:$A, (fneg f64:$C), f64:$B), |
| 3166 |
(FNMSUB $A, $C, $B)>; |
| 3167 |
def : Pat<(fma (fneg f32:$A), f32:$C, f32:$B), |
| 3168 |
(FNMSUBS $A, $C, $B)>; |
| 3169 |
def : Pat<(fma f32:$A, (fneg f32:$C), f32:$B), |
| 3170 |
(FNMSUBS $A, $C, $B)>; |
| 3171 |
|
| 3172 |
// FCOPYSIGN's operand types need not agree. |
| 3173 |
def : Pat<(fcopysign f64:$frB, f32:$frA), |
| 3174 |
(FCPSGND (COPY_TO_REGCLASS $frA, F8RC), $frB)>; |
| 3175 |
def : Pat<(fcopysign f32:$frB, f64:$frA), |
| 3176 |
(FCPSGNS (COPY_TO_REGCLASS $frA, F4RC), $frB)>; |
| 3177 |
} |
| 3178 |
|
| 3179 |
include "PPCInstrAltivec.td" |
| 3180 |
include "PPCInstrPS.td" |
| 3181 |
include "PPCInstrSPE.td" |
| 3182 |
include "PPCInstr64Bit.td" |
| 3183 |
include "PPCInstrVSX.td" |
| 3184 |
include "PPCInstrQPX.td" |
| 3185 |
include "PPCInstrHTM.td" |
| 3186 |
|
| 3187 |
def crnot : OutPatFrag<(ops node:$in), |
| 3188 |
(CRNOR $in, $in)>; |
| 3189 |
def : Pat<(not i1:$in), |
| 3190 |
(crnot $in)>; |
| 3191 |
|
| 3192 |
// Patterns for arithmetic i1 operations. |
| 3193 |
def : Pat<(add i1:$a, i1:$b), |
| 3194 |
(CRXOR $a, $b)>; |
| 3195 |
def : Pat<(sub i1:$a, i1:$b), |
| 3196 |
(CRXOR $a, $b)>; |
| 3197 |
def : Pat<(mul i1:$a, i1:$b), |
| 3198 |
(CRAND $a, $b)>; |
| 3199 |
|
| 3200 |
// We're sometimes asked to materialize i1 -1, which is just 1 in this case |
| 3201 |
// (-1 is used to mean all bits set). |
| 3202 |
def : Pat<(i1 -1), (CRSET)>; |
| 3203 |
|
| 3204 |
// i1 extensions, implemented in terms of isel. |
| 3205 |
def : Pat<(i32 (zext i1:$in)), |
| 3206 |
(SELECT_I4 $in, (LI 1), (LI 0))>; |
| 3207 |
def : Pat<(i32 (sext i1:$in)), |
| 3208 |
(SELECT_I4 $in, (LI -1), (LI 0))>; |
| 3209 |
|
| 3210 |
def : Pat<(i64 (zext i1:$in)), |
| 3211 |
(SELECT_I8 $in, (LI8 1), (LI8 0))>; |
| 3212 |
def : Pat<(i64 (sext i1:$in)), |
| 3213 |
(SELECT_I8 $in, (LI8 -1), (LI8 0))>; |
| 3214 |
|
| 3215 |
// FIXME: We should choose either a zext or a sext based on other constants |
| 3216 |
// already around. |
| 3217 |
def : Pat<(i32 (anyext i1:$in)), |
| 3218 |
(SELECT_I4 $in, (LI 1), (LI 0))>; |
| 3219 |
def : Pat<(i64 (anyext i1:$in)), |
| 3220 |
(SELECT_I8 $in, (LI8 1), (LI8 0))>; |
| 3221 |
|
| 3222 |
// match setcc on i1 variables. |
| 3223 |
// CRANDC is: |
| 3224 |
// 1 1 : F |
| 3225 |
// 1 0 : T |
| 3226 |
// 0 1 : F |
| 3227 |
// 0 0 : F |
| 3228 |
// |
| 3229 |
// LT is: |
| 3230 |
// -1 -1 : F |
| 3231 |
// -1 0 : T |
| 3232 |
// 0 -1 : F |
| 3233 |
// 0 0 : F |
| 3234 |
// |
| 3235 |
// ULT is: |
| 3236 |
// 1 1 : F |
| 3237 |
// 1 0 : F |
| 3238 |
// 0 1 : T |
| 3239 |
// 0 0 : F |
| 3240 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETLT)), |
| 3241 |
(CRANDC $s1, $s2)>; |
| 3242 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETULT)), |
| 3243 |
(CRANDC $s2, $s1)>; |
| 3244 |
// CRORC is: |
| 3245 |
// 1 1 : T |
| 3246 |
// 1 0 : T |
| 3247 |
// 0 1 : F |
| 3248 |
// 0 0 : T |
| 3249 |
// |
| 3250 |
// LE is: |
| 3251 |
// -1 -1 : T |
| 3252 |
// -1 0 : T |
| 3253 |
// 0 -1 : F |
| 3254 |
// 0 0 : T |
| 3255 |
// |
| 3256 |
// ULE is: |
| 3257 |
// 1 1 : T |
| 3258 |
// 1 0 : F |
| 3259 |
// 0 1 : T |
| 3260 |
// 0 0 : T |
| 3261 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETLE)), |
| 3262 |
(CRORC $s1, $s2)>; |
| 3263 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETULE)), |
| 3264 |
(CRORC $s2, $s1)>; |
| 3265 |
|
| 3266 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETEQ)), |
| 3267 |
(CREQV $s1, $s2)>; |
| 3268 |
|
| 3269 |
// GE is: |
| 3270 |
// -1 -1 : T |
| 3271 |
// -1 0 : F |
| 3272 |
// 0 -1 : T |
| 3273 |
// 0 0 : T |
| 3274 |
// |
| 3275 |
// UGE is: |
| 3276 |
// 1 1 : T |
| 3277 |
// 1 0 : T |
| 3278 |
// 0 1 : F |
| 3279 |
// 0 0 : T |
| 3280 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETGE)), |
| 3281 |
(CRORC $s2, $s1)>; |
| 3282 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETUGE)), |
| 3283 |
(CRORC $s1, $s2)>; |
| 3284 |
|
| 3285 |
// GT is: |
| 3286 |
// -1 -1 : F |
| 3287 |
// -1 0 : F |
| 3288 |
// 0 -1 : T |
| 3289 |
// 0 0 : F |
| 3290 |
// |
| 3291 |
// UGT is: |
| 3292 |
// 1 1 : F |
| 3293 |
// 1 0 : T |
| 3294 |
// 0 1 : F |
| 3295 |
// 0 0 : F |
| 3296 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETGT)), |
| 3297 |
(CRANDC $s2, $s1)>; |
| 3298 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETUGT)), |
| 3299 |
(CRANDC $s1, $s2)>; |
| 3300 |
|
| 3301 |
def : Pat<(i1 (setcc i1:$s1, i1:$s2, SETNE)), |
| 3302 |
(CRXOR $s1, $s2)>; |
| 3303 |
|
| 3304 |
// match setcc on non-i1 (non-vector) variables. Note that SETUEQ, SETOGE, |
| 3305 |
// SETOLE, SETONE, SETULT and SETUGT should be expanded by legalize for |
| 3306 |
// floating-point types. |
| 3307 |
|
| 3308 |
multiclass CRNotPat<dag pattern, dag result> { |
| 3309 |
def : Pat<pattern, (crnot result)>; |
| 3310 |
def : Pat<(not pattern), result>; |
| 3311 |
|
| 3312 |
// We can also fold the crnot into an extension: |
| 3313 |
def : Pat<(i32 (zext pattern)), |
| 3314 |
(SELECT_I4 result, (LI 0), (LI 1))>; |
| 3315 |
def : Pat<(i32 (sext pattern)), |
| 3316 |
(SELECT_I4 result, (LI 0), (LI -1))>; |
| 3317 |
|
| 3318 |
// We can also fold the crnot into an extension: |
| 3319 |
def : Pat<(i64 (zext pattern)), |
| 3320 |
(SELECT_I8 result, (LI8 0), (LI8 1))>; |
| 3321 |
def : Pat<(i64 (sext pattern)), |
| 3322 |
(SELECT_I8 result, (LI8 0), (LI8 -1))>; |
| 3323 |
|
| 3324 |
// FIXME: We should choose either a zext or a sext based on other constants |
| 3325 |
// already around. |
| 3326 |
def : Pat<(i32 (anyext pattern)), |
| 3327 |
(SELECT_I4 result, (LI 0), (LI 1))>; |
| 3328 |
|
| 3329 |
def : Pat<(i64 (anyext pattern)), |
| 3330 |
(SELECT_I8 result, (LI8 0), (LI8 1))>; |
| 3331 |
} |
| 3332 |
|
| 3333 |
// FIXME: Because of what seems like a bug in TableGen's type-inference code, |
| 3334 |
// we need to write imm:$imm in the output patterns below, not just $imm, or |
| 3335 |
// else the resulting matcher will not correctly add the immediate operand |
| 3336 |
// (making it a register operand instead). |
| 3337 |
|
| 3338 |
// extended SETCC. |
| 3339 |
multiclass ExtSetCCPat<CondCode cc, PatFrag pfrag, |
| 3340 |
OutPatFrag rfrag, OutPatFrag rfrag8> { |
| 3341 |
def : Pat<(i32 (zext (i1 (pfrag i32:$s1, cc)))), |
| 3342 |
(rfrag $s1)>; |
| 3343 |
def : Pat<(i64 (zext (i1 (pfrag i64:$s1, cc)))), |
| 3344 |
(rfrag8 $s1)>; |
| 3345 |
def : Pat<(i64 (zext (i1 (pfrag i32:$s1, cc)))), |
| 3346 |
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), (rfrag $s1), sub_32)>; |
| 3347 |
def : Pat<(i32 (zext (i1 (pfrag i64:$s1, cc)))), |
| 3348 |
(EXTRACT_SUBREG (rfrag8 $s1), sub_32)>; |
| 3349 |
|
| 3350 |
def : Pat<(i32 (anyext (i1 (pfrag i32:$s1, cc)))), |
| 3351 |
(rfrag $s1)>; |
| 3352 |
def : Pat<(i64 (anyext (i1 (pfrag i64:$s1, cc)))), |
| 3353 |
(rfrag8 $s1)>; |
| 3354 |
def : Pat<(i64 (anyext (i1 (pfrag i32:$s1, cc)))), |
| 3355 |
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), (rfrag $s1), sub_32)>; |
| 3356 |
def : Pat<(i32 (anyext (i1 (pfrag i64:$s1, cc)))), |
| 3357 |
(EXTRACT_SUBREG (rfrag8 $s1), sub_32)>; |
| 3358 |
} |
| 3359 |
|
| 3360 |
// Note that we do all inversions below with i(32|64)not, instead of using |
| 3361 |
// (xori x, 1) because on the A2 nor has single-cycle latency while xori |
| 3362 |
// has 2-cycle latency. |
| 3363 |
|
| 3364 |
defm : ExtSetCCPat<SETEQ, |
| 3365 |
PatFrag<(ops node:$in, node:$cc), |
| 3366 |
(setcc $in, 0, $cc)>, |
| 3367 |
OutPatFrag<(ops node:$in), |
| 3368 |
(RLWINM (CNTLZW $in), 27, 31, 31)>, |
| 3369 |
OutPatFrag<(ops node:$in), |
| 3370 |
(RLDICL (CNTLZD $in), 58, 63)> >; |
| 3371 |
|
| 3372 |
defm : ExtSetCCPat<SETNE, |
| 3373 |
PatFrag<(ops node:$in, node:$cc), |
| 3374 |
(setcc $in, 0, $cc)>, |
| 3375 |
OutPatFrag<(ops node:$in), |
| 3376 |
(RLWINM (i32not (CNTLZW $in)), 27, 31, 31)>, |
| 3377 |
OutPatFrag<(ops node:$in), |
| 3378 |
(RLDICL (i64not (CNTLZD $in)), 58, 63)> >; |
| 3379 |
|
| 3380 |
defm : ExtSetCCPat<SETLT, |
| 3381 |
PatFrag<(ops node:$in, node:$cc), |
| 3382 |
(setcc $in, 0, $cc)>, |
| 3383 |
OutPatFrag<(ops node:$in), |
| 3384 |
(RLWINM $in, 1, 31, 31)>, |
| 3385 |
OutPatFrag<(ops node:$in), |
| 3386 |
(RLDICL $in, 1, 63)> >; |
| 3387 |
|
| 3388 |
defm : ExtSetCCPat<SETGE, |
| 3389 |
PatFrag<(ops node:$in, node:$cc), |
| 3390 |
(setcc $in, 0, $cc)>, |
| 3391 |
OutPatFrag<(ops node:$in), |
| 3392 |
(RLWINM (i32not $in), 1, 31, 31)>, |
| 3393 |
OutPatFrag<(ops node:$in), |
| 3394 |
(RLDICL (i64not $in), 1, 63)> >; |
| 3395 |
|
| 3396 |
defm : ExtSetCCPat<SETGT, |
| 3397 |
PatFrag<(ops node:$in, node:$cc), |
| 3398 |
(setcc $in, 0, $cc)>, |
| 3399 |
OutPatFrag<(ops node:$in), |
| 3400 |
(RLWINM (ANDC (NEG $in), $in), 1, 31, 31)>, |
| 3401 |
OutPatFrag<(ops node:$in), |
| 3402 |
(RLDICL (ANDC8 (NEG8 $in), $in), 1, 63)> >; |
| 3403 |
|
| 3404 |
defm : ExtSetCCPat<SETLE, |
| 3405 |
PatFrag<(ops node:$in, node:$cc), |
| 3406 |
(setcc $in, 0, $cc)>, |
| 3407 |
OutPatFrag<(ops node:$in), |
| 3408 |
(RLWINM (ORC $in, (NEG $in)), 1, 31, 31)>, |
| 3409 |
OutPatFrag<(ops node:$in), |
| 3410 |
(RLDICL (ORC8 $in, (NEG8 $in)), 1, 63)> >; |
| 3411 |
|
| 3412 |
defm : ExtSetCCPat<SETLT, |
| 3413 |
PatFrag<(ops node:$in, node:$cc), |
| 3414 |
(setcc $in, -1, $cc)>, |
| 3415 |
OutPatFrag<(ops node:$in), |
| 3416 |
(RLWINM (AND $in, (ADDI $in, 1)), 1, 31, 31)>, |
| 3417 |
OutPatFrag<(ops node:$in), |
| 3418 |
(RLDICL (AND8 $in, (ADDI8 $in, 1)), 1, 63)> >; |
| 3419 |
|
| 3420 |
defm : ExtSetCCPat<SETGE, |
| 3421 |
PatFrag<(ops node:$in, node:$cc), |
| 3422 |
(setcc $in, -1, $cc)>, |
| 3423 |
OutPatFrag<(ops node:$in), |
| 3424 |
(RLWINM (NAND $in, (ADDI $in, 1)), 1, 31, 31)>, |
| 3425 |
OutPatFrag<(ops node:$in), |
| 3426 |
(RLDICL (NAND8 $in, (ADDI8 $in, 1)), 1, 63)> >; |
| 3427 |
|
| 3428 |
defm : ExtSetCCPat<SETGT, |
| 3429 |
PatFrag<(ops node:$in, node:$cc), |
| 3430 |
(setcc $in, -1, $cc)>, |
| 3431 |
OutPatFrag<(ops node:$in), |
| 3432 |
(RLWINM (i32not $in), 1, 31, 31)>, |
| 3433 |
OutPatFrag<(ops node:$in), |
| 3434 |
(RLDICL (i64not $in), 1, 63)> >; |
| 3435 |
|
| 3436 |
defm : ExtSetCCPat<SETLE, |
| 3437 |
PatFrag<(ops node:$in, node:$cc), |
| 3438 |
(setcc $in, -1, $cc)>, |
| 3439 |
OutPatFrag<(ops node:$in), |
| 3440 |
(RLWINM $in, 1, 31, 31)>, |
| 3441 |
OutPatFrag<(ops node:$in), |
| 3442 |
(RLDICL $in, 1, 63)> >; |
| 3443 |
|
| 3444 |
// An extended SETCC with shift amount. |
| 3445 |
multiclass ExtSetCCShiftPat<CondCode cc, PatFrag pfrag, |
| 3446 |
OutPatFrag rfrag, OutPatFrag rfrag8> { |
| 3447 |
def : Pat<(i32 (zext (i1 (pfrag i32:$s1, i32:$sa, cc)))), |
| 3448 |
(rfrag $s1, $sa)>; |
| 3449 |
def : Pat<(i64 (zext (i1 (pfrag i64:$s1, i32:$sa, cc)))), |
| 3450 |
(rfrag8 $s1, $sa)>; |
| 3451 |
def : Pat<(i64 (zext (i1 (pfrag i32:$s1, i32:$sa, cc)))), |
| 3452 |
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), (rfrag $s1, $sa), sub_32)>; |
| 3453 |
def : Pat<(i32 (zext (i1 (pfrag i64:$s1, i32:$sa, cc)))), |
| 3454 |
(EXTRACT_SUBREG (rfrag8 $s1, $sa), sub_32)>; |
| 3455 |
|
| 3456 |
def : Pat<(i32 (anyext (i1 (pfrag i32:$s1, i32:$sa, cc)))), |
| 3457 |
(rfrag $s1, $sa)>; |
| 3458 |
def : Pat<(i64 (anyext (i1 (pfrag i64:$s1, i32:$sa, cc)))), |
| 3459 |
(rfrag8 $s1, $sa)>; |
| 3460 |
def : Pat<(i64 (anyext (i1 (pfrag i32:$s1, i32:$sa, cc)))), |
| 3461 |
(INSERT_SUBREG (i64 (IMPLICIT_DEF)), (rfrag $s1, $sa), sub_32)>; |
| 3462 |
def : Pat<(i32 (anyext (i1 (pfrag i64:$s1, i32:$sa, cc)))), |
| 3463 |
(EXTRACT_SUBREG (rfrag8 $s1, $sa), sub_32)>; |
| 3464 |
} |
| 3465 |
|
| 3466 |
defm : ExtSetCCShiftPat<SETNE, |
| 3467 |
PatFrag<(ops node:$in, node:$sa, node:$cc), |
| 3468 |
(setcc (and $in, (shl 1, $sa)), 0, $cc)>, |
| 3469 |
OutPatFrag<(ops node:$in, node:$sa), |
| 3470 |
(RLWNM $in, (SUBFIC $sa, 32), 31, 31)>, |
| 3471 |
OutPatFrag<(ops node:$in, node:$sa), |
| 3472 |
(RLDCL $in, (SUBFIC $sa, 64), 63)> >; |
| 3473 |
|
| 3474 |
defm : ExtSetCCShiftPat<SETEQ, |
| 3475 |
PatFrag<(ops node:$in, node:$sa, node:$cc), |
| 3476 |
(setcc (and $in, (shl 1, $sa)), 0, $cc)>, |
| 3477 |
OutPatFrag<(ops node:$in, node:$sa), |
| 3478 |
(RLWNM (i32not $in), |
| 3479 |
(SUBFIC $sa, 32), 31, 31)>, |
| 3480 |
OutPatFrag<(ops node:$in, node:$sa), |
| 3481 |
(RLDCL (i64not $in), |
| 3482 |
(SUBFIC $sa, 64), 63)> >; |
| 3483 |
|
| 3484 |
// SETCC for i32. |
| 3485 |
def : Pat<(i1 (setcc i32:$s1, immZExt16:$imm, SETULT)), |
| 3486 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_lt)>; |
| 3487 |
def : Pat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETLT)), |
| 3488 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_lt)>; |
| 3489 |
def : Pat<(i1 (setcc i32:$s1, immZExt16:$imm, SETUGT)), |
| 3490 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_gt)>; |
| 3491 |
def : Pat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETGT)), |
| 3492 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_gt)>; |
| 3493 |
def : Pat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETEQ)), |
| 3494 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_eq)>; |
| 3495 |
def : Pat<(i1 (setcc i32:$s1, immZExt16:$imm, SETEQ)), |
| 3496 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_eq)>; |
| 3497 |
|
| 3498 |
// For non-equality comparisons, the default code would materialize the |
| 3499 |
// constant, then compare against it, like this: |
| 3500 |
// lis r2, 4660 |
| 3501 |
// ori r2, r2, 22136 |
| 3502 |
// cmpw cr0, r3, r2 |
| 3503 |
// beq cr0,L6 |
| 3504 |
// Since we are just comparing for equality, we can emit this instead: |
| 3505 |
// xoris r0,r3,0x1234 |
| 3506 |
// cmplwi cr0,r0,0x5678 |
| 3507 |
// beq cr0,L6 |
| 3508 |
|
| 3509 |
def : Pat<(i1 (setcc i32:$s1, imm:$imm, SETEQ)), |
| 3510 |
(EXTRACT_SUBREG (CMPLWI (XORIS $s1, (HI16 imm:$imm)), |
| 3511 |
(LO16 imm:$imm)), sub_eq)>; |
| 3512 |
|
| 3513 |
defm : CRNotPat<(i1 (setcc i32:$s1, immZExt16:$imm, SETUGE)), |
| 3514 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_lt)>; |
| 3515 |
defm : CRNotPat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETGE)), |
| 3516 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_lt)>; |
| 3517 |
defm : CRNotPat<(i1 (setcc i32:$s1, immZExt16:$imm, SETULE)), |
| 3518 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_gt)>; |
| 3519 |
defm : CRNotPat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETLE)), |
| 3520 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_gt)>; |
| 3521 |
defm : CRNotPat<(i1 (setcc i32:$s1, imm32SExt16:$imm, SETNE)), |
| 3522 |
(EXTRACT_SUBREG (CMPWI $s1, imm:$imm), sub_eq)>; |
| 3523 |
defm : CRNotPat<(i1 (setcc i32:$s1, immZExt16:$imm, SETNE)), |
| 3524 |
(EXTRACT_SUBREG (CMPLWI $s1, imm:$imm), sub_eq)>; |
| 3525 |
|
| 3526 |
defm : CRNotPat<(i1 (setcc i32:$s1, imm:$imm, SETNE)), |
| 3527 |
(EXTRACT_SUBREG (CMPLWI (XORIS $s1, (HI16 imm:$imm)), |
| 3528 |
(LO16 imm:$imm)), sub_eq)>; |
| 3529 |
|
| 3530 |
def : Pat<(i1 (setcc i32:$s1, i32:$s2, SETULT)), |
| 3531 |
(EXTRACT_SUBREG (CMPLW $s1, $s2), sub_lt)>; |
| 3532 |
def : Pat<(i1 (setcc i32:$s1, i32:$s2, SETLT)), |
| 3533 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_lt)>; |
| 3534 |
def : Pat<(i1 (setcc i32:$s1, i32:$s2, SETUGT)), |
| 3535 |
(EXTRACT_SUBREG (CMPLW $s1, $s2), sub_gt)>; |
| 3536 |
def : Pat<(i1 (setcc i32:$s1, i32:$s2, SETGT)), |
| 3537 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_gt)>; |
| 3538 |
def : Pat<(i1 (setcc i32:$s1, i32:$s2, SETEQ)), |
| 3539 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_eq)>; |
| 3540 |
|
| 3541 |
defm : CRNotPat<(i1 (setcc i32:$s1, i32:$s2, SETUGE)), |
| 3542 |
(EXTRACT_SUBREG (CMPLW $s1, $s2), sub_lt)>; |
| 3543 |
defm : CRNotPat<(i1 (setcc i32:$s1, i32:$s2, SETGE)), |
| 3544 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_lt)>; |
| 3545 |
defm : CRNotPat<(i1 (setcc i32:$s1, i32:$s2, SETULE)), |
| 3546 |
(EXTRACT_SUBREG (CMPLW $s1, $s2), sub_gt)>; |
| 3547 |
defm : CRNotPat<(i1 (setcc i32:$s1, i32:$s2, SETLE)), |
| 3548 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_gt)>; |
| 3549 |
defm : CRNotPat<(i1 (setcc i32:$s1, i32:$s2, SETNE)), |
| 3550 |
(EXTRACT_SUBREG (CMPW $s1, $s2), sub_eq)>; |
| 3551 |
|
| 3552 |
// SETCC for i64. |
| 3553 |
def : Pat<(i1 (setcc i64:$s1, immZExt16:$imm, SETULT)), |
| 3554 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_lt)>; |
| 3555 |
def : Pat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETLT)), |
| 3556 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_lt)>; |
| 3557 |
def : Pat<(i1 (setcc i64:$s1, immZExt16:$imm, SETUGT)), |
| 3558 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_gt)>; |
| 3559 |
def : Pat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETGT)), |
| 3560 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_gt)>; |
| 3561 |
def : Pat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETEQ)), |
| 3562 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_eq)>; |
| 3563 |
def : Pat<(i1 (setcc i64:$s1, immZExt16:$imm, SETEQ)), |
| 3564 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_eq)>; |
| 3565 |
|
| 3566 |
// For non-equality comparisons, the default code would materialize the |
| 3567 |
// constant, then compare against it, like this: |
| 3568 |
// lis r2, 4660 |
| 3569 |
// ori r2, r2, 22136 |
| 3570 |
// cmpd cr0, r3, r2 |
| 3571 |
// beq cr0,L6 |
| 3572 |
// Since we are just comparing for equality, we can emit this instead: |
| 3573 |
// xoris r0,r3,0x1234 |
| 3574 |
// cmpldi cr0,r0,0x5678 |
| 3575 |
// beq cr0,L6 |
| 3576 |
|
| 3577 |
def : Pat<(i1 (setcc i64:$s1, imm64ZExt32:$imm, SETEQ)), |
| 3578 |
(EXTRACT_SUBREG (CMPLDI (XORIS8 $s1, (HI16 imm:$imm)), |
| 3579 |
(LO16 imm:$imm)), sub_eq)>; |
| 3580 |
|
| 3581 |
defm : CRNotPat<(i1 (setcc i64:$s1, immZExt16:$imm, SETUGE)), |
| 3582 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_lt)>; |
| 3583 |
defm : CRNotPat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETGE)), |
| 3584 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_lt)>; |
| 3585 |
defm : CRNotPat<(i1 (setcc i64:$s1, immZExt16:$imm, SETULE)), |
| 3586 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_gt)>; |
| 3587 |
defm : CRNotPat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETLE)), |
| 3588 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_gt)>; |
| 3589 |
defm : CRNotPat<(i1 (setcc i64:$s1, imm64SExt16:$imm, SETNE)), |
| 3590 |
(EXTRACT_SUBREG (CMPDI $s1, imm:$imm), sub_eq)>; |
| 3591 |
defm : CRNotPat<(i1 (setcc i64:$s1, immZExt16:$imm, SETNE)), |
| 3592 |
(EXTRACT_SUBREG (CMPLDI $s1, imm:$imm), sub_eq)>; |
| 3593 |
|
| 3594 |
defm : CRNotPat<(i1 (setcc i64:$s1, imm64ZExt32:$imm, SETNE)), |
| 3595 |
(EXTRACT_SUBREG (CMPLDI (XORIS8 $s1, (HI16 imm:$imm)), |
| 3596 |
(LO16 imm:$imm)), sub_eq)>; |
| 3597 |
|
| 3598 |
def : Pat<(i1 (setcc i64:$s1, i64:$s2, SETULT)), |
| 3599 |
(EXTRACT_SUBREG (CMPLD $s1, $s2), sub_lt)>; |
| 3600 |
def : Pat<(i1 (setcc i64:$s1, i64:$s2, SETLT)), |
| 3601 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_lt)>; |
| 3602 |
def : Pat<(i1 (setcc i64:$s1, i64:$s2, SETUGT)), |
| 3603 |
(EXTRACT_SUBREG (CMPLD $s1, $s2), sub_gt)>; |
| 3604 |
def : Pat<(i1 (setcc i64:$s1, i64:$s2, SETGT)), |
| 3605 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_gt)>; |
| 3606 |
def : Pat<(i1 (setcc i64:$s1, i64:$s2, SETEQ)), |
| 3607 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_eq)>; |
| 3608 |
|
| 3609 |
defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETUGE)), |
| 3610 |
(EXTRACT_SUBREG (CMPLD $s1, $s2), sub_lt)>; |
| 3611 |
defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETGE)), |
| 3612 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_lt)>; |
| 3613 |
defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETULE)), |
| 3614 |
(EXTRACT_SUBREG (CMPLD $s1, $s2), sub_gt)>; |
| 3615 |
defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETLE)), |
| 3616 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_gt)>; |
| 3617 |
defm : CRNotPat<(i1 (setcc i64:$s1, i64:$s2, SETNE)), |
| 3618 |
(EXTRACT_SUBREG (CMPD $s1, $s2), sub_eq)>; |
| 3619 |
|
| 3620 |
// SETCC for f32. |
| 3621 |
let Predicates = [HasFPU] in { |
| 3622 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOLT)), |
| 3623 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; |
| 3624 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETLT)), |
| 3625 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; |
| 3626 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOGT)), |
| 3627 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; |
| 3628 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETGT)), |
| 3629 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; |
| 3630 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOEQ)), |
| 3631 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; |
| 3632 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETEQ)), |
| 3633 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; |
| 3634 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETUO)), |
| 3635 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_un)>; |
| 3636 |
|
| 3637 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUGE)), |
| 3638 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; |
| 3639 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETGE)), |
| 3640 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_lt)>; |
| 3641 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETULE)), |
| 3642 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; |
| 3643 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETLE)), |
| 3644 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_gt)>; |
| 3645 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUNE)), |
| 3646 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; |
| 3647 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETNE)), |
| 3648 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_eq)>; |
| 3649 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETO)), |
| 3650 |
(EXTRACT_SUBREG (FCMPUS $s1, $s2), sub_un)>; |
| 3651 |
|
| 3652 |
// SETCC for f64. |
| 3653 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOLT)), |
| 3654 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; |
| 3655 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETLT)), |
| 3656 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; |
| 3657 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOGT)), |
| 3658 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; |
| 3659 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETGT)), |
| 3660 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; |
| 3661 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOEQ)), |
| 3662 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; |
| 3663 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETEQ)), |
| 3664 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; |
| 3665 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETUO)), |
| 3666 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_un)>; |
| 3667 |
|
| 3668 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUGE)), |
| 3669 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; |
| 3670 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETGE)), |
| 3671 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_lt)>; |
| 3672 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETULE)), |
| 3673 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; |
| 3674 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETLE)), |
| 3675 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_gt)>; |
| 3676 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUNE)), |
| 3677 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; |
| 3678 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETNE)), |
| 3679 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_eq)>; |
| 3680 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETO)), |
| 3681 |
(EXTRACT_SUBREG (FCMPUD $s1, $s2), sub_un)>; |
| 3682 |
|
| 3683 |
// SETCC for f128. |
| 3684 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOLT)), |
| 3685 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; |
| 3686 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETLT)), |
| 3687 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; |
| 3688 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOGT)), |
| 3689 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; |
| 3690 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETGT)), |
| 3691 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; |
| 3692 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETOEQ)), |
| 3693 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; |
| 3694 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETEQ)), |
| 3695 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; |
| 3696 |
def : Pat<(i1 (setcc f128:$s1, f128:$s2, SETUO)), |
| 3697 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_un)>; |
| 3698 |
|
| 3699 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETUGE)), |
| 3700 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; |
| 3701 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETGE)), |
| 3702 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_lt)>; |
| 3703 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETULE)), |
| 3704 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; |
| 3705 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETLE)), |
| 3706 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_gt)>; |
| 3707 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETUNE)), |
| 3708 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; |
| 3709 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETNE)), |
| 3710 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_eq)>; |
| 3711 |
defm : CRNotPat<(i1 (setcc f128:$s1, f128:$s2, SETO)), |
| 3712 |
(EXTRACT_SUBREG (XSCMPUQP $s1, $s2), sub_un)>; |
| 3713 |
|
| 3714 |
} |
| 3715 |
|
| 3716 |
// This must be in this file because it relies on patterns defined in this file |
| 3717 |
// after the inclusion of the instruction sets. |
| 3718 |
let Predicates = [HasSPE] in { |
| 3719 |
// SETCC for f32. |
| 3720 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOLT)), |
| 3721 |
(EXTRACT_SUBREG (EFSCMPLT $s1, $s2), sub_gt)>; |
| 3722 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETLT)), |
| 3723 |
(EXTRACT_SUBREG (EFSCMPLT $s1, $s2), sub_gt)>; |
| 3724 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOGT)), |
| 3725 |
(EXTRACT_SUBREG (EFSCMPGT $s1, $s2), sub_gt)>; |
| 3726 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETGT)), |
| 3727 |
(EXTRACT_SUBREG (EFSCMPGT $s1, $s2), sub_gt)>; |
| 3728 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETOEQ)), |
| 3729 |
(EXTRACT_SUBREG (EFSCMPEQ $s1, $s2), sub_gt)>; |
| 3730 |
def : Pat<(i1 (setcc f32:$s1, f32:$s2, SETEQ)), |
| 3731 |
(EXTRACT_SUBREG (EFSCMPEQ $s1, $s2), sub_gt)>; |
| 3732 |
|
| 3733 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUGE)), |
| 3734 |
(EXTRACT_SUBREG (EFSCMPLT $s1, $s2), sub_gt)>; |
| 3735 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETGE)), |
| 3736 |
(EXTRACT_SUBREG (EFSCMPLT $s1, $s2), sub_gt)>; |
| 3737 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETULE)), |
| 3738 |
(EXTRACT_SUBREG (EFSCMPGT $s1, $s2), sub_gt)>; |
| 3739 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETLE)), |
| 3740 |
(EXTRACT_SUBREG (EFSCMPGT $s1, $s2), sub_gt)>; |
| 3741 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETUNE)), |
| 3742 |
(EXTRACT_SUBREG (EFSCMPEQ $s1, $s2), sub_gt)>; |
| 3743 |
defm : CRNotPat<(i1 (setcc f32:$s1, f32:$s2, SETNE)), |
| 3744 |
(EXTRACT_SUBREG (EFSCMPEQ $s1, $s2), sub_gt)>; |
| 3745 |
|
| 3746 |
// SETCC for f64. |
| 3747 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOLT)), |
| 3748 |
(EXTRACT_SUBREG (EFDCMPLT $s1, $s2), sub_gt)>; |
| 3749 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETLT)), |
| 3750 |
(EXTRACT_SUBREG (EFDCMPLT $s1, $s2), sub_gt)>; |
| 3751 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOGT)), |
| 3752 |
(EXTRACT_SUBREG (EFDCMPGT $s1, $s2), sub_gt)>; |
| 3753 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETGT)), |
| 3754 |
(EXTRACT_SUBREG (EFDCMPGT $s1, $s2), sub_gt)>; |
| 3755 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETOEQ)), |
| 3756 |
(EXTRACT_SUBREG (EFDCMPEQ $s1, $s2), sub_gt)>; |
| 3757 |
def : Pat<(i1 (setcc f64:$s1, f64:$s2, SETEQ)), |
| 3758 |
(EXTRACT_SUBREG (EFDCMPEQ $s1, $s2), sub_gt)>; |
| 3759 |
|
| 3760 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUGE)), |
| 3761 |
(EXTRACT_SUBREG (EFDCMPLT $s1, $s2), sub_gt)>; |
| 3762 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETGE)), |
| 3763 |
(EXTRACT_SUBREG (EFDCMPLT $s1, $s2), sub_gt)>; |
| 3764 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETULE)), |
| 3765 |
(EXTRACT_SUBREG (EFDCMPGT $s1, $s2), sub_gt)>; |
| 3766 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETLE)), |
| 3767 |
(EXTRACT_SUBREG (EFDCMPGT $s1, $s2), sub_gt)>; |
| 3768 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETUNE)), |
| 3769 |
(EXTRACT_SUBREG (EFDCMPEQ $s1, $s2), sub_gt)>; |
| 3770 |
defm : CRNotPat<(i1 (setcc f64:$s1, f64:$s2, SETNE)), |
| 3771 |
(EXTRACT_SUBREG (EFDCMPEQ $s1, $s2), sub_gt)>; |
| 3772 |
} |
| 3773 |
// match select on i1 variables: |
| 3774 |
def : Pat<(i1 (select i1:$cond, i1:$tval, i1:$fval)), |
| 3775 |
(CROR (CRAND $cond , $tval), |
| 3776 |
(CRAND (crnot $cond), $fval))>; |
| 3777 |
|
| 3778 |
// match selectcc on i1 variables: |
| 3779 |
// select (lhs == rhs), tval, fval is: |
| 3780 |
// ((lhs == rhs) & tval) | (!(lhs == rhs) & fval) |
| 3781 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETLT)), |
| 3782 |
(CROR (CRAND (CRANDC $lhs, $rhs), $tval), |
| 3783 |
(CRAND (CRORC $rhs, $lhs), $fval))>; |
| 3784 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETULT)), |
| 3785 |
(CROR (CRAND (CRANDC $rhs, $lhs), $tval), |
| 3786 |
(CRAND (CRORC $lhs, $rhs), $fval))>; |
| 3787 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETLE)), |
| 3788 |
(CROR (CRAND (CRORC $lhs, $rhs), $tval), |
| 3789 |
(CRAND (CRANDC $rhs, $lhs), $fval))>; |
| 3790 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETULE)), |
| 3791 |
(CROR (CRAND (CRORC $rhs, $lhs), $tval), |
| 3792 |
(CRAND (CRANDC $lhs, $rhs), $fval))>; |
| 3793 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETEQ)), |
| 3794 |
(CROR (CRAND (CREQV $lhs, $rhs), $tval), |
| 3795 |
(CRAND (CRXOR $lhs, $rhs), $fval))>; |
| 3796 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETGE)), |
| 3797 |
(CROR (CRAND (CRORC $rhs, $lhs), $tval), |
| 3798 |
(CRAND (CRANDC $lhs, $rhs), $fval))>; |
| 3799 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETUGE)), |
| 3800 |
(CROR (CRAND (CRORC $lhs, $rhs), $tval), |
| 3801 |
(CRAND (CRANDC $rhs, $lhs), $fval))>; |
| 3802 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETGT)), |
| 3803 |
(CROR (CRAND (CRANDC $rhs, $lhs), $tval), |
| 3804 |
(CRAND (CRORC $lhs, $rhs), $fval))>; |
| 3805 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETUGT)), |
| 3806 |
(CROR (CRAND (CRANDC $lhs, $rhs), $tval), |
| 3807 |
(CRAND (CRORC $rhs, $lhs), $fval))>; |
| 3808 |
def : Pat <(i1 (selectcc i1:$lhs, i1:$rhs, i1:$tval, i1:$fval, SETNE)), |
| 3809 |
(CROR (CRAND (CREQV $lhs, $rhs), $fval), |
| 3810 |
(CRAND (CRXOR $lhs, $rhs), $tval))>; |
| 3811 |
|
| 3812 |
// match selectcc on i1 variables with non-i1 output. |
| 3813 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETLT)), |
| 3814 |
(SELECT_I4 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3815 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETULT)), |
| 3816 |
(SELECT_I4 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3817 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETLE)), |
| 3818 |
(SELECT_I4 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3819 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETULE)), |
| 3820 |
(SELECT_I4 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3821 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETEQ)), |
| 3822 |
(SELECT_I4 (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3823 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETGE)), |
| 3824 |
(SELECT_I4 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3825 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETUGE)), |
| 3826 |
(SELECT_I4 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3827 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETGT)), |
| 3828 |
(SELECT_I4 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3829 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETUGT)), |
| 3830 |
(SELECT_I4 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3831 |
def : Pat<(i32 (selectcc i1:$lhs, i1:$rhs, i32:$tval, i32:$fval, SETNE)), |
| 3832 |
(SELECT_I4 (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3833 |
|
| 3834 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETLT)), |
| 3835 |
(SELECT_I8 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3836 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETULT)), |
| 3837 |
(SELECT_I8 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3838 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETLE)), |
| 3839 |
(SELECT_I8 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3840 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETULE)), |
| 3841 |
(SELECT_I8 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3842 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETEQ)), |
| 3843 |
(SELECT_I8 (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3844 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETGE)), |
| 3845 |
(SELECT_I8 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3846 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETUGE)), |
| 3847 |
(SELECT_I8 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3848 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETGT)), |
| 3849 |
(SELECT_I8 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3850 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETUGT)), |
| 3851 |
(SELECT_I8 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3852 |
def : Pat<(i64 (selectcc i1:$lhs, i1:$rhs, i64:$tval, i64:$fval, SETNE)), |
| 3853 |
(SELECT_I8 (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3854 |
|
| 3855 |
let Predicates = [HasFPU] in { |
| 3856 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETLT)), |
| 3857 |
(SELECT_F4 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3858 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETULT)), |
| 3859 |
(SELECT_F4 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3860 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETLE)), |
| 3861 |
(SELECT_F4 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3862 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETULE)), |
| 3863 |
(SELECT_F4 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3864 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETEQ)), |
| 3865 |
(SELECT_F4 (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3866 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETGE)), |
| 3867 |
(SELECT_F4 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3868 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETUGE)), |
| 3869 |
(SELECT_F4 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3870 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETGT)), |
| 3871 |
(SELECT_F4 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3872 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETUGT)), |
| 3873 |
(SELECT_F4 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3874 |
def : Pat<(f32 (selectcc i1:$lhs, i1:$rhs, f32:$tval, f32:$fval, SETNE)), |
| 3875 |
(SELECT_F4 (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3876 |
|
| 3877 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETLT)), |
| 3878 |
(SELECT_F8 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3879 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETULT)), |
| 3880 |
(SELECT_F8 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3881 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETLE)), |
| 3882 |
(SELECT_F8 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3883 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETULE)), |
| 3884 |
(SELECT_F8 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3885 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETEQ)), |
| 3886 |
(SELECT_F8 (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3887 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETGE)), |
| 3888 |
(SELECT_F8 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3889 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETUGE)), |
| 3890 |
(SELECT_F8 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3891 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETGT)), |
| 3892 |
(SELECT_F8 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3893 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETUGT)), |
| 3894 |
(SELECT_F8 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3895 |
def : Pat<(f64 (selectcc i1:$lhs, i1:$rhs, f64:$tval, f64:$fval, SETNE)), |
| 3896 |
(SELECT_F8 (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3897 |
} |
| 3898 |
|
| 3899 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETLT)), |
| 3900 |
(SELECT_F16 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3901 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETULT)), |
| 3902 |
(SELECT_F16 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3903 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETLE)), |
| 3904 |
(SELECT_F16 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3905 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETULE)), |
| 3906 |
(SELECT_F16 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3907 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETEQ)), |
| 3908 |
(SELECT_F16 (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3909 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETGE)), |
| 3910 |
(SELECT_F16 (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3911 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETUGE)), |
| 3912 |
(SELECT_F16 (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3913 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETGT)), |
| 3914 |
(SELECT_F16 (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3915 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETUGT)), |
| 3916 |
(SELECT_F16 (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3917 |
def : Pat<(f128 (selectcc i1:$lhs, i1:$rhs, f128:$tval, f128:$fval, SETNE)), |
| 3918 |
(SELECT_F16 (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3919 |
|
| 3920 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETLT)), |
| 3921 |
(SELECT_VRRC (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3922 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETULT)), |
| 3923 |
(SELECT_VRRC (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3924 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETLE)), |
| 3925 |
(SELECT_VRRC (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3926 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETULE)), |
| 3927 |
(SELECT_VRRC (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3928 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETEQ)), |
| 3929 |
(SELECT_VRRC (CREQV $lhs, $rhs), $tval, $fval)>; |
| 3930 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETGE)), |
| 3931 |
(SELECT_VRRC (CRORC $rhs, $lhs), $tval, $fval)>; |
| 3932 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETUGE)), |
| 3933 |
(SELECT_VRRC (CRORC $lhs, $rhs), $tval, $fval)>; |
| 3934 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETGT)), |
| 3935 |
(SELECT_VRRC (CRANDC $rhs, $lhs), $tval, $fval)>; |
| 3936 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETUGT)), |
| 3937 |
(SELECT_VRRC (CRANDC $lhs, $rhs), $tval, $fval)>; |
| 3938 |
def : Pat<(v4i32 (selectcc i1:$lhs, i1:$rhs, v4i32:$tval, v4i32:$fval, SETNE)), |
| 3939 |
(SELECT_VRRC (CRXOR $lhs, $rhs), $tval, $fval)>; |
| 3940 |
|
| 3941 |
let usesCustomInserter = 1 in { |
| 3942 |
def ANDIo_1_EQ_BIT : Pseudo<(outs crbitrc:$dst), (ins gprc:$in), |
| 3943 |
"#ANDIo_1_EQ_BIT", |
| 3944 |
[(set i1:$dst, (trunc (not i32:$in)))]>; |
| 3945 |
def ANDIo_1_GT_BIT : Pseudo<(outs crbitrc:$dst), (ins gprc:$in), |
| 3946 |
"#ANDIo_1_GT_BIT", |
| 3947 |
[(set i1:$dst, (trunc i32:$in))]>; |
| 3948 |
|
| 3949 |
def ANDIo_1_EQ_BIT8 : Pseudo<(outs crbitrc:$dst), (ins g8rc:$in), |
| 3950 |
"#ANDIo_1_EQ_BIT8", |
| 3951 |
[(set i1:$dst, (trunc (not i64:$in)))]>; |
| 3952 |
def ANDIo_1_GT_BIT8 : Pseudo<(outs crbitrc:$dst), (ins g8rc:$in), |
| 3953 |
"#ANDIo_1_GT_BIT8", |
| 3954 |
[(set i1:$dst, (trunc i64:$in))]>; |
| 3955 |
} |
| 3956 |
|
| 3957 |
def : Pat<(i1 (not (trunc i32:$in))), |
| 3958 |
(ANDIo_1_EQ_BIT $in)>; |
| 3959 |
def : Pat<(i1 (not (trunc i64:$in))), |
| 3960 |
(ANDIo_1_EQ_BIT8 $in)>; |
| 3961 |
|
| 3962 |
//===----------------------------------------------------------------------===// |
| 3963 |
// PowerPC Instructions used for assembler/disassembler only |
| 3964 |
// |
| 3965 |
|
| 3966 |
// FIXME: For B=0 or B > 8, the registers following RT are used. |
| 3967 |
// WARNING: Do not add patterns for this instruction without fixing this. |
| 3968 |
def LSWI : XForm_base_r3xo_memOp<31, 597, (outs gprc:$RT), |
| 3969 |
(ins gprc:$A, u5imm:$B), |
| 3970 |
"lswi $RT, $A, $B", IIC_LdStLoad, []>; |
| 3971 |
|
| 3972 |
// FIXME: For B=0 or B > 8, the registers following RT are used. |
| 3973 |
// WARNING: Do not add patterns for this instruction without fixing this. |
| 3974 |
def STSWI : XForm_base_r3xo_memOp<31, 725, (outs), |
| 3975 |
(ins gprc:$RT, gprc:$A, u5imm:$B), |
| 3976 |
"stswi $RT, $A, $B", IIC_LdStLoad, []>; |
| 3977 |
|
| 3978 |
def ISYNC : XLForm_2_ext<19, 150, 0, 0, 0, (outs), (ins), |
| 3979 |
"isync", IIC_SprISYNC, []>; |
| 3980 |
|
| 3981 |
def ICBI : XForm_1a<31, 982, (outs), (ins memrr:$src), |
| 3982 |
"icbi $src", IIC_LdStICBI, []>; |
| 3983 |
|
| 3984 |
// We used to have EIEIO as value but E[0-9A-Z] is a reserved name |
| 3985 |
def EnforceIEIO : XForm_24_eieio<31, 854, (outs), (ins), |
| 3986 |
"eieio", IIC_LdStLoad, []>; |
| 3987 |
|
| 3988 |
def WAIT : XForm_24_sync<31, 30, (outs), (ins i32imm:$L), |
| 3989 |
"wait $L", IIC_LdStLoad, []>; |
| 3990 |
|
| 3991 |
def MBAR : XForm_mbar<31, 854, (outs), (ins u5imm:$MO), |
| 3992 |
"mbar $MO", IIC_LdStLoad>, Requires<[IsBookE]>; |
| 3993 |
|
| 3994 |
def MTSR: XForm_sr<31, 210, (outs), (ins gprc:$RS, u4imm:$SR), |
| 3995 |
"mtsr $SR, $RS", IIC_SprMTSR>; |
| 3996 |
|
| 3997 |
def MFSR: XForm_sr<31, 595, (outs gprc:$RS), (ins u4imm:$SR), |
| 3998 |
"mfsr $RS, $SR", IIC_SprMFSR>; |
| 3999 |
|
| 4000 |
def MTSRIN: XForm_srin<31, 242, (outs), (ins gprc:$RS, gprc:$RB), |
| 4001 |
"mtsrin $RS, $RB", IIC_SprMTSR>; |
| 4002 |
|
| 4003 |
def MFSRIN: XForm_srin<31, 659, (outs gprc:$RS), (ins gprc:$RB), |
| 4004 |
"mfsrin $RS, $RB", IIC_SprMFSR>; |
| 4005 |
|
| 4006 |
def MTMSR: XForm_mtmsr<31, 146, (outs), (ins gprc:$RS, i32imm:$L), |
| 4007 |
"mtmsr $RS, $L", IIC_SprMTMSR>; |
| 4008 |
|
| 4009 |
def WRTEE: XForm_mtmsr<31, 131, (outs), (ins gprc:$RS), |
| 4010 |
"wrtee $RS", IIC_SprMTMSR>, Requires<[IsBookE]> { |
| 4011 |
let L = 0; |
| 4012 |
} |
| 4013 |
|
| 4014 |
def WRTEEI: I<31, (outs), (ins i1imm:$E), "wrteei $E", IIC_SprMTMSR>, |
| 4015 |
Requires<[IsBookE]> { |
| 4016 |
bits<1> E; |
| 4017 |
|
| 4018 |
let Inst{16} = E; |
| 4019 |
let Inst{21-30} = 163; |
| 4020 |
} |
| 4021 |
|
| 4022 |
def DCCCI : XForm_tlb<454, (outs), (ins gprc:$A, gprc:$B), |
| 4023 |
"dccci $A, $B", IIC_LdStLoad>, Requires<[IsPPC4xx]>; |
| 4024 |
def ICCCI : XForm_tlb<966, (outs), (ins gprc:$A, gprc:$B), |
| 4025 |
"iccci $A, $B", IIC_LdStLoad>, Requires<[IsPPC4xx]>; |
| 4026 |
|
| 4027 |
def : InstAlias<"dci 0", (DCCCI R0, R0)>, Requires<[IsPPC4xx]>; |
| 4028 |
def : InstAlias<"dccci", (DCCCI R0, R0)>, Requires<[IsPPC4xx]>; |
| 4029 |
def : InstAlias<"ici 0", (ICCCI R0, R0)>, Requires<[IsPPC4xx]>; |
| 4030 |
def : InstAlias<"iccci", (ICCCI R0, R0)>, Requires<[IsPPC4xx]>; |
| 4031 |
|
| 4032 |
def MFMSR : XForm_rs<31, 83, (outs gprc:$RT), (ins), |
| 4033 |
"mfmsr $RT", IIC_SprMFMSR, []>; |
| 4034 |
|
| 4035 |
def MTMSRD : XForm_mtmsr<31, 178, (outs), (ins gprc:$RS, i32imm:$L), |
| 4036 |
"mtmsrd $RS, $L", IIC_SprMTMSRD>; |
| 4037 |
|
| 4038 |
def MCRFS : XLForm_3<63, 64, (outs crrc:$BF), (ins crrc:$BFA), |
| 4039 |
"mcrfs $BF, $BFA", IIC_BrMCR>; |
| 4040 |
|
| 4041 |
def MTFSFI : XLForm_4<63, 134, (outs crrc:$BF), (ins i32imm:$U, i32imm:$W), |
| 4042 |
"mtfsfi $BF, $U, $W", IIC_IntMFFS>; |
| 4043 |
|
| 4044 |
def MTFSFIo : XLForm_4<63, 134, (outs crrc:$BF), (ins i32imm:$U, i32imm:$W), |
| 4045 |
"mtfsfi. $BF, $U, $W", IIC_IntMFFS>, isDOT; |
| 4046 |
|
| 4047 |
def : InstAlias<"mtfsfi $BF, $U", (MTFSFI crrc:$BF, i32imm:$U, 0)>; |
| 4048 |
def : InstAlias<"mtfsfi. $BF, $U", (MTFSFIo crrc:$BF, i32imm:$U, 0)>; |
| 4049 |
|
| 4050 |
let Predicates = [HasFPU] in { |
| 4051 |
def MTFSF : XFLForm_1<63, 711, (outs), |
| 4052 |
(ins i32imm:$FLM, f8rc:$FRB, i32imm:$L, i32imm:$W), |
| 4053 |
"mtfsf $FLM, $FRB, $L, $W", IIC_IntMFFS, []>; |
| 4054 |
def MTFSFo : XFLForm_1<63, 711, (outs), |
| 4055 |
(ins i32imm:$FLM, f8rc:$FRB, i32imm:$L, i32imm:$W), |
| 4056 |
"mtfsf. $FLM, $FRB, $L, $W", IIC_IntMFFS, []>, isDOT; |
| 4057 |
|
| 4058 |
def : InstAlias<"mtfsf $FLM, $FRB", (MTFSF i32imm:$FLM, f8rc:$FRB, 0, 0)>; |
| 4059 |
def : InstAlias<"mtfsf. $FLM, $FRB", (MTFSFo i32imm:$FLM, f8rc:$FRB, 0, 0)>; |
| 4060 |
} |
| 4061 |
|
| 4062 |
def SLBIE : XForm_16b<31, 434, (outs), (ins gprc:$RB), |
| 4063 |
"slbie $RB", IIC_SprSLBIE, []>; |
| 4064 |
|
| 4065 |
def SLBMTE : XForm_26<31, 402, (outs), (ins gprc:$RS, gprc:$RB), |
| 4066 |
"slbmte $RS, $RB", IIC_SprSLBMTE, []>; |
| 4067 |
|
| 4068 |
def SLBMFEE : XForm_26<31, 915, (outs gprc:$RT), (ins gprc:$RB), |
| 4069 |
"slbmfee $RT, $RB", IIC_SprSLBMFEE, []>; |
| 4070 |
|
| 4071 |
def SLBMFEV : XLForm_1_gen<31, 851, (outs gprc:$RT), (ins gprc:$RB), |
| 4072 |
"slbmfev $RT, $RB", IIC_SprSLBMFEV, []>; |
| 4073 |
|
| 4074 |
def SLBIA : XForm_0<31, 498, (outs), (ins), "slbia", IIC_SprSLBIA, []>; |
| 4075 |
|
| 4076 |
def TLBIA : XForm_0<31, 370, (outs), (ins), |
| 4077 |
"tlbia", IIC_SprTLBIA, []>; |
| 4078 |
|
| 4079 |
def TLBSYNC : XForm_0<31, 566, (outs), (ins), |
| 4080 |
"tlbsync", IIC_SprTLBSYNC, []>; |
| 4081 |
|
| 4082 |
def TLBIEL : XForm_16b<31, 274, (outs), (ins gprc:$RB), |
| 4083 |
"tlbiel $RB", IIC_SprTLBIEL, []>; |
| 4084 |
|
| 4085 |
def TLBLD : XForm_16b<31, 978, (outs), (ins gprc:$RB), |
| 4086 |
"tlbld $RB", IIC_LdStLoad, []>, Requires<[IsPPC6xx]>; |
| 4087 |
def TLBLI : XForm_16b<31, 1010, (outs), (ins gprc:$RB), |
| 4088 |
"tlbli $RB", IIC_LdStLoad, []>, Requires<[IsPPC6xx]>; |
| 4089 |
|
| 4090 |
def TLBIE : XForm_26<31, 306, (outs), (ins gprc:$RS, gprc:$RB), |
| 4091 |
"tlbie $RB,$RS", IIC_SprTLBIE, []>; |
| 4092 |
|
| 4093 |
def TLBSX : XForm_tlb<914, (outs), (ins gprc:$A, gprc:$B), "tlbsx $A, $B", |
| 4094 |
IIC_LdStLoad>, Requires<[IsBookE]>; |
| 4095 |
|
| 4096 |
def TLBIVAX : XForm_tlb<786, (outs), (ins gprc:$A, gprc:$B), "tlbivax $A, $B", |
| 4097 |
IIC_LdStLoad>, Requires<[IsBookE]>; |
| 4098 |
|
| 4099 |
def TLBRE : XForm_24_eieio<31, 946, (outs), (ins), |
| 4100 |
"tlbre", IIC_LdStLoad, []>, Requires<[IsBookE]>; |
| 4101 |
|
| 4102 |
def TLBWE : XForm_24_eieio<31, 978, (outs), (ins), |
| 4103 |
"tlbwe", IIC_LdStLoad, []>, Requires<[IsBookE]>; |
| 4104 |
|
| 4105 |
def TLBRE2 : XForm_tlbws<31, 946, (outs gprc:$RS), (ins gprc:$A, i1imm:$WS), |
| 4106 |
"tlbre $RS, $A, $WS", IIC_LdStLoad, []>, Requires<[IsPPC4xx]>; |
| 4107 |
|
| 4108 |
def TLBWE2 : XForm_tlbws<31, 978, (outs), (ins gprc:$RS, gprc:$A, i1imm:$WS), |
| 4109 |
"tlbwe $RS, $A, $WS", IIC_LdStLoad, []>, Requires<[IsPPC4xx]>; |
| 4110 |
|
| 4111 |
def TLBSX2 : XForm_base_r3xo<31, 914, (outs), (ins gprc:$RST, gprc:$A, gprc:$B), |
| 4112 |
"tlbsx $RST, $A, $B", IIC_LdStLoad, []>, |
| 4113 |
Requires<[IsPPC4xx]>; |
| 4114 |
def TLBSX2D : XForm_base_r3xo<31, 914, (outs), |
| 4115 |
(ins gprc:$RST, gprc:$A, gprc:$B), |
| 4116 |
"tlbsx. $RST, $A, $B", IIC_LdStLoad, []>, |
| 4117 |
Requires<[IsPPC4xx]>, isDOT; |
| 4118 |
|
| 4119 |
def RFID : XForm_0<19, 18, (outs), (ins), "rfid", IIC_IntRFID, []>; |
| 4120 |
|
| 4121 |
def RFI : XForm_0<19, 50, (outs), (ins), "rfi", IIC_SprRFI, []>, |
| 4122 |
Requires<[IsBookE]>; |
| 4123 |
def RFCI : XForm_0<19, 51, (outs), (ins), "rfci", IIC_BrB, []>, |
| 4124 |
Requires<[IsBookE]>; |
| 4125 |
|
| 4126 |
def RFDI : XForm_0<19, 39, (outs), (ins), "rfdi", IIC_BrB, []>, |
| 4127 |
Requires<[IsE500]>; |
| 4128 |
def RFMCI : XForm_0<19, 38, (outs), (ins), "rfmci", IIC_BrB, []>, |
| 4129 |
Requires<[IsE500]>; |
| 4130 |
|
| 4131 |
def MFDCR : XFXForm_1<31, 323, (outs gprc:$RT), (ins i32imm:$SPR), |
| 4132 |
"mfdcr $RT, $SPR", IIC_SprMFSPR>, Requires<[IsPPC4xx]>; |
| 4133 |
def MTDCR : XFXForm_1<31, 451, (outs), (ins gprc:$RT, i32imm:$SPR), |
| 4134 |
"mtdcr $SPR, $RT", IIC_SprMTSPR>, Requires<[IsPPC4xx]>; |
| 4135 |
|
| 4136 |
def HRFID : XLForm_1_np<19, 274, (outs), (ins), "hrfid", IIC_BrB, []>; |
| 4137 |
def NAP : XLForm_1_np<19, 434, (outs), (ins), "nap", IIC_BrB, []>; |
| 4138 |
|
| 4139 |
def ATTN : XForm_attn<0, 256, (outs), (ins), "attn", IIC_BrB>; |
| 4140 |
|
| 4141 |
def LBZCIX : XForm_base_r3xo_memOp<31, 853, (outs gprc:$RST), |
| 4142 |
(ins gprc:$A, gprc:$B), |
| 4143 |
"lbzcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4144 |
def LHZCIX : XForm_base_r3xo_memOp<31, 821, (outs gprc:$RST), |
| 4145 |
(ins gprc:$A, gprc:$B), |
| 4146 |
"lhzcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4147 |
def LWZCIX : XForm_base_r3xo_memOp<31, 789, (outs gprc:$RST), |
| 4148 |
(ins gprc:$A, gprc:$B), |
| 4149 |
"lwzcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4150 |
def LDCIX : XForm_base_r3xo_memOp<31, 885, (outs gprc:$RST), |
| 4151 |
(ins gprc:$A, gprc:$B), |
| 4152 |
"ldcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4153 |
|
| 4154 |
def STBCIX : XForm_base_r3xo_memOp<31, 981, (outs), |
| 4155 |
(ins gprc:$RST, gprc:$A, gprc:$B), |
| 4156 |
"stbcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4157 |
def STHCIX : XForm_base_r3xo_memOp<31, 949, (outs), |
| 4158 |
(ins gprc:$RST, gprc:$A, gprc:$B), |
| 4159 |
"sthcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4160 |
def STWCIX : XForm_base_r3xo_memOp<31, 917, (outs), |
| 4161 |
(ins gprc:$RST, gprc:$A, gprc:$B), |
| 4162 |
"stwcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4163 |
def STDCIX : XForm_base_r3xo_memOp<31, 1013, (outs), |
| 4164 |
(ins gprc:$RST, gprc:$A, gprc:$B), |
| 4165 |
"stdcix $RST, $A, $B", IIC_LdStLoad, []>; |
| 4166 |
|
| 4167 |
// External PID Load Store Instructions |
| 4168 |
|
| 4169 |
def LBEPX : XForm_1<31, 95, (outs gprc:$rD), (ins memrr:$src), |
| 4170 |
"lbepx $rD, $src", IIC_LdStLoad, []>, |
| 4171 |
Requires<[IsE500]>; |
| 4172 |
|
| 4173 |
def LFDEPX : XForm_25<31, 607, (outs f8rc:$frD), (ins memrr:$src), |
| 4174 |
"lfdepx $frD, $src", IIC_LdStLFD, []>, |
| 4175 |
Requires<[IsE500]>; |
| 4176 |
|
| 4177 |
def LHEPX : XForm_1<31, 287, (outs gprc:$rD), (ins memrr:$src), |
| 4178 |
"lhepx $rD, $src", IIC_LdStLoad, []>, |
| 4179 |
Requires<[IsE500]>; |
| 4180 |
|
| 4181 |
def LWEPX : XForm_1<31, 31, (outs gprc:$rD), (ins memrr:$src), |
| 4182 |
"lwepx $rD, $src", IIC_LdStLoad, []>, |
| 4183 |
Requires<[IsE500]>; |
| 4184 |
|
| 4185 |
def STBEPX : XForm_8<31, 223, (outs), (ins gprc:$rS, memrr:$dst), |
| 4186 |
"stbepx $rS, $dst", IIC_LdStStore, []>, |
| 4187 |
Requires<[IsE500]>; |
| 4188 |
|
| 4189 |
def STFDEPX : XForm_28_memOp<31, 735, (outs), (ins f8rc:$frS, memrr:$dst), |
| 4190 |
"stfdepx $frS, $dst", IIC_LdStSTFD, []>, |
| 4191 |
Requires<[IsE500]>; |
| 4192 |
|
| 4193 |
def STHEPX : XForm_8<31, 415, (outs), (ins gprc:$rS, memrr:$dst), |
| 4194 |
"sthepx $rS, $dst", IIC_LdStStore, []>, |
| 4195 |
Requires<[IsE500]>; |
| 4196 |
|
| 4197 |
def STWEPX : XForm_8<31, 159, (outs), (ins gprc:$rS, memrr:$dst), |
| 4198 |
"stwepx $rS, $dst", IIC_LdStStore, []>, |
| 4199 |
Requires<[IsE500]>; |
| 4200 |
|
| 4201 |
def DCBFEP : DCB_Form<127, 0, (outs), (ins memrr:$dst), "dcbfep $dst", |
| 4202 |
IIC_LdStDCBF, []>, Requires<[IsE500]>; |
| 4203 |
|
| 4204 |
def DCBSTEP : DCB_Form<63, 0, (outs), (ins memrr:$dst), "dcbstep $dst", |
| 4205 |
IIC_LdStDCBF, []>, Requires<[IsE500]>; |
| 4206 |
|
| 4207 |
def DCBTEP : DCB_Form_hint<319, (outs), (ins memrr:$dst, u5imm:$TH), |
| 4208 |
"dcbtep $TH, $dst", IIC_LdStDCBF, []>, |
| 4209 |
Requires<[IsE500]>; |
| 4210 |
|
| 4211 |
def DCBTSTEP : DCB_Form_hint<255, (outs), (ins memrr:$dst, u5imm:$TH), |
| 4212 |
"dcbtstep $TH, $dst", IIC_LdStDCBF, []>, |
| 4213 |
Requires<[IsE500]>; |
| 4214 |
|
| 4215 |
def DCBZEP : DCB_Form<1023, 0, (outs), (ins memrr:$dst), "dcbzep $dst", |
| 4216 |
IIC_LdStDCBF, []>, Requires<[IsE500]>; |
| 4217 |
|
| 4218 |
def DCBZLEP : DCB_Form<1023, 1, (outs), (ins memrr:$dst), "dcbzlep $dst", |
| 4219 |
IIC_LdStDCBF, []>, Requires<[IsE500]>; |
| 4220 |
|
| 4221 |
def ICBIEP : XForm_1a<31, 991, (outs), (ins memrr:$src), "icbiep $src", |
| 4222 |
IIC_LdStICBI, []>, Requires<[IsE500]>; |
| 4223 |
|
| 4224 |
//===----------------------------------------------------------------------===// |
| 4225 |
// PowerPC Assembler Instruction Aliases |
| 4226 |
// |
| 4227 |
|
| 4228 |
// Pseudo-instructions for alternate assembly syntax (never used by codegen). |
| 4229 |
// These are aliases that require C++ handling to convert to the target |
| 4230 |
// instruction, while InstAliases can be handled directly by tblgen. |
| 4231 |
class PPCAsmPseudo<string asm, dag iops> |
| 4232 |
: Instruction { |
| 4233 |
let Namespace = "PPC"; |
| 4234 |
bit PPC64 = 0; // Default value, override with isPPC64 |
| 4235 |
|
| 4236 |
let OutOperandList = (outs); |
| 4237 |
let InOperandList = iops; |
| 4238 |
let Pattern = []; |
| 4239 |
let AsmString = asm; |
| 4240 |
let isAsmParserOnly = 1; |
| 4241 |
let isPseudo = 1; |
| 4242 |
let hasNoSchedulingInfo = 1; |
| 4243 |
} |
| 4244 |
|
| 4245 |
def : InstAlias<"sc", (SC 0)>; |
| 4246 |
|
| 4247 |
def : InstAlias<"sync", (SYNC 0)>, Requires<[HasSYNC]>; |
| 4248 |
def : InstAlias<"msync", (SYNC 0), 0>, Requires<[HasSYNC]>; |
| 4249 |
def : InstAlias<"lwsync", (SYNC 1)>, Requires<[HasSYNC]>; |
| 4250 |
def : InstAlias<"ptesync", (SYNC 2)>, Requires<[HasSYNC]>; |
| 4251 |
|
| 4252 |
def : InstAlias<"wait", (WAIT 0)>; |
| 4253 |
def : InstAlias<"waitrsv", (WAIT 1)>; |
| 4254 |
def : InstAlias<"waitimpl", (WAIT 2)>; |
| 4255 |
|
| 4256 |
def : InstAlias<"mbar", (MBAR 0)>, Requires<[IsBookE]>; |
| 4257 |
|
| 4258 |
def DCBTx : PPCAsmPseudo<"dcbt $dst", (ins memrr:$dst)>; |
| 4259 |
def DCBTSTx : PPCAsmPseudo<"dcbtst $dst", (ins memrr:$dst)>; |
| 4260 |
|
| 4261 |
def DCBTCT : PPCAsmPseudo<"dcbtct $dst, $TH", (ins memrr:$dst, u5imm:$TH)>; |
| 4262 |
def DCBTDS : PPCAsmPseudo<"dcbtds $dst, $TH", (ins memrr:$dst, u5imm:$TH)>; |
| 4263 |
def DCBTT : PPCAsmPseudo<"dcbtt $dst", (ins memrr:$dst)>; |
| 4264 |
|
| 4265 |
def DCBTSTCT : PPCAsmPseudo<"dcbtstct $dst, $TH", (ins memrr:$dst, u5imm:$TH)>; |
| 4266 |
def DCBTSTDS : PPCAsmPseudo<"dcbtstds $dst, $TH", (ins memrr:$dst, u5imm:$TH)>; |
| 4267 |
def DCBTSTT : PPCAsmPseudo<"dcbtstt $dst", (ins memrr:$dst)>; |
| 4268 |
|
| 4269 |
def DCBFx : PPCAsmPseudo<"dcbf $dst", (ins memrr:$dst)>; |
| 4270 |
def DCBFL : PPCAsmPseudo<"dcbfl $dst", (ins memrr:$dst)>; |
| 4271 |
def DCBFLP : PPCAsmPseudo<"dcbflp $dst", (ins memrr:$dst)>; |
| 4272 |
|
| 4273 |
def : InstAlias<"crset $bx", (CREQV crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>; |
| 4274 |
def : InstAlias<"crclr $bx", (CRXOR crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>; |
| 4275 |
def : InstAlias<"crmove $bx, $by", (CROR crbitrc:$bx, crbitrc:$by, crbitrc:$by)>; |
| 4276 |
def : InstAlias<"crnot $bx, $by", (CRNOR crbitrc:$bx, crbitrc:$by, crbitrc:$by)>; |
| 4277 |
|
| 4278 |
def : InstAlias<"mtxer $Rx", (MTSPR 1, gprc:$Rx)>; |
| 4279 |
def : InstAlias<"mfxer $Rx", (MFSPR gprc:$Rx, 1)>; |
| 4280 |
|
| 4281 |
def : InstAlias<"mfrtcu $Rx", (MFSPR gprc:$Rx, 4)>; |
| 4282 |
def : InstAlias<"mfrtcl $Rx", (MFSPR gprc:$Rx, 5)>; |
| 4283 |
|
| 4284 |
def : InstAlias<"mtdscr $Rx", (MTSPR 17, gprc:$Rx)>; |
| 4285 |
def : InstAlias<"mfdscr $Rx", (MFSPR gprc:$Rx, 17)>; |
| 4286 |
|
| 4287 |
def : InstAlias<"mtdsisr $Rx", (MTSPR 18, gprc:$Rx)>; |
| 4288 |
def : InstAlias<"mfdsisr $Rx", (MFSPR gprc:$Rx, 18)>; |
| 4289 |
|
| 4290 |
def : InstAlias<"mtdar $Rx", (MTSPR 19, gprc:$Rx)>; |
| 4291 |
def : InstAlias<"mfdar $Rx", (MFSPR gprc:$Rx, 19)>; |
| 4292 |
|
| 4293 |
def : InstAlias<"mtdec $Rx", (MTSPR 22, gprc:$Rx)>; |
| 4294 |
def : InstAlias<"mfdec $Rx", (MFSPR gprc:$Rx, 22)>; |
| 4295 |
|
| 4296 |
def : InstAlias<"mtsdr1 $Rx", (MTSPR 25, gprc:$Rx)>; |
| 4297 |
def : InstAlias<"mfsdr1 $Rx", (MFSPR gprc:$Rx, 25)>; |
| 4298 |
|
| 4299 |
def : InstAlias<"mtsrr0 $Rx", (MTSPR 26, gprc:$Rx)>; |
| 4300 |
def : InstAlias<"mfsrr0 $Rx", (MFSPR gprc:$Rx, 26)>; |
| 4301 |
|
| 4302 |
def : InstAlias<"mtsrr1 $Rx", (MTSPR 27, gprc:$Rx)>; |
| 4303 |
def : InstAlias<"mfsrr1 $Rx", (MFSPR gprc:$Rx, 27)>; |
| 4304 |
|
| 4305 |
def : InstAlias<"mtsrr2 $Rx", (MTSPR 990, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4306 |
def : InstAlias<"mfsrr2 $Rx", (MFSPR gprc:$Rx, 990)>, Requires<[IsPPC4xx]>; |
| 4307 |
|
| 4308 |
def : InstAlias<"mtsrr3 $Rx", (MTSPR 991, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4309 |
def : InstAlias<"mfsrr3 $Rx", (MFSPR gprc:$Rx, 991)>, Requires<[IsPPC4xx]>; |
| 4310 |
|
| 4311 |
def : InstAlias<"mtcfar $Rx", (MTSPR 28, gprc:$Rx)>; |
| 4312 |
def : InstAlias<"mfcfar $Rx", (MFSPR gprc:$Rx, 28)>; |
| 4313 |
|
| 4314 |
def : InstAlias<"mtamr $Rx", (MTSPR 29, gprc:$Rx)>; |
| 4315 |
def : InstAlias<"mfamr $Rx", (MFSPR gprc:$Rx, 29)>; |
| 4316 |
|
| 4317 |
def : InstAlias<"mtpid $Rx", (MTSPR 48, gprc:$Rx)>, Requires<[IsBookE]>; |
| 4318 |
def : InstAlias<"mfpid $Rx", (MFSPR gprc:$Rx, 48)>, Requires<[IsBookE]>; |
| 4319 |
|
| 4320 |
def : InstAlias<"mftb $Rx", (MFTB gprc:$Rx, 268)>; |
| 4321 |
def : InstAlias<"mftbl $Rx", (MFTB gprc:$Rx, 268)>; |
| 4322 |
def : InstAlias<"mftbu $Rx", (MFTB gprc:$Rx, 269)>; |
| 4323 |
|
| 4324 |
def : InstAlias<"mttbl $Rx", (MTSPR 284, gprc:$Rx)>; |
| 4325 |
def : InstAlias<"mttbu $Rx", (MTSPR 285, gprc:$Rx)>; |
| 4326 |
|
| 4327 |
def : InstAlias<"mftblo $Rx", (MFSPR gprc:$Rx, 989)>, Requires<[IsPPC4xx]>; |
| 4328 |
def : InstAlias<"mttblo $Rx", (MTSPR 989, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4329 |
def : InstAlias<"mftbhi $Rx", (MFSPR gprc:$Rx, 988)>, Requires<[IsPPC4xx]>; |
| 4330 |
def : InstAlias<"mttbhi $Rx", (MTSPR 988, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4331 |
|
| 4332 |
def : InstAlias<"xnop", (XORI R0, R0, 0)>; |
| 4333 |
|
| 4334 |
def : InstAlias<"mr $rA, $rB", (OR8 g8rc:$rA, g8rc:$rB, g8rc:$rB)>; |
| 4335 |
def : InstAlias<"mr. $rA, $rB", (OR8o g8rc:$rA, g8rc:$rB, g8rc:$rB)>; |
| 4336 |
|
| 4337 |
def : InstAlias<"not $rA, $rB", (NOR8 g8rc:$rA, g8rc:$rB, g8rc:$rB)>; |
| 4338 |
def : InstAlias<"not. $rA, $rB", (NOR8o g8rc:$rA, g8rc:$rB, g8rc:$rB)>; |
| 4339 |
|
| 4340 |
def : InstAlias<"mtcr $rA", (MTCRF8 255, g8rc:$rA)>; |
| 4341 |
|
| 4342 |
foreach BATR = 0-3 in { |
| 4343 |
def : InstAlias<"mtdbatu "#BATR#", $Rx", |
| 4344 |
(MTSPR !add(BATR, !add(BATR, 536)), gprc:$Rx)>, |
| 4345 |
Requires<[IsPPC6xx]>; |
| 4346 |
def : InstAlias<"mfdbatu $Rx, "#BATR, |
| 4347 |
(MFSPR gprc:$Rx, !add(BATR, !add(BATR, 536)))>, |
| 4348 |
Requires<[IsPPC6xx]>; |
| 4349 |
def : InstAlias<"mtdbatl "#BATR#", $Rx", |
| 4350 |
(MTSPR !add(BATR, !add(BATR, 537)), gprc:$Rx)>, |
| 4351 |
Requires<[IsPPC6xx]>; |
| 4352 |
def : InstAlias<"mfdbatl $Rx, "#BATR, |
| 4353 |
(MFSPR gprc:$Rx, !add(BATR, !add(BATR, 537)))>, |
| 4354 |
Requires<[IsPPC6xx]>; |
| 4355 |
def : InstAlias<"mtibatu "#BATR#", $Rx", |
| 4356 |
(MTSPR !add(BATR, !add(BATR, 528)), gprc:$Rx)>, |
| 4357 |
Requires<[IsPPC6xx]>; |
| 4358 |
def : InstAlias<"mfibatu $Rx, "#BATR, |
| 4359 |
(MFSPR gprc:$Rx, !add(BATR, !add(BATR, 528)))>, |
| 4360 |
Requires<[IsPPC6xx]>; |
| 4361 |
def : InstAlias<"mtibatl "#BATR#", $Rx", |
| 4362 |
(MTSPR !add(BATR, !add(BATR, 529)), gprc:$Rx)>, |
| 4363 |
Requires<[IsPPC6xx]>; |
| 4364 |
def : InstAlias<"mfibatl $Rx, "#BATR, |
| 4365 |
(MFSPR gprc:$Rx, !add(BATR, !add(BATR, 529)))>, |
| 4366 |
Requires<[IsPPC6xx]>; |
| 4367 |
} |
| 4368 |
|
| 4369 |
foreach BR = 0-7 in { |
| 4370 |
def : InstAlias<"mfbr"#BR#" $Rx", |
| 4371 |
(MFDCR gprc:$Rx, !add(BR, 0x80))>, |
| 4372 |
Requires<[IsPPC4xx]>; |
| 4373 |
def : InstAlias<"mtbr"#BR#" $Rx", |
| 4374 |
(MTDCR gprc:$Rx, !add(BR, 0x80))>, |
| 4375 |
Requires<[IsPPC4xx]>; |
| 4376 |
} |
| 4377 |
|
| 4378 |
def : InstAlias<"mtdccr $Rx", (MTSPR 1018, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4379 |
def : InstAlias<"mfdccr $Rx", (MFSPR gprc:$Rx, 1018)>, Requires<[IsPPC4xx]>; |
| 4380 |
|
| 4381 |
def : InstAlias<"mticcr $Rx", (MTSPR 1019, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4382 |
def : InstAlias<"mficcr $Rx", (MFSPR gprc:$Rx, 1019)>, Requires<[IsPPC4xx]>; |
| 4383 |
|
| 4384 |
def : InstAlias<"mtdear $Rx", (MTSPR 981, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4385 |
def : InstAlias<"mfdear $Rx", (MFSPR gprc:$Rx, 981)>, Requires<[IsPPC4xx]>; |
| 4386 |
|
| 4387 |
def : InstAlias<"mtesr $Rx", (MTSPR 980, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4388 |
def : InstAlias<"mfesr $Rx", (MFSPR gprc:$Rx, 980)>, Requires<[IsPPC4xx]>; |
| 4389 |
|
| 4390 |
def : InstAlias<"mfspefscr $Rx", (MFSPR gprc:$Rx, 512)>; |
| 4391 |
def : InstAlias<"mtspefscr $Rx", (MTSPR 512, gprc:$Rx)>; |
| 4392 |
|
| 4393 |
def : InstAlias<"mttcr $Rx", (MTSPR 986, gprc:$Rx)>, Requires<[IsPPC4xx]>; |
| 4394 |
def : InstAlias<"mftcr $Rx", (MFSPR gprc:$Rx, 986)>, Requires<[IsPPC4xx]>; |
| 4395 |
|
| 4396 |
def LAx : PPCAsmPseudo<"la $rA, $addr", (ins gprc:$rA, memri:$addr)>; |
| 4397 |
|
| 4398 |
def SUBI : PPCAsmPseudo<"subi $rA, $rB, $imm", |
| 4399 |
(ins gprc:$rA, gprc:$rB, s16imm:$imm)>; |
| 4400 |
def SUBIS : PPCAsmPseudo<"subis $rA, $rB, $imm", |
| 4401 |
(ins gprc:$rA, gprc:$rB, s16imm:$imm)>; |
| 4402 |
def SUBIC : PPCAsmPseudo<"subic $rA, $rB, $imm", |
| 4403 |
(ins gprc:$rA, gprc:$rB, s16imm:$imm)>; |
| 4404 |
def SUBICo : PPCAsmPseudo<"subic. $rA, $rB, $imm", |
| 4405 |
(ins gprc:$rA, gprc:$rB, s16imm:$imm)>; |
| 4406 |
|
| 4407 |
def : InstAlias<"sub $rA, $rB, $rC", (SUBF8 g8rc:$rA, g8rc:$rC, g8rc:$rB)>; |
| 4408 |
def : InstAlias<"sub. $rA, $rB, $rC", (SUBF8o g8rc:$rA, g8rc:$rC, g8rc:$rB)>; |
| 4409 |
def : InstAlias<"subc $rA, $rB, $rC", (SUBFC8 g8rc:$rA, g8rc:$rC, g8rc:$rB)>; |
| 4410 |
def : InstAlias<"subc. $rA, $rB, $rC", (SUBFC8o g8rc:$rA, g8rc:$rC, g8rc:$rB)>; |
| 4411 |
|
| 4412 |
def : InstAlias<"mtmsrd $RS", (MTMSRD gprc:$RS, 0)>; |
| 4413 |
def : InstAlias<"mtmsr $RS", (MTMSR gprc:$RS, 0)>; |
| 4414 |
|
| 4415 |
def : InstAlias<"mfasr $RT", (MFSPR gprc:$RT, 280)>; |
| 4416 |
def : InstAlias<"mtasr $RT", (MTSPR 280, gprc:$RT)>; |
| 4417 |
|
| 4418 |
foreach SPRG = 0-3 in { |
| 4419 |
def : InstAlias<"mfsprg $RT, "#SPRG, (MFSPR gprc:$RT, !add(SPRG, 272))>; |
| 4420 |
def : InstAlias<"mfsprg"#SPRG#" $RT", (MFSPR gprc:$RT, !add(SPRG, 272))>; |
| 4421 |
def : InstAlias<"mtsprg "#SPRG#", $RT", (MTSPR !add(SPRG, 272), gprc:$RT)>; |
| 4422 |
def : InstAlias<"mtsprg"#SPRG#" $RT", (MTSPR !add(SPRG, 272), gprc:$RT)>; |
| 4423 |
} |
| 4424 |
foreach SPRG = 4-7 in { |
| 4425 |
def : InstAlias<"mfsprg $RT, "#SPRG, (MFSPR gprc:$RT, !add(SPRG, 256))>, |
| 4426 |
Requires<[IsBookE]>; |
| 4427 |
def : InstAlias<"mfsprg"#SPRG#" $RT", (MFSPR gprc:$RT, !add(SPRG, 256))>, |
| 4428 |
Requires<[IsBookE]>; |
| 4429 |
def : InstAlias<"mtsprg "#SPRG#", $RT", (MTSPR !add(SPRG, 256), gprc:$RT)>, |
| 4430 |
Requires<[IsBookE]>; |
| 4431 |
def : InstAlias<"mtsprg"#SPRG#" $RT", (MTSPR !add(SPRG, 256), gprc:$RT)>, |
| 4432 |
Requires<[IsBookE]>; |
| 4433 |
} |
| 4434 |
|
| 4435 |
def : InstAlias<"mtasr $RS", (MTSPR 280, gprc:$RS)>; |
| 4436 |
|
| 4437 |
def : InstAlias<"mfdec $RT", (MFSPR gprc:$RT, 22)>; |
| 4438 |
def : InstAlias<"mtdec $RT", (MTSPR 22, gprc:$RT)>; |
| 4439 |
|
| 4440 |
def : InstAlias<"mfpvr $RT", (MFSPR gprc:$RT, 287)>; |
| 4441 |
|
| 4442 |
def : InstAlias<"mfsdr1 $RT", (MFSPR gprc:$RT, 25)>; |
| 4443 |
def : InstAlias<"mtsdr1 $RT", (MTSPR 25, gprc:$RT)>; |
| 4444 |
|
| 4445 |
def : InstAlias<"mfsrr0 $RT", (MFSPR gprc:$RT, 26)>; |
| 4446 |
def : InstAlias<"mfsrr1 $RT", (MFSPR gprc:$RT, 27)>; |
| 4447 |
def : InstAlias<"mtsrr0 $RT", (MTSPR 26, gprc:$RT)>; |
| 4448 |
def : InstAlias<"mtsrr1 $RT", (MTSPR 27, gprc:$RT)>; |
| 4449 |
|
| 4450 |
def : InstAlias<"tlbie $RB", (TLBIE R0, gprc:$RB)>; |
| 4451 |
|
| 4452 |
def : InstAlias<"tlbrehi $RS, $A", (TLBRE2 gprc:$RS, gprc:$A, 0)>, |
| 4453 |
Requires<[IsPPC4xx]>; |
| 4454 |
def : InstAlias<"tlbrelo $RS, $A", (TLBRE2 gprc:$RS, gprc:$A, 1)>, |
| 4455 |
Requires<[IsPPC4xx]>; |
| 4456 |
def : InstAlias<"tlbwehi $RS, $A", (TLBWE2 gprc:$RS, gprc:$A, 0)>, |
| 4457 |
Requires<[IsPPC4xx]>; |
| 4458 |
def : InstAlias<"tlbwelo $RS, $A", (TLBWE2 gprc:$RS, gprc:$A, 1)>, |
| 4459 |
Requires<[IsPPC4xx]>; |
| 4460 |
|
| 4461 |
def EXTLWI : PPCAsmPseudo<"extlwi $rA, $rS, $n, $b", |
| 4462 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4463 |
def EXTLWIo : PPCAsmPseudo<"extlwi. $rA, $rS, $n, $b", |
| 4464 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4465 |
def EXTRWI : PPCAsmPseudo<"extrwi $rA, $rS, $n, $b", |
| 4466 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4467 |
def EXTRWIo : PPCAsmPseudo<"extrwi. $rA, $rS, $n, $b", |
| 4468 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4469 |
def INSLWI : PPCAsmPseudo<"inslwi $rA, $rS, $n, $b", |
| 4470 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4471 |
def INSLWIo : PPCAsmPseudo<"inslwi. $rA, $rS, $n, $b", |
| 4472 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4473 |
def INSRWI : PPCAsmPseudo<"insrwi $rA, $rS, $n, $b", |
| 4474 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4475 |
def INSRWIo : PPCAsmPseudo<"insrwi. $rA, $rS, $n, $b", |
| 4476 |
(ins gprc:$rA, gprc:$rS, u5imm:$n, u5imm:$b)>; |
| 4477 |
def ROTRWI : PPCAsmPseudo<"rotrwi $rA, $rS, $n", |
| 4478 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4479 |
def ROTRWIo : PPCAsmPseudo<"rotrwi. $rA, $rS, $n", |
| 4480 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4481 |
def SLWI : PPCAsmPseudo<"slwi $rA, $rS, $n", |
| 4482 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4483 |
def SLWIo : PPCAsmPseudo<"slwi. $rA, $rS, $n", |
| 4484 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4485 |
def SRWI : PPCAsmPseudo<"srwi $rA, $rS, $n", |
| 4486 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4487 |
def SRWIo : PPCAsmPseudo<"srwi. $rA, $rS, $n", |
| 4488 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4489 |
def CLRRWI : PPCAsmPseudo<"clrrwi $rA, $rS, $n", |
| 4490 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4491 |
def CLRRWIo : PPCAsmPseudo<"clrrwi. $rA, $rS, $n", |
| 4492 |
(ins gprc:$rA, gprc:$rS, u5imm:$n)>; |
| 4493 |
def CLRLSLWI : PPCAsmPseudo<"clrlslwi $rA, $rS, $b, $n", |
| 4494 |
(ins gprc:$rA, gprc:$rS, u5imm:$b, u5imm:$n)>; |
| 4495 |
def CLRLSLWIo : PPCAsmPseudo<"clrlslwi. $rA, $rS, $b, $n", |
| 4496 |
(ins gprc:$rA, gprc:$rS, u5imm:$b, u5imm:$n)>; |
| 4497 |
|
| 4498 |
def : InstAlias<"rotlwi $rA, $rS, $n", (RLWINM gprc:$rA, gprc:$rS, u5imm:$n, 0, 31)>; |
| 4499 |
def : InstAlias<"rotlwi. $rA, $rS, $n", (RLWINMo gprc:$rA, gprc:$rS, u5imm:$n, 0, 31)>; |
| 4500 |
def : InstAlias<"rotlw $rA, $rS, $rB", (RLWNM gprc:$rA, gprc:$rS, gprc:$rB, 0, 31)>; |
| 4501 |
def : InstAlias<"rotlw. $rA, $rS, $rB", (RLWNMo gprc:$rA, gprc:$rS, gprc:$rB, 0, 31)>; |
| 4502 |
def : InstAlias<"clrlwi $rA, $rS, $n", (RLWINM gprc:$rA, gprc:$rS, 0, u5imm:$n, 31)>; |
| 4503 |
def : InstAlias<"clrlwi. $rA, $rS, $n", (RLWINMo gprc:$rA, gprc:$rS, 0, u5imm:$n, 31)>; |
| 4504 |
|
| 4505 |
def : InstAlias<"cntlzw $rA, $rS", (CNTLZW gprc:$rA, gprc:$rS)>; |
| 4506 |
def : InstAlias<"cntlzw. $rA, $rS", (CNTLZWo gprc:$rA, gprc:$rS)>; |
| 4507 |
// The POWER variant |
| 4508 |
def : MnemonicAlias<"cntlz", "cntlzw">; |
| 4509 |
def : MnemonicAlias<"cntlz.", "cntlzw.">; |
| 4510 |
|
| 4511 |
def EXTLDI : PPCAsmPseudo<"extldi $rA, $rS, $n, $b", |
| 4512 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4513 |
def EXTLDIo : PPCAsmPseudo<"extldi. $rA, $rS, $n, $b", |
| 4514 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4515 |
def EXTRDI : PPCAsmPseudo<"extrdi $rA, $rS, $n, $b", |
| 4516 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4517 |
def EXTRDIo : PPCAsmPseudo<"extrdi. $rA, $rS, $n, $b", |
| 4518 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4519 |
def INSRDI : PPCAsmPseudo<"insrdi $rA, $rS, $n, $b", |
| 4520 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4521 |
def INSRDIo : PPCAsmPseudo<"insrdi. $rA, $rS, $n, $b", |
| 4522 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n, u6imm:$b)>; |
| 4523 |
def ROTRDI : PPCAsmPseudo<"rotrdi $rA, $rS, $n", |
| 4524 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4525 |
def ROTRDIo : PPCAsmPseudo<"rotrdi. $rA, $rS, $n", |
| 4526 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4527 |
def SLDI : PPCAsmPseudo<"sldi $rA, $rS, $n", |
| 4528 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4529 |
def SLDIo : PPCAsmPseudo<"sldi. $rA, $rS, $n", |
| 4530 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4531 |
def SRDI : PPCAsmPseudo<"srdi $rA, $rS, $n", |
| 4532 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4533 |
def SRDIo : PPCAsmPseudo<"srdi. $rA, $rS, $n", |
| 4534 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4535 |
def CLRRDI : PPCAsmPseudo<"clrrdi $rA, $rS, $n", |
| 4536 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4537 |
def CLRRDIo : PPCAsmPseudo<"clrrdi. $rA, $rS, $n", |
| 4538 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$n)>; |
| 4539 |
def CLRLSLDI : PPCAsmPseudo<"clrlsldi $rA, $rS, $b, $n", |
| 4540 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$b, u6imm:$n)>; |
| 4541 |
def CLRLSLDIo : PPCAsmPseudo<"clrlsldi. $rA, $rS, $b, $n", |
| 4542 |
(ins g8rc:$rA, g8rc:$rS, u6imm:$b, u6imm:$n)>; |
| 4543 |
def SUBPCIS : PPCAsmPseudo<"subpcis $RT, $D", (ins g8rc:$RT, s16imm:$D)>; |
| 4544 |
|
| 4545 |
def : InstAlias<"rotldi $rA, $rS, $n", (RLDICL g8rc:$rA, g8rc:$rS, u6imm:$n, 0)>; |
| 4546 |
def : InstAlias<"rotldi. $rA, $rS, $n", (RLDICLo g8rc:$rA, g8rc:$rS, u6imm:$n, 0)>; |
| 4547 |
def : InstAlias<"rotld $rA, $rS, $rB", (RLDCL g8rc:$rA, g8rc:$rS, gprc:$rB, 0)>; |
| 4548 |
def : InstAlias<"rotld. $rA, $rS, $rB", (RLDCLo g8rc:$rA, g8rc:$rS, gprc:$rB, 0)>; |
| 4549 |
def : InstAlias<"clrldi $rA, $rS, $n", (RLDICL g8rc:$rA, g8rc:$rS, 0, u6imm:$n)>; |
| 4550 |
def : InstAlias<"clrldi $rA, $rS, $n", |
| 4551 |
(RLDICL_32_64 g8rc:$rA, gprc:$rS, 0, u6imm:$n)>; |
| 4552 |
def : InstAlias<"clrldi. $rA, $rS, $n", (RLDICLo g8rc:$rA, g8rc:$rS, 0, u6imm:$n)>; |
| 4553 |
def : InstAlias<"lnia $RT", (ADDPCIS g8rc:$RT, 0)>; |
| 4554 |
|
| 4555 |
def RLWINMbm : PPCAsmPseudo<"rlwinm $rA, $rS, $n, $b", |
| 4556 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4557 |
def RLWINMobm : PPCAsmPseudo<"rlwinm. $rA, $rS, $n, $b", |
| 4558 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4559 |
def RLWIMIbm : PPCAsmPseudo<"rlwimi $rA, $rS, $n, $b", |
| 4560 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4561 |
def RLWIMIobm : PPCAsmPseudo<"rlwimi. $rA, $rS, $n, $b", |
| 4562 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4563 |
def RLWNMbm : PPCAsmPseudo<"rlwnm $rA, $rS, $n, $b", |
| 4564 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4565 |
def RLWNMobm : PPCAsmPseudo<"rlwnm. $rA, $rS, $n, $b", |
| 4566 |
(ins g8rc:$rA, g8rc:$rS, u5imm:$n, i32imm:$b)>; |
| 4567 |
|
| 4568 |
// These generic branch instruction forms are used for the assembler parser only. |
| 4569 |
// Defs and Uses are conservative, since we don't know the BO value. |
| 4570 |
let PPC970_Unit = 7, isBranch = 1 in { |
| 4571 |
let Defs = [CTR], Uses = [CTR, RM] in { |
| 4572 |
def gBC : BForm_3<16, 0, 0, (outs), |
| 4573 |
(ins u5imm:$bo, crbitrc:$bi, condbrtarget:$dst), |
| 4574 |
"bc $bo, $bi, $dst">; |
| 4575 |
def gBCA : BForm_3<16, 1, 0, (outs), |
| 4576 |
(ins u5imm:$bo, crbitrc:$bi, abscondbrtarget:$dst), |
| 4577 |
"bca $bo, $bi, $dst">; |
| 4578 |
let isAsmParserOnly = 1 in { |
| 4579 |
def gBCat : BForm_3_at<16, 0, 0, (outs), |
| 4580 |
(ins u5imm:$bo, atimm:$at, crbitrc:$bi, |
| 4581 |
condbrtarget:$dst), |
| 4582 |
"bc$at $bo, $bi, $dst">; |
| 4583 |
def gBCAat : BForm_3_at<16, 1, 0, (outs), |
| 4584 |
(ins u5imm:$bo, atimm:$at, crbitrc:$bi, |
| 4585 |
abscondbrtarget:$dst), |
| 4586 |
"bca$at $bo, $bi, $dst">; |
| 4587 |
} // isAsmParserOnly = 1 |
| 4588 |
} |
| 4589 |
let Defs = [LR, CTR], Uses = [CTR, RM] in { |
| 4590 |
def gBCL : BForm_3<16, 0, 1, (outs), |
| 4591 |
(ins u5imm:$bo, crbitrc:$bi, condbrtarget:$dst), |
| 4592 |
"bcl $bo, $bi, $dst">; |
| 4593 |
def gBCLA : BForm_3<16, 1, 1, (outs), |
| 4594 |
(ins u5imm:$bo, crbitrc:$bi, abscondbrtarget:$dst), |
| 4595 |
"bcla $bo, $bi, $dst">; |
| 4596 |
let isAsmParserOnly = 1 in { |
| 4597 |
def gBCLat : BForm_3_at<16, 0, 1, (outs), |
| 4598 |
(ins u5imm:$bo, atimm:$at, crbitrc:$bi, |
| 4599 |
condbrtarget:$dst), |
| 4600 |
"bcl$at $bo, $bi, $dst">; |
| 4601 |
def gBCLAat : BForm_3_at<16, 1, 1, (outs), |
| 4602 |
(ins u5imm:$bo, atimm:$at, crbitrc:$bi, |
| 4603 |
abscondbrtarget:$dst), |
| 4604 |
"bcla$at $bo, $bi, $dst">; |
| 4605 |
} // // isAsmParserOnly = 1 |
| 4606 |
} |
| 4607 |
let Defs = [CTR], Uses = [CTR, LR, RM] in |
| 4608 |
def gBCLR : XLForm_2<19, 16, 0, (outs), |
| 4609 |
(ins u5imm:$bo, crbitrc:$bi, i32imm:$bh), |
| 4610 |
"bclr $bo, $bi, $bh", IIC_BrB, []>; |
| 4611 |
let Defs = [LR, CTR], Uses = [CTR, LR, RM] in |
| 4612 |
def gBCLRL : XLForm_2<19, 16, 1, (outs), |
| 4613 |
(ins u5imm:$bo, crbitrc:$bi, i32imm:$bh), |
| 4614 |
"bclrl $bo, $bi, $bh", IIC_BrB, []>; |
| 4615 |
let Defs = [CTR], Uses = [CTR, LR, RM] in |
| 4616 |
def gBCCTR : XLForm_2<19, 528, 0, (outs), |
| 4617 |
(ins u5imm:$bo, crbitrc:$bi, i32imm:$bh), |
| 4618 |
"bcctr $bo, $bi, $bh", IIC_BrB, []>; |
| 4619 |
let Defs = [LR, CTR], Uses = [CTR, LR, RM] in |
| 4620 |
def gBCCTRL : XLForm_2<19, 528, 1, (outs), |
| 4621 |
(ins u5imm:$bo, crbitrc:$bi, i32imm:$bh), |
| 4622 |
"bcctrl $bo, $bi, $bh", IIC_BrB, []>; |
| 4623 |
} |
| 4624 |
|
| 4625 |
multiclass BranchSimpleMnemonicAT<string pm, int at> { |
| 4626 |
def : InstAlias<"bc"#pm#" $bo, $bi, $dst", (gBCat u5imm:$bo, at, crbitrc:$bi, |
| 4627 |
condbrtarget:$dst)>; |
| 4628 |
def : InstAlias<"bca"#pm#" $bo, $bi, $dst", (gBCAat u5imm:$bo, at, crbitrc:$bi, |
| 4629 |
condbrtarget:$dst)>; |
| 4630 |
def : InstAlias<"bcl"#pm#" $bo, $bi, $dst", (gBCLat u5imm:$bo, at, crbitrc:$bi, |
| 4631 |
condbrtarget:$dst)>; |
| 4632 |
def : InstAlias<"bcla"#pm#" $bo, $bi, $dst", (gBCLAat u5imm:$bo, at, crbitrc:$bi, |
| 4633 |
condbrtarget:$dst)>; |
| 4634 |
} |
| 4635 |
defm : BranchSimpleMnemonicAT<"+", 3>; |
| 4636 |
defm : BranchSimpleMnemonicAT<"-", 2>; |
| 4637 |
|
| 4638 |
def : InstAlias<"bclr $bo, $bi", (gBCLR u5imm:$bo, crbitrc:$bi, 0)>; |
| 4639 |
def : InstAlias<"bclrl $bo, $bi", (gBCLRL u5imm:$bo, crbitrc:$bi, 0)>; |
| 4640 |
def : InstAlias<"bcctr $bo, $bi", (gBCCTR u5imm:$bo, crbitrc:$bi, 0)>; |
| 4641 |
def : InstAlias<"bcctrl $bo, $bi", (gBCCTRL u5imm:$bo, crbitrc:$bi, 0)>; |
| 4642 |
|
| 4643 |
multiclass BranchSimpleMnemonic1<string name, string pm, int bo> { |
| 4644 |
def : InstAlias<"b"#name#pm#" $bi, $dst", (gBC bo, crbitrc:$bi, condbrtarget:$dst)>; |
| 4645 |
def : InstAlias<"b"#name#"a"#pm#" $bi, $dst", (gBCA bo, crbitrc:$bi, abscondbrtarget:$dst)>; |
| 4646 |
def : InstAlias<"b"#name#"lr"#pm#" $bi", (gBCLR bo, crbitrc:$bi, 0)>; |
| 4647 |
def : InstAlias<"b"#name#"l"#pm#" $bi, $dst", (gBCL bo, crbitrc:$bi, condbrtarget:$dst)>; |
| 4648 |
def : InstAlias<"b"#name#"la"#pm#" $bi, $dst", (gBCLA bo, crbitrc:$bi, abscondbrtarget:$dst)>; |
| 4649 |
def : InstAlias<"b"#name#"lrl"#pm#" $bi", (gBCLRL bo, crbitrc:$bi, 0)>; |
| 4650 |
} |
| 4651 |
multiclass BranchSimpleMnemonic2<string name, string pm, int bo> |
| 4652 |
: BranchSimpleMnemonic1<name, pm, bo> { |
| 4653 |
def : InstAlias<"b"#name#"ctr"#pm#" $bi", (gBCCTR bo, crbitrc:$bi, 0)>; |
| 4654 |
def : InstAlias<"b"#name#"ctrl"#pm#" $bi", (gBCCTRL bo, crbitrc:$bi, 0)>; |
| 4655 |
} |
| 4656 |
defm : BranchSimpleMnemonic2<"t", "", 12>; |
| 4657 |
defm : BranchSimpleMnemonic2<"f", "", 4>; |
| 4658 |
defm : BranchSimpleMnemonic2<"t", "-", 14>; |
| 4659 |
defm : BranchSimpleMnemonic2<"f", "-", 6>; |
| 4660 |
defm : BranchSimpleMnemonic2<"t", "+", 15>; |
| 4661 |
defm : BranchSimpleMnemonic2<"f", "+", 7>; |
| 4662 |
defm : BranchSimpleMnemonic1<"dnzt", "", 8>; |
| 4663 |
defm : BranchSimpleMnemonic1<"dnzf", "", 0>; |
| 4664 |
defm : BranchSimpleMnemonic1<"dzt", "", 10>; |
| 4665 |
defm : BranchSimpleMnemonic1<"dzf", "", 2>; |
| 4666 |
|
| 4667 |
multiclass BranchExtendedMnemonicPM<string name, string pm, int bibo> { |
| 4668 |
def : InstAlias<"b"#name#pm#" $cc, $dst", |
| 4669 |
(BCC bibo, crrc:$cc, condbrtarget:$dst)>; |
| 4670 |
def : InstAlias<"b"#name#pm#" $dst", |
| 4671 |
(BCC bibo, CR0, condbrtarget:$dst)>; |
| 4672 |
|
| 4673 |
def : InstAlias<"b"#name#"a"#pm#" $cc, $dst", |
| 4674 |
(BCCA bibo, crrc:$cc, abscondbrtarget:$dst)>; |
| 4675 |
def : InstAlias<"b"#name#"a"#pm#" $dst", |
| 4676 |
(BCCA bibo, CR0, abscondbrtarget:$dst)>; |
| 4677 |
|
| 4678 |
def : InstAlias<"b"#name#"lr"#pm#" $cc", |
| 4679 |
(BCCLR bibo, crrc:$cc)>; |
| 4680 |
def : InstAlias<"b"#name#"lr"#pm, |
| 4681 |
(BCCLR bibo, CR0)>; |
| 4682 |
|
| 4683 |
def : InstAlias<"b"#name#"ctr"#pm#" $cc", |
| 4684 |
(BCCCTR bibo, crrc:$cc)>; |
| 4685 |
def : InstAlias<"b"#name#"ctr"#pm, |
| 4686 |
(BCCCTR bibo, CR0)>; |
| 4687 |
|
| 4688 |
def : InstAlias<"b"#name#"l"#pm#" $cc, $dst", |
| 4689 |
(BCCL bibo, crrc:$cc, condbrtarget:$dst)>; |
| 4690 |
def : InstAlias<"b"#name#"l"#pm#" $dst", |
| 4691 |
(BCCL bibo, CR0, condbrtarget:$dst)>; |
| 4692 |
|
| 4693 |
def : InstAlias<"b"#name#"la"#pm#" $cc, $dst", |
| 4694 |
(BCCLA bibo, crrc:$cc, abscondbrtarget:$dst)>; |
| 4695 |
def : InstAlias<"b"#name#"la"#pm#" $dst", |
| 4696 |
(BCCLA bibo, CR0, abscondbrtarget:$dst)>; |
| 4697 |
|
| 4698 |
def : InstAlias<"b"#name#"lrl"#pm#" $cc", |
| 4699 |
(BCCLRL bibo, crrc:$cc)>; |
| 4700 |
def : InstAlias<"b"#name#"lrl"#pm, |
| 4701 |
(BCCLRL bibo, CR0)>; |
| 4702 |
|
| 4703 |
def : InstAlias<"b"#name#"ctrl"#pm#" $cc", |
| 4704 |
(BCCCTRL bibo, crrc:$cc)>; |
| 4705 |
def : InstAlias<"b"#name#"ctrl"#pm, |
| 4706 |
(BCCCTRL bibo, CR0)>; |
| 4707 |
} |
| 4708 |
multiclass BranchExtendedMnemonic<string name, int bibo> { |
| 4709 |
defm : BranchExtendedMnemonicPM<name, "", bibo>; |
| 4710 |
defm : BranchExtendedMnemonicPM<name, "-", !add(bibo, 2)>; |
| 4711 |
defm : BranchExtendedMnemonicPM<name, "+", !add(bibo, 3)>; |
| 4712 |
} |
| 4713 |
defm : BranchExtendedMnemonic<"lt", 12>; |
| 4714 |
defm : BranchExtendedMnemonic<"gt", 44>; |
| 4715 |
defm : BranchExtendedMnemonic<"eq", 76>; |
| 4716 |
defm : BranchExtendedMnemonic<"un", 108>; |
| 4717 |
defm : BranchExtendedMnemonic<"so", 108>; |
| 4718 |
defm : BranchExtendedMnemonic<"ge", 4>; |
| 4719 |
defm : BranchExtendedMnemonic<"nl", 4>; |
| 4720 |
defm : BranchExtendedMnemonic<"le", 36>; |
| 4721 |
defm : BranchExtendedMnemonic<"ng", 36>; |
| 4722 |
defm : BranchExtendedMnemonic<"ne", 68>; |
| 4723 |
defm : BranchExtendedMnemonic<"nu", 100>; |
| 4724 |
defm : BranchExtendedMnemonic<"ns", 100>; |
| 4725 |
|
| 4726 |
def : InstAlias<"cmpwi $rA, $imm", (CMPWI CR0, gprc:$rA, s16imm:$imm)>; |
| 4727 |
def : InstAlias<"cmpw $rA, $rB", (CMPW CR0, gprc:$rA, gprc:$rB)>; |
| 4728 |
def : InstAlias<"cmplwi $rA, $imm", (CMPLWI CR0, gprc:$rA, u16imm:$imm)>; |
| 4729 |
def : InstAlias<"cmplw $rA, $rB", (CMPLW CR0, gprc:$rA, gprc:$rB)>; |
| 4730 |
def : InstAlias<"cmpdi $rA, $imm", (CMPDI CR0, g8rc:$rA, s16imm64:$imm)>; |
| 4731 |
def : InstAlias<"cmpd $rA, $rB", (CMPD CR0, g8rc:$rA, g8rc:$rB)>; |
| 4732 |
def : InstAlias<"cmpldi $rA, $imm", (CMPLDI CR0, g8rc:$rA, u16imm64:$imm)>; |
| 4733 |
def : InstAlias<"cmpld $rA, $rB", (CMPLD CR0, g8rc:$rA, g8rc:$rB)>; |
| 4734 |
|
| 4735 |
def : InstAlias<"cmpi $bf, 0, $rA, $imm", (CMPWI crrc:$bf, gprc:$rA, s16imm:$imm)>; |
| 4736 |
def : InstAlias<"cmp $bf, 0, $rA, $rB", (CMPW crrc:$bf, gprc:$rA, gprc:$rB)>; |
| 4737 |
def : InstAlias<"cmpli $bf, 0, $rA, $imm", (CMPLWI crrc:$bf, gprc:$rA, u16imm:$imm)>; |
| 4738 |
def : InstAlias<"cmpl $bf, 0, $rA, $rB", (CMPLW crrc:$bf, gprc:$rA, gprc:$rB)>; |
| 4739 |
def : InstAlias<"cmpi $bf, 1, $rA, $imm", (CMPDI crrc:$bf, g8rc:$rA, s16imm64:$imm)>; |
| 4740 |
def : InstAlias<"cmp $bf, 1, $rA, $rB", (CMPD crrc:$bf, g8rc:$rA, g8rc:$rB)>; |
| 4741 |
def : InstAlias<"cmpli $bf, 1, $rA, $imm", (CMPLDI crrc:$bf, g8rc:$rA, u16imm64:$imm)>; |
| 4742 |
def : InstAlias<"cmpl $bf, 1, $rA, $rB", (CMPLD crrc:$bf, g8rc:$rA, g8rc:$rB)>; |
| 4743 |
|
| 4744 |
multiclass TrapExtendedMnemonic<string name, int to> { |
| 4745 |
def : InstAlias<"td"#name#"i $rA, $imm", (TDI to, g8rc:$rA, s16imm:$imm)>; |
| 4746 |
def : InstAlias<"td"#name#" $rA, $rB", (TD to, g8rc:$rA, g8rc:$rB)>; |
| 4747 |
def : InstAlias<"tw"#name#"i $rA, $imm", (TWI to, gprc:$rA, s16imm:$imm)>; |
| 4748 |
def : InstAlias<"tw"#name#" $rA, $rB", (TW to, gprc:$rA, gprc:$rB)>; |
| 4749 |
} |
| 4750 |
defm : TrapExtendedMnemonic<"lt", 16>; |
| 4751 |
defm : TrapExtendedMnemonic<"le", 20>; |
| 4752 |
defm : TrapExtendedMnemonic<"eq", 4>; |
| 4753 |
defm : TrapExtendedMnemonic<"ge", 12>; |
| 4754 |
defm : TrapExtendedMnemonic<"gt", 8>; |
| 4755 |
defm : TrapExtendedMnemonic<"nl", 12>; |
| 4756 |
defm : TrapExtendedMnemonic<"ne", 24>; |
| 4757 |
defm : TrapExtendedMnemonic<"ng", 20>; |
| 4758 |
defm : TrapExtendedMnemonic<"llt", 2>; |
| 4759 |
defm : TrapExtendedMnemonic<"lle", 6>; |
| 4760 |
defm : TrapExtendedMnemonic<"lge", 5>; |
| 4761 |
defm : TrapExtendedMnemonic<"lgt", 1>; |
| 4762 |
defm : TrapExtendedMnemonic<"lnl", 5>; |
| 4763 |
defm : TrapExtendedMnemonic<"lng", 6>; |
| 4764 |
defm : TrapExtendedMnemonic<"u", 31>; |
| 4765 |
|
| 4766 |
// Atomic loads |
| 4767 |
def : Pat<(atomic_load_8 iaddr:$src), (LBZ memri:$src)>; |
| 4768 |
def : Pat<(atomic_load_16 iaddr:$src), (LHZ memri:$src)>; |
| 4769 |
def : Pat<(atomic_load_32 iaddr:$src), (LWZ memri:$src)>; |
| 4770 |
def : Pat<(atomic_load_8 xaddr:$src), (LBZX memrr:$src)>; |
| 4771 |
def : Pat<(atomic_load_16 xaddr:$src), (LHZX memrr:$src)>; |
| 4772 |
def : Pat<(atomic_load_32 xaddr:$src), (LWZX memrr:$src)>; |
| 4773 |
|
| 4774 |
// Atomic stores |
| 4775 |
def : Pat<(atomic_store_8 iaddr:$ptr, i32:$val), (STB gprc:$val, memri:$ptr)>; |
| 4776 |
def : Pat<(atomic_store_16 iaddr:$ptr, i32:$val), (STH gprc:$val, memri:$ptr)>; |
| 4777 |
def : Pat<(atomic_store_32 iaddr:$ptr, i32:$val), (STW gprc:$val, memri:$ptr)>; |
| 4778 |
def : Pat<(atomic_store_8 xaddr:$ptr, i32:$val), (STBX gprc:$val, memrr:$ptr)>; |
| 4779 |
def : Pat<(atomic_store_16 xaddr:$ptr, i32:$val), (STHX gprc:$val, memrr:$ptr)>; |
| 4780 |
def : Pat<(atomic_store_32 xaddr:$ptr, i32:$val), (STWX gprc:$val, memrr:$ptr)>; |
| 4781 |
|
| 4782 |
let Predicates = [IsISA3_0] in { |
| 4783 |
|
| 4784 |
// Copy-Paste Facility |
| 4785 |
// We prefix 'CP' to COPY due to name conflict in Target.td. We also prefix to |
| 4786 |
// PASTE for naming consistency. |
| 4787 |
let mayLoad = 1 in |
| 4788 |
def CP_COPY : X_L1_RA5_RB5<31, 774, "copy" , gprc, IIC_LdStCOPY, []>; |
| 4789 |
|
| 4790 |
let mayStore = 1 in |
| 4791 |
def CP_PASTE : X_L1_RA5_RB5<31, 902, "paste" , gprc, IIC_LdStPASTE, []>; |
| 4792 |
|
| 4793 |
let mayStore = 1, Defs = [CR0] in |
| 4794 |
def CP_PASTEo : X_L1_RA5_RB5<31, 902, "paste.", gprc, IIC_LdStPASTE, []>, isDOT; |
| 4795 |
|
| 4796 |
def CP_COPYx : PPCAsmPseudo<"copy $rA, $rB" , (ins gprc:$rA, gprc:$rB)>; |
| 4797 |
def CP_PASTEx : PPCAsmPseudo<"paste $rA, $rB", (ins gprc:$rA, gprc:$rB)>; |
| 4798 |
def CP_COPY_FIRST : PPCAsmPseudo<"copy_first $rA, $rB", |
| 4799 |
(ins gprc:$rA, gprc:$rB)>; |
| 4800 |
def CP_PASTE_LAST : PPCAsmPseudo<"paste_last $rA, $rB", |
| 4801 |
(ins gprc:$rA, gprc:$rB)>; |
| 4802 |
def CP_ABORT : XForm_0<31, 838, (outs), (ins), "cp_abort", IIC_SprABORT, []>; |
| 4803 |
|
| 4804 |
// Message Synchronize |
| 4805 |
def MSGSYNC : XForm_0<31, 886, (outs), (ins), "msgsync", IIC_SprMSGSYNC, []>; |
| 4806 |
|
| 4807 |
// Power-Saving Mode Instruction: |
| 4808 |
def STOP : XForm_0<19, 370, (outs), (ins), "stop", IIC_SprSTOP, []>; |
| 4809 |
|
| 4810 |
} // IsISA3_0 |
| 4811 |
|
| 4812 |
// Fast 32-bit reverse bits algorithm: |
| 4813 |
// Step 1: 1-bit swap (swap odd 1-bit and even 1-bit): |
| 4814 |
// n = ((n >> 1) & 0x55555555) | ((n << 1) & 0xAAAAAAAA); |
| 4815 |
// Step 2: 2-bit swap (swap odd 2-bit and even 2-bit): |
| 4816 |
// n = ((n >> 2) & 0x33333333) | ((n << 2) & 0xCCCCCCCC); |
| 4817 |
// Step 3: 4-bit swap (swap odd 4-bit and even 4-bit): |
| 4818 |
// n = ((n >> 4) & 0x0F0F0F0F) | ((n << 4) & 0xF0F0F0F0); |
| 4819 |
// Step 4: byte reverse (Suppose n = [B1,B2,B3,B4]): |
| 4820 |
// Step 4.1: Put B4,B2 in the right position (rotate left 3 bytes): |
| 4821 |
// n' = (n rotl 24); After which n' = [B4, B1, B2, B3] |
| 4822 |
// Step 4.2: Insert B3 to the right position: |
| 4823 |
// n' = rlwimi n', n, 8, 8, 15; After which n' = [B4, B3, B2, B3] |
| 4824 |
// Step 4.3: Insert B1 to the right position: |
| 4825 |
// n' = rlwimi n', n, 8, 24, 31; After which n' = [B4, B3, B2, B1] |
| 4826 |
def MaskValues { |
| 4827 |
dag Lo1 = (ORI (LIS 0x5555), 0x5555); |
| 4828 |
dag Hi1 = (ORI (LIS 0xAAAA), 0xAAAA); |
| 4829 |
dag Lo2 = (ORI (LIS 0x3333), 0x3333); |
| 4830 |
dag Hi2 = (ORI (LIS 0xCCCC), 0xCCCC); |
| 4831 |
dag Lo4 = (ORI (LIS 0x0F0F), 0x0F0F); |
| 4832 |
dag Hi4 = (ORI (LIS 0xF0F0), 0xF0F0); |
| 4833 |
} |
| 4834 |
|
| 4835 |
def Shift1 { |
| 4836 |
dag Right = (RLWINM $A, 31, 1, 31); |
| 4837 |
dag Left = (RLWINM $A, 1, 0, 30); |
| 4838 |
} |
| 4839 |
|
| 4840 |
def Swap1 { |
| 4841 |
dag Bit = (OR (AND Shift1.Right, MaskValues.Lo1), |
| 4842 |
(AND Shift1.Left, MaskValues.Hi1)); |
| 4843 |
} |
| 4844 |
|
| 4845 |
def Shift2 { |
| 4846 |
dag Right = (RLWINM Swap1.Bit, 30, 2, 31); |
| 4847 |
dag Left = (RLWINM Swap1.Bit, 2, 0, 29); |
| 4848 |
} |
| 4849 |
|
| 4850 |
def Swap2 { |
| 4851 |
dag Bits = (OR (AND Shift2.Right, MaskValues.Lo2), |
| 4852 |
(AND Shift2.Left, MaskValues.Hi2)); |
| 4853 |
} |
| 4854 |
|
| 4855 |
def Shift4 { |
| 4856 |
dag Right = (RLWINM Swap2.Bits, 28, 4, 31); |
| 4857 |
dag Left = (RLWINM Swap2.Bits, 4, 0, 27); |
| 4858 |
} |
| 4859 |
|
| 4860 |
def Swap4 { |
| 4861 |
dag Bits = (OR (AND Shift4.Right, MaskValues.Lo4), |
| 4862 |
(AND Shift4.Left, MaskValues.Hi4)); |
| 4863 |
} |
| 4864 |
|
| 4865 |
def Rotate { |
| 4866 |
dag Left3Bytes = (RLWINM Swap4.Bits, 24, 0, 31); |
| 4867 |
} |
| 4868 |
|
| 4869 |
def RotateInsertByte3 { |
| 4870 |
dag Left = (RLWIMI Rotate.Left3Bytes, Swap4.Bits, 8, 8, 15); |
| 4871 |
} |
| 4872 |
|
| 4873 |
def RotateInsertByte1 { |
| 4874 |
dag Left = (RLWIMI RotateInsertByte3.Left, Swap4.Bits, 8, 24, 31); |
| 4875 |
} |
| 4876 |
|
| 4877 |
def : Pat<(i32 (bitreverse i32:$A)), |
| 4878 |
(RLDICL_32 RotateInsertByte1.Left, 0, 32)>; |
| 4879 |
|
| 4880 |
// Fast 64-bit reverse bits algorithm: |
| 4881 |
// Step 1: 1-bit swap (swap odd 1-bit and even 1-bit): |
| 4882 |
// n = ((n >> 1) & 0x5555555555555555) | ((n << 1) & 0xAAAAAAAAAAAAAAAA); |
| 4883 |
// Step 2: 2-bit swap (swap odd 2-bit and even 2-bit): |
| 4884 |
// n = ((n >> 2) & 0x3333333333333333) | ((n << 2) & 0xCCCCCCCCCCCCCCCC); |
| 4885 |
// Step 3: 4-bit swap (swap odd 4-bit and even 4-bit): |
| 4886 |
// n = ((n >> 4) & 0x0F0F0F0F0F0F0F0F) | ((n << 4) & 0xF0F0F0F0F0F0F0F0); |
| 4887 |
// Step 4: byte reverse (Suppose n = [B0,B1,B2,B3,B4,B5,B6,B7]): |
| 4888 |
// Apply the same byte reverse algorithm mentioned above for the fast 32-bit |
| 4889 |
// reverse to both the high 32 bit and low 32 bit of the 64 bit value. And |
| 4890 |
// then OR them together to get the final result. |
| 4891 |
def MaskValues64 { |
| 4892 |
dag Lo1 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Lo1, sub_32)); |
| 4893 |
dag Hi1 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Hi1, sub_32)); |
| 4894 |
dag Lo2 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Lo2, sub_32)); |
| 4895 |
dag Hi2 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Hi2, sub_32)); |
| 4896 |
dag Lo4 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Lo4, sub_32)); |
| 4897 |
dag Hi4 = (i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), MaskValues.Hi4, sub_32)); |
| 4898 |
} |
| 4899 |
|
| 4900 |
def DWMaskValues { |
| 4901 |
dag Lo1 = (ORI8 (ORIS8 (RLDICR MaskValues64.Lo1, 32, 31), 0x5555), 0x5555); |
| 4902 |
dag Hi1 = (ORI8 (ORIS8 (RLDICR MaskValues64.Hi1, 32, 31), 0xAAAA), 0xAAAA); |
| 4903 |
dag Lo2 = (ORI8 (ORIS8 (RLDICR MaskValues64.Lo2, 32, 31), 0x3333), 0x3333); |
| 4904 |
dag Hi2 = (ORI8 (ORIS8 (RLDICR MaskValues64.Hi2, 32, 31), 0xCCCC), 0xCCCC); |
| 4905 |
dag Lo4 = (ORI8 (ORIS8 (RLDICR MaskValues64.Lo4, 32, 31), 0x0F0F), 0x0F0F); |
| 4906 |
dag Hi4 = (ORI8 (ORIS8 (RLDICR MaskValues64.Hi4, 32, 31), 0xF0F0), 0xF0F0); |
| 4907 |
} |
| 4908 |
|
| 4909 |
def DWSwapInByte { |
| 4910 |
dag Swap1 = (OR8 (AND8 (RLDICL $A, 63, 1), DWMaskValues.Lo1), |
| 4911 |
(AND8 (RLDICR $A, 1, 62), DWMaskValues.Hi1)); |
| 4912 |
dag Swap2 = (OR8 (AND8 (RLDICL Swap1, 62, 2), DWMaskValues.Lo2), |
| 4913 |
(AND8 (RLDICR Swap1, 2, 61), DWMaskValues.Hi2)); |
| 4914 |
dag Swap4 = (OR8 (AND8 (RLDICL Swap2, 60, 4), DWMaskValues.Lo4), |
| 4915 |
(AND8 (RLDICR Swap2, 4, 59), DWMaskValues.Hi4)); |
| 4916 |
} |
| 4917 |
|
| 4918 |
// Intra-byte swap is done, now start inter-byte swap. |
| 4919 |
def DWBytes4567 { |
| 4920 |
dag Word = (i32 (EXTRACT_SUBREG DWSwapInByte.Swap4, sub_32)); |
| 4921 |
} |
| 4922 |
|
| 4923 |
def DWBytes7456 { |
| 4924 |
dag Word = (RLWINM DWBytes4567.Word, 24, 0, 31); |
| 4925 |
} |
| 4926 |
|
| 4927 |
def DWBytes7656 { |
| 4928 |
dag Word = (RLWIMI DWBytes7456.Word, DWBytes4567.Word, 8, 8, 15); |
| 4929 |
} |
| 4930 |
|
| 4931 |
// B7 B6 B5 B4 in the right order |
| 4932 |
def DWBytes7654 { |
| 4933 |
dag Word = (RLWIMI DWBytes7656.Word, DWBytes4567.Word, 8, 24, 31); |
| 4934 |
dag DWord = |
| 4935 |
(i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), Word, sub_32)); |
| 4936 |
} |
| 4937 |
|
| 4938 |
def DWBytes0123 { |
| 4939 |
dag Word = (i32 (EXTRACT_SUBREG (RLDICL DWSwapInByte.Swap4, 32, 32), sub_32)); |
| 4940 |
} |
| 4941 |
|
| 4942 |
def DWBytes3012 { |
| 4943 |
dag Word = (RLWINM DWBytes0123.Word, 24, 0, 31); |
| 4944 |
} |
| 4945 |
|
| 4946 |
def DWBytes3212 { |
| 4947 |
dag Word = (RLWIMI DWBytes3012.Word, DWBytes0123.Word, 8, 8, 15); |
| 4948 |
} |
| 4949 |
|
| 4950 |
// B3 B2 B1 B0 in the right order |
| 4951 |
def DWBytes3210 { |
| 4952 |
dag Word = (RLWIMI DWBytes3212.Word, DWBytes0123.Word, 8, 24, 31); |
| 4953 |
dag DWord = |
| 4954 |
(i64 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), Word, sub_32)); |
| 4955 |
} |
| 4956 |
|
| 4957 |
// Now both high word and low word are reversed, next |
| 4958 |
// swap the high word and low word. |
| 4959 |
def : Pat<(i64 (bitreverse i64:$A)), |
| 4960 |
(OR8 (RLDICR DWBytes7654.DWord, 32, 31), DWBytes3210.DWord)>; |