| 1 |
//===-- TriCoreInstrInfo.td - Target Description for TriCore ---*- 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 TriCore instructions in TableGen format. |
| 11 |
// |
| 12 |
//===----------------------------------------------------------------------===// |
| 13 |
|
| 14 |
//===----------------------------------------------------------------------===// |
| 15 |
// Instruction format superclass. |
| 16 |
//===----------------------------------------------------------------------===// |
| 17 |
|
| 18 |
include "TriCoreInstrFormats.td" |
| 19 |
|
| 20 |
//===----------------------------------------------------------------------===// |
| 21 |
// TriCore specific DAG Nodes. |
| 22 |
// |
| 23 |
|
| 24 |
// Call |
| 25 |
def SDT_TriCoreCmp : SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, |
| 26 |
SDTCisSameAs<1, 2>, |
| 27 |
SDTCisVT<3, i32>]>; |
| 28 |
def SDT_TriCoreImask : SDTypeProfile<1, 3, [SDTCisVT<0, i64>, |
| 29 |
SDTCisVT<1, i32>, |
| 30 |
SDTCisVT<2, i32>, |
| 31 |
SDTCisVT<3, i32>]>; |
| 32 |
|
| 33 |
def SDT_TriCoreExtract : SDTypeProfile<1, 3, [SDTCisVT<0, i32>, |
| 34 |
SDTCisVT<1, i32>, |
| 35 |
SDTCisVT<2, i32>, |
| 36 |
SDTCisVT<3, i32>]>; |
| 37 |
|
| 38 |
def SDT_TriCoreLCmp : SDTypeProfile<1, 4, [SDTCisSameAs<0, 1>, |
| 39 |
SDTCisSameAs<1, 2>, |
| 40 |
SDTCisSameAs<2, 3>, |
| 41 |
SDTCisVT<4, i32>]>; |
| 42 |
def SDT_TriCoreBrCC : SDTypeProfile<0, 3, [SDTCisVT<0, OtherVT>, |
| 43 |
SDTCisVT<1, i32>, |
| 44 |
SDTCisVT<2, i32>]>; |
| 45 |
def SDT_TriCoreCall : SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>; |
| 46 |
def SDT_TriCoreSelectCC : SDTypeProfile<1, 4, [SDTCisSameAs<0, 1>, |
| 47 |
SDTCisSameAs<1, 2>, |
| 48 |
SDTCisVT<3, i32>, |
| 49 |
SDTCisVT<4, i32>]>; |
| 50 |
def SDT_TriCoreWrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, |
| 51 |
SDTCisPtrTy<0>]>; |
| 52 |
|
| 53 |
def SDT_TriCoreShift : SDTypeProfile<1, 2, [SDTCisVT<0, i32>, |
| 54 |
SDTCisVT<1, i32>, |
| 55 |
SDTCisVT<2, i32>]>; |
| 56 |
|
| 57 |
def SDT_TriCoreMovei32 : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, |
| 58 |
SDTCisVT<0, i32>]>; |
| 59 |
|
| 60 |
def SDT_TriCoreMovei64 : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, |
| 61 |
SDTCisVT<0, i64>]>; |
| 62 |
|
| 63 |
def TriCoreAbs : SDNode<"TriCoreISD::ABS", SDTIntUnaryOp>; |
| 64 |
def TriCoreAbsDif : SDNode<"TriCoreISD::ABSDIF", SDTIntBinOp>; |
| 65 |
def TriCoreBrCC : SDNode<"TriCoreISD::BR_CC", |
| 66 |
SDT_TriCoreBrCC, [SDNPHasChain, SDNPInGlue]>; |
| 67 |
def TriCoreCall : SDNode<"TriCoreISD::CALL", SDT_TriCoreCall, |
| 68 |
[ SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, SDNPVariadic ]>; |
| 69 |
def TriCoreCmp : SDNode<"TriCoreISD::CMP", |
| 70 |
SDT_TriCoreCmp, [SDNPOutGlue]>; |
| 71 |
def TriCoreLogicCmp: SDNode<"TriCoreISD::LOGICCMP", |
| 72 |
SDT_TriCoreLCmp, [SDNPInGlue, SDNPOutGlue]>; |
| 73 |
def TriCoreWrapper : SDNode<"TriCoreISD::Wrapper", SDT_TriCoreWrapper>; |
| 74 |
def TriCoreImask : SDNode<"TriCoreISD::IMASK", SDT_TriCoreImask>; |
| 75 |
def TriCoreSh : SDNode<"TriCoreISD::SH", SDT_TriCoreShift>; |
| 76 |
def TriCoreSha : SDNode<"TriCoreISD::SHA", SDT_TriCoreShift>; |
| 77 |
def TriCoreExtr : SDNode<"TriCoreISD::EXTR", SDT_TriCoreExtract>; |
| 78 |
def TriCoreSelectCC: SDNode<"TriCoreISD::SELECT_CC", SDT_TriCoreSelectCC, []>; |
| 79 |
|
| 80 |
def load_sym : SDNode<"TriCoreISD::LOAD_SYM", SDTIntUnaryOp>; |
| 81 |
|
| 82 |
def movei32 : SDNode<"TriCoreISD::MOVEi32", SDT_TriCoreMovei32>; |
| 83 |
|
| 84 |
|
| 85 |
def jmptarget : Operand<OtherVT> { |
| 86 |
let PrintMethod = "printPCRelImmOperand"; |
| 87 |
} |
| 88 |
|
| 89 |
// Operand for printing out a condition code. |
| 90 |
def cc : Operand<i32> { |
| 91 |
let PrintMethod = "printCCOperand"; |
| 92 |
} |
| 93 |
|
| 94 |
def isPointer : Predicate<"isPointer() == true">; |
| 95 |
def isnotPointer : Predicate<"isPointer() == false">; |
| 96 |
|
| 97 |
// TriCore Condition Codes |
| 98 |
def TriCore_COND_EQ : PatLeaf<(i32 0)>; |
| 99 |
def TriCore_COND_NE : PatLeaf<(i32 1)>; |
| 100 |
def TriCore_COND_GE : PatLeaf<(i32 2)>; |
| 101 |
def TriCore_COND_LT : PatLeaf<(i32 3)>; |
| 102 |
// TriCore Logic Codes |
| 103 |
def TriCore_LOGIC_AND_EQ : PatLeaf<(i32 0)>; |
| 104 |
def TriCore_LOGIC_AND_NE : PatLeaf<(i32 1)>; |
| 105 |
def TriCore_LOGIC_AND_GE : PatLeaf<(i32 2)>; |
| 106 |
def TriCore_LOGIC_AND_LT : PatLeaf<(i32 3)>; |
| 107 |
def TriCore_LOGIC_OR_EQ : PatLeaf<(i32 0)>; |
| 108 |
def TriCore_LOGIC_OR_NE : PatLeaf<(i32 1)>; |
| 109 |
def TriCore_LOGIC_OR_GE : PatLeaf<(i32 12)>; |
| 110 |
def TriCore_LOGIC_OR_LT : PatLeaf<(i32 13)>; |
| 111 |
|
| 112 |
// These are target-independent nodes, but have target-specific formats. |
| 113 |
def SDT_TriCoreCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>; |
| 114 |
def SDT_TriCoreCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, |
| 115 |
SDTCisVT<1, i32> ]>; |
| 116 |
|
| 117 |
def TriCoreRetFlag : SDNode<"TriCoreISD::RET_FLAG", SDTNone, |
| 118 |
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>; |
| 119 |
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_TriCoreCallSeqStart, |
| 120 |
[SDNPHasChain, SDNPOutGlue, SDNPSideEffect]>; |
| 121 |
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_TriCoreCallSeqEnd, |
| 122 |
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, |
| 123 |
SDNPSideEffect]>; |
| 124 |
|
| 125 |
//===----------------------------------------------------------------------===// |
| 126 |
// Instruction Pattern Stuff |
| 127 |
//===----------------------------------------------------------------------===// |
| 128 |
|
| 129 |
// Lower 32 bits of a 64-bit word |
| 130 |
def LO32 : SDNodeXForm<imm, [{ |
| 131 |
return CurDAG->getTargetConstant((uint32_t) N->getZExtValue(), SDLoc(N), |
| 132 |
MVT::i32); |
| 133 |
}]>; |
| 134 |
|
| 135 |
// Higher 32 bits of a 64-bit word |
| 136 |
def HI32 : SDNodeXForm<imm, [{ |
| 137 |
return CurDAG->getTargetConstant((uint32_t) (N->getZExtValue()>>32), SDLoc(N), |
| 138 |
MVT::i32); |
| 139 |
}]>; |
| 140 |
|
| 141 |
def INVERT_VAL : SDNodeXForm<imm, [{ |
| 142 |
outs() << "vall: "<< N->getZExtValue() <<"\n"; |
| 143 |
return CurDAG->getTargetConstant(-N->getZExtValue(), SDLoc(N), MVT::i32); |
| 144 |
}]>; |
| 145 |
|
| 146 |
def SHIFTAMT : SDNodeXForm<imm, [{ |
| 147 |
outs() << "vall: "<< N->getZExtValue() <<"\n"; |
| 148 |
return CurDAG->getTargetConstant(N->getZExtValue() - 32, SDLoc(N), MVT::i32); |
| 149 |
}]>; |
| 150 |
|
| 151 |
def SHIFTAMT_POS : SDNodeXForm<imm, [{ |
| 152 |
outs() << "vall: "<< N->getZExtValue() <<"\n"; |
| 153 |
return CurDAG->getTargetConstant((32 - N->getZExtValue()), SDLoc(N), MVT::i32); |
| 154 |
}]>; |
| 155 |
|
| 156 |
def SHIFTAMT_NEG : SDNodeXForm<imm, [{ |
| 157 |
return CurDAG->getTargetConstant(-(N->getZExtValue() - 32), SDLoc(N), |
| 158 |
MVT::i32); |
| 159 |
}]>; |
| 160 |
|
| 161 |
def imm32_64 : PatLeaf<(imm), |
| 162 |
[{ |
| 163 |
uint64_t val = N->getZExtValue(); |
| 164 |
return val >= 32 && val < 64; |
| 165 |
}]>; |
| 166 |
|
| 167 |
def imm0_31 : PatLeaf<(imm), |
| 168 |
[{ |
| 169 |
uint64_t val = N->getZExtValue(); |
| 170 |
outs() <<"imm0_31: " << val << "\n"; |
| 171 |
return val > 0 && val < 32; |
| 172 |
}]>; |
| 173 |
|
| 174 |
//Operands |
| 175 |
def s4imm : Operand<i32> { let PrintMethod = "printSExtImm<4>"; } |
| 176 |
def s6imm : Operand<i32> { let PrintMethod = "printSExtImm<6>"; } |
| 177 |
def s8imm : Operand<i32> { let PrintMethod = "printSExtImm<8>"; } |
| 178 |
def s9imm : Operand<i32> { let PrintMethod = "printSExtImm<9>"; } |
| 179 |
def s10imm : Operand<i32> { let PrintMethod = "printSExtImm<10>"; } |
| 180 |
def s16imm : Operand<i32> { let PrintMethod = "printSExtImm<16>"; } |
| 181 |
def s24imm : Operand<i32> { let PrintMethod = "printSExtImm<24>"; } |
| 182 |
def u8imm : Operand<i32> { let PrintMethod = "printZExtImm<8>"; } |
| 183 |
def u4imm : Operand<i32> { let PrintMethod = "printZExtImm<4>"; } |
| 184 |
def u2imm : Operand<i32> { let PrintMethod = "printZExtImm<2>"; } |
| 185 |
def u9imm : Operand<i32> { let PrintMethod = "printZExtImm<9>"; } |
| 186 |
def u16imm : Operand<i32> { let PrintMethod = "printZExtImm<16>"; } |
| 187 |
|
| 188 |
def oext4imm: Operand<i32> { let PrintMethod = "printOExtImm<4>"; } |
| 189 |
|
| 190 |
def off18imm : Operand<i32> { let PrintMethod = "printOff18Imm"; } |
| 191 |
|
| 192 |
def disp24imm : Operand<i32> { let PrintMethod = "printDisp24Imm"; } |
| 193 |
def disp15imm : Operand<i32> { let PrintMethod = "printDisp15Imm"; } |
| 194 |
def disp8imm : Operand<i32> { let PrintMethod = "printDisp8Imm"; } |
| 195 |
def disp4imm : Operand<i32> { let PrintMethod = "printDisp4Imm"; } |
| 196 |
|
| 197 |
def PairAddrRegsOp : RegisterOperand<PairAddrRegs, "printPairAddrRegsOperand">; |
| 198 |
|
| 199 |
//Nodes |
| 200 |
def immSExt4 : PatLeaf<(imm), [{ return isInt<4>(N->getSExtValue()); }]>; |
| 201 |
def immSExt6 : PatLeaf<(imm), [{ return isInt<6>(N->getSExtValue()); }]>; |
| 202 |
def immSExt9 : PatLeaf<(imm), [{ return isInt<9>(N->getSExtValue()); }]>; |
| 203 |
def immSExt10 : PatLeaf<(imm), [{ return isInt<10>(N->getSExtValue()); }]>; |
| 204 |
def immSExt16 : PatLeaf<(imm), [{ return isInt<16>(N->getSExtValue()); }]>; |
| 205 |
def immSExt24 : PatLeaf<(imm), [{ return isInt<24>(N->getSExtValue()); }]>; |
| 206 |
|
| 207 |
def immZExt2 : ImmLeaf<i32, [{return Imm == (Imm & 0x3);}]>; |
| 208 |
def immZExt4 : ImmLeaf<i32, [{return Imm == (Imm & 0xf);}]>; |
| 209 |
def immZExt8 : ImmLeaf<i32, [{return Imm == (Imm & 0xff);}]>; |
| 210 |
def immZExt9 : ImmLeaf<i32, [{return Imm == (Imm & 0x1ff);}]>; |
| 211 |
def immZExt16 : ImmLeaf<i32, [{return Imm == (Imm & 0xffff);}]>; |
| 212 |
|
| 213 |
/// 16-Bit Opcode Formats |
| 214 |
|
| 215 |
class ISC_D15C<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 216 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 217 |
asmstr # " d15, $const8", []>; |
| 218 |
|
| 219 |
class ISC_A10C<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 220 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 221 |
asmstr # " sp, $const8", []>; |
| 222 |
|
| 223 |
class ISC_A15A10C<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 224 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 225 |
asmstr # " a15, [sp]$const8", []>; |
| 226 |
|
| 227 |
class ISC_D15A10C<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 228 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 229 |
asmstr # " d15, [sp]$const8", []>; |
| 230 |
|
| 231 |
class ISC_A10CA15<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 232 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 233 |
asmstr # " [sp]$const8, a15", []>; |
| 234 |
|
| 235 |
class ISC_A10CD15<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 236 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 237 |
asmstr # " [sp]$const8, d15", []>; |
| 238 |
|
| 239 |
class ISC_C<bits<8> op1, string asmstr, Operand TypeC=u8imm> |
| 240 |
: SC<op1, (outs), (ins TypeC:$const8), |
| 241 |
asmstr # " $const8", []>; |
| 242 |
|
| 243 |
class ISRC_dC<bits<8> op1, string asmstr, RegisterClass RCd=RD, Operand TypeC=s4imm> |
| 244 |
: SRC<op1, (outs RCd:$d), (ins TypeC:$const4), |
| 245 |
asmstr # " $d, $const4", []>; |
| 246 |
|
| 247 |
class ISRC_dD15C<bits<8> op1, string asmstr, RegisterClass RCd=RD, Operand TypeC=s4imm> |
| 248 |
: SRC<op1, (outs RCd:$d), (ins TypeC:$const4), |
| 249 |
asmstr # " $d, d15, $const4", []>; |
| 250 |
|
| 251 |
class ISRC_D15dC<bits<8> op1, string asmstr, RegisterClass RCd=RD, Operand TypeC=s4imm> |
| 252 |
: SRC<op1, (outs RCd:$d), (ins TypeC:$const4), |
| 253 |
asmstr # " d15, $d, $const4", []>; |
| 254 |
|
| 255 |
multiclass mISRR_SRC<bits<8> op_srr, bits<8> op_src, string asmstr, |
| 256 |
RegisterClass RCd=RD, RegisterClass RC2=RD, Operand Oc=u4imm, string posfix="">{ |
| 257 |
def _srr#posfix: SRR<op_srr, (outs RCd:$d), (ins RC2:$s2), |
| 258 |
asmstr # " d15, $d, $s2", []>; |
| 259 |
def _src#posfix: SRC<op_src, (outs RCd:$d), (ins Oc:$const4), |
| 260 |
asmstr # " d15, $d, $const4", []>; |
| 261 |
} |
| 262 |
|
| 263 |
multiclass mISRC_a15a<bits<8> op1, bits<8> op2, bits<8> op3, |
| 264 |
string asmstr> { |
| 265 |
def _src : ISRC_dC<op1, asmstr>; |
| 266 |
def _src_a15 : ISRC_dD15C<op2, asmstr>, Requires<[HasV120_UP]>; |
| 267 |
def _src_15a : ISRC_D15dC<op3, asmstr>; |
| 268 |
} |
| 269 |
|
| 270 |
/// 32-Bit Opcode Formats |
| 271 |
|
| 272 |
/// RC |
| 273 |
|
| 274 |
class IRC_C<bits<8> op1, bits<7> op2, string asmstr> |
| 275 |
: RC<op1, op2, (outs), (ins s9imm:$const9), |
| 276 |
asmstr # " $const9", []>; |
| 277 |
|
| 278 |
class IRC<bits<8> op1, bits<7> op2, string asmstr, RegisterClass RCd=RD, RegisterClass RC1=RD, Operand TypeC=s9imm> |
| 279 |
: RC<op1, op2, (outs RCd:$d), (ins RC1:$s1, TypeC:$const9), |
| 280 |
asmstr # " $d, $s1, $const9", []>; |
| 281 |
|
| 282 |
/// RR |
| 283 |
|
| 284 |
class IRR_0<bits<8> op1, bits<8> op2, string asmstr>: RR<op1, op2, (outs), (ins), asmstr, []>; |
| 285 |
|
| 286 |
class IRR_R1<bits<8> op1, bits<8> op2, string asmstr, RegisterClass RC=RD> |
| 287 |
: RR<op1, op2, (outs), (ins RC:$s1), asmstr # " $s1", []>; |
| 288 |
class IRR_R2<bits<8> op1, bits<8> op2, string asmstr, RegisterClass RC=RD> |
| 289 |
: RR<op1, op2, (outs), (ins RC:$s2), asmstr # " $s2", []>; |
| 290 |
|
| 291 |
/// op R[c], R[a] |
| 292 |
class IRR_a<bits<8> op1, bits<8> op2, string asmstr, RegisterClass cd=RD, RegisterClass c1=RD> |
| 293 |
: RR<op1, op2, (outs cd:$d), (ins c1:$s1), |
| 294 |
asmstr # " $d, $s1", []>; |
| 295 |
|
| 296 |
/// op R[c], R[b] |
| 297 |
class IRR_b<bits<8> op1, bits<8> op2, string asmstr, RegisterClass cd=RD, RegisterClass c2=RD> |
| 298 |
: RR<op1, op2, (outs cd:$d), (ins c2:$s1, c2:$s2), |
| 299 |
asmstr # " $d, $s2", []>; |
| 300 |
|
| 301 |
/// R[c], R[a], R[b] |
| 302 |
class IRR_2<bits<8> op1, bits<8> op2, string asmstr |
| 303 |
, RegisterClass cd=RD, RegisterClass c1=RD, RegisterClass c2=RD> |
| 304 |
: RR<op1, op2, (outs cd:$d), (ins c1:$s1, c2:$s2), asmstr, []>; |
| 305 |
|
| 306 |
class IRR_dab<bits<8> op1, bits<8> op2, string asmstr, |
| 307 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD> |
| 308 |
: IRR_2<op1, op2, asmstr # " $d, $s1, $s2", RCd, RC1, RC2>; |
| 309 |
|
| 310 |
class IRR_dba<bits<8> op1, bits<8> op2, string asmstr, |
| 311 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD> |
| 312 |
: IRR_2<op1, op2, asmstr # " $d, $s2, $s1", RCd, RC1, RC2>; |
| 313 |
|
| 314 |
class IRR_dabn<bits<8> op1, bits<8> op2, string asmstr, |
| 315 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD, Operand TypeC=u2imm> |
| 316 |
: RR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC2:$s2, TypeC:$n), asmstr#" $d, $s1, $s2, $n", []>; |
| 317 |
class IRR_dban<bits<8> op1, bits<8> op2, string asmstr, |
| 318 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD, Operand TypeC=u2imm> |
| 319 |
: RR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC2:$s2, TypeC:$n), asmstr#" $d, $s2, $s1, $n", []>; |
| 320 |
|
| 321 |
multiclass mIRR_RC<bits<8> rr1, bits<8> rr2, bits<8> rc1, bits<7> rc2, string asmstr, |
| 322 |
RegisterClass RCd=RD, RegisterClass RC1=RD, Operand TypeC=s9imm> { |
| 323 |
def _rr : IRR_dab<rr1, rr2, asmstr, RCd, RC1>; |
| 324 |
def _rc : IRC<rc1, rc2, asmstr, RCd, RC1, TypeC>; |
| 325 |
} |
| 326 |
|
| 327 |
class IRLC<bits<8> op1, string asmstr, Operand TypeC=s16imm, RegisterClass RCd=RD, RegisterClass RC1=RD> |
| 328 |
: RLC<op1, (outs RCd:$d), (ins RC1:$s1, TypeC:$const16), |
| 329 |
asmstr # " $d, $s1, $const16", |
| 330 |
[]>; |
| 331 |
|
| 332 |
|
| 333 |
class ISRR_db<bits<8> op1, string asmstr, RegisterClass RCd=RD, RegisterClass RC2=RD> |
| 334 |
: SRR<op1, (outs RCd:$d), (ins RC2:$s2), |
| 335 |
asmstr # " $d, $s2", []>; |
| 336 |
|
| 337 |
class ISRR_dD15b<bits<8> op1, string asmstr, RegisterClass RCd=RD, RegisterClass RC2=RD> |
| 338 |
: SRR<op1, (outs RCd:$d), (ins RC2:$s2), |
| 339 |
asmstr # " $d, d15, $s2", []>; |
| 340 |
|
| 341 |
class ISRR_D15db<bits<8> op1, string asmstr, RegisterClass RCd=RD, RegisterClass RC2=RD> |
| 342 |
: SRR<op1, (outs RCd:$d), (ins RC2:$s2), |
| 343 |
asmstr # " d15, $d, $s2", []>; |
| 344 |
|
| 345 |
|
| 346 |
multiclass mISRR_s<bits<8> op1, string asmstr>{ |
| 347 |
def _srr : ISRR_db<op1, asmstr>; |
| 348 |
} |
| 349 |
|
| 350 |
multiclass mISRR_a15a<bits<8> op1, bits<8> op2, bits<8> op3, |
| 351 |
string asmstr>{ |
| 352 |
def _srr : ISRR_db<op1, asmstr>; |
| 353 |
def _srr_a15 : ISRR_dD15b<op2, asmstr>, Requires<[HasV120_UP]>; |
| 354 |
def _srr_15a : ISRR_D15db<op3, asmstr>; |
| 355 |
} |
| 356 |
|
| 357 |
class IBIT<bits<8> op1, bits<2> op2, string asmstr> |
| 358 |
: BIT<op1, op2, (outs RD:$d), (ins RD:$s1, RD:$s2, u4imm:$pos1, u4imm:$pos_r), |
| 359 |
asmstr # " $d, $s1, $pos1, $s2, $pos_r", |
| 360 |
[]>; |
| 361 |
|
| 362 |
class NsRequires<list<Predicate> Ps> : Requires<Ps> { |
| 363 |
string DecoderNamespace = !cond(!eq(HasV110, !head(Ps)): "v110", |
| 364 |
!eq(HasV120, !head(Ps)): "v120", |
| 365 |
!eq(HasV130, !head(Ps)): "v130", |
| 366 |
!eq(HasV131, !head(Ps)): "v131", |
| 367 |
!eq(HasV160, !head(Ps)): "v160", |
| 368 |
!eq(HasV161, !head(Ps)): "v161", |
| 369 |
!eq(HasV162, !head(Ps)): "v162", |
| 370 |
true: ""); |
| 371 |
} |
| 372 |
|
| 373 |
//===----------------------------------------------------------------------===// |
| 374 |
// Pseudo Instructions |
| 375 |
//===----------------------------------------------------------------------===// |
| 376 |
|
| 377 |
|
| 378 |
//===----------------------------------------------------------------------===// |
| 379 |
// Instructions |
| 380 |
//===----------------------------------------------------------------------===// |
| 381 |
|
| 382 |
// Arithmetic Instructions |
| 383 |
|
| 384 |
// Absolute Value Instructions |
| 385 |
let Defs = [PSW] in { |
| 386 |
def ABS_rr : RR<0x0B, 0x1C, (outs RD:$d), |
| 387 |
(ins RD:$s2), |
| 388 |
"abs $d, $s2", |
| 389 |
[(set RD:$d, (TriCoreAbs RD:$s2))]>; |
| 390 |
def ABS_B_rr : RR<0x0B, 0x5C, (outs RD:$d), |
| 391 |
(ins RD:$s2), |
| 392 |
"abs.b $d, $s2", |
| 393 |
[(set RD:$d, (TriCoreAbs RD:$s2))]>; |
| 394 |
def ABS_H_rr : RR<0x0B, 0x7C, (outs RD:$d), |
| 395 |
(ins RD:$s2), |
| 396 |
"abs.h $d, $s2", |
| 397 |
[(set RD:$d, (TriCoreAbs RD:$s2))]>; |
| 398 |
|
| 399 |
def ABSDIF_rc : RC<0x8B, 0x0E, (outs RD:$d), |
| 400 |
(ins RD:$s1, s9imm:$const9), "absdif $d, $s1, $const9", |
| 401 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, immSExt9:$const9))]>; |
| 402 |
def ABSDIF_rr : RR<0x0B, 0x0E, (outs RD:$d), |
| 403 |
(ins RD:$s1, RD:$s2), "absdif $d, $s1, $s2", |
| 404 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 405 |
def ABSDIF_B_rr : RR<0x0B, 0x4E, (outs RD:$d), |
| 406 |
(ins RD:$s1, RD:$s2), "absdif.b $d, $s1, $s2", |
| 407 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 408 |
def ABSDIF_H_rr : RR<0x0B, 0x6E, (outs RD:$d), |
| 409 |
(ins RD:$s1, RD:$s2), "absdif.h $d, $s1, $s2", |
| 410 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 411 |
|
| 412 |
def ABSDIFS_rc : RC<0x8B, 0x0F, (outs RD:$d), |
| 413 |
(ins RD:$s1, RD:$s2), "absdifs $d, $s1, $s2", |
| 414 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 415 |
def ABSDIFS_rr : RR<0x0B, 0x0F, (outs RD:$d), |
| 416 |
(ins RD:$s1, RD:$s2), "absdifs $d, $s1, $s2", |
| 417 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 418 |
def ABSDIFS_B_rr_v110 : RR<0x0B, 0x4F, (outs RD:$d), |
| 419 |
(ins RD:$s1, RD:$s2), "absdifs.b $d, $s1, $s2", |
| 420 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]> |
| 421 |
, NsRequires<[HasV110]>; |
| 422 |
def ABSDIFS_H_rr : RR<0x0B, 0x6F, (outs RD:$d), |
| 423 |
(ins RD:$s1, RD:$s2), "absdifs.h $d, $s1, $s2", |
| 424 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 425 |
|
| 426 |
def ABSS_rr : RR<0x0B, 0x1D, (outs RD:$d), |
| 427 |
(ins RD:$s1, RD:$s2), "abss $d, $s2", |
| 428 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 429 |
def ABSS_B_rr_v110 : RR<0x0B, 0x5D, (outs RD:$d), |
| 430 |
(ins RD:$s1, RD:$s2), "abss.b $d, $s2", |
| 431 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]> |
| 432 |
, NsRequires<[HasV110]>; |
| 433 |
def ABSS_H_rr : RR<0x0B, 0x7D, (outs RD:$d), |
| 434 |
(ins RD:$s1, RD:$s2), "abss.h $d, $s2", |
| 435 |
[(set RD:$d, (TriCoreAbsDif RD:$s1, RD:$s2))]>; |
| 436 |
} |
| 437 |
|
| 438 |
multiclass mIB_H<bits<8> brr1, bits<8> brr2, bits<8> hrr1, bits<8> hrr2, |
| 439 |
string asmstr> { |
| 440 |
def _B_rr : IRR_dab<brr1, brr2, asmstr # ".b">; |
| 441 |
def _H_rr : IRR_dab<hrr1, hrr2, asmstr # ".h">; |
| 442 |
} |
| 443 |
|
| 444 |
// - ADD Instructions |
| 445 |
|
| 446 |
defm ADD : mIRR_RC<0x0B, 0x00, 0x8B, 0x00, "add">, |
| 447 |
mISRC_a15a<0xC2, 0x92, 0x9A, "add">, |
| 448 |
mISRR_a15a<0x42, 0x12, 0x1A, "add">, |
| 449 |
mIB_H<0x0B, 0x40, 0x0B, 0x60, "add">; |
| 450 |
|
| 451 |
multiclass mIRR_SRC_SRR__A<bits<8> rr1, bits<8> rr2, bits<8> src1, bits<8> srr1, |
| 452 |
string asmstr> { |
| 453 |
def _rr : IRR_dab<rr1, rr2, asmstr, RA, RA, RA>; |
| 454 |
def _src : ISRC_dC<src1, asmstr, RA>, Requires<[HasV120_UP]>; |
| 455 |
def _srr : ISRR_db<srr1, asmstr, RA, RA>, Requires<[HasV120_UP]>; |
| 456 |
} |
| 457 |
|
| 458 |
defm ADD_A : mIRR_SRC_SRR__A<0x01, 0x01, 0xB0, 0x30, "add.a">; |
| 459 |
defm ADDC : mIRR_RC<0x0B, 0x05, 0x8B, 0x05, "addc">; |
| 460 |
|
| 461 |
multiclass mIRLC<bits<8> op1, bits<8> op2, bits<8> op3, string asmstr>{ |
| 462 |
def _rlc : IRLC<op1, asmstr>; |
| 463 |
def H_rlc : IRLC<op2, asmstr # "h", u16imm>; |
| 464 |
def H_A_rlc : IRLC<op3, asmstr # "h.a", u16imm, RA, RA>; |
| 465 |
} |
| 466 |
|
| 467 |
defm ADDI : mIRLC<0x1B, 0x9B, 0x11, "addi">; |
| 468 |
|
| 469 |
multiclass mIH_HU_U<bits<8> h1, bits<8> h2, |
| 470 |
bits<8> hu1, bits<8> hu2, |
| 471 |
bits<8> u1, bits<8> u2, |
| 472 |
string asmstr>{ |
| 473 |
def _H : IRR_dab<h1, h2, asmstr # ".h">; |
| 474 |
def _HU : IRR_dab<hu1,hu2,asmstr # ".hu">; |
| 475 |
def _U : IRR_dab<u1, u2, asmstr # ".u">; |
| 476 |
} |
| 477 |
|
| 478 |
defm ADDS : mIRR_RC<0x0B, 0x02, 0x8B, 0x02, "adds">, |
| 479 |
mISRR_s<0x22, "adds">, |
| 480 |
mIH_HU_U<0x0B, 0x62, 0x0B, 0x63, 0x0B, 0x03, "adds">; |
| 481 |
def ADDS_U_rc : IRC<0x8B, 0x03, "adds.u">; |
| 482 |
def ADDS_B_rr : IRR_dab<0x0B, 0x42, "adds.b">, NsRequires<[HasV110]>; |
| 483 |
|
| 484 |
def ADDSC_A_srrs_v110 : SRRS<0x10, (outs RA:$d), (ins RD:$s2, u2imm:$n), |
| 485 |
"addsc.a $d, $s2, $n", []> |
| 486 |
, NsRequires<[HasV110]>; |
| 487 |
def ADDSC_A_srrs: SRRS<0x10, (outs RA:$d), (ins RA:$s2, u2imm:$n), |
| 488 |
"addsc.a $d, $s2, d15, $n", []> |
| 489 |
, Requires<[HasV120_UP]>; |
| 490 |
|
| 491 |
def ADDSC_A_rr_v110: IRR_dabn<0x01, 0x60, "addsc.a", RA, RA, RD>, NsRequires<[HasV110]>; |
| 492 |
def ADDSC_A_rr : IRR_dban<0x01, 0x60, "addsc.a", RA, RD, RA>, Requires<[HasV120_UP]>; |
| 493 |
|
| 494 |
def ADDSC_AT_rr_v110 : IRR_dab<0x01, 0x62, "addsc.at", RA, RA>, NsRequires<[HasV110]>; |
| 495 |
def ADDSC_AT_rr : IRR_dba<0x01, 0x62, "addsc.at", RA, RD, RA>, Requires<[HasV120_UP]>; |
| 496 |
|
| 497 |
def ADDS_BU_rr_v110 : IRR_dab<0x0B, 0x43, "adds.bu">, Requires<[HasV110]>; |
| 498 |
|
| 499 |
defm ADDX : mIRR_RC<0x0B, 0x04, 0x8B, 0x04, "addx">; |
| 500 |
|
| 501 |
|
| 502 |
/// AND Instructions |
| 503 |
|
| 504 |
defm AND : mIRR_RC<0x0F, 0x08, 0x8F, 0x08, "and">; |
| 505 |
|
| 506 |
def AND_srr : ISRR_db<0x26, "and">, Requires<[HasV120_UP]>; |
| 507 |
def AND_srr_v110 : ISRR_db<0x16, "and">, NsRequires<[HasV110]>; |
| 508 |
def AND_sc : ISC_D15C<0x16, "and">, Requires<[HasV120_UP]>; |
| 509 |
def AND_sc_v110 : ISC_D15C<0x96, "and">, NsRequires<[HasV110]>; |
| 510 |
|
| 511 |
def AND_AND_T : IBIT<0x47, 0x00, "and.and.t">; |
| 512 |
def AND_ANDN_T : IBIT<0x47, 0x03, "and.andn.t">; |
| 513 |
def AND_NOR_T : IBIT<0x47, 0x02, "and.nor.t">; |
| 514 |
def AND_OR_T : IBIT<0x47, 0x01, "and.or.t">; |
| 515 |
def AND_T : IBIT<0x87, 0x00, "and.t">; |
| 516 |
def ANDN_T : IBIT<0x87, 0x03, "andn.t">; |
| 517 |
|
| 518 |
defm AND_EQ : mIRR_RC<0x0B, 0x20, 0x8B, 0x20, "and.eq">; |
| 519 |
defm AND_GE : mIRR_RC<0x0B, 0x24, 0x8B, 0x24, "and.ge">; |
| 520 |
defm AND_GE_U : mIRR_RC<0x0B, 0x25, 0x8B, 0x25, "and.ge.u">; |
| 521 |
defm AND_LT : mIRR_RC<0x0B, 0x22, 0x8B, 0x22, "and.lt">; |
| 522 |
defm AND_LT_U : mIRR_RC<0x0B, 0x23, 0x8B, 0x23, "and.lt.u">; |
| 523 |
defm AND_NE : mIRR_RC<0x0B, 0x21, 0x8B, 0x21, "and.ne">; |
| 524 |
|
| 525 |
defm ANDN : mIRR_RC<0x0F, 0x0E, 0x8F, 0x0E, "andn">; |
| 526 |
|
| 527 |
/// BISR |
| 528 |
def BISR_rc : IRC_C<0xAD, 0x00, "bisr">; |
| 529 |
def BISR_rc_v161 : IRC_C<0xAD, 0x01, "bisr">, NsRequires<[HasV161]>; |
| 530 |
|
| 531 |
def BISR_sc_v110 : ISC_C<0xC0, "bisr">, NsRequires<[HasV110]>; |
| 532 |
def BISR_sc : ISC_C<0xE0, "bisr">, Requires<[HasV120_UP]>; |
| 533 |
|
| 534 |
/// Multiple Instructions (RR) |
| 535 |
def BMERGAE_rr_v110 : IRR_dab<0x4B, 0x00, "bmerge">, NsRequires<[HasV110]>; |
| 536 |
def BMERGE_rr : IRR_dab<0x4B, 0x01, "bmerge">, Requires<[HasV120_UP]>; |
| 537 |
|
| 538 |
def BSPLIT_rr_v110: IRR_a<0x4B, 0x60, "bsplit", RE>, NsRequires<[HasV110]>; |
| 539 |
def BSPLIT_rr : IRR_a<0x4B, 0x09, "bsplit", RE>, Requires<[HasV120_UP]>; |
| 540 |
|
| 541 |
/// BO Opcode Formats |
| 542 |
// A[b], off10 (BO) (Base + Short Offset Addressing Mode) |
| 543 |
class IBO_bso<bits<8> op1, bits<6> op2, string asmstr> |
| 544 |
: BO<op1, op2, (outs), (ins RA:$s2, s10imm:$off10), |
| 545 |
asmstr # " [$s2]$off10", []>; |
| 546 |
// P[b] (BO) (Bit Reverse Addressing Mode) |
| 547 |
class IBO_r<bits<8> op1, bits<6> op2, string asmstr> |
| 548 |
: BO<op1, op2, (outs), (ins RP:$s2), |
| 549 |
asmstr # " [${s2}+r]", []>; |
| 550 |
// P[b], off10 (BO) (Circular Addressing Mode) |
| 551 |
class IBO_c<bits<8> op1, bits<6> op2, string asmstr> |
| 552 |
: BO<op1, op2, (outs), (ins RP:$s2, s10imm:$off10), |
| 553 |
asmstr # " [${s2}+c]$off10", []>; |
| 554 |
// A[b], off10 (BO) (Post-increment Addressing Mode) |
| 555 |
|
| 556 |
class IBO_pos<bits<8> op1, bits<6> op2, string asmstr> |
| 557 |
: BO<op1, op2, (outs), (ins RA:$s2, s10imm:$off10), |
| 558 |
asmstr # " [${s2}+]$off10", []>; |
| 559 |
// A[b], off10 (BO) (Pre-increment Addressing Mode) |
| 560 |
class IBO_pre<bits<8> op1, bits<6> op2, string asmstr> |
| 561 |
: BO<op1, op2, (outs), (ins RA:$s2, s10imm:$off10), |
| 562 |
asmstr # " [+${s2}]$off10", []>; |
| 563 |
|
| 564 |
|
| 565 |
multiclass mI_CACHEI_<bits<8> prefix, bits<6> op12, bits<6> op22, bits<6> op32, string asmstr> { |
| 566 |
def _bo_bso : IBO_bso<prefix, op12, asmstr>; |
| 567 |
def _bo_pos : IBO_pos<prefix, op22, asmstr>; |
| 568 |
def _bo_pre : IBO_pre<prefix, op32, asmstr>; |
| 569 |
} |
| 570 |
|
| 571 |
multiclass mI_CACHE_<bits<8> prefixi, bits<8> prefix_r_c, bits<6> bso, bits<6> pos_r, bits<6> pre_c, string asmstr>{ |
| 572 |
defm "" : mI_CACHEI_<prefixi, bso, pos_r, pre_c, asmstr>; |
| 573 |
def _bo_r: IBO_r<prefix_r_c, pos_r, asmstr>; |
| 574 |
def _bo_c: IBO_c<prefix_r_c, pre_c, asmstr>; |
| 575 |
} |
| 576 |
|
| 577 |
/// CACHEA.* Instructions |
| 578 |
|
| 579 |
defm CACHEA_I : mI_CACHE_<0x89, 0xA9, 0x2E, 0x0E, 0x1E, "cachea.i">, Requires<[HasV120_UP]>; |
| 580 |
defm CACHEA_W : mI_CACHE_<0x89, 0xA9, 0x2C, 0x0C, 0x1C, "cachea.w">, Requires<[HasV120_UP]>; |
| 581 |
defm CACHEA_WI: mI_CACHE_<0x89, 0xA9, 0x2D, 0x0D, 0x1D, "cachea.wi">, Requires<[HasV120_UP]>; |
| 582 |
|
| 583 |
defm CACHEI_W : mI_CACHEI_<0x89, 0x2B, 0x0B, 0x1B, "cachei.w">, Requires<[HasV131_UP]>; |
| 584 |
defm CACHEI_I : mI_CACHEI_<0x89, 0x2A, 0x0A, 0x1A, "cachei.i">, Requires<[HasV160_UP]>; |
| 585 |
defm CACHEI_WI: mI_CACHEI_<0x89, 0x2F, 0x0F, 0x1F, "cachei.wi">, Requires<[HasV131_UP]>; |
| 586 |
|
| 587 |
|
| 588 |
/// RRR Opcodes Formats |
| 589 |
|
| 590 |
class IRRR<bits<8>op1, bits<4> op2, string asmstr, |
| 591 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD, RegisterClass RC3=RD> |
| 592 |
: RRR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC2:$s2, RC3:$s3), |
| 593 |
asmstr # " $d, $s3, $s1, $s2", []>; |
| 594 |
|
| 595 |
class IRRR_d31<bits<8>op1, bits<4> op2, string asmstr, |
| 596 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD, RegisterClass RC3=RD> |
| 597 |
: RRR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC2:$s2, RC3:$s3), asmstr # " $d, $s3, $s1", []>; |
| 598 |
|
| 599 |
class IRRR_d32<bits<8>op1, bits<4> op2, string asmstr, |
| 600 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC2=RD, RegisterClass RC3=RD> |
| 601 |
: RRR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC2:$s2, RC3:$s3), |
| 602 |
asmstr # " $d, $s3, $s2", []>; |
| 603 |
|
| 604 |
/// RCR Opcodes Formats |
| 605 |
class IRCR<bits<8> op1, bits<3> op2, string asmstr, |
| 606 |
RegisterClass RCd=RD, RegisterClass RC1=RD, RegisterClass RC3=RD, Operand TypeC=s9imm> |
| 607 |
: RCR<op1, op2, (outs RCd:$d), (ins RC1:$s1, RC3:$s3, TypeC:$const9), |
| 608 |
asmstr # " $d, $s3, $s1, $const9", []>; |
| 609 |
|
| 610 |
multiclass mIRCR<bits<8>op1, bits<3> op2, bits<8>op3, bits<3> op4, string asmstr>{ |
| 611 |
def _rcr : IRCR<op1, op2, asmstr>; |
| 612 |
def _rcr_e : IRCR<op3, op4, asmstr, RE, RD, RE, s9imm>, Requires<[HasV120_UP]>; |
| 613 |
} |
| 614 |
|
| 615 |
/// CADD Instructions |
| 616 |
def CADD_srr_v110 : ISRR_dD15b<0x0A, "cadd">, NsRequires<[HasV110]>; |
| 617 |
|
| 618 |
def CADD_rcr : IRCR<0xAB, 0x00, "cadd">; |
| 619 |
def CADD_rrr : IRRR<0x2B, 0x00, "cadd">; |
| 620 |
def CADD_src : ISRC_dD15C<0x8A, "cadd">; |
| 621 |
|
| 622 |
multiclass mI_CADDnA_CSUBnA_v110_<bits<8> rrr1, bits<4> rrr2, bits<8> rcr1, bits<3> rcr2, string asmstr>{ |
| 623 |
def _rrr_v110: IRRR<rrr1, rrr2, asmstr, RA, RA, RA, RD>, NsRequires<[HasV110]>; |
| 624 |
if !or(!eq(asmstr, "cadd.a"), !eq(asmstr, "caddn.a")) then { |
| 625 |
def _rcr_v110: RCR<rcr1, rcr2, (outs RA:$d), (ins RA:$s1, RD:$s3, s9imm:$const9), |
| 626 |
asmstr#" $d, $s3, $s1, $const9", []> |
| 627 |
, NsRequires<[HasV110]>; |
| 628 |
} |
| 629 |
} |
| 630 |
|
| 631 |
defm CADD_A: mI_CADDnA_CSUBnA_v110_<0x21, 0x00, 0xA1, 0x00, "cadd.a">; |
| 632 |
|
| 633 |
def CADDN_srr_v110 : ISRR_dD15b<0x4A, "caddn"> |
| 634 |
, NsRequires<[HasV110]>; |
| 635 |
|
| 636 |
def CADDN_rcr : IRCR<0xAB, 0x01, "caddn">; |
| 637 |
def CADDN_rrr : IRRR<0x2B, 0x01, "caddn">; |
| 638 |
def CADDN_src : ISRC_dD15C<0xCA, "caddn">; |
| 639 |
|
| 640 |
defm CADDN_A: mI_CADDnA_CSUBnA_v110_<0x21, 0x01, 0xA1, 0x01, "caddn.a">; |
| 641 |
|
| 642 |
// Call Instructions |
| 643 |
|
| 644 |
class IB<bits<8> op1, string asmstr> |
| 645 |
: B<op1, (outs), (ins disp24imm:$disp24), |
| 646 |
asmstr # " $disp24", []>; |
| 647 |
|
| 648 |
// The target of a 24-bit call instruction. |
| 649 |
def call_target : Operand<i32> { |
| 650 |
let EncoderMethod = "encodeCallTarget"; |
| 651 |
} |
| 652 |
|
| 653 |
class ISB<bits<8> op1, string asmstr> |
| 654 |
: SB<op1, (outs), (ins disp8imm:$disp8), asmstr # " $disp8", []>; |
| 655 |
|
| 656 |
class ISB_D15D<bits<8> op1, string asmstr> |
| 657 |
: SB<op1, (outs), (ins disp8imm:$disp8), asmstr # " d15, $disp8", []>; |
| 658 |
|
| 659 |
let isCall = 1, |
| 660 |
Defs = [A11], |
| 661 |
Uses = [A10] in { |
| 662 |
def CALL_b : IB<0x6D, "call">; |
| 663 |
def CALL_sb : ISB<0x5C, "call">, Requires<[HasV120_UP]>; |
| 664 |
def CALLA_b : IB<0xED, "calla">; |
| 665 |
def CALLI_rr_v110: IRR_R2<0x2D, 0x00, "calli", RA>, NsRequires<[HasV110]>; |
| 666 |
def CALLI_rr : IRR_R1<0x2D, 0x00, "calli", RA>, Requires<[HasV120_UP]>; |
| 667 |
} |
| 668 |
|
| 669 |
multiclass mI_H<bits<8> op1,bits<8> op2,bits<8> op3, bits<8> op4, string asmstr> { |
| 670 |
def _rr : IRR_a<op1, op2, asmstr>; |
| 671 |
def _H_rr : IRR_a<op3, op4, asmstr # ".h">; |
| 672 |
} |
| 673 |
|
| 674 |
defm CLO : mI_H<0x0F, 0x1C, 0x0F, 0x7D, "clo">; |
| 675 |
def CLO_B_rr_v110 : IRR_a<0x0F, 0x3D, "clo.b">, NsRequires<[HasV110]>; |
| 676 |
defm CLS : mI_H<0x0F, 0x1D, 0x0F, 0x7E, "cls">; |
| 677 |
def CLS_B_rr_v110 : IRR_a<0x0F, 0x3E, "cls.b">, NsRequires<[HasV110]>; |
| 678 |
defm CLZ : mI_H<0x0F, 0x1B, 0x0F, 0x7C, "clz">; |
| 679 |
def CLZ_B_rr_v110 : IRR_a<0x0F, 0x3C, "clz.b">, NsRequires<[HasV110]>; |
| 680 |
|
| 681 |
def CMOV_src : ISRC_dD15C<0xAA, "cmov">; |
| 682 |
def CMOV_srr : ISRR_dD15b<0x2A, "cmov">; |
| 683 |
def CMOVN_src : ISRC_dD15C<0xEA, "cmovn">; |
| 684 |
def CMOVN_srr : ISRR_dD15b<0x6A, "cmovn">; |
| 685 |
|
| 686 |
// A[b], off10, E[a] (BO)(Base + Short Offset Addressing Mode) |
| 687 |
class IBO_bsoAbOEa<bits<8> op1, bits<6> op2, string asmstr> |
| 688 |
: BO<op1, op2, (outs), (ins RE:$s1, RA:$s2, s10imm:$off10), |
| 689 |
asmstr # " [$s2]$off10, $s1", []>; |
| 690 |
// P[b], E[a] (BO)(Bit-reverse Addressing Mode) |
| 691 |
class IBO_rPbEa<bits<8> op1, bits<6> op2, string asmstr> |
| 692 |
: BO<op1, op2, (outs), (ins RE:$s1, RP:$s2), |
| 693 |
asmstr # " [${s2}+r], $s1", []>; |
| 694 |
// P[b], off10, E[a] (BO)(Circular Addressing Mode) |
| 695 |
class IBO_cPbOEa<bits<8> op1, bits<6> op2, string asmstr> |
| 696 |
: BO<op1, op2, (outs), (ins RE:$s1, RP:$s2, s10imm:$off10), |
| 697 |
asmstr # " [${s2}+c]$off10, $s1", []>; |
| 698 |
// A[b], off10, E[a] (BO)(Post-increment Addressing Mode) |
| 699 |
class IBO_posAbOEa<bits<8> op1, bits<6> op2, string asmstr> |
| 700 |
: BO<op1, op2, (outs), (ins RE:$s1, RA:$s2, s10imm:$off10), |
| 701 |
asmstr # " [${s2}+]$off10, $s1", []>; |
| 702 |
// A[b], off10, E[a] (BO)(Pre-increment Addressing Mode) |
| 703 |
class IBO_preAbOEa<bits<8> op1, bits<6> op2, string asmstr> |
| 704 |
: BO<op1, op2, (outs), (ins RE:$s1, RA:$s2, s10imm:$off10), |
| 705 |
asmstr # " [+$s2]$off10, $s1", []>; |
| 706 |
|
| 707 |
|
| 708 |
multiclass mIBO_Ea<bits<8> bso1, bits<6> bso2, ///_bso |
| 709 |
bits<8> r1, bits<6> r2, ///_r |
| 710 |
bits<8> c1, bits<6> c2, ///_c |
| 711 |
bits<8> pos1, bits<6> pos_r, ///_post |
| 712 |
bits<8> pre1, bits<6> pre_c, ///_pre |
| 713 |
string asmstr>{ |
| 714 |
def _bo_bso : IBO_bsoAbOEa<bso1, bso2, asmstr>; |
| 715 |
def _bo_pos : IBO_posAbOEa<pos1, pos_r, asmstr>; |
| 716 |
def _bo_pre : IBO_preAbOEa<pre1, pre_c, asmstr>; |
| 717 |
def _bo_r : IBO_rPbEa<r1, r2, asmstr>; |
| 718 |
def _bo_c : IBO_cPbOEa<c1, c2, asmstr>; |
| 719 |
} |
| 720 |
|
| 721 |
defm CMPSWAP_W : mIBO_Ea<0x49, 0x23, 0x69, 0x03, |
| 722 |
0x69, 0x13, 0x49,0x03, |
| 723 |
0x49, 0x13, "cmpswap.w"> |
| 724 |
, Requires<[HasV161_UP]>; |
| 725 |
|
| 726 |
def CRC32_B_rr : IRR_dba<0x4B, 0x06, "crc32.b">, Requires<[HasV162]>; |
| 727 |
def CRC32B_W_rr : IRR_dba<0x4B, 0x03, "crc32b.w">, Requires<[HasV162]>; |
| 728 |
def CRC32L_W_rr : IRR_dba<0x4B, 0x07, "crc32l.w">, Requires<[HasV162]>; |
| 729 |
def CRCN_rrr : IRRR<0x6B, 0x01, "crcn">, Requires<[HasV162]>; |
| 730 |
|
| 731 |
def CSUB_rrr : IRRR<0x2B, 0x02, "csub">; |
| 732 |
def CSUBN_rrr : IRRR<0x2B, 0x03, "csubn">; |
| 733 |
|
| 734 |
defm CSUB_A_: mI_CADDnA_CSUBnA_v110_<0x21, 0x02, 0, 0, "csub.a">; |
| 735 |
defm CSUBN_A_: mI_CADDnA_CSUBnA_v110_<0x21, 0x03, 0, 0, "csubn.a">; |
| 736 |
|
| 737 |
class ISR_0<bits<8> op1, bits<4> op2, string asmstr> |
| 738 |
: SR<op1, op2, (outs), (ins), |
| 739 |
asmstr, []>; |
| 740 |
|
| 741 |
class ISR_1<bits<8> op1, bits<4> op2, string asmstr, RegisterClass RC1=RD> |
| 742 |
: SR<op1, op2, (outs), (ins RC1:$s1), |
| 743 |
asmstr # " $s1", []>; |
| 744 |
|
| 745 |
class ISYS_0<bits<8> op1, bits<6> op2, string asmstr> |
| 746 |
: SYS<op1, op2, (outs), (ins), |
| 747 |
asmstr, []>; |
| 748 |
class ISYS_1<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC1=RD> |
| 749 |
: SYS<op1, op2, (outs), (ins RC1:$s1), |
| 750 |
asmstr # " $s1", []>; |
| 751 |
|
| 752 |
def DEBUG_sr : ISR_0<0x00, 0x0A, "debug">; |
| 753 |
def DEBUG_sys : ISYS_0<0x0D, 0x04, "debug">; |
| 754 |
|
| 755 |
/// RRRR Instruction Formats |
| 756 |
/// op D[c], D[a], D[b], D[d] |
| 757 |
class IRRRR<bits<8> op1, bits<3> op2, string asmstr> |
| 758 |
: RRRR<op1, op2, (outs RD:$d), (ins RD:$s1, RD:$s2, RD:$s3), |
| 759 |
asmstr # " $d, $s1, $s2, $s3", []>; |
| 760 |
/// op D[c], D[a], D[d] |
| 761 |
class IRRRR_ad<bits<8> op1, bits<3> op2, string asmstr, RegisterClass RC3=RD> |
| 762 |
: RRRR<op1, op2, (outs RD:$d), (ins RD:$s1, RC3:$s3), |
| 763 |
asmstr # " $d, $s1, $s3", []>; |
| 764 |
|
| 765 |
/// op D[c], D[a], D[b], D[d], width |
| 766 |
class IRRRW_cabdw<bits<8> op1, bits<3> op2, string asmstr> |
| 767 |
: RRRW<op1, op2, (outs RD:$d), (ins RD:$s1, RD:$s2, RD:$s3, i32imm:$width), |
| 768 |
asmstr # " $d, $s1, $s2, $s3, $width", []>; |
| 769 |
/// op D[c], D[a], D[d], width |
| 770 |
class IRRRW_cadw<bits<8> op1, bits<3> op2, string asmstr> |
| 771 |
: RRRW<op1, op2, (outs RD:$d), (ins RD:$s1, RD:$s2, RD:$s3, i32imm:$width), |
| 772 |
asmstr # " $d, $s1, $s3, $width", []>; |
| 773 |
/// op E[c], D[b], D[d], width |
| 774 |
class IRRRW_cEbdw<bits<8> op1, bits<3> op2, string asmstr> |
| 775 |
: RRRW<op1, op2, (outs RE:$d), (ins RD:$s1, RD:$s2, RD:$s3, i32imm:$width), |
| 776 |
asmstr # " $d, $s2, $s3, $width", []>; |
| 777 |
|
| 778 |
def DEXTR_rrpw : RRPW<0x77, 0x00, (outs RD:$d), (ins RD:$s1, RD:$s2, i32imm:$pos, i32imm:$width), |
| 779 |
"dextr $d, $s1, $s2, $pos", []>; |
| 780 |
def DEXTR_rrrr : IRRRR<0x17, 0x04, "dextr">; |
| 781 |
|
| 782 |
def DIFSC_A_rr_v110 : IRR_dabn<0x01, 0x50, "difsc.a", RD, RA, RA>, NsRequires<[HasV110]>; |
| 783 |
|
| 784 |
def DISABLE_sys : ISYS_0<0x0D, 0x0D, "disable">; |
| 785 |
def DISABLE_sys_1 : ISYS_1<0x0D, 0x0F, "disable">, Requires<[HasV160_UP]>; |
| 786 |
|
| 787 |
def DSYNC_sys : ISYS_0<0x0D, 0x12, "dsync">; |
| 788 |
|
| 789 |
def DVADJ_srr_v110 : ISRR_db<0x72, "dvadj", RE, RD>, NsRequires<[HasV110]>; |
| 790 |
def DVADJ_rrr_v110 : IRRR_d32<0x2B, 0x08, "dvadj", RE, RD, RD, RE>, NsRequires<[HasV110]>; |
| 791 |
def DVADJ_rrr : IRRR_d32<0x6B, 0x0D, "dvadj", RE, RD, RD, RE>, Requires<[HasV120_UP]>; |
| 792 |
|
| 793 |
multiclass mI_U_RR_Eab<bits<8> op1, bits<8> op2, bits<8> op3, bits<8> op4, |
| 794 |
string asmstr, string posfix = ""> { |
| 795 |
def _rr # posfix : IRR_dab<op1, op2, asmstr, RE>; |
| 796 |
def _U_rr # posfix : IRR_dab<op3, op4, asmstr # ".u", RE>; |
| 797 |
} |
| 798 |
|
| 799 |
multiclass mIU_RR_Eab<bits<8> op1, bits<8> op2, bits<8> op3, bits<8> op4, |
| 800 |
string asmstr, string posfix = ""> { |
| 801 |
def _rr # posfix : IRR_dab<op1, op2, asmstr, RE>; |
| 802 |
def U_rr # posfix : IRR_dab<op3, op4, asmstr # "u", RE>; |
| 803 |
} |
| 804 |
|
| 805 |
multiclass mI_DVINIT_<bits<8> oprefix, |
| 806 |
bits<8> op, bits<8> op_u, |
| 807 |
bits<8> opb, bits<8> opbu, |
| 808 |
bits<8> oph, bits<8> ophu, |
| 809 |
string asmstr, string posfix = ""> { |
| 810 |
defm "": mI_U_RR_Eab<oprefix, op, oprefix, op_u, asmstr, posfix>; |
| 811 |
defm _B: mIU_RR_Eab <oprefix, opb, oprefix, opbu, asmstr # ".b", posfix>; |
| 812 |
defm _H: mIU_RR_Eab <oprefix, oph, oprefix, ophu, asmstr # ".h", posfix>; |
| 813 |
} |
| 814 |
|
| 815 |
defm DIV : mI_U_RR_Eab<0x4B, 0x20, 0x4B, 0x21, "div">, Requires<[HasV160_UP]>; |
| 816 |
|
| 817 |
defm DVINIT : mI_DVINIT_<0x4F, 0x00, 0x01, 0x04, 0x05, 0x02, 0x03, "dvinit", "_v110">, NsRequires<[HasV110]>; |
| 818 |
defm DVINIT : mI_DVINIT_<0x4B, 0x1A, 0x0A, 0x5A, 0x4A, 0x3A, 0x2A, "dvinit">, Requires<[HasV120_UP]>; |
| 819 |
|
| 820 |
multiclass mI_U_RRR_EEdb<bits<8> op1, bits<4> op2, bits<8> op3, bits<4> op4, |
| 821 |
string asmstr, string posfix = ""> { |
| 822 |
def _rrr # posfix : IRRR_d32<op1, op2, asmstr, RE, RD, RD, RE>; |
| 823 |
def _U_rrr # posfix: IRRR_d32<op3, op4, asmstr # ".u", RE, RD, RD, RE>; |
| 824 |
} |
| 825 |
|
| 826 |
multiclass mI_U_SRR_sds2<bits<8> op1, bits<8> op2, string asmstr, |
| 827 |
string posfix = "", RegisterClass RC1, RegisterClass RC2>{ |
| 828 |
def "" # posfix: ISRR_db<op1, asmstr, RC1, RC2>; |
| 829 |
def _U # posfix: ISRR_db<op2, asmstr # ".u", RC1, RC2>; |
| 830 |
} |
| 831 |
|
| 832 |
defm DVSTEP : mI_U_SRR_sds2<0x32, 0xB2, "dvstep", "v110", RE, RD>, NsRequires<[HasV110]>; |
| 833 |
defm DVSTEP : mI_U_RRR_EEdb<0x2B, 0x09, 0x2B, 0x0A, "dvstep", "v110">, NsRequires<[HasV110]>; |
| 834 |
defm DVSTEP : mI_U_RRR_EEdb<0x6B, 0x0F, 0x6B, 0x0E, "dvstep">, Requires<[HasV120_UP]>; |
| 835 |
|
| 836 |
def ENABLE_sys : ISYS_0<0x0D, 0x0C, "enable">; |
| 837 |
|
| 838 |
multiclass mIB_H_W<bits<8> brr1, bits<8> brr2, |
| 839 |
bits<8> hrr1, bits<8> hrr2, |
| 840 |
bits<8> wrr1, bits<8> wrr2, |
| 841 |
string asmstr> |
| 842 |
: mIB_H<brr1, brr2, hrr1, hrr2, asmstr>{ |
| 843 |
def _W_rr : IRR_dab<wrr1, wrr2, asmstr # ".w">; |
| 844 |
} |
| 845 |
|
| 846 |
defm EQ : mIRR_RC<0x0B, 0x10, 0x8B, 0x10, "eq"> |
| 847 |
, mIB_H_W<0x0B, 0x50, 0x0B, 0x70, 0x0B, 0x90, "eq">; |
| 848 |
def EQ_src : ISRC_D15dC<0xBA, "eq">; |
| 849 |
def EQ_srr : ISRR_D15db<0x3A, "eq">; |
| 850 |
def EQ_A_rr: IRR_dab<0x01, 0x40, "eq.a", RD, RA, RA>; |
| 851 |
|
| 852 |
defm EQANY_B : mIRR_RC<0x0B, 0x56, 0x8B, 0x56, "eqany.b">; |
| 853 |
defm EQANY_H : mIRR_RC<0x0B, 0x76, 0x8B, 0x76, "eqany.h">; |
| 854 |
|
| 855 |
def EQZ_A_rr : IRR_a<0x01, 0x48, "eqz.a", RD, RA>; |
| 856 |
|
| 857 |
def EXTR_rrpw : RRPW<0x37, 0x02, (outs RD:$d), (ins RD:$s1, RD:$s2, i32imm:$pos, i32imm:$width), |
| 858 |
"extr $d, $s1, $pos, $width", []>; |
| 859 |
def EXTR_rrrr : IRRRR_ad<0x17, 0x02, "extr", RE>; |
| 860 |
def EXTR_rrrw : IRRRW_cadw<0x57, 0x02, "extr">; |
| 861 |
|
| 862 |
def EXTR_U_rrpw : RRPW<0x37, 0x03, (outs RD:$d), (ins RD:$s1, RD:$s2, i32imm:$pos, i32imm:$width), |
| 863 |
"extr.u $d, $s1, $pos, $width", []>; |
| 864 |
def EXTR_U_rrrr : IRRRR_ad<0x17, 0x03, "extr.u", RE>; |
| 865 |
def EXTR_U_rrrw : IRRRW_cadw<0x57, 0x03, "extr.u">; |
| 866 |
|
| 867 |
def FCALL_b : IB<0x61, "fcall">, Requires<[HasV160_UP]>; |
| 868 |
def FCALLA_b : IB<0xE1, "fcalla">, Requires<[HasV160_UP]>; |
| 869 |
def FCALLA_i : IRR_R1<0x2D, 0x01, "fcalli", RA>, Requires<[HasV160_UP]>; |
| 870 |
|
| 871 |
def FRET_sr : ISR_0<0x00, 0x07, "fret">, Requires<[HasV160_UP]>; |
| 872 |
def FRET_sys : ISYS_0<0x0D, 0x03, "fret">, Requires<[HasV160_UP]>; |
| 873 |
|
| 874 |
multiclass mI_U__RR_RC<bits<8> op1, bits<8> op2, bits<8> op3, bits<7> op4, |
| 875 |
bits<8> uop1, bits<8> uop2, bits<8> uop3, bits<7> uop4, |
| 876 |
string asmstr> { |
| 877 |
defm "" : mIRR_RC<op1, op2, op3, op4, asmstr>; |
| 878 |
defm _U : mIRR_RC<uop1, uop2, uop3, uop4, asmstr # ".u">; |
| 879 |
} |
| 880 |
|
| 881 |
defm GE : mI_U__RR_RC<0x0B, 0x14, 0x8B, 0x14, |
| 882 |
0x0B, 0x15, 0x8B, 0x15, "ge">; |
| 883 |
def GE_A_rr : IRR_dab<0x01, 0x43, "ge.a", RD, RA, RA>; |
| 884 |
|
| 885 |
def IMASK_rcpw : RCPW<0xB7, 0x01, (outs RE:$d), (ins RD:$s1, i32imm:$const4, i32imm:$pos, i32imm:$width), |
| 886 |
"imask $d, $const4, $pos, $width", []>; |
| 887 |
def IMASK_rcrw : RCRW<0xD7, 0x01, (outs RE:$d), (ins RD:$s1, RD:$s3, i32imm:$const4, i32imm:$width), |
| 888 |
"imask $d, $const4, $s3, $width", []>; |
| 889 |
def IMASK_rrpw : RRPW<0x37, 0x01, (outs RE:$d), (ins RD:$s1, RD:$s2, i32imm:$pos, i32imm:$width), |
| 890 |
"imask $d, $s2, $pos, $width", []>; |
| 891 |
def IMASK_rrrw : IRRRW_cEbdw<0x57, 0x01, "imask">; |
| 892 |
|
| 893 |
def INS_T : IBIT<0x67, 0x00, "ins.t">; |
| 894 |
def INSN_T : IBIT<0x67, 0x01, "insn.t">; |
| 895 |
|
| 896 |
def INSERT_rcpw : RCPW<0xB7, 0x00, (outs RD:$d), (ins RD:$s1, i32imm:$const4, i32imm:$pos, i32imm:$width), |
| 897 |
"insert $d, $s1, $const4, $pos, $width", []>; |
| 898 |
def INSERT_rcrr : RCRR<0x97, 0x00, (outs RD:$d), (ins RD:$s1, i32imm:$const4, RE:$s3), |
| 899 |
"insert $d, $s1, $const4, $s3", []>; |
| 900 |
def INSERT_rcrw : RCRW<0xD7, 0x00, (outs RD:$d), (ins RD:$s1, RD:$s3, i32imm:$const4, i32imm:$width), |
| 901 |
"insert $d, $s1, $const4, $s3, $width", []>; |
| 902 |
def INSERT_rrpw : RRPW<0x37, 0x00, (outs RD:$d), (ins RD:$s1, RD:$s2, i32imm:$pos, i32imm:$width), |
| 903 |
"insert $d, $s1, $s2, $pos, $width", []>; |
| 904 |
def INSERT_rrrr : RRRW<0x17, 0x00, (outs RD:$d), (ins RD:$s1, RD:$s2, RE:$s3), |
| 905 |
"insert $d, $s1, $s2, $s3", []>; |
| 906 |
def INSERT_rrrw : IRRRW_cabdw<0x57, 0x00, "insert">; |
| 907 |
|
| 908 |
def ISYNC_sys : ISYS_0<0x0D, 0x13, "isync">; |
| 909 |
|
| 910 |
defm IXMAX : mI_U_RRR_EEdb<0x6B, 0x0A, 0x6B, 0x0B, "ixmax">, Requires<[HasV130_UP]>; |
| 911 |
defm IXMIN : mI_U_RRR_EEdb<0x6B, 0x08, 0x6B, 0x09, "ixmin">, Requires<[HasV130_UP]>; |
| 912 |
|
| 913 |
def J_b : IB<0x1D, "j">; |
| 914 |
def J_sb_v110 : ISB<0x5C, "j">, NsRequires<[HasV110]>; |
| 915 |
def J_sb : ISB<0x3C, "j">, Requires<[HasV120_UP]>; |
| 916 |
def JA_b : IB<0x9D, "ja">; |
| 917 |
|
| 918 |
// disp15 |
| 919 |
class IBRR_0<bits<8> op1, bits<1> op2, string asmstr> |
| 920 |
: BRR<op1, op2, (outs), (ins disp15imm:$disp15), asmstr # " $disp15", []>; |
| 921 |
// A[a], disp15 |
| 922 |
class IBRR_1<bits<8> op1, bits<1> op2, string asmstr> |
| 923 |
: BRR<op1, op2, (outs), (ins RA:$s1, disp15imm:$disp15), asmstr # " $s1, $disp15", []>; |
| 924 |
// D[a], D[b], disp15 |
| 925 |
class IBRR<bits<8> op1, bits<1> op2, string asmstr, RegisterClass RC1=RD, RegisterClass RC2=RD> |
| 926 |
: BRR<op1, op2, (outs), (ins RC1:$s1, RC2:$s2, disp15imm:$disp15), |
| 927 |
asmstr # " $s1, $s2, $disp15", []>; |
| 928 |
|
| 929 |
|
| 930 |
class IBRC<bits<8> op1, bits<1> op2, string asmstr, Operand TypeC=u4imm> |
| 931 |
: BRC<op1, op2, (outs), (ins RD:$s1, TypeC:$const4, disp15imm:$disp15), |
| 932 |
!strconcat(asmstr, " $s1, $const4, $disp15"), []>; |
| 933 |
|
| 934 |
class ISBC<bits<8> op1, string asmstr> |
| 935 |
: SBC<op1, (outs), (ins disp4imm:$disp4, s4imm:$const4), |
| 936 |
!strconcat(asmstr, " d15, $const4, $disp4"), []>; |
| 937 |
|
| 938 |
// D[15], D[b], disp4 (SBR) |
| 939 |
class ISBR_15b<bits<8> op1, string asmstr> |
| 940 |
: SBR<op1, (outs), (ins RD:$s2, disp4imm:$disp4), |
| 941 |
!strconcat(asmstr, " d15, $s2, $disp4"), []>; |
| 942 |
// D[b], disp4 (SBR) |
| 943 |
class ISBR_b<bits<8> op1, string asmstr, RegisterClass RC2=RD> |
| 944 |
: SBR<op1, (outs), (ins RC2:$s2, disp4imm:$disp4), |
| 945 |
!strconcat(asmstr, " $s2, $disp4"), []>; |
| 946 |
|
| 947 |
// D[b](SBR) |
| 948 |
class ISBR<bits<8> op1, string asmstr, RegisterClass RC2=RD> |
| 949 |
: SBR<op1, (outs), (ins RC2:$s2), |
| 950 |
!strconcat(asmstr, " $s2"), []>; |
| 951 |
|
| 952 |
multiclass mIBRC_BRR<bits<8> c1, bits<1> c2, bits<8> r1, bits<1> r2, string asmstr, Operand TypeC=u4imm>{ |
| 953 |
def _brc : IBRC<c1, c2, asmstr, TypeC>; |
| 954 |
def _brr : IBRR<r1, r2, asmstr>; |
| 955 |
} |
| 956 |
|
| 957 |
multiclass mI_JnEq_<bits<8> c1, bits<1> c2, bits<8> r1, bits<1> r2, |
| 958 |
bits<8> x1, bits<8> x2, bits<8> x3, bits<8> x4, |
| 959 |
bits<8> x5, bits<1> x6, bits<8> v1, bits<8> v2, string asmstr>{ |
| 960 |
defm "": mIBRC_BRR<c1, c2, r1, r2, asmstr, s4imm>; |
| 961 |
|
| 962 |
def _sbr_v110 : ISBR_15b<v1, asmstr>, NsRequires<[HasV110]>; |
| 963 |
def _sbc_v110 : ISBC<v2, asmstr>, NsRequires<[HasV110]>; |
| 964 |
|
| 965 |
def _sbc1 : ISBC<x1, asmstr>, Requires<[HasV120_UP]>; |
| 966 |
def _sbc2 : ISBC<x2, asmstr>, Requires<[HasV160_UP]>; |
| 967 |
|
| 968 |
if !eq(asmstr, "jne") then def _sbr1 : ISBR_15b<x3, asmstr>, Requires<[HasV120_UP]>; |
| 969 |
if !eq(asmstr, "jeq") then def _sbr1 : ISBR_15b<x3, asmstr>, Requires<[HasV130_UP]>; |
| 970 |
|
| 971 |
def _sbr2 : ISBR_15b<x4, asmstr>, Requires<[HasV160_UP]>; |
| 972 |
def _A_brr: IBRR<x5, x6, asmstr # ".a", RA, RA>; |
| 973 |
} |
| 974 |
|
| 975 |
defm JEQ : mI_JnEq_<0xDF, 0x00, 0x5F, 0x00, |
| 976 |
0x1E, 0x9E, 0x3E, 0xBE, |
| 977 |
0x7D, 0x00, 0x1E, 0x6E, "jeq">; |
| 978 |
|
| 979 |
defm JGE : mIBRC_BRR<0xFF, 0x00, 0x7F, 0x00, "jge", s4imm>; |
| 980 |
defm JGE_U : mIBRC_BRR<0xFF, 0x01, 0x7F, 0x01, "jge.u">; |
| 981 |
|
| 982 |
def JGEZ_sbr_v110 : ISBR_b<0xFE, "jgez">, NsRequires<[HasV110]>; |
| 983 |
def JGEZ_sbr : ISBR_b<0xCE, "jgez">, Requires<[HasV120_UP]>; |
| 984 |
def JGTZ_sbr_v110 : ISBR_b<0x7E, "jgtz">, NsRequires<[HasV110]>; |
| 985 |
def JGTZ_sbr : ISBR_b<0x4E, "jgtz">, Requires<[HasV120_UP]>; |
| 986 |
|
| 987 |
def JI_sbr_v110 : ISBR<0x3C, "ji", RA>, NsRequires<[HasV110]>; |
| 988 |
def JI_rr_v110 : IRR_R1<0x2D, 0x03, "ji", RA>, NsRequires<[HasV110]>; |
| 989 |
def JI_rr : IRR_R1<0x2D, 0x03, "ji", RA>, Requires<[HasV120_UP]>; |
| 990 |
def JI_sr : SR<0xDC, 0x00, (outs), (ins RA:$s1), "ji $s1", []>, Requires<[HasV120_UP]>; |
| 991 |
|
| 992 |
def JL_b : IB<0x5D, "jl">; |
| 993 |
def JLA_b : IB<0xDD, "jla">; |
| 994 |
|
| 995 |
def JLEZ_sbr_v110 : ISBR_b<0xBE, "jlez">, NsRequires<[HasV110]>; |
| 996 |
def JLEZ_sbr : ISBR_b<0x8E, "jlez">, Requires<[HasV120_UP]>; |
| 997 |
|
| 998 |
def JLI_rr_v110 : IRR_R1<0x2D, 0x02, "jli", RA>, NsRequires<[HasV110]>; |
| 999 |
def JLI_rr : IRR_R1<0x2D, 0x02, "jli", RA>, Requires<[HasV120_UP]>; |
| 1000 |
|
| 1001 |
defm JLT : mIBRC_BRR<0xBF, 0x00, 0x3F, 0x00, "jlt">; |
| 1002 |
defm JLT_U : mIBRC_BRR<0xBF, 0x01, 0x3F, 0x01, "jlt.u">; |
| 1003 |
|
| 1004 |
def JLTZ_sbr_v110 : ISBR_b<0x3E, "jltz">, NsRequires<[HasV110]>; |
| 1005 |
def JLTZ_sbr : ISBR_b<0x0E, "jltz">, Requires<[HasV120_UP]>; |
| 1006 |
|
| 1007 |
defm JNE : mI_JnEq_<0xDF, 0x01, 0x5F, 0x01, |
| 1008 |
0x5E, 0xDE, 0x7E, 0xFE, |
| 1009 |
0x7D, 0x01, 0x9E, 0xEE, "jne">; |
| 1010 |
|
| 1011 |
defm JNED : mIBRC_BRR<0x9F, 0x01, 0x1F, 0x01, "jned">; |
| 1012 |
defm JNEI : mIBRC_BRR<0x9F, 0x00, 0x1F, 0x00, "jnei">; |
| 1013 |
|
| 1014 |
multiclass mI_JnZ_<bits<8> sb, bits<8> sbr, |
| 1015 |
bits<8> abrr1, bits<1> abrr2, bits<8> asbr, |
| 1016 |
bits<7> brn1, bits<1> brn2, bits<8> sbrn, |
| 1017 |
bits<8> sbv, bits<8> sbrv, bits<8> sbrnv, |
| 1018 |
string asmstr> { |
| 1019 |
def _sb_v110 : ISB_D15D<sbv, asmstr>, NsRequires<[HasV110]>; |
| 1020 |
def _sbr_v110 : ISBR_b<sbrv, asmstr>, NsRequires<[HasV110]>; |
| 1021 |
def _T_sbrn_v110: SBRN<sbrnv, (outs), (ins i32imm:$n, disp4imm:$disp4), asmstr # ".t d15, $n, $disp4", []> |
| 1022 |
, NsRequires<[HasV110]>; |
| 1023 |
|
| 1024 |
def _sb : ISB_D15D<sb, asmstr>, Requires<[HasV120_UP]>; |
| 1025 |
def _sbr : ISBR_b<sbr, asmstr>, Requires<[HasV120_UP]>; |
| 1026 |
def _A_brr : IBRR_1<abrr1, abrr2, asmstr # ".a">; |
| 1027 |
def _A_sbr : ISBR_b<asbr, asmstr # ".a", RA>; |
| 1028 |
def _T_brn : BRN<brn1, brn2, (outs), (ins RD:$s1, i32imm:$n, disp15imm:$disp15), asmstr # ".t $s1, $n, $disp15", []>; |
| 1029 |
def _T_sbrn: SBRN<sbrn, (outs), (ins i32imm:$n, disp4imm:$disp4), asmstr # ".t d15, $n, $disp4", []> |
| 1030 |
, Requires<[HasV120_UP]>; |
| 1031 |
} |
| 1032 |
|
| 1033 |
defm JNZ : mI_JnZ_<0xEE, 0xF6, 0xBD, 0x01, 0x7C, 0x6F, 0x01, 0xAE, 0xAE, 0xDE, 0x4E, "jnz">; |
| 1034 |
defm JZ : mI_JnZ_<0x6E, 0x76, 0xBD, 0x00, 0xBC, 0x6F, 0x00, 0x2E, 0x2E, 0x5E, 0x0E, "jz">; |
| 1035 |
|
| 1036 |
|
| 1037 |
class IABS_off18<bits<8> op1, bits<2> op2, string asmstr> |
| 1038 |
: ABS<op1, op2, (outs), (ins off18imm:$off18), |
| 1039 |
asmstr # " $off18", []>; |
| 1040 |
class IABS_RO<bits<8> op1, bits<2> op2, string asmstr, RegisterClass dc> |
| 1041 |
: ABS<op1, op2, (outs dc:$d), (ins off18imm:$off18), |
| 1042 |
asmstr # " $d, $off18", []>; |
| 1043 |
class IABS_OR<bits<8> op1, bits<2> op2, string asmstr, RegisterClass s1c> |
| 1044 |
: ABS<op1, op2, (outs), (ins s1c:$s1, off18imm:$off18), |
| 1045 |
asmstr # " $off18, $s1", []>; |
| 1046 |
|
| 1047 |
class IBOL_RAaO<bits<8> op1, string asmstr, RegisterClass RC> |
| 1048 |
: BOL<op1, (outs RC:$s1), (ins RA:$s2, s16imm:$off16), |
| 1049 |
asmstr # " $s1, [$s2]$off16", []>; |
| 1050 |
|
| 1051 |
class IBOL_AbOR<bits<8> op1, string asmstr, RegisterClass RC> |
| 1052 |
: BOL<op1, (outs RA:$s2), (ins RC:$s1, s16imm:$off16), |
| 1053 |
asmstr # " [$s2]$off16, $s1", []>; |
| 1054 |
|
| 1055 |
class ISLR<bits<8> op1, string asmstr, RegisterClass dc> |
| 1056 |
: SLR<op1, (outs dc:$d), (ins RA:$s2), |
| 1057 |
asmstr # " $d, [$s2]", []>; |
| 1058 |
class ISLR_pos<bits<8> op1, string asmstr, RegisterClass dc> |
| 1059 |
: SLR<op1, (outs dc:$d), (ins RA:$s2), |
| 1060 |
asmstr # " $d, [${s2}+]", []>; |
| 1061 |
|
| 1062 |
class ISLRO<bits<8> op1, string asmstr, RegisterClass dc> |
| 1063 |
: SLRO<op1, (outs dc:$d), (ins u4imm:$off4), |
| 1064 |
asmstr # " $d, [a15]$off4", []>; |
| 1065 |
|
| 1066 |
class ISRO_A15RO<bits<8> op1, string asmstr, RegisterClass s2c> |
| 1067 |
: SRO<op1, (outs), (ins s2c:$s2, u4imm:$off4), |
| 1068 |
asmstr # " a15, [$s2]$off4", []>; |
| 1069 |
|
| 1070 |
class ISRO_ROA15<bits<8> op1, string asmstr, RegisterClass s2c> |
| 1071 |
: SRO<op1, (outs), (ins s2c:$s2, u4imm:$off4), |
| 1072 |
asmstr # " [$s2]$off4, a15", []>; |
| 1073 |
|
| 1074 |
class ISRO_D15RO<bits<8> op1, string asmstr, RegisterClass s2c> |
| 1075 |
: SRO<op1, (outs), (ins s2c:$s2, u4imm:$off4), |
| 1076 |
asmstr # " d15, [$s2]$off4", []>; |
| 1077 |
|
| 1078 |
class ISRO_ROD15<bits<8> op1, string asmstr, RegisterClass s2c> |
| 1079 |
: SRO<op1, (outs), (ins s2c:$s2, u4imm:$off4), |
| 1080 |
asmstr # " [$s2]$off4, d15", []>; |
| 1081 |
|
| 1082 |
// A|D[a], A[b], off10 (BO) (Base + Short Offset Addressing Mode) |
| 1083 |
class IBO_RAbso<bits<8> op1, bits<6> op2, string asmstr, RegisterClass dc> |
| 1084 |
: BO<op1, op2, (outs dc:$d), (ins RA:$s2, s10imm:$off10), |
| 1085 |
asmstr # " $d, [$s2]$off10", []>; |
| 1086 |
// A|D[a], P[b] (BO) (Bit Reverse Addressing Mode) |
| 1087 |
class IBO_RPr<bits<8> op1, bits<6> op2, string asmstr, RegisterClass dc> |
| 1088 |
: BO<op1, op2, (outs dc:$d), (ins RP:$s2), |
| 1089 |
asmstr # " $d, [${s2}+r]", []>; |
| 1090 |
// A|D[a], P[b], off10 (BO) (Circular Addressing Mode) |
| 1091 |
class IBO_RPc<bits<8> op1, bits<6> op2, string asmstr, RegisterClass dc> |
| 1092 |
: BO<op1, op2, (outs dc:$d), (ins RP:$s2, s10imm:$off10), |
| 1093 |
asmstr # " $d, [${s2}+c]$off10", []>; |
| 1094 |
// A|D[a], A[b], off10 (BO)(Post-increment Addressing Mode) |
| 1095 |
class IBO_RApos<bits<8> op1, bits<6> op2, string asmstr, RegisterClass dc> |
| 1096 |
: BO<op1, op2, (outs), (ins dc:$s1, RA:$s2, s10imm:$off10), |
| 1097 |
asmstr # " $s1, [${s2}+]$off10", []>; |
| 1098 |
// A|D[a], A[b], off10 (BO) (Pre-increment Addressing Mode) |
| 1099 |
class IBO_RApre<bits<8> op1, bits<6> op2, string asmstr, RegisterClass dc> |
| 1100 |
: BO<op1, op2, (outs), (ins dc:$s1, RA:$s2, s10imm:$off10), |
| 1101 |
asmstr # " $s1, [+${s2}]$off10", []>; |
| 1102 |
|
| 1103 |
|
| 1104 |
multiclass mI_LD_<bits<8> abs1, bits<2> abs2, ///_abs |
| 1105 |
bits<8> prefix1, bits<8> prefix2, |
| 1106 |
bits<6> bso2, ///_bso |
| 1107 |
bits<6> pos_r, ///_pos|_r |
| 1108 |
bits<6> pre_c, ///_pre|_c |
| 1109 |
string asmstr, RegisterClass RC>{ |
| 1110 |
def _abs : IABS_RO<abs1, abs2, asmstr, RC>; |
| 1111 |
def _bo_bso : IBO_RAbso<prefix1, bso2, asmstr, RC>; |
| 1112 |
def _bo_pos : IBO_RApos<prefix1, pos_r, asmstr, RC>; |
| 1113 |
def _bo_pre : IBO_RApre<prefix1, pre_c, asmstr, RC>; |
| 1114 |
def _bo_r : IBO_RPr<prefix2, pos_r, asmstr, RC>; |
| 1115 |
def _bo_c : IBO_RPc<prefix2, pre_c, asmstr, RC>; |
| 1116 |
} |
| 1117 |
|
| 1118 |
multiclass mI_LD_2_<bits<8> slr, bits<8> slrp, bits<8> slro, bits<8> sro, |
| 1119 |
string asmstr, RegisterClass RC, string posfix="">{ |
| 1120 |
def _slr # posfix: ISLR<slr, asmstr, RC>; |
| 1121 |
def _slr_post # posfix: ISLR_pos<slrp, asmstr, RC>; |
| 1122 |
def _slro # posfix: ISLRO<slro, asmstr, RC>; |
| 1123 |
if !eq(RC, RD) then def _sro # posfix: ISRO_D15RO<sro, asmstr, RA>; |
| 1124 |
if !eq(RC, RA) then def _sro # posfix: ISRO_A15RO<sro, asmstr, RA>; |
| 1125 |
} |
| 1126 |
|
| 1127 |
defm LD_A: mI_LD_<0x85, 0x02, 0x09, 0x29, 0x26, 0x06, 0x16, "ld.a", RA>; |
| 1128 |
defm LD_A: mI_LD_2_<0xB8, 0x64, 0x0C, 0x28, "ld.a", RA, "_v110">, NsRequires<[HasV110]>; |
| 1129 |
defm LD_A: mI_LD_2_<0xD4, 0xC4, 0xC8, 0xCC, "ld.a", RA>, Requires<[HasV120_UP]>; |
| 1130 |
def LD_A_bol : IBOL_RAaO<0x99, "ld.a", RA>; |
| 1131 |
def LD_A_sc : ISC_A15A10C<0xD8, "ld.a">, Requires<[HasV120_UP]>; |
| 1132 |
|
| 1133 |
defm LD_B: mI_LD_2_<0x98, 0x44, 0x34, 0x08, "ld.b", RD, "_v110">, NsRequires<[HasV110]>; |
| 1134 |
defm LD_B: mI_LD_<0x05, 0x00, 0x09, 0x29, 0x20, 0x00, 0x10,"ld.b", RD>; |
| 1135 |
def LD_B_bol : IBOL_RAaO<0x79, "ld.b", RD>, Requires<[HasV160_UP]>; |
| 1136 |
|
| 1137 |
defm LD_BU: mI_LD_<0x05, 0x01, 0x09, 0x29, 0x21, 0x01, 0x11, "ld.bu", RD>; |
| 1138 |
defm LD_BU: mI_LD_2_<0x58, 0xC4, 0xB4, 0x88, "ld.bu", RD, "_v110">, NsRequires<[HasV110]>; |
| 1139 |
defm LD_BU: mI_LD_2_<0x14, 0x04, 0x08, 0x0C, "ld.bu", RD>, Requires<[HasV120_UP]>; |
| 1140 |
def LD_BU_bol : IBOL_RAaO<0x39, "ld.bu", RD>, Requires<[HasV160_UP]>; |
| 1141 |
|
| 1142 |
defm LD_D : mI_LD_<0x85, 0x01, 0x09, 0x29, 0x25, 0x05, 0x15, "ld.d", RE>; |
| 1143 |
defm LD_DA : mI_LD_<0x85, 0x03, 0x09, 0x29, 0x27, 0x07, 0x17, "ld.da", RP>; |
| 1144 |
|
| 1145 |
defm LD_H : mI_LD_<0x05, 0x02, 0x09, 0x29, 0x22, 0x02, 0x12, "ld.h", RD>; |
| 1146 |
defm LD_H: mI_LD_2_<0xD8, 0x24, 0x74, 0x48, "ld.h", RD, "_v110">, NsRequires<[HasV110]>; |
| 1147 |
defm LD_H: mI_LD_2_<0x94, 0x84, 0x88, 0x8C, "ld.h", RD>, Requires<[HasV120_UP]>; |
| 1148 |
def LD_H_bol : IBOL_RAaO<0xC9, "ld.h", RD>, Requires<[HasV160_UP]>; |
| 1149 |
|
| 1150 |
defm LD_HU : mI_LD_<0x05, 0x03, 0x09, 0x29, 0x23, 0x03, 0x13, "ld.hu", RD>; |
| 1151 |
def LD_HU_bol : IBOL_RAaO<0xB9, "ld.hu", RD>, Requires<[HasV160_UP]>; |
| 1152 |
|
| 1153 |
defm LD_Q : mI_LD_<0x45, 0x00, 0x09, 0x29, 0x28, 0x08, 0x18, "ld.q", RD>; |
| 1154 |
|
| 1155 |
defm LD_W: mI_LD_<0x85, 0x00, 0x09, 0x29, 0x24, 0x04, 0x14, "ld.w", RD>; |
| 1156 |
defm LD_W: mI_LD_2_<0x38, 0xA4, 0xF4, 0xC8, "ld.w", RD, "_v110">, NsRequires<[HasV110]>; |
| 1157 |
defm LD_W: mI_LD_2_<0x54, 0x44, 0x48, 0x4C, "ld.w", RD>, Requires<[HasV120_UP]>; |
| 1158 |
def LD_W_bol : IBOL_RAaO<0x19, "ld.w", RD>; |
| 1159 |
def LD_W_sc : ISC_D15A10C<0x58, "ld.w">, Requires<[HasV120_UP]>; |
| 1160 |
|
| 1161 |
|
| 1162 |
def LDLCX_abs : IABS_off18<0x15, 0x02, "ldlcx">; |
| 1163 |
def LDLCX_bo_bso : IBO_bso<0x49, 0x24, "ldlcx">; |
| 1164 |
|
| 1165 |
def LDMST_abs : IABS_OR<0xE5, 0x01, "ldmst", RE>; |
| 1166 |
defm LDMST : mIBO_Ea<0x49, 0x21, 0x69, 0x01, 0x69, 0x11, 0x49, 0x01, 0x49, 0x11, "ldmst">; |
| 1167 |
|
| 1168 |
def LDUCX_abs : IABS_off18<0x15, 0x03, "lducx">; |
| 1169 |
def LDUCX_bo_bso : IBO_bso<0x49, 0x25, "lducx">; |
| 1170 |
|
| 1171 |
def LEA_abs : IABS_RO<0xC5, 0x00, "lea", RA>; |
| 1172 |
def LEA_bo_bso : IBO_RAbso<0x49, 0x28, "lea", RA>; |
| 1173 |
def LEA_bol : IBOL_RAaO<0xD9, "lea", RA>; |
| 1174 |
|
| 1175 |
def LHA_abs : IABS_RO<0xC5, 0x01, "lha", RA>, Requires<[HasV162_UP]>; |
| 1176 |
|
| 1177 |
def LOOP_brr : IBRR_1<0xFD, 0x00, "loop">; |
| 1178 |
|
| 1179 |
def LOOP_sbr : SBR<0xFC, (outs), (ins RA:$s2, oext4imm:$disp4), |
| 1180 |
"loop $s2, $disp4", []>; |
| 1181 |
def LOOPU_brr : IBRR_0<0xFD, 0x01, "loopu">, Requires<[HasV120_UP]>; |
| 1182 |
|
| 1183 |
defm LT : mIRR_RC<0x0B, 0x12, 0x8B, 0x12, "lt">; |
| 1184 |
defm LT : mISRR_SRC<0x7A, 0xFA, "lt", RD, RD, s4imm>; |
| 1185 |
|
| 1186 |
defm LT_U : mIRR_RC<0x0B, 0x13, 0x8B, 0x13, "lt.u">; |
| 1187 |
defm LT_U : mISRR_SRC<0x06, 0x86, "lt.u", RD, RD, u4imm, "v110">, NsRequires<[HasV110]>; |
| 1188 |
def LT_A_rr : IRR_dab<0x01, 0x42, "lt.a", RD, RA, RA>; |
| 1189 |
|
| 1190 |
multiclass mIU__RR_ab<bits<8> op1, bits<8> op2, |
| 1191 |
bits<8> uop1, bits<8> uop2, |
| 1192 |
string asmstr> { |
| 1193 |
def "" : IRR_dab<op1, op2, asmstr>; |
| 1194 |
def U : IRR_dab<uop1, uop2, asmstr # "u">; |
| 1195 |
} |
| 1196 |
|
| 1197 |
defm LT_B : mIU__RR_ab<0x0B, 0x52, 0x0B, 0x53, "lt.b">; |
| 1198 |
defm LT_H : mIU__RR_ab<0x0B, 0x72, 0x0B, 0x73, "lt.h">; |
| 1199 |
defm LT_W : mIU__RR_ab<0x0B, 0x92, 0x0B, 0x93, "lt.w">; |
| 1200 |
|
| 1201 |
class IRRR1_label<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC, string label> |
| 1202 |
: RRR1<op1, op2, (outs RC:$d), (ins RD:$s1, RD:$s2, RC:$s3, u2imm:$n), |
| 1203 |
asmstr # " $d, $s3, $s1, ${s2}" # label # ", $n", []>; |
| 1204 |
class IRRR1_label2<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC, string label1, string label2> |
| 1205 |
: RRR1<op1, op2, (outs RC:$d), (ins RD:$s1, RD:$s2, RC:$s3, u2imm:$n), |
| 1206 |
asmstr # " $d, $s3, ${s1}" # label1 # ", ${s2}" # label2 # ", $n", []>; |
| 1207 |
class IRRR1_n<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC=RD> |
| 1208 |
: RRR1<op1, op2, (outs RC:$d), (ins RD:$s1, RD:$s2, RC:$s3, u2imm:$n), |
| 1209 |
asmstr # " $d, $s3, $s1, $s2, $n", []>; |
| 1210 |
class IRRR1<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC=RD> |
| 1211 |
: RRR1<op1, op2, (outs RC:$d), (ins RD:$s1, RD:$s2, RC:$s3, u2imm:$n), |
| 1212 |
asmstr # " $d, $s3, $s1, $s2", []>; |
| 1213 |
|
| 1214 |
class IRRR2<bits<8> op1, bits<8> op2, string asmstr, RegisterClass RC> |
| 1215 |
: RRR2<op1, op2, (outs RC:$d), (ins RD:$s1, RD:$s2, RC:$s3), |
| 1216 |
asmstr # " $d, $s3, $s1, $s2", []>; |
| 1217 |
|
| 1218 |
multiclass mIRRR2<bits<8> op1, bits<8> op2, bits<8> op3, bits<8> op4, string asmstr>{ |
| 1219 |
def _rrr2 : IRRR2<op1, op2, asmstr, RD>; |
| 1220 |
def _rrr2_e : IRRR2<op3, op4, asmstr, RE>, Requires<[HasV120_UP]>; |
| 1221 |
} |
| 1222 |
|
| 1223 |
multiclass mIRCR_RRR2<bits<8> op_rcr1, bits<3> op_rcr2, bits<8> op_rrr21, bits<8> op_rrr22, |
| 1224 |
string asmstr, string posfix="", |
| 1225 |
Operand Type3=s9imm, RegisterClass RC1=RE, RegisterClass RC2=RD>{ |
| 1226 |
def _rcr#posfix: IRCR<op_rcr1, op_rcr2, asmstr, RC1, RC2, RC1, Type3>; |
| 1227 |
def _rrr2#posfix: IRRR2<op_rrr21, op_rrr22, asmstr, RC1>; |
| 1228 |
} |
| 1229 |
|
| 1230 |
multiclass mIRRR1_LU2<bits<8> prefix, bits<6> ll, bits<6> lu, |
| 1231 |
bits<6> ul, bits<6> uu, |
| 1232 |
string asmstr, RegisterClass RC>{ |
| 1233 |
def _rrr1_LL : IRRR1_label<prefix, ll, asmstr, RC, "ll">; |
| 1234 |
def _rrr1_LU : IRRR1_label<prefix, lu, asmstr, RC, "lu">; |
| 1235 |
def _rrr1_UL : IRRR1_label<prefix, ul, asmstr, RC, "ul">; |
| 1236 |
def _rrr1_UU : IRRR1_label<prefix, uu, asmstr, RC, "uu">; |
| 1237 |
} |
| 1238 |
multiclass mI_MADD_H_MSUB_H_<bits<8> pre, bits<6> ll, bits<6> lu, |
| 1239 |
bits<6> ul, bits<6> uu, string asmstr, bit hasv110=true, RegisterClass RC=RE>{ |
| 1240 |
if hasv110 then { |
| 1241 |
if !or(!eq("maddm.h", asmstr), !eq("msubm.h", asmstr)) then |
| 1242 |
def _rrr1_v110 : IRRR1<pre, ul, asmstr, RC>, NsRequires<[HasV110]>; |
| 1243 |
else |
| 1244 |
def _rrr1_v110 : IRRR1_n<pre, ul, asmstr, RC>, NsRequires<[HasV110]>; |
| 1245 |
} |
| 1246 |
defm "" : mIRRR1_LU2<pre, ll, lu, ul, uu, asmstr, RC>, Requires<[HasV120_UP]>; |
| 1247 |
} |
| 1248 |
|
| 1249 |
multiclass mI_MADDRsH_MSUBRsH_<bits<8> pre2, bits<6> ul2, bits<8> pre1, bits<6> ll, bits<6> lu, |
| 1250 |
bits<6> ul, bits<6> uu, string asmstr>{ |
| 1251 |
def _rrr1_v110: RRR1<pre2, ul2, (outs RD:$d), (ins RD:$s1, RD:$s2, RE:$s3, u2imm:$n), |
| 1252 |
asmstr # " $d, $s3, $s1, $s2, $n", []>, NsRequires<[HasV110]>; |
| 1253 |
def _rrr1_UL_2: RRR1<pre2, ul2, (outs RD:$d), (ins RD:$s1, RD:$s2, RE:$s3, u2imm:$n), |
| 1254 |
asmstr # " $d, $s3, $s1, ${s2}ul, $n", []>, Requires<[HasV120_UP]>; |
| 1255 |
defm "" : mIRRR1_LU2<pre1, ll, lu, ul, uu, asmstr, RD>, Requires<[HasV120_UP]>; |
| 1256 |
} |
| 1257 |
|
| 1258 |
multiclass mI_MADDsQ_MSUBsQ_<bits<8> prefix, bits<6> op, bits<6> eop, bits<6> l, bits<6> el, bits<6> u, bits<6> eu, |
| 1259 |
bits<6> ll, bits<6> ell, bits<6> uu, bits<6> euu, string asmstr>{ |
| 1260 |
def _rrr1_UU2_v110: IRRR1_n<prefix, uu, asmstr, RD>, NsRequires<[HasV110]>; |
| 1261 |
def _rrr1: IRRR1_n<prefix, op, asmstr, RD>, Requires<[HasV120_UP]>; |
| 1262 |
def _rrr1_e: IRRR1_n<prefix, eop, asmstr, RE>, Requires<[HasV120_UP]>; |
| 1263 |
def _rrr1_L: IRRR1_label<prefix, l, asmstr, RD, "l">, Requires<[HasV120_UP]>; |
| 1264 |
def _rrr1_e_L: IRRR1_label<prefix, el, asmstr, RE, "l">, Requires<[HasV120_UP]>; |
| 1265 |
def _rrr1_U: IRRR1_label<prefix, u, asmstr, RD, "u">, Requires<[HasV120_UP]>; |
| 1266 |
def _rrr1_e_U: IRRR1_label<prefix, eu, asmstr, RE, "u">, Requires<[HasV120_UP]>; |
| 1267 |
def _rrr1_L_L: IRRR1_label2<prefix, ll, asmstr, RD, "l", "l">, Requires<[HasV120_UP]>; |
| 1268 |
def _rrr1_e_L_L: IRRR1_label2<prefix, ell, asmstr, RE, "l", "l">, Requires<[HasV120_UP]>; |
| 1269 |
def _rrr1_U_U: IRRR1_label2<prefix, uu, asmstr, RD, "u", "u">, Requires<[HasV120_UP]>; |
| 1270 |
def _rrr1_e_U_U: IRRR1_label2<prefix, euu, asmstr, RE, "u", "u">, Requires<[HasV120_UP]>; |
| 1271 |
} |
| 1272 |
|
| 1273 |
defm MADD : mIRCR<0x13, 0x01, 0x13, 0x03, "madd"> |
| 1274 |
, mIRRR2<0x03, 0x0A, 0x03, 0x6A, "madd">; |
| 1275 |
|
| 1276 |
defm MADDS : mIRCR<0x13, 0x05, 0x13, 0x07, "madds"> |
| 1277 |
, mIRRR2<0x03, 0x8A, 0x03, 0xEA, "madds">; |
| 1278 |
|
| 1279 |
defm MADD_H : mI_MADD_H_MSUB_H_<0x83, 0x1A, 0x19, 0x18, 0x1B, "madd.h">; |
| 1280 |
defm MADDS_H : mI_MADD_H_MSUB_H_<0x83, 0x3A, 0x39, 0x38, 0x3B, "madds.h">; |
| 1281 |
|
| 1282 |
defm MADD_Q : mI_MADDsQ_MSUBsQ_<0x43, 0x02, 0x1B, 0x01, 0x19, 0x00, 0x18, 0x05, 0x1D, 0x04, 0x1C, "madd.q">; |
| 1283 |
defm MADDS_Q : mI_MADDsQ_MSUBsQ_<0x43, 0x22, 0x3B, 0x21, 0x39, 0x20, 0x38, 0x25, 0x3D, 0x24, 0x3C, "madds.q">; |
| 1284 |
|
| 1285 |
defm MADD_U: mIRCR_RRR2<0x13, 0x02, 0x03, 0x68, "madd.u", "", u9imm>, Requires<[HasV120_UP]>; |
| 1286 |
|
| 1287 |
defm MADDS_U: mIRCR<0x13, 0x04, 0x13, 0x06, "madds.u"> |
| 1288 |
, mIRRR2<0x03, 0x88, 0x03, 0xE8, "madds.u">; |
| 1289 |
|
| 1290 |
defm MADDM: mIRCR_RRR2<0x13, 0x03, 0x03, 0x6A, "maddm", "_v110">, NsRequires<[HasV110]>; |
| 1291 |
def MADDM_Q_rrr1_v110: IRRR1<0x43, 0x70, "maddm.q", RE>, NsRequires<[HasV110]>; |
| 1292 |
defm MADDM_U: mIRCR_RRR2<0x13, 0x02, 0x03, 0x68, "maddm.u", "_v110", u9imm>, NsRequires<[HasV110]>; |
| 1293 |
|
| 1294 |
defm MADDM_H : mI_MADD_H_MSUB_H_<0x83, 0x1E, 0x1D, 0x1C, 0x1F, "maddm.h">; |
| 1295 |
|
| 1296 |
defm MADDMS: mIRCR_RRR2<0x13, 0x07, 0x03, 0xEA, "maddms", "_v110">, NsRequires<[HasV110]>; |
| 1297 |
defm MADDMS_U: mIRCR_RRR2<0x13, 0x06, 0x03, 0xE8, "maddms.u", "_v110", u9imm>, NsRequires<[HasV110]>; |
| 1298 |
defm MADDMS_H : mI_MADD_H_MSUB_H_<0x83, 0x3E, 0x3D, 0x3C, 0x3F, "maddms.h", false>; |
| 1299 |
|
| 1300 |
defm MADDR_H : mI_MADDRsH_MSUBRsH_<0x43, 0x1E, 0x83, 0x0E, 0x0D, 0x0C, 0x0F, "maddr.h">; |
| 1301 |
defm MADDRS_H : mI_MADDRsH_MSUBRsH_<0x43, 0x3E, 0x83, 0x2E, 0x2D, 0x2C, 0x2F, "maddrs.h">; |
| 1302 |
|
| 1303 |
multiclass mI_MADDRsQ_MSUBRsQ_<bits<8> prefix, bits<6> op, bits<6> eop, string asmstr> { |
| 1304 |
def _rrr1_L_L : IRRR1_label2<prefix, op, asmstr, RD, "l", "l">, Requires<[HasV120_UP]>; |
| 1305 |
def _rrr1_U_U : IRRR1_label2<prefix, eop, asmstr, RD, "u", "u">, Requires<[HasV120_UP]>; |
| 1306 |
def _rrr1_v110: IRRR1_n<prefix, eop, asmstr, RD>, NsRequires<[HasV110]>; |
| 1307 |
} |
| 1308 |
|
| 1309 |
defm MADDR_Q : mI_MADDRsQ_MSUBRsQ_<0x43, 0x07, 0x06, "maddr.q">; |
| 1310 |
defm MADDRS_Q: mI_MADDRsQ_MSUBRsQ_<0x43, 0x27, 0x26, "maddrs.q">; |
| 1311 |
|
| 1312 |
defm MADDSU_H : mI_MADD_H_MSUB_H_<0xC3, 0x1A, 0x19, 0x18, 0x1B, "maddsu.h", false>; |
| 1313 |
defm MADDSUS_H : mI_MADD_H_MSUB_H_<0xC3, 0x3A, 0x39, 0x38, 0x3B, "maddsus.h", false>; |
| 1314 |
defm MADDSUM_H : mI_MADD_H_MSUB_H_<0xC3, 0x1E, 0x1D, 0x1C, 0x1F, "maddsum.h", false>; |
| 1315 |
defm MADDSUMS_H : mI_MADD_H_MSUB_H_<0xC3, 0x3E, 0x3D, 0x3C, 0x3F, "maddsums.h", false>; |
| 1316 |
defm MADDSUR_H : mI_MADD_H_MSUB_H_<0xC3, 0x0E, 0x0D, 0x0C, 0x0F, "maddsur.h", false, RD>; |
| 1317 |
defm MADDSURS_H : mI_MADD_H_MSUB_H_<0xC3, 0x2E, 0x2D, 0x2C, 0x2F, "maddsurs.h", false, RD>; |
| 1318 |
|
| 1319 |
defm MAX : mIRR_RC<0x0B, 0x1A, 0x8B, 0x1A, "max">; |
| 1320 |
defm MAX_U : mIRR_RC<0x0B, 0x1B, 0x8B, 0x1B, "max.u">; |
| 1321 |
|
| 1322 |
defm MAX_B : mIU__RR_ab<0x0B, 0x5A, 0x0B, 0x5B, "max.b">; |
| 1323 |
defm MAX_H : mIU__RR_ab<0x0B, 0x7A, 0x0B, 0x7B, "max.h">; |
| 1324 |
|
| 1325 |
defm MIN : mIRR_RC<0x0B, 0x18, 0x8B, 0x18, "min">; |
| 1326 |
defm MIN_U : mIRR_RC<0x0B, 0x19, 0x8B, 0x19, "min.u">; |
| 1327 |
|
| 1328 |
defm MIN_B : mIU__RR_ab<0x0B, 0x58, 0x0B, 0x59, "min.b">; |
| 1329 |
defm MIN_H : mIU__RR_ab<0x0B, 0x78, 0x0B, 0x79, "min.h">; |
| 1330 |
|
| 1331 |
class IRLC_1<bits<8> op1, string asmstr, RegisterClass RC=RD, Operand TypeC=u16imm> |
| 1332 |
: RLC<op1, (outs RC:$d), (ins TypeC:$const16), |
| 1333 |
asmstr # " $d, $const16", []>; |
| 1334 |
|
| 1335 |
class ISRC_1<bits<8> op1, string asmstr, RegisterClass RC=RD> |
| 1336 |
: SRC<op1, (outs RC:$d), (ins s4imm:$const4), |
| 1337 |
asmstr # " $d, $const4", []>; |
| 1338 |
|
| 1339 |
def MOV_rlc : IRLC_1<0x3B, "mov", RD, s16imm>; |
| 1340 |
def MOV_rlc_e: IRLC_1<0xFB, "mov", RE>, Requires<[HasV160_UP]>; |
| 1341 |
|
| 1342 |
def MOV_rr : IRR_b<0x0B, 0x1F, "mov">; |
| 1343 |
def MOV_rr_e: IRR_b<0x0B, 0x80, "mov", RE>, Requires<[HasV160_UP]>; |
| 1344 |
def MOV_rr_eab : IRR_dab<0x0B, 0x81, "mov", RE>, Requires<[HasV160_UP]>; |
| 1345 |
|
| 1346 |
def MOV_sc_v110: ISC_D15C<0xC6, "mov">, NsRequires<[HasV110]>; |
| 1347 |
def MOV_sc : ISC_D15C<0xDA, "mov">, Requires<[HasV120_UP]>; |
| 1348 |
|
| 1349 |
def MOV_src: ISRC_dC<0x82, "mov">; |
| 1350 |
def MOV_src_e: ISRC_1<0xD2, "mov", RE>, Requires<[HasV160_UP]>; |
| 1351 |
|
| 1352 |
def MOV_srr : ISRR_db<0x02, "mov">; |
| 1353 |
|
| 1354 |
multiclass mI_MOV_srr<bits<8> srr110,bits<8> srr1, string asmstr, RegisterClass RCd=RA, RegisterClass RC1=RD>{ |
| 1355 |
def _srr_v110: ISRR_db<srr110, asmstr, RCd, RC1>, NsRequires<[HasV110]>; |
| 1356 |
def _srr: ISRR_db<srr1, asmstr, RCd, RC1>, Requires<[HasV120_UP]>; |
| 1357 |
} |
| 1358 |
|
| 1359 |
multiclass mI_MOVA_<bits<8> rr1, bits<8> rr2, bits<8> src1, bits<8> srr110,bits<8> srr1, string asmstr> { |
| 1360 |
def _rr : IRR_b<rr1, rr2, asmstr, RA>; |
| 1361 |
def _src: ISRC_dC<src1, asmstr, RA, u4imm>, Requires<[HasV120_UP]>; |
| 1362 |
defm "" : mI_MOV_srr<srr110, srr1, asmstr>; |
| 1363 |
} |
| 1364 |
|
| 1365 |
defm MOV_A : mI_MOVA_<0x01, 0x63, 0xA0, 0x30, 0x60, "mov.a">; |
| 1366 |
|
| 1367 |
def MOV_AA_rr : IRR_b<0x01, 0x00, "mov.aa", RA, RA>; |
| 1368 |
defm MOV_AA_srr: mI_MOV_srr<0x80, 0x40, "mov.aa", RA, RA>; |
| 1369 |
|
| 1370 |
def MOV_D_rr : IRR_b<0x01, 0x4C, "mov.d", RD, RA>; |
| 1371 |
defm MOV_D_srr : mI_MOV_srr<0x20, 0x80, "mov.d", RD, RA>; |
| 1372 |
|
| 1373 |
def MOV_U_rlc : IRLC_1<0xBB, "mov.u">; |
| 1374 |
def MOVH_rlc : IRLC_1<0x7B, "movh", RD, u16imm>; |
| 1375 |
def MOVH_A_rlc : IRLC_1<0x91, "movh.a", RA, u16imm>; |
| 1376 |
def MOVZ_A_sr: ISR_1<0x00, 0x01, "movz.a", RA>, NsRequires<[HasV110]>; |
| 1377 |
|
| 1378 |
defm MSUB : mIRCR<0x33, 0x01, 0x33, 0x03, "msub"> |
| 1379 |
, mIRRR2<0x23, 0x0A, 0x23, 0x6A, "msub">; |
| 1380 |
defm MSUBS: mIRCR<0x33, 0x05, 0x33, 0x07, "msubs"> |
| 1381 |
, mIRRR2<0x23, 0x8A, 0x23, 0xEA, "msubs">; |
| 1382 |
|
| 1383 |
defm MSUB_H : mI_MADD_H_MSUB_H_<0xA3, 0x1A, 0x19, 0x18, 0x1B, "msub.h">; |
| 1384 |
defm MSUBS_H : mI_MADD_H_MSUB_H_<0xA3, 0x3A, 0x39, 0x38, 0x3B, "msubs.h">; |
| 1385 |
defm MSUB_Q : mI_MADDsQ_MSUBsQ_<0x63, 0x02, 0x1B, 0x01, 0x19, 0x00, 0x18, 0x05, 0x1D, 0x04, 0x1C, "msub.q">; |
| 1386 |
defm MSUBS_Q : mI_MADDsQ_MSUBsQ_<0x63, 0x22, 0x3B, 0x21, 0x39, 0x20, 0x38, 0x25, 0x3D, 0x24, 0x3C, "msubs.q">; |
| 1387 |
|
| 1388 |
defm MSUB_U: mIRCR_RRR2<0x33, 0x02, 0x23, 0x68, "msub.u", "", u9imm>, Requires<[HasV120_UP]>; |
| 1389 |
defm MSUBS_U : mIRCR<0x33, 0x04, 0x33, 0x06, "msubs.u"> |
| 1390 |
, mIRRR2<0x23, 0x88, 0x23, 0xE8, "msubs.u">; |
| 1391 |
|
| 1392 |
defm MSUBAD_H : mI_MADD_H_MSUB_H_<0xE3, 0x1A, 0x19, 0x18, 0x1B, "msubad.h", false>; |
| 1393 |
defm MSUBADS_H : mI_MADD_H_MSUB_H_<0xE3, 0x3A, 0x39, 0x38, 0x3B, "msubads.h", false>; |
| 1394 |
defm MSUBADM_H : mI_MADD_H_MSUB_H_<0xE3, 0x1E, 0x1D, 0x1C, 0x1F, "msubadm.h", false>; |
| 1395 |
defm MSUBADMS_H : mI_MADD_H_MSUB_H_<0xE3, 0x3E, 0x3D, 0x3C, 0x3F, "msubadms.h", false>; |
| 1396 |
defm MSUBADR_H : mI_MADD_H_MSUB_H_<0xE3, 0x0E, 0x0D, 0x0C, 0x0F, "msubadr.h", true, RD>; |
| 1397 |
defm MSUBADRS_H : mI_MADD_H_MSUB_H_<0xE3, 0x2E, 0x2D, 0x2C, 0x2F, "msubadrs.h", true, RD>; |
| 1398 |
|
| 1399 |
defm MSUBM: mIRCR_RRR2<0x33, 0x03, 0x23, 0x6A, "msubm", "v110">, NsRequires<[HasV110]>; |
| 1400 |
def MSUBM_Q_rrr1_v110: IRRR1<0x63, 0x1C, "msubm.q", RE>, NsRequires<[HasV110]>; |
| 1401 |
defm MSUBM_U: mIRCR_RRR2<0x33, 0x02, 0x23, 0x68, "msubm.u", "v110">, NsRequires<[HasV110]>; |
| 1402 |
defm MSUBMS: mIRCR_RRR2<0x33, 0x07, 0x23, 0xEA, "msubms", "v110">, NsRequires<[HasV110]>; |
| 1403 |
defm MSUBMS_U: mIRCR_RRR2<0x33, 0x06, 0x23, 0xE8, "msubms.u", "v110">, NsRequires<[HasV110]>; |
| 1404 |
|
| 1405 |
defm MSUBM_H : mI_MADD_H_MSUB_H_<0xA3, 0x1E, 0x1D, 0x1C, 0x1F, "msubm.h">; |
| 1406 |
defm MSUBMS_H : mI_MADD_H_MSUB_H_<0xA3, 0x3E, 0x3D, 0x3C, 0x3F, "msubms.h", false>; |
| 1407 |
|
| 1408 |
defm MSUBR_H : mI_MADDRsH_MSUBRsH_<0x63, 0x1E, 0xA3, 0x0E, 0x0D, 0x0C, 0x0F, "msubr.h">; |
| 1409 |
defm MSUBRS_H: mI_MADDRsH_MSUBRsH_<0x63, 0x3E, 0xA3, 0x2E, 0x2D, 0x2C, 0x2F, "msubrs.h">; |
| 1410 |
|
| 1411 |
defm MSUBR_Q : mI_MADDRsQ_MSUBRsQ_<0x63, 0x07, 0x06, "msubr.q">; |
| 1412 |
defm MSUBRS_Q: mI_MADDRsQ_MSUBRsQ_<0x63, 0x27, 0x26, "msubrs.q">; |
| 1413 |
|
| 1414 |
class IRLC_CR<bits<8> op1, string asmstr, RegisterClass RC=RD> |
| 1415 |
: RLC<op1, (outs), (ins s16imm:$const16, RC:$d), |
| 1416 |
asmstr # " $const16, $d", []>; |
| 1417 |
|
| 1418 |
def MTCR_rlc : IRLC_CR<0xCD, "mtcr">; |
| 1419 |
def MFCR_rlc : IRLC_1 <0x4D, "mfcr">; |
| 1420 |
|
| 1421 |
class IRR2<bits<8> op1, bits<12> op2, string asmstr, |
| 1422 |
RegisterClass RCd=RD, RegisterClass RCa=RD, RegisterClass RCb=RD> |
| 1423 |
: RR2<op1, op2, (outs RCd:$d), (ins RCa:$s1, RCb:$s2), asmstr # " $d, $s1, $s2", []>; |
| 1424 |
|
| 1425 |
def MUL_rc : RC<0x53, 0x01, (outs RD:$d), (ins RD:$s1, s9imm:$const9), |
| 1426 |
"mul $d, $s1, $const9", []>; |
| 1427 |
def MUL_rc_e: RC<0x53, 0x03, (outs RE:$d), (ins RD:$s1, s9imm:$const9), |
| 1428 |
"mul $d, $s1, $const9", []> |
| 1429 |
, Requires<[HasV120_UP]>; |
| 1430 |
|
| 1431 |
def MUL_rr2 : IRR2<0x73, 0x0A, "mul">, Requires<[HasV120_UP]>; |
| 1432 |
def MUL_rr2_e: IRR2<0x73, 0x6A, "mul", RE>, Requires<[HasV120_UP]>; |
| 1433 |
|
| 1434 |
def MUL_srr : ISRR_db<0xE2, "mul">; |
| 1435 |
def MUL_rr_v110: IRR_dab<0x73, 0x0A, "mul">, NsRequires<[HasV110]>; |
| 1436 |
|
| 1437 |
multiclass mI_MUL_<bits<8> rc1, bits<7> rc2, bits<8> oprr1, bits<12> oprr2, string asmstr, |
| 1438 |
RegisterClass RCd=RD>{ |
| 1439 |
if !eq(asmstr, "mul.u") then |
| 1440 |
def _rc : IRC<rc1, rc2, asmstr, RCd>, Requires<[HasV120_UP]>; |
| 1441 |
else{ |
| 1442 |
def _rc : IRC<rc1, rc2, asmstr, RCd>; |
| 1443 |
def _rr_v110: IRR_dab<oprr1, oprr2{7-0}, asmstr, RCd>, NsRequires<[HasV110]>; |
| 1444 |
} |
| 1445 |
|
| 1446 |
def _rr2 : IRR2<oprr1, oprr2, asmstr, RCd>, Requires<[HasV120_UP]>; |
| 1447 |
} |
| 1448 |
|
| 1449 |
defm MULS : mI_MUL_<0x53, 0x05, 0x73, 0x8A, "muls", RD>; |
| 1450 |
|
| 1451 |
class IRR1<bits<8> op1, bits<10> op2, string asmstr, |
| 1452 |
RegisterClass RCd, string labela, string labelb> |
| 1453 |
: RR1<op1, op2, (outs RCd:$d), (ins RD:$s1, RD:$s2, u2imm:$n), |
| 1454 |
asmstr # " $d, ${s1}" # labela # ", ${s2}" # labelb # ", $n", []>; |
| 1455 |
|
| 1456 |
multiclass mI_MUL_H_<bits<8> pre, bits<10> ll, bits<10> lu, bits<10> ul, bits<10> uu, string asmstr |
| 1457 |
, bit hasv110=false, bits<8> rr=0, RegisterClass RCd=RE>{ |
| 1458 |
if hasv110 then |
| 1459 |
def _rr_v110 : IRR_dabn<pre, rr, asmstr, RCd>, NsRequires<[HasV110]>; |
| 1460 |
def _rr1_LL2e : IRR1<pre, ll, asmstr, RCd, "", "ll">, Requires<[HasV120_UP]>; |
| 1461 |
def _rr1_LU2e : IRR1<pre, lu, asmstr, RCd, "", "lu">, Requires<[HasV120_UP]>; |
| 1462 |
def _rr1_UL2e : IRR1<pre, ul, asmstr, RCd, "", "ul">, Requires<[HasV120_UP]>; |
| 1463 |
def _rr1_UU2e : IRR1<pre, uu, asmstr, RCd, "", "uu">, Requires<[HasV120_UP]>; |
| 1464 |
} |
| 1465 |
|
| 1466 |
defm MUL_H : mI_MUL_H_<0xB3, 0x1A, 0x19, 0x18, 0x1B, "mul.h", true, 0x18>; |
| 1467 |
|
| 1468 |
multiclass mI_MULQ_<bits<8> pre, bits<8> rr, bits<10> op1, bits<10> op2, bits<10> op3, bits<10> op4, |
| 1469 |
bits<10> op5, bits<10> op6, bits<10> op7, bits<10> op8, string asmstr>{ |
| 1470 |
def _rr_v110 : IRR_dabn<pre, rr, asmstr, RD>, NsRequires<[HasV110]>; |
| 1471 |
def _rr1_2 : IRR1<pre, op1, asmstr, RD, "", "">, Requires<[HasV120_UP]>; |
| 1472 |
def _rr1_2__e: IRR1<pre, op2, asmstr, RE, "", "">, Requires<[HasV120_UP]>; |
| 1473 |
|
| 1474 |
def _rr1_2_L : IRR1<pre, op3, asmstr, RD, "", "l">, Requires<[HasV120_UP]>; |
| 1475 |
def _rr1_2_Le: IRR1<pre, op4, asmstr, RE, "", "l">, Requires<[HasV120_UP]>; |
| 1476 |
def _rr1_2_U : IRR1<pre, op5, asmstr, RD, "", "u">, Requires<[HasV120_UP]>; |
| 1477 |
def _rr1_2_Ue: IRR1<pre, op6, asmstr, RE, "", "u">, Requires<[HasV120_UP]>; |
| 1478 |
|
| 1479 |
def _rr1_2LL : IRR1<pre, op7, asmstr, RD, "l", "l">, Requires<[HasV120_UP]>; |
| 1480 |
def _rr1_2UU : IRR1<pre, op8, asmstr, RD, "u", "u">, Requires<[HasV120_UP]>; |
| 1481 |
} |
| 1482 |
|
| 1483 |
defm MUL_Q : mI_MULQ_<0x93, 0x04, 0x02, 0x1B, 0x01, 0x19, 0x00, 0x18, 0x05, 0x04, "mul.q">; |
| 1484 |
|
| 1485 |
defm MUL_U : mI_MUL_<0x53, 0x02, 0x73, 0x68, "mul.u", RE>; |
| 1486 |
defm MULS_U : mI_MUL_<0x53, 0x04, 0x73, 0x88, "muls.u", RD>; |
| 1487 |
|
| 1488 |
defm MULM: mIRR_RC<0x73, 0x6A, 0x53, 0x03, "mulm", RE>, NsRequires<[HasV110]>; |
| 1489 |
defm MULM_U: mIRR_RC<0x73, 0x68, 0x53, 0x02, "mulm.u", RE>, NsRequires<[HasV110]>; |
| 1490 |
defm MULMS_H: mI_MUL_H_<0xB3, 0x3E,0x3D, 0x3C, 0x3F, "mulms.h">; |
| 1491 |
|
| 1492 |
defm MULM_H : mI_MUL_H_<0xB3, 0x1E, 0x1D, 0x1C, 0x1F, "mulm.h">; |
| 1493 |
defm MULR_H : mI_MUL_H_<0xB3, 0x0E, 0x0D, 0x0C, 0x0F, "mulr.h", true, 0x0C, RD>; |
| 1494 |
|
| 1495 |
def MULR_Q_rr_v110 : IRR_dabn<0x93, 0x06, "mulr.q">, NsRequires<[HasV110]>; |
| 1496 |
def MULR_Q_rr1_2LL : IRR1<0x93, 0x07, "mulr.q", RD, "l", "l">, Requires<[HasV120_UP]>; |
| 1497 |
def MULR_Q_rr1_2UU : IRR1<0x93, 0x06, "mulr.q", RD, "u", "u">, Requires<[HasV120_UP]>; |
| 1498 |
|
| 1499 |
defm NAND : mIRR_RC<0x0F, 0x09, 0x8F, 0x09, "nand">; |
| 1500 |
def NAND_T : IBIT<0x07, 0x00, "nand.t">; |
| 1501 |
|
| 1502 |
defm NE : mIRR_RC<0x0B, 0x11, 0x8B, 0x11, "ne">; |
| 1503 |
def NE_A : IRR_dab<0x01, 0x41, "ne.a", RD, RA, RA>; |
| 1504 |
def NEZ_A : IRR_a<0x01, 0x49, "nez.a", RD, RA>; |
| 1505 |
|
| 1506 |
def NOP_sr : ISR_0<0x00, 0x00, "nop">; |
| 1507 |
def NOP_sys : ISYS_0<0x0D, 0x00, "nop">; |
| 1508 |
|
| 1509 |
multiclass mISR_1<bits<8> sr1op1, bits<4> sr1op2, bits<8> sr2op1, bits<4> sr2op2, |
| 1510 |
string asmstr>{ |
| 1511 |
def _sr : ISR_1<sr1op1, sr1op2, asmstr>, Requires<[HasV120_UP]>; |
| 1512 |
def _sr_v110 : ISR_1<sr2op1, sr2op2, asmstr>, NsRequires<[HasV110]>; |
| 1513 |
} |
| 1514 |
|
| 1515 |
defm NOR : mIRR_RC<0x0F, 0x0B, 0x8F, 0x0B, "nor">; |
| 1516 |
def NOR_T : IBIT<0x87, 0x02, "nor.t">; |
| 1517 |
|
| 1518 |
defm NOR : mISR_1<0x46, 0x00, 0x36, 0x00, "nor">; |
| 1519 |
|
| 1520 |
def NOT_sr_v162 : ISR_1<0x46, 0x00, "not">, NsRequires<[HasV162]>; |
| 1521 |
|
| 1522 |
|
| 1523 |
defm OR : mIRR_RC<0x0F, 0x0A, 0x8F, 0x0A, "or", RD, RD, u9imm>; |
| 1524 |
def OR_sc : ISC_D15C<0x96, "or">, Requires<[HasV120_UP]>; |
| 1525 |
def OR_srr : ISRR_db<0xA6, "or">, Requires<[HasV120_UP]>; |
| 1526 |
def OR_sc_v110 : ISC_D15C<0xD6, "or">, NsRequires<[HasV110]>; |
| 1527 |
def OR_srr_v110 : ISRR_db<0x56, "or">, NsRequires<[HasV110]>; |
| 1528 |
|
| 1529 |
def OR_AND_T : IBIT<0xC7, 0x00, "or.and.t">; |
| 1530 |
def OR_ANDN_T : IBIT<0xC7, 0x03, "or.andn.t">; |
| 1531 |
def OR_NOR_T : IBIT<0xC7, 0x02, "or.nor.t">; |
| 1532 |
def OR_OR_T : IBIT<0xC7, 0x01, "or.or.t">; |
| 1533 |
|
| 1534 |
defm OR_EQ : mIRR_RC<0x0B, 0x27, 0x8B, 0x27, "or.eq">; |
| 1535 |
defm OR_GE : mIRR_RC<0x0B, 0x2B, 0x8B, 0x2B, "or.ge">; |
| 1536 |
defm OR_GE_U : mIRR_RC<0x0B, 0x2C, 0x8B, 0x2C, "or.ge.u">; |
| 1537 |
defm OR_LT : mIRR_RC<0x0B, 0x29, 0x8B, 0x29, "or.lt">; |
| 1538 |
defm OR_LT_U : mIRR_RC<0x0B, 0x2A, 0x8B, 0x2A, "or.lt.u">; |
| 1539 |
defm OR_NE : mIRR_RC<0x0B, 0x28, 0x8B, 0x28, "or.ne">; |
| 1540 |
|
| 1541 |
def OR_T : IBIT<0x87, 0x01, "or.t">; |
| 1542 |
|
| 1543 |
defm ORN : mIRR_RC<0x0F, 0x0F, 0x8F, 0x0F, "orn">; |
| 1544 |
|
| 1545 |
def ORN_T : IBIT<0x07, 0x01, "orn.t">; |
| 1546 |
|
| 1547 |
def PACK_rrr : IRRR_d31<0x6B, 0x00, "pack", RD, RD, RD, RE>; |
| 1548 |
|
| 1549 |
multiclass mISYS_0<bits<8> sys1op1, bits<6> sys1op2, bits<8> sys2op1, bits<6> sys2op2, |
| 1550 |
string asmstr>{ |
| 1551 |
def _sys : ISYS_0<sys1op1, sys1op2, asmstr>, Requires<[HasV120_UP]>; |
| 1552 |
def _sys_v110 : ISYS_0<sys2op1, sys2op2, asmstr>, NsRequires<[HasV110]>; |
| 1553 |
} |
| 1554 |
|
| 1555 |
def PARITY_rr : IRR_a<0x4B, 0x02, "parity">, Requires<[HasV120_UP]>; |
| 1556 |
def PARITY_rr_v110 : IRR_a<0x4B, 0x08, "parity">, NsRequires<[HasV110]>; |
| 1557 |
|
| 1558 |
def POPCNT_W_rr : IRR_a<0x4B, 0x22, "popcnt.w">, NsRequires<[HasV162]>; |
| 1559 |
|
| 1560 |
def RESTORE_sys : ISYS_1<0x0D, 0x0E, "restore">, Requires<[HasV160_UP]>; |
| 1561 |
|
| 1562 |
def RET_sr : ISR_0<0x00, 0x09, "ret">; |
| 1563 |
defm RET : mISYS_0<0x0D, 0x06, 0x0D, 0x05, "ret">; |
| 1564 |
|
| 1565 |
def RFE_sr : ISR_0<0x00, 0x08, "rfe">; |
| 1566 |
defm RFE_sys : mISYS_0<0x0D, 0x07, 0x0D, 0x06, "rfe">; |
| 1567 |
|
| 1568 |
def RFM_sys : ISYS_0<0x0D, 0x05, "rfm">; |
| 1569 |
|
| 1570 |
def RSLCX_sys : ISYS_0<0x0D, 0x09, "rslcx">; |
| 1571 |
|
| 1572 |
def RSTV_sys : ISYS_0<0x2F, 0x00, "rstv">; |
| 1573 |
|
| 1574 |
def RSUB_rc : IRC<0x8B, 0x08, "rsub">; |
| 1575 |
defm RSUB_sr : mISR_1<0x32, 0x05, 0xD2, 0x05, "rsub">; |
| 1576 |
|
| 1577 |
def RSUBS_rc : IRC<0x8B, 0x0A, "rsubs">; |
| 1578 |
def RSUBS_U_rc : IRC<0x8B, 0x0B, "rsubs.u">; |
| 1579 |
|
| 1580 |
multiclass mI_SAT_<bits<8> r1, bits<8> r2, bits<8> s1, bits<4> s2, bits<8> vs1, bits<4> vs2, string asmstr>{ |
| 1581 |
def _rr : IRR_a<r1, r2, asmstr>; |
| 1582 |
defm "" : mISR_1<s1, s2, vs1, vs2, asmstr>; |
| 1583 |
} |
| 1584 |
|
| 1585 |
defm SAT_B : mI_SAT_<0x0B, 0x5E, 0x32, 0x00, 0xD2, 0x00, "sat.b">; |
| 1586 |
defm SAT_BU : mI_SAT_<0x0B, 0x5F, 0x32, 0x01, 0xD2, 0x01, "sat.bu">; |
| 1587 |
defm SAT_H : mI_SAT_<0x0B, 0x7E, 0x32, 0x02, 0xD2, 0x02, "sat.h">; |
| 1588 |
defm SAT_HU : mI_SAT_<0x0B, 0x7F, 0x32, 0x03, 0xD2, 0x03, "sat.hu">; |
| 1589 |
|
| 1590 |
def SEL_rcr : IRCR<0xAB, 0x04, "sel">; |
| 1591 |
def SEL_rrr : IRRR<0x2B, 0x04, "sel">; |
| 1592 |
|
| 1593 |
def SEL_A_rcr_v110: IRCR<0xA1, 0x04, "sel.a", RA, RA>, NsRequires<[HasV110]>; |
| 1594 |
def SEL_A_rrr_v110: IRRR<0x21, 0x04, "sel.a", RA, RA, RA>, NsRequires<[HasV110]>; |
| 1595 |
|
| 1596 |
def SELN_rcr : IRCR<0xAB, 0x05, "seln">; |
| 1597 |
def SELN_rrr : IRRR<0x2B, 0x05, "seln">; |
| 1598 |
|
| 1599 |
def SELN_A_rcr_v110: IRCR<0xA1, 0x05, "seln.a", RA, RA>, NsRequires<[HasV110]>; |
| 1600 |
def SELN_A_rrr_v110: IRRR<0x21, 0x05, "seln.a", RA, RA, RA>, NsRequires<[HasV110]>; |
| 1601 |
|
| 1602 |
multiclass mISRC_1<bits<8> op1, bits<8> op2, string asmstr>{ |
| 1603 |
def _src: ISRC_1<op1, asmstr>, Requires<[HasV120_UP]>; |
| 1604 |
def _src_v110: ISRC_1<op2, asmstr>, NsRequires<[HasV110]>; |
| 1605 |
} |
| 1606 |
|
| 1607 |
defm SH : mISRC_1<0x06, 0x26, "sh">; |
| 1608 |
defm SH : mIRR_RC<0x0F, 0x00, 0x8F, 0x00, "sh">; |
| 1609 |
defm SH_B : mIRR_RC<0x0F, 0x20, 0x8F, 0x20, "sh.b">, NsRequires<[HasV110]>; |
| 1610 |
defm SH_H : mIRR_RC<0x0F, 0x40, 0x8F, 0x40, "sh.h">; |
| 1611 |
|
| 1612 |
defm SH_EQ : mIRR_RC<0x0B, 0x37, 0x8B, 0x37, "sh.eq">; |
| 1613 |
defm SH_NE : mIRR_RC<0x0B, 0x38, 0x8B, 0x38, "sh.ne">; |
| 1614 |
defm SH_GE : mIRR_RC<0x0B, 0x3B, 0x8B, 0x3B, "sh.ge">; |
| 1615 |
defm SH_GE_U : mIRR_RC<0x0B, 0x3C, 0x8B, 0x3C, "sh.ge.u">; |
| 1616 |
defm SH_LT : mIRR_RC<0x0B, 0x39, 0x8B, 0x39, "sh.lt">; |
| 1617 |
defm SH_LT_U : mIRR_RC<0x0B, 0x3A, 0x8B, 0x3A, "sh.lt.u">; |
| 1618 |
|
| 1619 |
def SH_AND_T : IBIT<0x27, 0x00, "sh.and.t">; |
| 1620 |
def SH_ANDN_T : IBIT<0x27, 0x03, "sh.andn.t">; |
| 1621 |
def SH_NAND_T : IBIT<0xA7, 0x00, "sh.nand.t">; |
| 1622 |
def SH_NOR_T : IBIT<0x27, 0x02, "sh.nor.t">; |
| 1623 |
def SH_OR_T : IBIT<0x27, 0x01, "sh.or.t">; |
| 1624 |
def SH_ORN_T : IBIT<0xA7, 0x01, "sh.orn.t">; |
| 1625 |
def SH_XNOR_T : IBIT<0xA7, 0x02, "sh.xnor.t">; |
| 1626 |
def SH_XOR_T : IBIT<0xA7, 0x03, "sh.xor.t">; |
| 1627 |
|
| 1628 |
|
| 1629 |
defm SHA : mISRC_1<0x86, 0xA6, "sha">; |
| 1630 |
defm SHA : mIRR_RC<0x0F, 0x01, 0x8F, 0x01, "sha">; |
| 1631 |
defm SHA_B : mIRR_RC<0x0F, 0x21, 0x8F, 0x21, "sha.b">, NsRequires<[HasV110]>; |
| 1632 |
defm SHA_H : mIRR_RC<0x0F, 0x41, 0x8F, 0x41, "sha.h">; |
| 1633 |
defm SHAS : mIRR_RC<0x0F, 0x02, 0x8F, 0x02, "shas">; |
| 1634 |
|
| 1635 |
def SHUFFLE_rc : IRC<0x8F, 0x07, "shuffle">, Requires<[HasV162]>; |
| 1636 |
|
| 1637 |
// A[b], off10, A[a] (BO)(Base + Short Offset Addressing Mode) |
| 1638 |
class IBO_bso_st<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC> |
| 1639 |
: BO<op1, op2, (outs RC:$d), (ins RA:$s1, s10imm:$off10), |
| 1640 |
asmstr # " [$s1]$off10, $d", []>; |
| 1641 |
// P[b], A[a] (BO)(Bit-reverse Addressing Mode) |
| 1642 |
class IBO_r_st<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC> |
| 1643 |
: BO<op1, op2, (outs RP:$d), (ins RC:$s1), |
| 1644 |
asmstr # " [${d}+r], $s1", []>; |
| 1645 |
// P[b], off10, A[a] (BO)(Circular Addressing Mode) |
| 1646 |
class IBO_c_st<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC> |
| 1647 |
: BO<op1, op2, (outs RP:$d), (ins RC:$s1, s10imm:$off10), |
| 1648 |
asmstr # " [${d}+c]$off10, $s1", []>; |
| 1649 |
// A[b], off10, A[a] (BO)(Post-increment Addressing Mode) |
| 1650 |
class IBO_pos_st<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC> |
| 1651 |
: BO<op1, op2, (outs), (ins RC:$s1, RA:$s2, s10imm:$off10), |
| 1652 |
asmstr # " [${s2}+]$off10, $s1", []>; |
| 1653 |
// A[b], off10, A[a] (BO)(Pre-increment Addressing Mode) |
| 1654 |
class IBO_pre_st<bits<8> op1, bits<6> op2, string asmstr, RegisterClass RC> |
| 1655 |
: BO<op1, op2, (outs), (ins RC:$s1, RA:$s2, s10imm:$off10), |
| 1656 |
asmstr # " [+${s2}]$off10, $s1", []>; |
| 1657 |
|
| 1658 |
|
| 1659 |
multiclass mIBO_st<bits<8> prefix1, bits<8> prefix2, |
| 1660 |
bits<6> bso2, ///_bso |
| 1661 |
bits<6> pos_r, ///_pos|_r |
| 1662 |
bits<6> pre_c, ///_pre|_c |
| 1663 |
string asmstr, RegisterClass RC>{ |
| 1664 |
def _bo_bso : IBO_bso_st<prefix1, bso2, asmstr, RC>; |
| 1665 |
def _bo_pos : IBO_pos_st<prefix1, pos_r, asmstr, RC>; |
| 1666 |
def _bo_pre : IBO_pre_st<prefix1, pre_c, asmstr, RC>; |
| 1667 |
def _bo_r : IBO_r_st<prefix2, pos_r, asmstr, RC>; |
| 1668 |
def _bo_c : IBO_c_st<prefix2, pre_c, asmstr, RC>; |
| 1669 |
} |
| 1670 |
|
| 1671 |
multiclass mI_ST_<bits<8> abs1, bits<2> abs2, ///_abs |
| 1672 |
bits<8> prefix1, bits<8> prefix2, |
| 1673 |
bits<6> bso, ///_bso |
| 1674 |
bits<6> pos_r, ///_pos|_r |
| 1675 |
bits<6> pre_c, ///_pre|_c |
| 1676 |
string asmstr, RegisterClass RC> |
| 1677 |
: mIBO_st<prefix1, prefix2, bso, pos_r, pre_c, asmstr, RC>{ |
| 1678 |
def _abs : IABS_OR<abs1, abs2, asmstr, RC>; |
| 1679 |
} |
| 1680 |
|
| 1681 |
defm ST_A : mI_ST_<0xA5, 0x02, 0x89, 0xA9, 0x26, 0x06, 0x16, "st.a", RA>; |
| 1682 |
defm ST_B : mI_ST_<0x25, 0x00, 0x89, 0xA9, 0x20, 0x00, 0x10, "st.b", RD>; |
| 1683 |
defm ST_D : mI_ST_<0xA5, 0x01, 0x89, 0xA9, 0x25, 0x05, 0x15, "st.d", RE>; |
| 1684 |
defm ST_DA : mI_ST_<0xA5, 0x03, 0x89, 0xA9, 0x27, 0x07, 0x17, "st.da", RP>; |
| 1685 |
defm ST_H : mI_ST_<0x25, 0x02, 0x89, 0xA9, 0x22, 0x02, 0x12, "st.h", RD>; |
| 1686 |
defm ST_Q : mI_ST_<0x65, 0x00, 0x89, 0xA9, 0x28, 0x08, 0x18, "st.q", RD>; |
| 1687 |
|
| 1688 |
multiclass mI_ST_2_<bits<8> sro, bits<8> ssr, bits<8> ssrpos, bits<8> ssro, |
| 1689 |
bits<8> srov, bits<8> ssrv, bits<8> ssrposv, bits<8> ssrov, |
| 1690 |
string asmstr, RegisterClass RC>{ |
| 1691 |
if !eq(RC,RD) then { |
| 1692 |
def _sro_v110: ISRO_ROD15<srov, asmstr, RA>, NsRequires<[HasV110]>; |
| 1693 |
def _sro : ISRO_ROD15<sro, asmstr, RA>, Requires<[HasV120_UP]>; |
| 1694 |
} else if !eq(RC,RA) then { |
| 1695 |
def _sro_v110: ISRO_ROA15<srov, asmstr, RA>, NsRequires<[HasV110]>; |
| 1696 |
def _sro : ISRO_ROA15<sro, asmstr, RA>, Requires<[HasV120_UP]>; |
| 1697 |
} |
| 1698 |
def _ssr_v110 : SSR<ssrv, (outs RA:$d), (ins RC:$s1), |
| 1699 |
asmstr # " [$d], $s1", []> |
| 1700 |
, NsRequires<[HasV110]>; |
| 1701 |
def _ssr_pos_v110: SSR<ssrposv, (outs RA:$d), (ins RC:$s1), |
| 1702 |
asmstr # " [${d}+], $s1", []> |
| 1703 |
, NsRequires<[HasV110]>; |
| 1704 |
def _ssro_v110: SSRO<ssrov, (outs), (ins RC:$s1, u4imm:$off4), |
| 1705 |
asmstr # " [a15]$off4, $s1", []> |
| 1706 |
, NsRequires<[HasV110]>; |
| 1707 |
|
| 1708 |
def _ssr : SSR<ssr, (outs RA:$d), (ins RC:$s1), |
| 1709 |
asmstr # " [$d], $s1", []> |
| 1710 |
, Requires<[HasV120_UP]>; |
| 1711 |
def _ssr_pos : SSR<ssrpos, (outs RA:$d), (ins RC:$s1), |
| 1712 |
asmstr # " [${d}+], $s1", []> |
| 1713 |
, Requires<[HasV120_UP]>; |
| 1714 |
def _ssro : SSRO<ssro, (outs), (ins RC:$s1, u4imm:$off4), |
| 1715 |
asmstr # " [a15]$off4, $s1", []> |
| 1716 |
, Requires<[HasV120_UP]>; |
| 1717 |
} |
| 1718 |
|
| 1719 |
def ST_A_bol : IBOL_AbOR<0xB5, "st.a", RA>, Requires<[HasV160_UP]>; |
| 1720 |
def ST_A_sc : ISC_A10CA15<0xF8, "st.a">, Requires<[HasV120_UP]>; |
| 1721 |
defm ST_A : mI_ST_2_<0xEC, 0xF4, 0xE4, 0xE8, 0x18, 0x84, 0x54, 0x2C, "st.a", RA>; |
| 1722 |
|
| 1723 |
def ST_B_bol : IBOL_AbOR<0xE9, "st.b", RD>, Requires<[HasV160_UP]>; |
| 1724 |
defm ST_B : mI_ST_2_<0x2C, 0x34, 0x24, 0x28, 0xA8, 0x78, 0xE4, 0x8C, "st.b", RD>; |
| 1725 |
|
| 1726 |
def ST_H_bol : IBOL_AbOR<0xF9, "st.h", RD>, Requires<[HasV160_UP]>; |
| 1727 |
defm ST_H : mI_ST_2_<0xAC, 0xB4, 0xA4, 0xA8, 0x68, 0xF8, 0x14, 0x4C, "st.h", RD>; |
| 1728 |
|
| 1729 |
def ST_T : ABSB<0xD5, 0x00, (outs), (ins off18imm:$off18, i32imm:$bpos3, i32imm:$b), |
| 1730 |
"st.t $off18, $bpos3, $b", []>; |
| 1731 |
|
| 1732 |
defm ST_W : mI_ST_<0xA5, 0x00, 0x89, 0xA9, 0x24, 0x04, 0x14, "st.w", RD> |
| 1733 |
, mI_ST_2_<0x6C, 0x74, 0x64, 0x68, 0xE8, 0x04, 0x94, 0xCC, "st.w", RD>; |
| 1734 |
def ST_W_bol : IBOL_AbOR<0x59, "st.w", RD>; |
| 1735 |
def ST_W_sc : ISC_A10CD15<0x78, "st.w">, Requires<[HasV120_UP]>; |
| 1736 |
|
| 1737 |
def STLCX_abs : IABS_off18<0x15, 0x00, "stlcx">; |
| 1738 |
def STLCX_bo_bso : IBO_bso<0x49, 0x26, "stlcx">; |
| 1739 |
|
| 1740 |
def STUCX_abs : IABS_off18<0x15, 0x01, "stucx">; |
| 1741 |
def STUCX_bo_bso : IBO_bso<0x49, 0x27, "stucx">; |
| 1742 |
|
| 1743 |
def SUB_rr : IRR_dab<0x0B, 0x08, "sub">; |
| 1744 |
defm SUB : mISRR_a15a<0xA2, 0x52, 0x5A, "sub"> |
| 1745 |
, mIB_H<0x0B, 0x48, 0x0B, 0x68, "sub">; |
| 1746 |
|
| 1747 |
|
| 1748 |
multiclass mISC_A10C<bits<8> scv, bits<8> sc, string asmstr>{ |
| 1749 |
def _sc_v110: ISC_A10C<scv, asmstr>, NsRequires<[HasV110]>; |
| 1750 |
def _sc : ISC_A10C<sc, asmstr>, Requires<[HasV120_UP]>; |
| 1751 |
} |
| 1752 |
|
| 1753 |
def SUB_A_rr : IRR_dab<0x01, 0x02, "sub.a", RA, RA, RA>; |
| 1754 |
defm SUB_A : mISC_A10C<0x40, 0x20, "sub.a">; |
| 1755 |
def SUBSC_A_rr: IRR_dabn<0x01, 0x61, "subsc.a", RA, RA, RD>, NsRequires<[HasV110]>; |
| 1756 |
|
| 1757 |
def SUBC_rr : IRR_dab<0x0B, 0x0D, "subc">; |
| 1758 |
|
| 1759 |
def SUBS_rr : IRR_dab<0x0B, 0x0A, "subs">; |
| 1760 |
def SUBS_srr : ISRR_db<0x62, "subs">; |
| 1761 |
|
| 1762 |
def SUBS_U_rr : IRR_dab<0x0B, 0x0B, "subs.u">; |
| 1763 |
def SUBS_B_rr : IRR_dab<0x0B, 0x4A, "subs.b">, NsRequires<[HasV110]>; |
| 1764 |
def SUBS_BU_rr: IRR_dab<0x0B, 0x4B, "subs.bu">, NsRequires<[HasV110]>; |
| 1765 |
def SUBS_H_rr : IRR_dab<0x0B, 0x6A, "subs.h">; |
| 1766 |
def SUBS_HU_rr: IRR_dab<0x0B, 0x6B, "subs.hu">; |
| 1767 |
def SUBX_rr : IRR_dab<0x0B, 0x0C, "subx">; |
| 1768 |
|
| 1769 |
def SVLCX_sys : ISYS_0<0x0D, 0x08, "svlcx">; |
| 1770 |
|
| 1771 |
multiclass mI_SWAP_1<bits<8> prefix_bso_pos_pre, bits<8> prefix_r_c, |
| 1772 |
bits<6> bso, ///_bso |
| 1773 |
bits<6> pos_r, ///_pos|_r |
| 1774 |
bits<6> pre_c, ///_pre|_c |
| 1775 |
string asmstr, RegisterClass RC=RA>{ |
| 1776 |
def _bo_bso: BO<prefix_bso_pos_pre, bso, (outs RC:$d), (ins RA:$s1, s10imm:$off10), |
| 1777 |
asmstr # " [$s1]$off10, $d", []>; |
| 1778 |
def _bo_pos: BO<prefix_bso_pos_pre, pos_r, (outs), (ins RC:$s1, RA:$s2, s10imm:$off10), |
| 1779 |
asmstr # " [${s2}+]$off10, $s1", []>; |
| 1780 |
def _bo_pre: BO<prefix_bso_pos_pre, pre_c, (outs), (ins RC:$s1, RA:$s2, s10imm:$off10), |
| 1781 |
asmstr # " [+${s2}]$off10, $s1", []>; |
| 1782 |
|
| 1783 |
def _bo_r : BO<prefix_r_c, pos_r, (outs RP:$d), (ins RC:$s1), |
| 1784 |
asmstr # " [${d}+r], $s1", []>; |
| 1785 |
def _bo_c : BO<prefix_r_c, pre_c, (outs RP:$d), (ins RC:$s1, s10imm:$off10), |
| 1786 |
asmstr # " [${d}+c]$off10, $s1", []>; |
| 1787 |
} |
| 1788 |
|
| 1789 |
multiclass mI_SWAP_<bits<8> abs1, bits<2> abs2, ///_abs |
| 1790 |
bits<8> prefix_bso_pos_pre, bits<8> prefix_r_c, |
| 1791 |
bits<6> bso, ///_bso |
| 1792 |
bits<6> pos_r, ///_pos|_r |
| 1793 |
bits<6> pre_c, ///_pre|_c |
| 1794 |
string asmstr, RegisterClass RC=RA>{ |
| 1795 |
def _abs: IABS_OR<abs1, abs2, asmstr, RC>; |
| 1796 |
defm "" : mI_SWAP_1<prefix_bso_pos_pre, prefix_r_c, bso, pos_r, pre_c, asmstr, RC>; |
| 1797 |
} |
| 1798 |
|
| 1799 |
defm SWAP_A : mI_SWAP_<0xE5, 0x02, 0x49, 0x69, 0x22, 0x02, 0x12, "swap.a">, NsRequires<[HasV110]>; |
| 1800 |
defm SWAP_W : mI_SWAP_<0xE5, 0x00, 0x49, 0x69, 0x20, 0x00, 0x10, "swap.w", RD>; |
| 1801 |
def SWAP_W_bo_i: BO<0x69, 0x20, (outs RD:$d), (ins RP:$s1, s10imm:$off10), |
| 1802 |
"swap.w [${s1}+i], $d", []>, Requires<[HasV160_UP]>; |
| 1803 |
|
| 1804 |
defm SWAPMSK_W : mI_SWAP_1<0x49, 0x69, 0x22, 0x02, 0x12, "swapmsk.w", RE>, Requires<[HasV161_UP]>; |
| 1805 |
def SWAPMSK_W_bo_i: BO<0x69, 0x22, (outs RE:$d), (ins RP:$s1, s10imm:$off10), |
| 1806 |
"swapmsk.w [${s1}+i], $d", []>, Requires<[HasV161_UP]>; |
| 1807 |
|
| 1808 |
def SYSCALL_rc : IRC_C<0xAD, 0x04, "syscall">; |
| 1809 |
|
| 1810 |
def TLBDEMAP_rr : IRR_R1<0x75, 0x00, "tlbdemap">, Requires<[HasV130_UP]>; |
| 1811 |
def TLBFLUSH_A_rr: IRR_0<0x75, 0x04, "tlbflush.a">, Requires<[HasV130_UP]>; |
| 1812 |
def TLBFLUSH_B_rr: IRR_0<0x75, 0x05, "tlbflush.b">, Requires<[HasV130_UP]>; |
| 1813 |
def TLBMAP_rr : IRR_R1<0x75, 0x40, "tlbmap", RE>, Requires<[HasV130_UP]>; |
| 1814 |
def TLBPROBE_A_rr: IRR_R1<0x75, 0x08, "tlbprobe.a">, Requires<[HasV130_UP]>; |
| 1815 |
def TLBPROBE_I_rr: IRR_R1<0x75, 0x09, "tlbprobe.i">, Requires<[HasV130_UP]>; |
| 1816 |
|
| 1817 |
def TRAPSV_sys : ISYS_0<0x0D, 0x15, "trapsv">; |
| 1818 |
def TRAPV_sys : ISYS_0<0x0D, 0x14, "trapv">; |
| 1819 |
|
| 1820 |
multiclass mIRR_a<bits<8> pre, bits<8> op1, bits<8> op2, string asmstr, RegisterClass RC=RD>{ |
| 1821 |
def _rr_v110: IRR_a<pre, op1, asmstr, RC>, NsRequires<[HasV110]>; |
| 1822 |
def _rr : IRR_a<pre, op2, asmstr, RC>, Requires<[HasV120_UP]>; |
| 1823 |
} |
| 1824 |
|
| 1825 |
defm UNPACK_rr : mIRR_a<0x4B, 0x50, 0x08, "unpack", RE>; |
| 1826 |
|
| 1827 |
def WAIT_sys : ISYS_0<0x0D, 0x16, "wait">, Requires<[HasV161_UP]>; |
| 1828 |
|
| 1829 |
defm XNOR : mIRR_RC<0x0F, 0x0D, 0x8F, 0x0D, "xnor">; |
| 1830 |
def XNOR_T : IBIT<0x07, 0x02, "xnor.t">; |
| 1831 |
|
| 1832 |
defm XOR : mIRR_RC<0x0F, 0x0C, 0x8F, 0x0C, "xor">; |
| 1833 |
def XOR_srr : ISRR_db<0xC6, "xor">, Requires<[HasV120_UP]>; |
| 1834 |
def XOR_T : IBIT<0x07, 0x03, "xor.t">; |
| 1835 |
|
| 1836 |
defm XOR_EQ : mIRR_RC<0x0B, 0x2F, 0x8B, 0x2F, "xor.eq">; |
| 1837 |
defm XOR_NE : mIRR_RC<0x0B, 0x30, 0x8B, 0x30, "xor.ne">; |
| 1838 |
defm XOR_GE : mIRR_RC<0x0B, 0x33, 0x8B, 0x33, "xor.ge">; |
| 1839 |
defm XOR_GE_U : mIRR_RC<0x0B, 0x34, 0x8B, 0x34, "xor.ge.u">; |
| 1840 |
defm XOR_LT : mIRR_RC<0x0B, 0x31, 0x8B, 0x31, "xor.lt">; |
| 1841 |
defm XOR_LT_U : mIRR_RC<0x0B, 0x32, 0x8B, 0x32, "xor.lt.u">; |
| 1842 |
|
| 1843 |
|
| 1844 |
|
| 1845 |
/// FPU Instructions |
| 1846 |
|
| 1847 |
def MADD_F_rrr : IRRR<0x6B, 0x06, "madd.f">, Requires<[HasV130_UP]>; |
| 1848 |
def MSUB_F_rrr : IRRR<0x6B, 0x07, "msub.f">, Requires<[HasV130_UP]>; |
| 1849 |
def ADD_F_rrr : IRRR_d31<0x6B, 0x02, "add.f">, Requires<[HasV130_UP]>; |
| 1850 |
def SUB_F_rrr : IRRR_d31<0x6B, 0x03, "sub.f">, Requires<[HasV130_UP]>; |
| 1851 |
def MUL_F_rrr : IRR_dab<0x4B, 0x04, "mul.f">, Requires<[HasV130_UP]>; |
| 1852 |
def DIV_F_rr : IRR_dab<0x4B, 0x05, "div.f">, Requires<[HasV130_UP]>; |
| 1853 |
def CMP_F_rr : IRR_dab<0x4B, 0x00, "cmp.f">, Requires<[HasV130_UP]>; |
| 1854 |
|
| 1855 |
def FTOI_rr : IRR_a<0x4B, 0x10, "ftoi">, Requires<[HasV130_UP]>; |
| 1856 |
def FTOIZ_rr : IRR_a<0x4B, 0x13, "ftoiz">, Requires<[HasV131_UP]>; |
| 1857 |
|
| 1858 |
def FTOQ31_rr : IRR_dab<0x4B, 0x11, "ftoq31">, Requires<[HasV130_UP]>; |
| 1859 |
def FTOQ31Z_rr: IRR_dab<0x4B, 0x18, "ftoq31z">, Requires<[HasV131_UP]>; |
| 1860 |
|
| 1861 |
def FTOU_rr : IRR_a<0x4B, 0x12, "ftou">, Requires<[HasV130_UP]>; |
| 1862 |
def FTOUZ_rr : IRR_a<0x4B, 0x17, "ftouz">, Requires<[HasV131_UP]>; |
| 1863 |
|
| 1864 |
def FTOHP_rr : IRR_a<0x4B, 0x25, "ftohp">, Requires<[HasV162_UP]>; |
| 1865 |
|
| 1866 |
def HPTOF_rr : IRR_a<0x4B, 0x24, "hptof">, Requires<[HasV162_UP]>; |
| 1867 |
def ITOF_rr : IRR_a<0x4B, 0x14, "itof">, Requires<[HasV130_UP]>; |
| 1868 |
|
| 1869 |
def Q31TOF_rr : IRR_dab<0x4B, 0x15, "q31tof">, Requires<[HasV130_UP]>; |
| 1870 |
def QSEED_F_rr : IRR_a<0x4B, 0x19, "qseed.f">, Requires<[HasV130_UP]>; |
| 1871 |
|
| 1872 |
def UPDFL_rr : IRR_R1<0x4B, 0x0C, "updfl">, Requires<[HasV130_UP]>; |
| 1873 |
def UTOF_rr : IRR_a<0x4B, 0x16, "utof">, Requires<[HasV130_UP]>; |