2013-02-21 23:16:44 +08:00
|
|
|
//===-- SIInstrInfo.td - SI Instruction Infos -------------*- tablegen -*--===//
|
2012-12-12 05:25:42 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2015-04-08 09:09:26 +08:00
|
|
|
def isCI : Predicate<"Subtarget->getGeneration() "
|
|
|
|
">= AMDGPUSubtarget::SEA_ISLANDS">;
|
2015-08-07 03:28:38 +08:00
|
|
|
def isCIOnly : Predicate<"Subtarget->getGeneration() =="
|
|
|
|
"AMDGPUSubtarget::SEA_ISLANDS">,
|
|
|
|
AssemblerPredicate <"FeatureSeaIslands">;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-04-24 03:33:54 +08:00
|
|
|
def DisableInst : Predicate <"false">, AssemblerPredicate<"FeatureDisable">;
|
|
|
|
|
2014-10-08 07:51:34 +08:00
|
|
|
class vop {
|
|
|
|
field bits<9> SI3;
|
2014-12-07 20:18:57 +08:00
|
|
|
field bits<10> VI3;
|
2014-10-08 07:51:34 +08:00
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class vopc <bits<8> si, bits<8> vi = !add(0x40, si)> : vop {
|
2014-10-08 07:51:39 +08:00
|
|
|
field bits<8> SI = si;
|
2014-12-07 20:18:57 +08:00
|
|
|
field bits<8> VI = vi;
|
2014-10-08 07:51:39 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
field bits<9> SI3 = {0, si{7-0}};
|
|
|
|
field bits<10> VI3 = {0, 0, vi{7-0}};
|
2014-10-08 07:51:39 +08:00
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class vop1 <bits<8> si, bits<8> vi = si> : vop {
|
|
|
|
field bits<8> SI = si;
|
|
|
|
field bits<8> VI = vi;
|
2014-10-08 07:51:34 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
field bits<9> SI3 = {1, 1, si{6-0}};
|
|
|
|
field bits<10> VI3 = !add(0x140, vi);
|
2014-10-08 07:51:34 +08:00
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class vop2 <bits<6> si, bits<6> vi = si> : vop {
|
2014-10-08 07:51:38 +08:00
|
|
|
field bits<6> SI = si;
|
2014-12-07 20:18:57 +08:00
|
|
|
field bits<6> VI = vi;
|
|
|
|
|
|
|
|
field bits<9> SI3 = {1, 0, 0, si{5-0}};
|
|
|
|
field bits<10> VI3 = {0, 1, 0, 0, vi{5-0}};
|
|
|
|
}
|
|
|
|
|
2015-01-16 02:43:06 +08:00
|
|
|
// Specify a VOP2 opcode for SI and VOP3 opcode for VI
|
|
|
|
// that doesn't have VOP2 encoding on VI
|
|
|
|
class vop23 <bits<6> si, bits<10> vi> : vop2 <si> {
|
|
|
|
let VI3 = vi;
|
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class vop3 <bits<9> si, bits<10> vi = {0, si}> : vop {
|
|
|
|
let SI3 = si;
|
|
|
|
let VI3 = vi;
|
|
|
|
}
|
|
|
|
|
|
|
|
class sop1 <bits<8> si, bits<8> vi = si> {
|
|
|
|
field bits<8> SI = si;
|
|
|
|
field bits<8> VI = vi;
|
|
|
|
}
|
2014-10-08 07:51:38 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class sop2 <bits<7> si, bits<7> vi = si> {
|
|
|
|
field bits<7> SI = si;
|
|
|
|
field bits<7> VI = vi;
|
2014-10-08 07:51:38 +08:00
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class sopk <bits<5> si, bits<5> vi = si> {
|
|
|
|
field bits<5> SI = si;
|
|
|
|
field bits<5> VI = vi;
|
2014-10-08 07:51:41 +08:00
|
|
|
}
|
|
|
|
|
2015-08-22 08:54:31 +08:00
|
|
|
// Specify an SMRD opcode for SI and SMEM opcode for VI
|
2015-09-25 03:52:27 +08:00
|
|
|
|
|
|
|
// FIXME: This should really be bits<5> si, Tablegen crashes if
|
|
|
|
// parameter default value is other parameter with different bit size
|
|
|
|
class smrd<bits<8> si, bits<8> vi = si> {
|
|
|
|
field bits<5> SI = si{4-0};
|
|
|
|
field bits<8> VI = vi;
|
2015-08-22 08:54:31 +08:00
|
|
|
}
|
|
|
|
|
2014-05-17 04:56:47 +08:00
|
|
|
// Execpt for the NONE field, this must be kept in sync with the SISubtarget enum
|
2015-01-16 02:42:51 +08:00
|
|
|
// in AMDGPUInstrInfo.cpp
|
2014-05-17 04:56:47 +08:00
|
|
|
def SISubtarget {
|
|
|
|
int NONE = -1;
|
|
|
|
int SI = 0;
|
2014-12-07 20:18:57 +08:00
|
|
|
int VI = 1;
|
2014-05-17 04:56:47 +08:00
|
|
|
}
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SI DAG Nodes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-08-15 07:24:45 +08:00
|
|
|
def SIload_constant : SDNode<"AMDGPUISD::LOAD_CONSTANT",
|
2014-04-18 05:00:11 +08:00
|
|
|
SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i32>]>,
|
2013-08-15 07:24:45 +08:00
|
|
|
[SDNPMayLoad, SDNPMemOperand]
|
|
|
|
>;
|
|
|
|
|
2013-09-12 10:55:14 +08:00
|
|
|
def SItbuffer_store : SDNode<"AMDGPUISD::TBUFFER_STORE_FORMAT",
|
|
|
|
SDTypeProfile<0, 13,
|
2014-04-18 05:00:11 +08:00
|
|
|
[SDTCisVT<0, v4i32>, // rsrc(SGPR)
|
2013-09-12 10:55:14 +08:00
|
|
|
SDTCisVT<1, iAny>, // vdata(VGPR)
|
|
|
|
SDTCisVT<2, i32>, // num_channels(imm)
|
|
|
|
SDTCisVT<3, i32>, // vaddr(VGPR)
|
|
|
|
SDTCisVT<4, i32>, // soffset(SGPR)
|
|
|
|
SDTCisVT<5, i32>, // inst_offset(imm)
|
|
|
|
SDTCisVT<6, i32>, // dfmt(imm)
|
|
|
|
SDTCisVT<7, i32>, // nfmt(imm)
|
|
|
|
SDTCisVT<8, i32>, // offen(imm)
|
|
|
|
SDTCisVT<9, i32>, // idxen(imm)
|
|
|
|
SDTCisVT<10, i32>, // glc(imm)
|
|
|
|
SDTCisVT<11, i32>, // slc(imm)
|
|
|
|
SDTCisVT<12, i32> // tfe(imm)
|
|
|
|
]>,
|
|
|
|
[SDNPMayStore, SDNPMemOperand, SDNPHasChain]
|
|
|
|
>;
|
|
|
|
|
2013-08-15 07:24:45 +08:00
|
|
|
def SIload_input : SDNode<"AMDGPUISD::LOAD_INPUT",
|
2014-04-18 05:00:11 +08:00
|
|
|
SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisVT<1, v4i32>, SDTCisVT<2, i16>,
|
2013-08-15 07:24:45 +08:00
|
|
|
SDTCisVT<3, i32>]>
|
|
|
|
>;
|
|
|
|
|
|
|
|
class SDSample<string opcode> : SDNode <opcode,
|
2016-01-26 12:43:48 +08:00
|
|
|
SDTypeProfile<1, 4, [SDTCisVT<0, v4f32>, SDTCisVT<2, v8i32>,
|
2014-04-18 05:00:11 +08:00
|
|
|
SDTCisVT<3, v4i32>, SDTCisVT<4, i32>]>
|
2013-08-15 07:24:45 +08:00
|
|
|
>;
|
|
|
|
|
|
|
|
def SIsample : SDSample<"AMDGPUISD::SAMPLE">;
|
|
|
|
def SIsampleb : SDSample<"AMDGPUISD::SAMPLEB">;
|
|
|
|
def SIsampled : SDSample<"AMDGPUISD::SAMPLED">;
|
|
|
|
def SIsamplel : SDSample<"AMDGPUISD::SAMPLEL">;
|
|
|
|
|
2014-07-21 22:01:14 +08:00
|
|
|
def SIconstdata_ptr : SDNode<
|
2015-12-10 10:13:01 +08:00
|
|
|
"AMDGPUISD::CONST_DATA_PTR", SDTypeProfile <1, 1, [SDTCisVT<0, i64>,
|
|
|
|
SDTCisVT<0, i64>]>
|
2014-07-21 22:01:14 +08:00
|
|
|
>;
|
|
|
|
|
2016-01-05 10:26:37 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// PatFrags for FLAT instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class flat_ld <SDPatternOperator ld> : PatFrag<(ops node:$ptr),
|
|
|
|
(ld node:$ptr), [{
|
|
|
|
return isFlatLoad(dyn_cast<LoadSDNode>(N)) ||
|
2016-01-05 11:40:16 +08:00
|
|
|
isGlobalLoad(dyn_cast<LoadSDNode>(N)) ||
|
|
|
|
isConstantLoad(cast<LoadSDNode>(N), -1);
|
2016-01-05 10:26:37 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
def flat_load : flat_ld <load>;
|
|
|
|
def flat_az_extloadi8 : flat_ld <az_extloadi8>;
|
|
|
|
def flat_sextloadi8 : flat_ld <sextloadi8>;
|
|
|
|
def flat_az_extloadi16 : flat_ld <az_extloadi16>;
|
|
|
|
def flat_sextloadi16 : flat_ld <sextloadi16>;
|
|
|
|
|
|
|
|
class flat_st <SDPatternOperator st> : PatFrag<(ops node:$val, node:$ptr),
|
|
|
|
(st node:$val, node:$ptr), [{
|
|
|
|
return isFlatStore(dyn_cast<StoreSDNode>(N)) ||
|
|
|
|
isGlobalStore(dyn_cast<StoreSDNode>(N));
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def flat_store: flat_st <store>;
|
|
|
|
def flat_truncstorei8 : flat_st <truncstorei8>;
|
|
|
|
def flat_truncstorei16 : flat_st <truncstorei16>;
|
|
|
|
|
|
|
|
|
2015-12-16 04:55:55 +08:00
|
|
|
def mubuf_load : PatFrag <(ops node:$ptr), (load node:$ptr), [{
|
|
|
|
return isGlobalLoad(cast<LoadSDNode>(N)) ||
|
|
|
|
isConstantLoad(cast<LoadSDNode>(N), -1);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def smrd_load : PatFrag <(ops node:$ptr), (load node:$ptr), [{
|
|
|
|
return isConstantLoad(cast<LoadSDNode>(N), -1) &&
|
|
|
|
static_cast<const SITargetLowering *>(getTargetLowering())->isMemOpUniform(N);
|
|
|
|
}]>;
|
|
|
|
|
2015-05-12 23:00:49 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SDNodes and PatFrag for local loads and stores to enable s_mov_b32 m0, -1
|
|
|
|
// to be glued to the memory instructions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def SIld_local : SDNode <"ISD::LOAD", SDTLoad,
|
|
|
|
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
|
|
|
|
>;
|
|
|
|
|
|
|
|
def si_ld_local : PatFrag <(ops node:$ptr), (SIld_local node:$ptr), [{
|
|
|
|
return isLocalLoad(cast<LoadSDNode>(N));
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_load_local : PatFrag <(ops node:$ptr), (si_ld_local node:$ptr), [{
|
|
|
|
return cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED &&
|
|
|
|
cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_load_local_align8 : Aligned8Bytes <
|
|
|
|
(ops node:$ptr), (si_load_local node:$ptr)
|
|
|
|
>;
|
|
|
|
|
|
|
|
def si_sextload_local : PatFrag <(ops node:$ptr), (si_ld_local node:$ptr), [{
|
|
|
|
return cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
|
|
|
|
}]>;
|
|
|
|
def si_az_extload_local : AZExtLoadBase <si_ld_local>;
|
|
|
|
|
|
|
|
multiclass SIExtLoadLocal <PatFrag ld_node> {
|
|
|
|
|
|
|
|
def _i8 : PatFrag <(ops node:$ptr), (ld_node node:$ptr),
|
|
|
|
[{return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i8;}]
|
|
|
|
>;
|
|
|
|
|
|
|
|
def _i16 : PatFrag <(ops node:$ptr), (ld_node node:$ptr),
|
|
|
|
[{return cast<LoadSDNode>(N)->getMemoryVT() == MVT::i16;}]
|
|
|
|
>;
|
|
|
|
}
|
|
|
|
|
|
|
|
defm si_sextload_local : SIExtLoadLocal <si_sextload_local>;
|
|
|
|
defm si_az_extload_local : SIExtLoadLocal <si_az_extload_local>;
|
|
|
|
|
|
|
|
def SIst_local : SDNode <"ISD::STORE", SDTStore,
|
|
|
|
[SDNPHasChain, SDNPMayStore, SDNPMemOperand, SDNPInGlue]
|
|
|
|
>;
|
|
|
|
|
|
|
|
def si_st_local : PatFrag <
|
|
|
|
(ops node:$val, node:$ptr), (SIst_local node:$val, node:$ptr), [{
|
|
|
|
return isLocalStore(cast<StoreSDNode>(N));
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_store_local : PatFrag <
|
|
|
|
(ops node:$val, node:$ptr), (si_st_local node:$val, node:$ptr), [{
|
|
|
|
return cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED &&
|
|
|
|
!cast<StoreSDNode>(N)->isTruncatingStore();
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_store_local_align8 : Aligned8Bytes <
|
|
|
|
(ops node:$val, node:$ptr), (si_store_local node:$val, node:$ptr)
|
|
|
|
>;
|
|
|
|
|
|
|
|
def si_truncstore_local : PatFrag <
|
|
|
|
(ops node:$val, node:$ptr), (si_st_local node:$val, node:$ptr), [{
|
|
|
|
return cast<StoreSDNode>(N)->isTruncatingStore();
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_truncstore_local_i8 : PatFrag <
|
|
|
|
(ops node:$val, node:$ptr), (si_truncstore_local node:$val, node:$ptr), [{
|
|
|
|
return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i8;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_truncstore_local_i16 : PatFrag <
|
|
|
|
(ops node:$val, node:$ptr), (si_truncstore_local node:$val, node:$ptr), [{
|
|
|
|
return cast<StoreSDNode>(N)->getMemoryVT() == MVT::i16;
|
|
|
|
}]>;
|
|
|
|
|
2016-02-13 07:45:29 +08:00
|
|
|
def si_setcc_uniform : PatFrag <
|
|
|
|
(ops node:$lhs, node:$rhs, node:$cond),
|
|
|
|
(setcc node:$lhs, node:$rhs, node:$cond), [{
|
|
|
|
for (SDNode *Use : N->uses()) {
|
|
|
|
if (Use->isMachineOpcode() || Use->getOpcode() != ISD::CopyToReg)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
unsigned Reg = cast<RegisterSDNode>(Use->getOperand(1))->getReg();
|
|
|
|
if (Reg != AMDGPU::SCC)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_uniform_br : PatFrag <
|
|
|
|
(ops node:$cond, node:$bb), (brcond node:$cond, node:$bb), [{
|
|
|
|
return isUniformBr(N);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def si_uniform_br_scc : PatFrag <
|
|
|
|
(ops node:$cond, node:$bb), (si_uniform_br node:$cond, node:$bb), [{
|
|
|
|
return isCBranchSCC(N);
|
|
|
|
}]>;
|
|
|
|
|
2015-05-12 23:00:49 +08:00
|
|
|
multiclass SIAtomicM0Glue2 <string op_name> {
|
|
|
|
|
|
|
|
def _glue : SDNode <"ISD::ATOMIC_"#op_name, SDTAtomic2,
|
|
|
|
[SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
|
|
|
|
>;
|
|
|
|
|
|
|
|
def _local : local_binary_atomic_op <!cast<SDNode>(NAME#"_glue")>;
|
|
|
|
}
|
|
|
|
|
|
|
|
defm si_atomic_load_add : SIAtomicM0Glue2 <"LOAD_ADD">;
|
|
|
|
defm si_atomic_load_and : SIAtomicM0Glue2 <"LOAD_AND">;
|
|
|
|
defm si_atomic_load_min : SIAtomicM0Glue2 <"LOAD_MIN">;
|
|
|
|
defm si_atomic_load_max : SIAtomicM0Glue2 <"LOAD_MAX">;
|
|
|
|
defm si_atomic_load_or : SIAtomicM0Glue2 <"LOAD_OR">;
|
|
|
|
defm si_atomic_load_sub : SIAtomicM0Glue2 <"LOAD_SUB">;
|
|
|
|
defm si_atomic_load_xor : SIAtomicM0Glue2 <"LOAD_XOR">;
|
|
|
|
defm si_atomic_load_umin : SIAtomicM0Glue2 <"LOAD_UMIN">;
|
|
|
|
defm si_atomic_load_umax : SIAtomicM0Glue2 <"LOAD_UMAX">;
|
|
|
|
defm si_atomic_swap : SIAtomicM0Glue2 <"SWAP">;
|
|
|
|
|
|
|
|
def si_atomic_cmp_swap_glue : SDNode <"ISD::ATOMIC_CMP_SWAP", SDTAtomic3,
|
|
|
|
[SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand, SDNPInGlue]
|
|
|
|
>;
|
|
|
|
|
|
|
|
defm si_atomic_cmp_swap : AtomicCmpSwapLocal <si_atomic_cmp_swap_glue>;
|
|
|
|
|
2013-02-08 03:39:38 +08:00
|
|
|
// Transformation function, extract the lower 32bit of a 64bit immediate
|
|
|
|
def LO32 : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getZExtValue() & 0xffffffff, SDLoc(N),
|
|
|
|
MVT::i32);
|
2013-02-08 03:39:38 +08:00
|
|
|
}]>;
|
|
|
|
|
2013-07-13 02:15:02 +08:00
|
|
|
def LO32f : SDNodeXForm<fpimm, [{
|
2013-07-13 04:18:05 +08:00
|
|
|
APInt V = N->getValueAPF().bitcastToAPInt().trunc(32);
|
|
|
|
return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32);
|
2013-07-13 02:15:02 +08:00
|
|
|
}]>;
|
|
|
|
|
2013-02-08 03:39:38 +08:00
|
|
|
// Transformation function, extract the upper 32bit of a 64bit immediate
|
|
|
|
def HI32 : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getZExtValue() >> 32, SDLoc(N), MVT::i32);
|
2013-02-08 03:39:38 +08:00
|
|
|
}]>;
|
|
|
|
|
2013-07-13 02:15:02 +08:00
|
|
|
def HI32f : SDNodeXForm<fpimm, [{
|
2013-07-13 04:18:05 +08:00
|
|
|
APInt V = N->getValueAPF().bitcastToAPInt().lshr(32).trunc(32);
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), SDLoc(N),
|
|
|
|
MVT::f32);
|
2013-07-13 02:15:02 +08:00
|
|
|
}]>;
|
|
|
|
|
2014-02-07 02:36:34 +08:00
|
|
|
def IMM8bitDWORD : PatLeaf <(imm),
|
|
|
|
[{return (N->getZExtValue() & ~0x3FC) == 0;}]
|
2013-02-08 03:39:40 +08:00
|
|
|
>;
|
|
|
|
|
2014-02-07 02:36:34 +08:00
|
|
|
def as_dword_i32imm : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getZExtValue() >> 2, SDLoc(N), MVT::i32);
|
2014-02-07 02:36:34 +08:00
|
|
|
}]>;
|
|
|
|
|
2013-09-12 10:55:14 +08:00
|
|
|
def as_i1imm : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getZExtValue(), SDLoc(N), MVT::i1);
|
2013-09-12 10:55:14 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
def as_i8imm : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getZExtValue(), SDLoc(N), MVT::i8);
|
2013-09-12 10:55:14 +08:00
|
|
|
}]>;
|
|
|
|
|
2013-06-04 01:39:43 +08:00
|
|
|
def as_i16imm : SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i16);
|
2013-06-04 01:39:43 +08:00
|
|
|
}]>;
|
|
|
|
|
2014-02-07 02:36:34 +08:00
|
|
|
def as_i32imm: SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i32);
|
2014-02-07 02:36:34 +08:00
|
|
|
}]>;
|
|
|
|
|
2014-12-03 13:22:35 +08:00
|
|
|
def as_i64imm: SDNodeXForm<imm, [{
|
2015-04-28 22:05:47 +08:00
|
|
|
return CurDAG->getTargetConstant(N->getSExtValue(), SDLoc(N), MVT::i64);
|
2014-12-03 13:22:35 +08:00
|
|
|
}]>;
|
|
|
|
|
2015-01-14 06:59:41 +08:00
|
|
|
// Copied from the AArch64 backend:
|
|
|
|
def bitcast_fpimm_to_i32 : SDNodeXForm<fpimm, [{
|
|
|
|
return CurDAG->getTargetConstant(
|
2015-04-28 22:05:47 +08:00
|
|
|
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);
|
2015-01-14 06:59:41 +08:00
|
|
|
}]>;
|
|
|
|
|
|
|
|
// Copied from the AArch64 backend:
|
|
|
|
def bitcast_fpimm_to_i64 : SDNodeXForm<fpimm, [{
|
|
|
|
return CurDAG->getTargetConstant(
|
2015-04-28 22:05:47 +08:00
|
|
|
N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i64);
|
2015-01-14 06:59:41 +08:00
|
|
|
}]>;
|
|
|
|
|
2014-03-20 06:19:49 +08:00
|
|
|
def IMM8bit : PatLeaf <(imm),
|
|
|
|
[{return isUInt<8>(N->getZExtValue());}]
|
|
|
|
>;
|
|
|
|
|
2013-06-04 01:39:43 +08:00
|
|
|
def IMM12bit : PatLeaf <(imm),
|
|
|
|
[{return isUInt<12>(N->getZExtValue());}]
|
2013-02-08 03:39:40 +08:00
|
|
|
>;
|
|
|
|
|
2014-03-20 06:19:49 +08:00
|
|
|
def IMM16bit : PatLeaf <(imm),
|
|
|
|
[{return isUInt<16>(N->getZExtValue());}]
|
|
|
|
>;
|
|
|
|
|
2014-12-08 01:17:38 +08:00
|
|
|
def IMM20bit : PatLeaf <(imm),
|
|
|
|
[{return isUInt<20>(N->getZExtValue());}]
|
|
|
|
>;
|
|
|
|
|
2014-05-10 00:42:21 +08:00
|
|
|
def IMM32bit : PatLeaf <(imm),
|
|
|
|
[{return isUInt<32>(N->getZExtValue());}]
|
|
|
|
>;
|
|
|
|
|
2014-02-07 02:36:41 +08:00
|
|
|
def mubuf_vaddr_offset : PatFrag<
|
|
|
|
(ops node:$ptr, node:$offset, node:$imm_offset),
|
|
|
|
(add (add node:$ptr, node:$offset), node:$imm_offset)
|
|
|
|
>;
|
|
|
|
|
2013-02-27 01:52:23 +08:00
|
|
|
class InlineImm <ValueType vt> : PatLeaf <(vt imm), [{
|
2014-04-04 04:19:27 +08:00
|
|
|
return isInlineImmediate(N);
|
2013-02-16 19:28:36 +08:00
|
|
|
}]>;
|
|
|
|
|
2014-12-18 05:04:08 +08:00
|
|
|
class InlineFPImm <ValueType vt> : PatLeaf <(vt fpimm), [{
|
|
|
|
return isInlineImmediate(N);
|
|
|
|
}]>;
|
|
|
|
|
2013-08-15 07:24:24 +08:00
|
|
|
class SGPRImm <dag frag> : PatLeaf<frag, [{
|
2015-01-31 07:24:40 +08:00
|
|
|
if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS) {
|
2013-08-15 07:24:24 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const SIRegisterInfo *SIRI =
|
2015-01-31 07:24:40 +08:00
|
|
|
static_cast<const SIRegisterInfo *>(Subtarget->getRegisterInfo());
|
2013-08-15 07:24:24 +08:00
|
|
|
for (SDNode::use_iterator U = N->use_begin(), E = SDNode::use_end();
|
|
|
|
U != E; ++U) {
|
2015-09-26 12:59:04 +08:00
|
|
|
const TargetRegisterClass *RC = getOperandRegClass(*U, U.getOperandNo());
|
|
|
|
if (RC && SIRI->isSGPRClass(RC))
|
2013-08-15 07:24:24 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}]>;
|
|
|
|
|
2014-07-21 22:01:08 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Custom Operands
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-12-19 13:32:55 +08:00
|
|
|
def FRAMEri32 : Operand<iPTR> {
|
2014-05-02 00:37:52 +08:00
|
|
|
let MIOperandInfo = (ops i32:$ptr, i32imm:$index);
|
2013-11-14 07:36:50 +08:00
|
|
|
}
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
def SoppBrTarget : AsmOperandClass {
|
|
|
|
let Name = "SoppBrTarget";
|
|
|
|
let ParserMethod = "parseSOppBrTarget";
|
|
|
|
}
|
|
|
|
|
2014-07-21 22:01:08 +08:00
|
|
|
def sopp_brtarget : Operand<OtherVT> {
|
|
|
|
let EncoderMethod = "getSOPPBrEncoding";
|
|
|
|
let OperandType = "OPERAND_PCREL";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = SoppBrTarget;
|
2014-07-21 22:01:08 +08:00
|
|
|
}
|
|
|
|
|
2015-12-10 10:13:01 +08:00
|
|
|
def const_ga : Operand<iPTR>;
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
include "SIInstrFormats.td"
|
2014-12-07 20:18:57 +08:00
|
|
|
include "VIInstrFormats.td"
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
def MubufOffsetMatchClass : AsmOperandClass {
|
|
|
|
let Name = "MubufOffset";
|
|
|
|
let ParserMethod = "parseMubufOptionalOps";
|
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
|
|
|
class DSOffsetBaseMatchClass <string parser> : AsmOperandClass {
|
|
|
|
let Name = "DSOffset"#parser;
|
|
|
|
let ParserMethod = parser;
|
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
let PredicateMethod = "isDSOffset";
|
|
|
|
}
|
|
|
|
|
|
|
|
def DSOffsetMatchClass : DSOffsetBaseMatchClass <"parseDSOptionalOps">;
|
|
|
|
def DSOffsetGDSMatchClass : DSOffsetBaseMatchClass <"parseDSOffsetOptional">;
|
|
|
|
|
|
|
|
def DSOffset01MatchClass : AsmOperandClass {
|
|
|
|
let Name = "DSOffset1";
|
|
|
|
let ParserMethod = "parseDSOff01OptionalOps";
|
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
let PredicateMethod = "isDSOffset01";
|
|
|
|
}
|
|
|
|
|
|
|
|
class GDSBaseMatchClass <string parser> : AsmOperandClass {
|
|
|
|
let Name = "GDS"#parser;
|
|
|
|
let PredicateMethod = "isImm";
|
|
|
|
let ParserMethod = parser;
|
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
|
|
|
def GDSMatchClass : GDSBaseMatchClass <"parseDSOptionalOps">;
|
|
|
|
def GDS01MatchClass : GDSBaseMatchClass <"parseDSOff01OptionalOps">;
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
class GLCBaseMatchClass <string parser> : AsmOperandClass {
|
|
|
|
let Name = "GLC"#parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let PredicateMethod = "isImm";
|
2015-08-06 00:42:54 +08:00
|
|
|
let ParserMethod = parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
def GLCMubufMatchClass : GLCBaseMatchClass <"parseMubufOptionalOps">;
|
|
|
|
def GLCFlatMatchClass : GLCBaseMatchClass <"parseFlatOptionalOps">;
|
|
|
|
|
|
|
|
class SLCBaseMatchClass <string parser> : AsmOperandClass {
|
|
|
|
let Name = "SLC"#parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let PredicateMethod = "isImm";
|
2015-06-13 04:47:06 +08:00
|
|
|
let ParserMethod = parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
def SLCMubufMatchClass : SLCBaseMatchClass <"parseMubufOptionalOps">;
|
|
|
|
def SLCFlatMatchClass : SLCBaseMatchClass <"parseFlatOptionalOps">;
|
|
|
|
def SLCFlatAtomicMatchClass : SLCBaseMatchClass <"parseFlatAtomicOptionalOps">;
|
|
|
|
|
|
|
|
class TFEBaseMatchClass <string parser> : AsmOperandClass {
|
|
|
|
let Name = "TFE"#parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let PredicateMethod = "isImm";
|
2015-06-13 04:47:06 +08:00
|
|
|
let ParserMethod = parser;
|
2015-04-08 09:09:26 +08:00
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
def TFEMubufMatchClass : TFEBaseMatchClass <"parseMubufOptionalOps">;
|
|
|
|
def TFEFlatMatchClass : TFEBaseMatchClass <"parseFlatOptionalOps">;
|
|
|
|
def TFEFlatAtomicMatchClass : TFEBaseMatchClass <"parseFlatAtomicOptionalOps">;
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
def OModMatchClass : AsmOperandClass {
|
|
|
|
let Name = "OMod";
|
|
|
|
let PredicateMethod = "isImm";
|
|
|
|
let ParserMethod = "parseVOP3OptionalOps";
|
|
|
|
let RenderMethod = "addImmOperands";
|
2016-02-11 11:28:15 +08:00
|
|
|
let IsOptional = 1;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def ClampMatchClass : AsmOperandClass {
|
|
|
|
let Name = "Clamp";
|
|
|
|
let PredicateMethod = "isImm";
|
|
|
|
let ParserMethod = "parseVOP3OptionalOps";
|
|
|
|
let RenderMethod = "addImmOperands";
|
2016-02-11 11:28:15 +08:00
|
|
|
let IsOptional = 1;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
|
|
|
|
2015-08-07 03:28:38 +08:00
|
|
|
class SMRDOffsetBaseMatchClass <string predicate> : AsmOperandClass {
|
|
|
|
let Name = "SMRDOffset"#predicate;
|
|
|
|
let PredicateMethod = predicate;
|
|
|
|
let RenderMethod = "addImmOperands";
|
|
|
|
}
|
|
|
|
|
|
|
|
def SMRDOffsetMatchClass : SMRDOffsetBaseMatchClass <"isSMRDOffset">;
|
|
|
|
def SMRDLiteralOffsetMatchClass : SMRDOffsetBaseMatchClass <
|
|
|
|
"isSMRDLiteralOffset"
|
|
|
|
>;
|
|
|
|
|
2014-08-05 22:48:12 +08:00
|
|
|
let OperandType = "OPERAND_IMMEDIATE" in {
|
|
|
|
|
|
|
|
def offen : Operand<i1> {
|
|
|
|
let PrintMethod = "printOffen";
|
|
|
|
}
|
|
|
|
def idxen : Operand<i1> {
|
|
|
|
let PrintMethod = "printIdxen";
|
|
|
|
}
|
|
|
|
def addr64 : Operand<i1> {
|
|
|
|
let PrintMethod = "printAddr64";
|
|
|
|
}
|
|
|
|
def mbuf_offset : Operand<i16> {
|
|
|
|
let PrintMethod = "printMBUFOffset";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = MubufOffsetMatchClass;
|
2014-08-05 22:48:12 +08:00
|
|
|
}
|
2015-04-08 09:09:26 +08:00
|
|
|
class ds_offset_base <AsmOperandClass mc> : Operand<i16> {
|
2014-10-11 06:16:07 +08:00
|
|
|
let PrintMethod = "printDSOffset";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = mc;
|
2014-10-11 06:16:07 +08:00
|
|
|
}
|
2015-04-08 09:09:26 +08:00
|
|
|
def ds_offset : ds_offset_base <DSOffsetMatchClass>;
|
|
|
|
def ds_offset_gds : ds_offset_base <DSOffsetGDSMatchClass>;
|
|
|
|
|
2014-10-11 06:16:07 +08:00
|
|
|
def ds_offset0 : Operand<i8> {
|
|
|
|
let PrintMethod = "printDSOffset0";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = DSOffset01MatchClass;
|
2014-10-11 06:16:07 +08:00
|
|
|
}
|
|
|
|
def ds_offset1 : Operand<i8> {
|
|
|
|
let PrintMethod = "printDSOffset1";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = DSOffset01MatchClass;
|
2014-10-11 06:16:07 +08:00
|
|
|
}
|
2015-04-08 09:09:26 +08:00
|
|
|
class gds_base <AsmOperandClass mc> : Operand <i1> {
|
2015-03-10 02:49:54 +08:00
|
|
|
let PrintMethod = "printGDS";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = mc;
|
2015-03-10 02:49:54 +08:00
|
|
|
}
|
2015-04-08 09:09:26 +08:00
|
|
|
def gds : gds_base <GDSMatchClass>;
|
|
|
|
|
|
|
|
def gds01 : gds_base <GDS01MatchClass>;
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
class glc_base <AsmOperandClass mc> : Operand <i1> {
|
2014-08-05 22:48:12 +08:00
|
|
|
let PrintMethod = "printGLC";
|
2015-06-13 04:47:06 +08:00
|
|
|
let ParserMatchClass = mc;
|
2014-08-05 22:48:12 +08:00
|
|
|
}
|
2015-06-13 04:47:06 +08:00
|
|
|
|
|
|
|
def glc : glc_base <GLCMubufMatchClass>;
|
|
|
|
def glc_flat : glc_base <GLCFlatMatchClass>;
|
|
|
|
|
|
|
|
class slc_base <AsmOperandClass mc> : Operand <i1> {
|
2014-08-05 22:48:12 +08:00
|
|
|
let PrintMethod = "printSLC";
|
2015-06-13 04:47:06 +08:00
|
|
|
let ParserMatchClass = mc;
|
2014-08-05 22:48:12 +08:00
|
|
|
}
|
2015-06-13 04:47:06 +08:00
|
|
|
|
|
|
|
def slc : slc_base <SLCMubufMatchClass>;
|
|
|
|
def slc_flat : slc_base <SLCFlatMatchClass>;
|
|
|
|
def slc_flat_atomic : slc_base <SLCFlatAtomicMatchClass>;
|
|
|
|
|
|
|
|
class tfe_base <AsmOperandClass mc> : Operand <i1> {
|
2014-08-05 22:48:12 +08:00
|
|
|
let PrintMethod = "printTFE";
|
2015-06-13 04:47:06 +08:00
|
|
|
let ParserMatchClass = mc;
|
2014-08-05 22:48:12 +08:00
|
|
|
}
|
|
|
|
|
2015-06-13 04:47:06 +08:00
|
|
|
def tfe : tfe_base <TFEMubufMatchClass>;
|
|
|
|
def tfe_flat : tfe_base <TFEFlatMatchClass>;
|
|
|
|
def tfe_flat_atomic : tfe_base <TFEFlatAtomicMatchClass>;
|
|
|
|
|
2014-10-01 03:49:48 +08:00
|
|
|
def omod : Operand <i32> {
|
|
|
|
let PrintMethod = "printOModSI";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = OModMatchClass;
|
2014-10-01 03:49:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def ClampMod : Operand <i1> {
|
|
|
|
let PrintMethod = "printClampSI";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = ClampMatchClass;
|
2014-10-01 03:49:48 +08:00
|
|
|
}
|
|
|
|
|
2015-08-07 03:28:38 +08:00
|
|
|
def smrd_offset : Operand <i32> {
|
|
|
|
let PrintMethod = "printU32ImmOperand";
|
|
|
|
let ParserMatchClass = SMRDOffsetMatchClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
def smrd_literal_offset : Operand <i32> {
|
|
|
|
let PrintMethod = "printU32ImmOperand";
|
|
|
|
let ParserMatchClass = SMRDLiteralOffsetMatchClass;
|
|
|
|
}
|
|
|
|
|
2014-08-05 22:48:12 +08:00
|
|
|
} // End OperandType = "OPERAND_IMMEDIATE"
|
|
|
|
|
2015-03-13 05:34:22 +08:00
|
|
|
def VOPDstS64 : VOPDstOperand <SReg_64>;
|
|
|
|
|
2014-06-25 07:33:07 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Complex patterns
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-23 02:49:33 +08:00
|
|
|
def DS1Addr1Offset : ComplexPattern<i32, 2, "SelectDS1Addr1Offset">;
|
2014-08-23 02:49:35 +08:00
|
|
|
def DS64Bit4ByteAligned : ComplexPattern<i32, 3, "SelectDS64Bit4ByteAligned">;
|
2014-08-23 02:49:33 +08:00
|
|
|
|
2014-07-21 23:45:01 +08:00
|
|
|
def MUBUFAddr32 : ComplexPattern<i64, 9, "SelectMUBUFAddr32">;
|
2015-02-27 22:59:41 +08:00
|
|
|
def MUBUFAddr64 : ComplexPattern<i64, 7, "SelectMUBUFAddr64">;
|
2015-02-11 08:34:32 +08:00
|
|
|
def MUBUFAddr64Atomic : ComplexPattern<i64, 5, "SelectMUBUFAddr64">;
|
2014-07-21 23:45:01 +08:00
|
|
|
def MUBUFScratch : ComplexPattern<i64, 4, "SelectMUBUFScratch">;
|
2014-08-12 06:18:17 +08:00
|
|
|
def MUBUFOffset : ComplexPattern<i64, 6, "SelectMUBUFOffset">;
|
2014-09-26 02:30:26 +08:00
|
|
|
def MUBUFOffsetAtomic : ComplexPattern<i64, 4, "SelectMUBUFOffset">;
|
2014-06-25 07:33:07 +08:00
|
|
|
|
2015-08-07 03:28:30 +08:00
|
|
|
def SMRDImm : ComplexPattern<i64, 2, "SelectSMRDImm">;
|
2015-08-07 03:28:38 +08:00
|
|
|
def SMRDImm32 : ComplexPattern<i64, 2, "SelectSMRDImm32">;
|
2015-08-07 03:28:30 +08:00
|
|
|
def SMRDSgpr : ComplexPattern<i64, 2, "SelectSMRDSgpr">;
|
|
|
|
def SMRDBufferImm : ComplexPattern<i32, 1, "SelectSMRDBufferImm">;
|
2015-08-07 03:28:38 +08:00
|
|
|
def SMRDBufferImm32 : ComplexPattern<i32, 1, "SelectSMRDBufferImm32">;
|
2015-08-07 03:28:30 +08:00
|
|
|
def SMRDBufferSgpr : ComplexPattern<i32, 1, "SelectSMRDBufferSgpr">;
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP3Mods0 : ComplexPattern<untyped, 4, "SelectVOP3Mods0">;
|
2015-07-13 23:47:57 +08:00
|
|
|
def VOP3NoMods0 : ComplexPattern<untyped, 4, "SelectVOP3NoMods0">;
|
2014-11-14 03:49:04 +08:00
|
|
|
def VOP3Mods0Clamp : ComplexPattern<untyped, 3, "SelectVOP3Mods0Clamp">;
|
2015-01-07 07:00:37 +08:00
|
|
|
def VOP3Mods0Clamp0OMod : ComplexPattern<untyped, 4, "SelectVOP3Mods0Clamp0OMod">;
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP3Mods : ComplexPattern<untyped, 2, "SelectVOP3Mods">;
|
2015-07-13 23:47:57 +08:00
|
|
|
def VOP3NoMods : ComplexPattern<untyped, 2, "SelectVOP3NoMods">;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2013-02-21 23:16:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SI assembler operands
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2013-02-21 23:16:49 +08:00
|
|
|
def SIOperand {
|
|
|
|
int ZERO = 0x80;
|
2013-02-27 01:52:09 +08:00
|
|
|
int VCC = 0x6A;
|
2014-09-15 23:41:53 +08:00
|
|
|
int FLAT_SCR = 0x68;
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
def SRCMODS {
|
|
|
|
int NONE = 0;
|
2015-03-24 21:40:15 +08:00
|
|
|
int NEG = 1;
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def DSTCLAMP {
|
|
|
|
int NONE = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def DSTOMOD {
|
|
|
|
int NONE = 0;
|
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2013-02-21 23:16:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// SI Instruction multiclass helpers.
|
|
|
|
//
|
|
|
|
// Instructions with _32 take 32-bit operands.
|
|
|
|
// Instructions with _64 take 64-bit operands.
|
|
|
|
//
|
|
|
|
// VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit
|
|
|
|
// encoding is the standard encoding, but instruction that make use of
|
|
|
|
// any of the instruction modifiers must use the 64-bit encoding.
|
|
|
|
//
|
|
|
|
// Instructions with _e32 use the 32-bit encoding.
|
|
|
|
// Instructions with _e64 use the 64-bit encoding.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-10-01 22:44:42 +08:00
|
|
|
class SIMCInstr <string pseudo, int subtarget> {
|
|
|
|
string PseudoInstr = pseudo;
|
|
|
|
int Subtarget = subtarget;
|
|
|
|
}
|
|
|
|
|
2014-10-01 22:44:45 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// EXP classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class EXPCommon : InstSI<
|
|
|
|
(outs),
|
|
|
|
(ins i32imm:$en, i32imm:$tgt, i32imm:$compr, i32imm:$done, i32imm:$vm,
|
2015-01-08 04:59:25 +08:00
|
|
|
VGPR_32:$src0, VGPR_32:$src1, VGPR_32:$src2, VGPR_32:$src3),
|
2014-11-05 22:50:53 +08:00
|
|
|
"exp $en, $tgt, $compr, $done, $vm, $src0, $src1, $src2, $src3",
|
2014-10-01 22:44:45 +08:00
|
|
|
[] > {
|
|
|
|
|
|
|
|
let EXP_CNT = 1;
|
|
|
|
let Uses = [EXEC];
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass EXP_m {
|
|
|
|
|
2015-02-19 00:08:17 +08:00
|
|
|
let isPseudo = 1, isCodeGenOnly = 1 in {
|
2014-11-05 22:50:53 +08:00
|
|
|
def "" : EXPCommon, SIMCInstr <"exp", SISubtarget.NONE> ;
|
2014-10-01 22:44:45 +08:00
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
def _si : EXPCommon, SIMCInstr <"exp", SISubtarget.SI>, EXPe {
|
|
|
|
let DecoderNamespace="SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
def _vi : EXPCommon, SIMCInstr <"exp", SISubtarget.VI>, EXPe_vi {
|
|
|
|
let DecoderNamespace="VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
|
|
|
}
|
2014-10-01 22:44:45 +08:00
|
|
|
}
|
|
|
|
|
2013-02-21 23:16:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Scalar classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class SOP1_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
SOP1 <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOP1_Real_si <sop1 op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOP1 <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOP1e <op.SI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOP1_Real_vi <sop1 op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOP1 <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOP1e <op.VI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-14 05:02:37 +08:00
|
|
|
multiclass SOP1_m <sop1 op, string opName, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern> {
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-14 05:02:37 +08:00
|
|
|
def "" : SOP1_Pseudo <opName, outs, ins, pattern>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-14 05:02:37 +08:00
|
|
|
def _si : SOP1_Real_si <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-14 05:02:37 +08:00
|
|
|
def _vi : SOP1_Real_vi <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-02-14 05:02:37 +08:00
|
|
|
multiclass SOP1_32 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
|
|
|
|
op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0),
|
|
|
|
opName#" $dst, $src0", pattern
|
|
|
|
>;
|
|
|
|
|
|
|
|
multiclass SOP1_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
|
|
|
|
op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0),
|
|
|
|
opName#" $dst, $src0", pattern
|
|
|
|
>;
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
// no input, 64-bit output.
|
|
|
|
multiclass SOP1_64_0 <sop1 op, string opName, list<dag> pattern> {
|
|
|
|
def "" : SOP1_Pseudo <opName, (outs SReg_64:$dst), (ins), pattern>;
|
|
|
|
|
|
|
|
def _si : SOP1_Real_si <op, opName, (outs SReg_64:$dst), (ins),
|
2015-01-28 01:25:11 +08:00
|
|
|
opName#" $dst"> {
|
2015-02-18 10:15:35 +08:00
|
|
|
let ssrc0 = 0;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : SOP1_Real_vi <op, opName, (outs SReg_64:$dst), (ins),
|
2015-01-28 01:25:11 +08:00
|
|
|
opName#" $dst"> {
|
2015-02-18 10:15:35 +08:00
|
|
|
let ssrc0 = 0;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-02-19 00:08:11 +08:00
|
|
|
// 64-bit input, no output
|
|
|
|
multiclass SOP1_1 <sop1 op, string opName, list<dag> pattern> {
|
|
|
|
def "" : SOP1_Pseudo <opName, (outs), (ins SReg_64:$src0), pattern>;
|
|
|
|
|
|
|
|
def _si : SOP1_Real_si <op, opName, (outs), (ins SReg_64:$src0),
|
|
|
|
opName#" $src0"> {
|
|
|
|
let sdst = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : SOP1_Real_vi <op, opName, (outs), (ins SReg_64:$src0),
|
|
|
|
opName#" $src0"> {
|
|
|
|
let sdst = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-11 03:18:24 +08:00
|
|
|
// 64-bit input, 32-bit output.
|
2015-02-14 05:02:37 +08:00
|
|
|
multiclass SOP1_32_64 <sop1 op, string opName, list<dag> pattern> : SOP1_m <
|
|
|
|
op, opName, (outs SReg_32:$dst), (ins SSrc_64:$src0),
|
|
|
|
opName#" $dst, $src0", pattern
|
|
|
|
>;
|
2014-11-14 04:23:36 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class SOP2_Pseudo<string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
SOP2<outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
let Size = 4;
|
2015-02-19 00:08:13 +08:00
|
|
|
|
|
|
|
// Pseudo instructions have no encodings, but adding this field here allows
|
|
|
|
// us to do:
|
|
|
|
// let sdst = xxx in {
|
|
|
|
// for multiclasses that include both real and pseudo instructions.
|
|
|
|
field bits<7> sdst = 0;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOP2_Real_si<sop2 op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOP2<outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOP2e<op.SI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-11-15 02:18:16 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOP2_Real_vi<sop2 op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOP2<outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOP2e<op.VI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
multiclass SOP2_m <sop2 op, string opName, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern> {
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
def "" : SOP2_Pseudo <opName, outs, ins, pattern>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
def _si : SOP2_Real_si <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
def _vi : SOP2_Real_vi <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
multiclass SOP2_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
|
|
|
|
op, opName, (outs SReg_32:$dst), (ins SSrc_32:$src0, SSrc_32:$src1),
|
|
|
|
opName#" $dst, $src0, $src1", pattern
|
|
|
|
>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
multiclass SOP2_64 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
|
|
|
|
op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_64:$src1),
|
|
|
|
opName#" $dst, $src0, $src1", pattern
|
|
|
|
>;
|
2013-11-14 07:36:37 +08:00
|
|
|
|
2015-02-19 00:08:09 +08:00
|
|
|
multiclass SOP2_64_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
|
|
|
|
op, opName, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_32:$src1),
|
|
|
|
opName#" $dst, $src0, $src1", pattern
|
|
|
|
>;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2016-02-23 17:19:14 +08:00
|
|
|
multiclass SOP2_64_32_32 <sop2 op, string opName, list<dag> pattern> : SOP2_m <
|
|
|
|
op, opName, (outs SReg_64:$dst), (ins SSrc_32:$src0, SSrc_32:$src1),
|
|
|
|
opName#" $dst, $src0, $src1", pattern
|
|
|
|
>;
|
|
|
|
|
2015-01-13 03:33:18 +08:00
|
|
|
class SOPC_Helper <bits<7> op, RegisterOperand rc, ValueType vt,
|
2014-04-12 03:25:18 +08:00
|
|
|
string opName, PatLeaf cond> : SOPC <
|
2015-08-06 00:42:54 +08:00
|
|
|
op, (outs), (ins rc:$src0, rc:$src1),
|
2016-02-13 07:45:29 +08:00
|
|
|
opName#" $src0, $src1",
|
|
|
|
[(set SCC, (si_setcc_uniform vt:$src0, vt:$src1, cond))] > {
|
2015-08-06 00:42:54 +08:00
|
|
|
let Defs = [SCC];
|
|
|
|
}
|
2014-04-12 03:25:18 +08:00
|
|
|
|
|
|
|
class SOPC_32<bits<7> op, string opName, PatLeaf cond = COND_NULL>
|
|
|
|
: SOPC_Helper<op, SSrc_32, i32, opName, cond>;
|
|
|
|
|
|
|
|
class SOPC_64<bits<7> op, string opName, PatLeaf cond = COND_NULL>
|
|
|
|
: SOPC_Helper<op, SSrc_64, i64, opName, cond>;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class SOPK_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
SOPK <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOPK_Real_si <sopk op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOPK <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOPKe <op.SI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class SOPK_Real_vi <sopk op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
SOPK <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SOPKe <op.VI>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-04-08 09:09:22 +08:00
|
|
|
multiclass SOPK_m <sopk op, string opName, dag outs, dag ins, string opAsm,
|
|
|
|
string asm = opName#opAsm> {
|
|
|
|
def "" : SOPK_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
def _si : SOPK_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
|
|
|
|
def _vi : SOPK_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
multiclass SOPK_32 <sopk op, string opName, list<dag> pattern> {
|
|
|
|
def "" : SOPK_Pseudo <opName, (outs SReg_32:$dst), (ins u16imm:$src0),
|
|
|
|
pattern>;
|
|
|
|
|
|
|
|
def _si : SOPK_Real_si <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
|
2015-01-28 01:25:11 +08:00
|
|
|
opName#" $dst, $src0">;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
def _vi : SOPK_Real_vi <op, opName, (outs SReg_32:$dst), (ins u16imm:$src0),
|
2015-01-28 01:25:11 +08:00
|
|
|
opName#" $dst, $src0">;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
multiclass SOPK_SCC <sopk op, string opName, list<dag> pattern> {
|
2015-08-06 00:42:54 +08:00
|
|
|
def "" : SOPK_Pseudo <opName, (outs),
|
|
|
|
(ins SReg_32:$src0, u16imm:$src1), pattern> {
|
|
|
|
let Defs = [SCC];
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
|
2015-08-06 00:42:54 +08:00
|
|
|
def _si : SOPK_Real_si <op, opName, (outs),
|
|
|
|
(ins SReg_32:$sdst, u16imm:$simm16), opName#" $sdst, $simm16"> {
|
|
|
|
let Defs = [SCC];
|
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : SOPK_Real_vi <op, opName, (outs),
|
|
|
|
(ins SReg_32:$sdst, u16imm:$simm16), opName#" $sdst, $simm16"> {
|
|
|
|
let Defs = [SCC];
|
2015-04-08 09:09:22 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-04-08 09:09:22 +08:00
|
|
|
multiclass SOPK_32TIE <sopk op, string opName, list<dag> pattern> : SOPK_m <
|
|
|
|
op, opName, (outs SReg_32:$sdst), (ins SReg_32:$src0, u16imm:$simm16),
|
|
|
|
" $sdst, $simm16"
|
|
|
|
>;
|
|
|
|
|
|
|
|
multiclass SOPK_IMM32 <sopk op, string opName, dag outs, dag ins,
|
|
|
|
string argAsm, string asm = opName#argAsm> {
|
|
|
|
|
|
|
|
def "" : SOPK_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
def _si : SOPK <outs, ins, asm, []>,
|
|
|
|
SOPK64e <op.SI>,
|
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:22 +08:00
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : SOPK <outs, ins, asm, []>,
|
|
|
|
SOPK64e <op.VI>,
|
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:22 +08:00
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
}
|
|
|
|
}
|
2014-10-01 22:44:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// SMRD classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class SMRD_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
SMRD <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-10-01 22:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class SMRD_Real_si <bits<5> op, string opName, bit imm, dag outs, dag ins,
|
|
|
|
string asm> :
|
|
|
|
SMRD <outs, ins, asm, []>,
|
|
|
|
SMRDe <op, imm>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-10-01 22:44:42 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class SMRD_Real_vi <bits<8> op, string opName, bit imm, dag outs, dag ins,
|
2015-09-25 03:52:27 +08:00
|
|
|
string asm, list<dag> pattern = []> :
|
|
|
|
SMRD <outs, ins, asm, pattern>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SMEMe_vi <op, imm>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-08-22 08:54:31 +08:00
|
|
|
multiclass SMRD_m <smrd op, string opName, bit imm, dag outs, dag ins,
|
2014-10-01 22:44:42 +08:00
|
|
|
string asm, list<dag> pattern> {
|
|
|
|
|
|
|
|
def "" : SMRD_Pseudo <opName, outs, ins, pattern>;
|
|
|
|
|
2015-08-22 08:54:31 +08:00
|
|
|
def _si : SMRD_Real_si <op.SI, opName, imm, outs, ins, asm>;
|
2014-10-01 22:44:42 +08:00
|
|
|
|
2015-02-18 10:10:40 +08:00
|
|
|
// glc is only applicable to scalar stores, which are not yet
|
|
|
|
// implemented.
|
|
|
|
let glc = 0 in {
|
2015-08-22 08:54:31 +08:00
|
|
|
def _vi : SMRD_Real_vi <op.VI, opName, imm, outs, ins, asm>;
|
2015-02-18 10:10:40 +08:00
|
|
|
}
|
2014-10-01 22:44:42 +08:00
|
|
|
}
|
|
|
|
|
2015-09-25 03:52:27 +08:00
|
|
|
multiclass SMRD_Inval <smrd op, string opName,
|
|
|
|
SDPatternOperator node> {
|
|
|
|
let hasSideEffects = 1, mayStore = 1 in {
|
|
|
|
def "" : SMRD_Pseudo <opName, (outs), (ins), [(node)]>;
|
|
|
|
|
|
|
|
let sbase = 0, offset = 0 in {
|
|
|
|
let sdst = 0 in {
|
|
|
|
def _si : SMRD_Real_si <op.SI, opName, 0, (outs), (ins), opName>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let glc = 0, sdata = 0 in {
|
|
|
|
def _vi : SMRD_Real_vi <op.VI, opName, 0, (outs), (ins), opName>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SMEM_Inval <bits<8> op, string opName, SDPatternOperator node> :
|
|
|
|
SMRD_Real_vi<op, opName, 0, (outs), (ins), opName, [(node)]> {
|
|
|
|
let hasSideEffects = 1;
|
|
|
|
let mayStore = 1;
|
|
|
|
let sbase = 0;
|
|
|
|
let sdata = 0;
|
|
|
|
let glc = 0;
|
|
|
|
let offset = 0;
|
|
|
|
}
|
|
|
|
|
2015-08-22 08:54:31 +08:00
|
|
|
multiclass SMRD_Helper <smrd op, string opName, RegisterClass baseClass,
|
2013-03-18 19:33:50 +08:00
|
|
|
RegisterClass dstClass> {
|
2014-10-01 22:44:42 +08:00
|
|
|
defm _IMM : SMRD_m <
|
|
|
|
op, opName#"_IMM", 1, (outs dstClass:$dst),
|
2015-08-07 03:28:38 +08:00
|
|
|
(ins baseClass:$sbase, smrd_offset:$offset),
|
2014-10-01 22:44:42 +08:00
|
|
|
opName#" $dst, $sbase, $offset", []
|
2013-02-21 23:16:44 +08:00
|
|
|
>;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-08-07 03:28:30 +08:00
|
|
|
def _IMM_ci : SMRD <
|
2015-08-07 03:28:38 +08:00
|
|
|
(outs dstClass:$dst), (ins baseClass:$sbase, smrd_literal_offset:$offset),
|
2015-08-22 08:54:31 +08:00
|
|
|
opName#" $dst, $sbase, $offset", []>, SMRD_IMMe_ci <op.SI> {
|
2015-08-07 03:28:38 +08:00
|
|
|
let AssemblerPredicates = [isCIOnly];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "CI";
|
2015-08-07 03:28:30 +08:00
|
|
|
}
|
|
|
|
|
2014-10-01 22:44:42 +08:00
|
|
|
defm _SGPR : SMRD_m <
|
|
|
|
op, opName#"_SGPR", 0, (outs dstClass:$dst),
|
2013-03-18 19:33:50 +08:00
|
|
|
(ins baseClass:$sbase, SReg_32:$soff),
|
2014-10-01 22:44:42 +08:00
|
|
|
opName#" $dst, $sbase, $soff", []
|
2013-02-21 23:16:44 +08:00
|
|
|
>;
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2013-02-21 23:16:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Vector ALU classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
// This must always be right before the operand being input modified.
|
|
|
|
def InputMods : OperandWithDefaultOps <i32, (ops (i32 0))> {
|
|
|
|
let PrintMethod = "printOperandAndMods";
|
|
|
|
}
|
2015-04-08 09:09:26 +08:00
|
|
|
|
|
|
|
def InputModsMatchClass : AsmOperandClass {
|
2016-02-23 03:17:56 +08:00
|
|
|
let Name = "RegOrImmWithInputMods";
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
def InputModsNoDefault : Operand <i32> {
|
|
|
|
let PrintMethod = "printOperandAndMods";
|
2015-04-08 09:09:26 +08:00
|
|
|
let ParserMatchClass = InputModsMatchClass;
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
2015-10-06 23:57:53 +08:00
|
|
|
class getNumSrcArgs<ValueType Src0, ValueType Src1, ValueType Src2> {
|
2014-08-01 08:32:39 +08:00
|
|
|
int ret =
|
2015-10-06 23:57:53 +08:00
|
|
|
!if (!eq(Src0.Value, untyped.Value), 0,
|
|
|
|
!if (!eq(Src1.Value, untyped.Value), 1, // VOP1
|
2014-08-01 08:32:39 +08:00
|
|
|
!if (!eq(Src2.Value, untyped.Value), 2, // VOP2
|
2015-10-06 23:57:53 +08:00
|
|
|
3))); // VOP3
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the register class to use for the destination of VOP[123C]
|
|
|
|
// instructions for the given VT.
|
|
|
|
class getVALUDstForVT<ValueType VT> {
|
2015-03-13 05:34:22 +08:00
|
|
|
RegisterOperand ret = !if(!eq(VT.Size, 32), VOPDstOperand<VGPR_32>,
|
|
|
|
!if(!eq(VT.Size, 64), VOPDstOperand<VReg_64>,
|
2015-08-22 07:49:51 +08:00
|
|
|
!if(!eq(VT.Size, 16), VOPDstOperand<VGPR_32>,
|
|
|
|
VOPDstOperand<SReg_64>))); // else VT == i1
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the register class to use for source 0 of VOP[12C]
|
|
|
|
// instructions for the given VT.
|
|
|
|
class getVOPSrc0ForVT<ValueType VT> {
|
2015-08-22 07:49:51 +08:00
|
|
|
RegisterOperand ret = !if(!eq(VT.Size, 64), VSrc_64, VSrc_32);
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the register class to use for source 1 of VOP[12C] for the
|
|
|
|
// given VT.
|
|
|
|
class getVOPSrc1ForVT<ValueType VT> {
|
2015-08-22 07:49:51 +08:00
|
|
|
RegisterClass ret = !if(!eq(VT.Size, 64), VReg_64, VGPR_32);
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
2016-02-13 08:51:31 +08:00
|
|
|
// Returns the register class to use for DPP source operands.
|
|
|
|
class getDPPSrcForVT<ValueType VT> {
|
|
|
|
RegisterClass ret = !if(!eq(VT.Size, 64), VReg_64, VGPR_32);
|
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
// Returns the register class to use for sources of VOP3 instructions for the
|
|
|
|
// given VT.
|
|
|
|
class getVOP3SrcForVT<ValueType VT> {
|
2015-09-09 05:15:00 +08:00
|
|
|
RegisterOperand ret =
|
|
|
|
!if(!eq(VT.Size, 64),
|
|
|
|
VCSrc_64,
|
|
|
|
!if(!eq(VT.Value, i1.Value),
|
|
|
|
SCSrc_64,
|
|
|
|
VCSrc_32
|
|
|
|
)
|
|
|
|
);
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns 1 if the source arguments have modifiers, 0 if they do not.
|
2015-08-22 07:49:51 +08:00
|
|
|
// XXX - do f16 instructions?
|
2014-08-01 08:32:39 +08:00
|
|
|
class hasModifiers<ValueType SrcVT> {
|
2016-02-11 11:28:15 +08:00
|
|
|
bit ret =
|
|
|
|
!if(!eq(SrcVT.Value, f32.Value), 1,
|
|
|
|
!if(!eq(SrcVT.Value, f64.Value), 1,
|
|
|
|
0));
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the input arguments for VOP[12C] instructions for the given SrcVT.
|
2015-01-13 03:33:18 +08:00
|
|
|
class getIns32 <RegisterOperand Src0RC, RegisterClass Src1RC, int NumSrcArgs> {
|
2014-08-01 08:32:39 +08:00
|
|
|
dag ret = !if(!eq(NumSrcArgs, 1), (ins Src0RC:$src0), // VOP1
|
|
|
|
!if(!eq(NumSrcArgs, 2), (ins Src0RC:$src0, Src1RC:$src1), // VOP2
|
|
|
|
(ins)));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the input arguments for VOP3 instructions for the given SrcVT.
|
2015-01-13 03:33:18 +08:00
|
|
|
class getIns64 <RegisterOperand Src0RC, RegisterOperand Src1RC,
|
|
|
|
RegisterOperand Src2RC, int NumSrcArgs,
|
2014-08-01 08:32:39 +08:00
|
|
|
bit HasModifiers> {
|
|
|
|
|
|
|
|
dag ret =
|
2016-02-18 11:42:32 +08:00
|
|
|
!if (!eq(NumSrcArgs, 0),
|
|
|
|
// VOP1 without input operands (V_NOP, V_CLREXCP)
|
|
|
|
(ins),
|
|
|
|
/* else */
|
2014-08-01 08:32:39 +08:00
|
|
|
!if (!eq(NumSrcArgs, 1),
|
|
|
|
!if (!eq(HasModifiers, 1),
|
|
|
|
// VOP1 with modifiers
|
|
|
|
(ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
|
2014-10-01 03:49:48 +08:00
|
|
|
ClampMod:$clamp, omod:$omod)
|
2014-08-01 08:32:39 +08:00
|
|
|
/* else */,
|
|
|
|
// VOP1 without modifiers
|
|
|
|
(ins Src0RC:$src0)
|
|
|
|
/* endif */ ),
|
|
|
|
!if (!eq(NumSrcArgs, 2),
|
|
|
|
!if (!eq(HasModifiers, 1),
|
|
|
|
// VOP 2 with modifiers
|
|
|
|
(ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
|
|
|
|
InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
|
2014-10-01 03:49:48 +08:00
|
|
|
ClampMod:$clamp, omod:$omod)
|
2014-08-01 08:32:39 +08:00
|
|
|
/* else */,
|
|
|
|
// VOP2 without modifiers
|
|
|
|
(ins Src0RC:$src0, Src1RC:$src1)
|
|
|
|
/* endif */ )
|
|
|
|
/* NumSrcArgs == 3 */,
|
|
|
|
!if (!eq(HasModifiers, 1),
|
|
|
|
// VOP3 with modifiers
|
|
|
|
(ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
|
|
|
|
InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
|
|
|
|
InputModsNoDefault:$src2_modifiers, Src2RC:$src2,
|
2014-10-01 03:49:48 +08:00
|
|
|
ClampMod:$clamp, omod:$omod)
|
2014-08-01 08:32:39 +08:00
|
|
|
/* else */,
|
|
|
|
// VOP3 without modifiers
|
|
|
|
(ins Src0RC:$src0, Src1RC:$src1, Src2RC:$src2)
|
2016-02-18 11:42:32 +08:00
|
|
|
/* endif */ ))));
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
2016-02-13 08:51:31 +08:00
|
|
|
class getInsDPP <RegisterClass Src0RC, RegisterClass Src1RC, int NumSrcArgs,
|
|
|
|
bit HasModifiers> {
|
|
|
|
|
|
|
|
dag ret = !if (!eq(NumSrcArgs, 1),
|
|
|
|
!if (!eq(HasModifiers, 1),
|
|
|
|
// VOP1_DPP with modifiers
|
|
|
|
(ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
|
|
|
|
i32imm:$dpp_ctrl, i1imm:$bound_ctrl,
|
|
|
|
i32imm:$bank_mask, i32imm:$row_mask)
|
|
|
|
/* else */,
|
|
|
|
// VOP1_DPP without modifiers
|
|
|
|
(ins Src0RC:$src0, i32imm:$dpp_ctrl, i1imm:$bound_ctrl,
|
|
|
|
i32imm:$bank_mask, i32imm:$row_mask)
|
|
|
|
/* endif */)
|
|
|
|
/* NumSrcArgs == 2 */,
|
|
|
|
!if (!eq(HasModifiers, 1),
|
|
|
|
// VOP2_DPP with modifiers
|
|
|
|
(ins InputModsNoDefault:$src0_modifiers, Src0RC:$src0,
|
|
|
|
InputModsNoDefault:$src1_modifiers, Src1RC:$src1,
|
|
|
|
i32imm:$dpp_ctrl, i1imm:$bound_ctrl,
|
|
|
|
i32imm:$bank_mask, i32imm:$row_mask)
|
|
|
|
/* else */,
|
|
|
|
// VOP2_DPP without modifiers
|
|
|
|
(ins Src0RC:$src0, Src1RC:$src1, i32imm:$dpp_ctrl, i1imm:$bound_ctrl,
|
|
|
|
i32imm:$bank_mask, i32imm:$row_mask)
|
|
|
|
/* endif */));
|
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
// Returns the assembly string for the inputs and outputs of a VOP[12C]
|
|
|
|
// instruction. This does not add the _e32 suffix, so it can be reused
|
|
|
|
// by getAsm64.
|
2016-02-17 02:14:56 +08:00
|
|
|
class getAsm32 <bit HasDst, int NumSrcArgs, ValueType DstVT = i32> {
|
|
|
|
string dst = !if(!eq(DstVT.Size, 1), "$sdst", "$vdst"); // use $sdst for VOPC
|
2015-10-06 23:57:53 +08:00
|
|
|
string src0 = ", $src0";
|
2014-08-01 08:32:39 +08:00
|
|
|
string src1 = ", $src1";
|
|
|
|
string src2 = ", $src2";
|
2015-10-06 23:57:53 +08:00
|
|
|
string ret = !if(HasDst, dst, "") #
|
|
|
|
!if(!eq(NumSrcArgs, 1), src0, "") #
|
|
|
|
!if(!eq(NumSrcArgs, 2), src0#src1, "") #
|
|
|
|
!if(!eq(NumSrcArgs, 3), src0#src1#src2, "");
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the assembly string for the inputs and outputs of a VOP3
|
|
|
|
// instruction.
|
2016-02-17 02:14:56 +08:00
|
|
|
class getAsm64 <bit HasDst, int NumSrcArgs, bit HasModifiers, ValueType DstVT = i32> {
|
|
|
|
string dst = !if(!eq(DstVT.Size, 1), "$sdst", "$vdst"); // use $sdst for VOPC
|
2015-01-16 07:17:03 +08:00
|
|
|
string src0 = !if(!eq(NumSrcArgs, 1), "$src0_modifiers", "$src0_modifiers,");
|
2014-10-01 03:49:48 +08:00
|
|
|
string src1 = !if(!eq(NumSrcArgs, 1), "",
|
|
|
|
!if(!eq(NumSrcArgs, 2), " $src1_modifiers",
|
|
|
|
" $src1_modifiers,"));
|
|
|
|
string src2 = !if(!eq(NumSrcArgs, 3), " $src2_modifiers", "");
|
2014-08-01 08:32:39 +08:00
|
|
|
string ret =
|
|
|
|
!if(!eq(HasModifiers, 0),
|
2016-02-17 02:14:56 +08:00
|
|
|
getAsm32<HasDst, NumSrcArgs, DstVT>.ret,
|
|
|
|
dst#", "#src0#src1#src2#"$clamp"#"$omod");
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
class getAsmDPP <bit HasDst, int NumSrcArgs, bit HasModifiers, ValueType DstVT = i32> {
|
|
|
|
string dst = !if(!eq(DstVT.Size, 1), "$sdst", "$vdst"); // use $sdst for VOPC
|
2016-02-13 08:51:31 +08:00
|
|
|
string src0 = !if(!eq(NumSrcArgs, 1), "$src0_modifiers", "$src0_modifiers,");
|
|
|
|
string src1 = !if(!eq(NumSrcArgs, 1), "",
|
|
|
|
!if(!eq(NumSrcArgs, 2), " $src1_modifiers",
|
|
|
|
" $src1_modifiers,"));
|
|
|
|
string args = !if(!eq(HasModifiers, 0),
|
2016-02-17 02:14:56 +08:00
|
|
|
getAsm32<0, NumSrcArgs, DstVT>.ret,
|
2016-02-13 08:51:31 +08:00
|
|
|
src0#src1);
|
2016-02-17 02:14:56 +08:00
|
|
|
string ret = " "#dst#args#", $dpp_ctrl, "#"$bound_ctrl, "#"$bank_mask, "#"$row_mask";
|
2016-02-13 08:51:31 +08:00
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
class VOPProfile <list<ValueType> _ArgVT> {
|
|
|
|
|
|
|
|
field list<ValueType> ArgVT = _ArgVT;
|
|
|
|
|
|
|
|
field ValueType DstVT = ArgVT[0];
|
|
|
|
field ValueType Src0VT = ArgVT[1];
|
|
|
|
field ValueType Src1VT = ArgVT[2];
|
|
|
|
field ValueType Src2VT = ArgVT[3];
|
2015-03-13 05:34:22 +08:00
|
|
|
field RegisterOperand DstRC = getVALUDstForVT<DstVT>.ret;
|
2016-02-13 08:51:31 +08:00
|
|
|
field RegisterClass DstRCDPP = !if(!eq(DstVT.Size, 64), VReg_64, VGPR_32);
|
2015-01-13 03:33:18 +08:00
|
|
|
field RegisterOperand Src0RC32 = getVOPSrc0ForVT<Src0VT>.ret;
|
2014-08-01 08:32:39 +08:00
|
|
|
field RegisterClass Src1RC32 = getVOPSrc1ForVT<Src1VT>.ret;
|
2015-01-13 03:33:18 +08:00
|
|
|
field RegisterOperand Src0RC64 = getVOP3SrcForVT<Src0VT>.ret;
|
|
|
|
field RegisterOperand Src1RC64 = getVOP3SrcForVT<Src1VT>.ret;
|
|
|
|
field RegisterOperand Src2RC64 = getVOP3SrcForVT<Src2VT>.ret;
|
2016-02-13 08:51:31 +08:00
|
|
|
field RegisterClass Src0DPP = getDPPSrcForVT<Src0VT>.ret;
|
|
|
|
field RegisterClass Src1DPP = getDPPSrcForVT<Src1VT>.ret;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2015-10-06 23:57:53 +08:00
|
|
|
field bit HasDst = !if(!eq(DstVT.Value, untyped.Value), 0, 1);
|
|
|
|
field bit HasDst32 = HasDst;
|
|
|
|
field int NumSrcArgs = getNumSrcArgs<Src0VT, Src1VT, Src2VT>.ret;
|
2014-08-01 08:32:39 +08:00
|
|
|
field bit HasModifiers = hasModifiers<Src0VT>.ret;
|
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
field dag Outs = !if(HasDst,(outs DstRC:$vdst),(outs));
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2015-08-29 15:16:50 +08:00
|
|
|
// VOP3b instructions are a special case with a second explicit
|
|
|
|
// output. This is manually overridden for them.
|
|
|
|
field dag Outs32 = Outs;
|
|
|
|
field dag Outs64 = Outs;
|
2016-02-17 02:14:56 +08:00
|
|
|
field dag OutsDPP = !if(!eq(DstVT.Size, 1), (outs DstRCDPP:$sdst), // sdst for VOPC
|
|
|
|
(outs DstRCDPP:$vdst));
|
2015-08-29 15:16:50 +08:00
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
field dag Ins32 = getIns32<Src0RC32, Src1RC32, NumSrcArgs>.ret;
|
|
|
|
field dag Ins64 = getIns64<Src0RC64, Src1RC64, Src2RC64, NumSrcArgs,
|
|
|
|
HasModifiers>.ret;
|
2016-02-13 08:51:31 +08:00
|
|
|
field dag InsDPP = getInsDPP<Src0DPP, Src1DPP, NumSrcArgs, HasModifiers>.ret;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
field string Asm32 = getAsm32<HasDst, NumSrcArgs, DstVT>.ret;
|
|
|
|
field string Asm64 = getAsm64<HasDst, NumSrcArgs, HasModifiers, DstVT>.ret;
|
|
|
|
field string AsmDPP = getAsmDPP<HasDst, NumSrcArgs, HasModifiers, DstVT>.ret;
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
|
|
|
|
2015-05-26 23:55:52 +08:00
|
|
|
// FIXME: I think these F16/I16 profiles will need to use f16/i16 types in order
|
2015-04-24 03:33:54 +08:00
|
|
|
// for the instruction patterns to work.
|
2015-08-22 07:49:51 +08:00
|
|
|
def VOP_F16_F16 : VOPProfile <[f16, f16, untyped, untyped]>;
|
|
|
|
def VOP_F16_I16 : VOPProfile <[f16, i32, untyped, untyped]>;
|
|
|
|
def VOP_I16_F16 : VOPProfile <[i32, f16, untyped, untyped]>;
|
2015-04-24 03:33:54 +08:00
|
|
|
|
2015-08-22 07:49:51 +08:00
|
|
|
def VOP_F16_F16_F16 : VOPProfile <[f16, f16, f16, untyped]>;
|
|
|
|
def VOP_F16_F16_I16 : VOPProfile <[f16, f16, i32, untyped]>;
|
2015-05-26 23:55:52 +08:00
|
|
|
def VOP_I16_I16_I16 : VOPProfile <[i32, i32, i32, untyped]>;
|
|
|
|
|
2015-10-06 23:57:53 +08:00
|
|
|
def VOP_NONE : VOPProfile <[untyped, untyped, untyped, untyped]>;
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP_F32_F32 : VOPProfile <[f32, f32, untyped, untyped]>;
|
|
|
|
def VOP_F32_F64 : VOPProfile <[f32, f64, untyped, untyped]>;
|
|
|
|
def VOP_F32_I32 : VOPProfile <[f32, i32, untyped, untyped]>;
|
|
|
|
def VOP_F64_F32 : VOPProfile <[f64, f32, untyped, untyped]>;
|
|
|
|
def VOP_F64_F64 : VOPProfile <[f64, f64, untyped, untyped]>;
|
|
|
|
def VOP_F64_I32 : VOPProfile <[f64, i32, untyped, untyped]>;
|
|
|
|
def VOP_I32_F32 : VOPProfile <[i32, f32, untyped, untyped]>;
|
|
|
|
def VOP_I32_F64 : VOPProfile <[i32, f64, untyped, untyped]>;
|
|
|
|
def VOP_I32_I32 : VOPProfile <[i32, i32, untyped, untyped]>;
|
|
|
|
|
|
|
|
def VOP_F32_F32_F32 : VOPProfile <[f32, f32, f32, untyped]>;
|
|
|
|
def VOP_F32_F32_I32 : VOPProfile <[f32, f32, i32, untyped]>;
|
|
|
|
def VOP_F64_F64_F64 : VOPProfile <[f64, f64, f64, untyped]>;
|
|
|
|
def VOP_F64_F64_I32 : VOPProfile <[f64, f64, i32, untyped]>;
|
|
|
|
def VOP_I32_F32_F32 : VOPProfile <[i32, f32, f32, untyped]>;
|
2015-02-04 01:38:01 +08:00
|
|
|
def VOP_I32_F32_I32 : VOPProfile <[i32, f32, i32, untyped]>;
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP_I32_I32_I32 : VOPProfile <[i32, i32, i32, untyped]>;
|
2015-08-29 15:16:50 +08:00
|
|
|
|
2015-09-09 05:15:00 +08:00
|
|
|
// Write out to vcc or arbitrary SGPR.
|
|
|
|
def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped]> {
|
2016-02-17 02:14:56 +08:00
|
|
|
let Asm32 = "$vdst, vcc, $src0, $src1";
|
|
|
|
let Asm64 = "$vdst, $sdst, $src0, $src1";
|
|
|
|
let Outs32 = (outs DstRC:$vdst);
|
|
|
|
let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
|
2015-08-29 15:16:50 +08:00
|
|
|
}
|
|
|
|
|
2015-09-09 05:15:00 +08:00
|
|
|
// Write out to vcc or arbitrary SGPR and read in from vcc or
|
|
|
|
// arbitrary SGPR.
|
|
|
|
def VOP2b_I32_I1_I32_I32_I1 : VOPProfile<[i32, i32, i32, i1]> {
|
2015-10-07 09:36:00 +08:00
|
|
|
// We use VCSrc_32 to exclude literal constants, even though the
|
|
|
|
// encoding normally allows them since the implicit VCC use means
|
|
|
|
// using one would always violate the constant bus
|
|
|
|
// restriction. SGPRs are still allowed because it should
|
|
|
|
// technically be possible to use VCC again as src0.
|
2014-09-24 05:26:25 +08:00
|
|
|
let Src0RC32 = VCSrc_32;
|
2016-02-17 02:14:56 +08:00
|
|
|
let Asm32 = "$vdst, vcc, $src0, $src1, vcc";
|
|
|
|
let Asm64 = "$vdst, $sdst, $src0, $src1, $src2";
|
|
|
|
let Outs32 = (outs DstRC:$vdst);
|
|
|
|
let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
|
2015-09-09 05:15:00 +08:00
|
|
|
|
|
|
|
// Suppress src2 implied by type since the 32-bit encoding uses an
|
|
|
|
// implicit VCC use.
|
|
|
|
let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1);
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
2015-01-07 07:00:37 +08:00
|
|
|
|
2015-09-26 10:25:48 +08:00
|
|
|
class VOP3b_Profile<ValueType vt> : VOPProfile<[vt, vt, vt, vt]> {
|
|
|
|
let Outs64 = (outs DstRC:$vdst, SReg_64:$sdst);
|
|
|
|
let Asm64 = "$vdst, $sdst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod";
|
|
|
|
}
|
|
|
|
|
|
|
|
def VOP3b_F32_I1_F32_F32_F32 : VOP3b_Profile<f32> {
|
|
|
|
// FIXME: Hack to stop printing _e64
|
|
|
|
let DstRC = RegisterOperand<VGPR_32>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def VOP3b_F64_I1_F64_F64_F64 : VOP3b_Profile<f64> {
|
|
|
|
// FIXME: Hack to stop printing _e64
|
|
|
|
let DstRC = RegisterOperand<VReg_64>;
|
|
|
|
}
|
|
|
|
|
2015-08-08 08:41:48 +08:00
|
|
|
// VOPC instructions are a special case because for the 32-bit
|
|
|
|
// encoding, we want to display the implicit vcc write as if it were
|
|
|
|
// an explicit $dst.
|
|
|
|
class VOPC_Profile<ValueType vt0, ValueType vt1 = vt0> : VOPProfile <[i1, vt0, vt1, untyped]> {
|
|
|
|
let Asm32 = "vcc, $src0, $src1";
|
2015-10-06 01:57:39 +08:00
|
|
|
// The destination for 32-bit encoding is implicit.
|
|
|
|
let HasDst32 = 0;
|
2016-02-17 02:14:56 +08:00
|
|
|
let Outs64 = (outs DstRC:$sdst);
|
2015-01-07 07:00:37 +08:00
|
|
|
}
|
|
|
|
|
2015-08-08 08:41:48 +08:00
|
|
|
class VOPC_Class_Profile<ValueType vt> : VOPC_Profile<vt, i32> {
|
2015-01-07 07:00:37 +08:00
|
|
|
let Ins64 = (ins InputModsNoDefault:$src0_modifiers, Src0RC64:$src0, Src1RC64:$src1);
|
2016-02-17 02:14:56 +08:00
|
|
|
let Asm64 = "$sdst, $src0_modifiers, $src1";
|
2015-01-07 07:00:37 +08:00
|
|
|
}
|
|
|
|
|
2015-08-08 08:41:48 +08:00
|
|
|
def VOPC_I1_F32_F32 : VOPC_Profile<f32>;
|
|
|
|
def VOPC_I1_F64_F64 : VOPC_Profile<f64>;
|
|
|
|
def VOPC_I1_I32_I32 : VOPC_Profile<i32>;
|
|
|
|
def VOPC_I1_I64_I64 : VOPC_Profile<i64>;
|
|
|
|
|
|
|
|
def VOPC_I1_F32_I32 : VOPC_Class_Profile<f32>;
|
|
|
|
def VOPC_I1_F64_I32 : VOPC_Class_Profile<f64>;
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP_I64_I64_I32 : VOPProfile <[i64, i64, i32, untyped]>;
|
2015-02-04 05:53:01 +08:00
|
|
|
def VOP_I64_I32_I64 : VOPProfile <[i64, i32, i64, untyped]>;
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP_I64_I64_I64 : VOPProfile <[i64, i64, i64, untyped]>;
|
2015-03-11 00:16:44 +08:00
|
|
|
def VOP_CNDMASK : VOPProfile <[i32, i32, i32, untyped]> {
|
2015-08-08 08:41:45 +08:00
|
|
|
let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1);
|
2015-03-11 00:16:44 +08:00
|
|
|
let Ins64 = (ins Src0RC64:$src0, Src1RC64:$src1, SSrc_64:$src2);
|
2016-02-17 02:14:56 +08:00
|
|
|
let Asm64 = "$vdst, $src0, $src1, $src2";
|
2015-03-11 00:16:44 +08:00
|
|
|
}
|
2014-08-01 08:32:39 +08:00
|
|
|
|
|
|
|
def VOP_F32_F32_F32_F32 : VOPProfile <[f32, f32, f32, f32]>;
|
2015-02-22 05:29:00 +08:00
|
|
|
def VOP_MADK : VOPProfile <[f32, f32, f32, f32]> {
|
|
|
|
field dag Ins = (ins VCSrc_32:$src0, VGPR_32:$vsrc1, u32imm:$src2);
|
2016-02-17 02:14:56 +08:00
|
|
|
field string Asm = "$vdst, $src0, $vsrc1, $src2";
|
2015-02-22 05:29:00 +08:00
|
|
|
}
|
2015-07-13 23:47:57 +08:00
|
|
|
def VOP_MAC : VOPProfile <[f32, f32, f32, f32]> {
|
|
|
|
let Ins32 = (ins Src0RC32:$src0, Src1RC32:$src1, VGPR_32:$src2);
|
|
|
|
let Ins64 = getIns64<Src0RC64, Src1RC64, RegisterOperand<VGPR_32>, 3,
|
|
|
|
HasModifiers>.ret;
|
2016-02-17 02:14:56 +08:00
|
|
|
let Asm32 = getAsm32<1, 2, f32>.ret;
|
|
|
|
let Asm64 = getAsm64<1, 2, HasModifiers, f32>.ret;
|
2015-07-13 23:47:57 +08:00
|
|
|
}
|
2014-08-01 08:32:39 +08:00
|
|
|
def VOP_F64_F64_F64_F64 : VOPProfile <[f64, f64, f64, f64]>;
|
|
|
|
def VOP_I32_I32_I32_I32 : VOPProfile <[i32, i32, i32, i32]>;
|
|
|
|
def VOP_I64_I32_I32_I64 : VOPProfile <[i64, i32, i32, i64]>;
|
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
// This class is used only with VOPC instructions. Use $sdst for out operand
|
2015-10-06 01:57:39 +08:00
|
|
|
class SIInstAlias <string asm, Instruction inst, VOPProfile p> :
|
|
|
|
InstAlias <asm, (inst)>, PredicateControl {
|
|
|
|
|
2015-08-08 06:00:56 +08:00
|
|
|
field bit isCompare;
|
|
|
|
field bit isCommutable;
|
2015-10-06 01:57:39 +08:00
|
|
|
|
|
|
|
let ResultInst =
|
|
|
|
!if (p.HasDst32,
|
|
|
|
!if (!eq(p.NumSrcArgs, 0),
|
|
|
|
// 1 dst, 0 src
|
2016-02-17 02:14:56 +08:00
|
|
|
(inst p.DstRC:$sdst),
|
2015-10-06 01:57:39 +08:00
|
|
|
!if (!eq(p.NumSrcArgs, 1),
|
|
|
|
// 1 dst, 1 src
|
2016-02-17 02:14:56 +08:00
|
|
|
(inst p.DstRC:$sdst, p.Src0RC32:$src0),
|
2015-10-06 01:57:39 +08:00
|
|
|
!if (!eq(p.NumSrcArgs, 2),
|
|
|
|
// 1 dst, 2 src
|
2016-02-17 02:14:56 +08:00
|
|
|
(inst p.DstRC:$sdst, p.Src0RC32:$src0, p.Src1RC32:$src1),
|
2015-10-06 01:57:39 +08:00
|
|
|
// else - unreachable
|
|
|
|
(inst)))),
|
|
|
|
// else
|
|
|
|
!if (!eq(p.NumSrcArgs, 2),
|
|
|
|
// 0 dst, 2 src
|
|
|
|
(inst p.Src0RC32:$src0, p.Src1RC32:$src1),
|
|
|
|
!if (!eq(p.NumSrcArgs, 1),
|
|
|
|
// 0 dst, 1 src
|
|
|
|
(inst p.Src0RC32:$src1),
|
|
|
|
// else
|
|
|
|
// 0 dst, 0 src
|
|
|
|
(inst))));
|
|
|
|
}
|
|
|
|
|
|
|
|
class SIInstAliasSI <string asm, string op_name, VOPProfile p> :
|
|
|
|
SIInstAlias <asm, !cast<Instruction>(op_name#"_e32_si"), p> {
|
|
|
|
let AssemblerPredicate = SIAssemblerPredicate;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SIInstAliasVI <string asm, string op_name, VOPProfile p> :
|
|
|
|
SIInstAlias <asm, !cast<Instruction>(op_name#"_e32_vi"), p> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass SIInstAliasBuilder <string asm, VOPProfile p> {
|
|
|
|
|
|
|
|
def : SIInstAliasSI <asm, NAME, p>;
|
|
|
|
|
|
|
|
def : SIInstAliasVI <asm, NAME, p>;
|
2015-08-08 06:00:56 +08:00
|
|
|
}
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2013-02-27 01:52:42 +08:00
|
|
|
class VOP <string opName> {
|
|
|
|
string OpName = opName;
|
|
|
|
}
|
|
|
|
|
2013-03-27 17:12:59 +08:00
|
|
|
class VOP2_REV <string revOp, bit isOrig> {
|
|
|
|
string RevOp = revOp;
|
|
|
|
bit IsOrig = isOrig;
|
|
|
|
}
|
|
|
|
|
2014-09-08 23:07:27 +08:00
|
|
|
class AtomicNoRet <string noRetOp, bit isRet> {
|
|
|
|
string NoRetOp = noRetOp;
|
|
|
|
bit IsRet = isRet;
|
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:34 +08:00
|
|
|
class VOP1_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
|
|
|
|
VOP1Common <outs, ins, "", pattern>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP <opName>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.NONE>,
|
|
|
|
MnemonicAlias<opName#"_e32", opName> {
|
2014-10-08 07:51:34 +08:00
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2015-02-19 00:08:15 +08:00
|
|
|
|
|
|
|
field bits<8> vdst;
|
|
|
|
field bits<9> src0;
|
2014-10-08 07:51:34 +08:00
|
|
|
}
|
|
|
|
|
2015-03-20 23:14:21 +08:00
|
|
|
class VOP1_Real_si <string opName, vop1 op, dag outs, dag ins, string asm> :
|
|
|
|
VOP1<op.SI, outs, ins, asm, []>,
|
2015-04-24 03:33:54 +08:00
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.SI> {
|
|
|
|
let AssemblerPredicate = SIAssemblerPredicate;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-24 03:33:54 +08:00
|
|
|
}
|
2015-03-20 23:14:21 +08:00
|
|
|
|
|
|
|
class VOP1_Real_vi <string opName, vop1 op, dag outs, dag ins, string asm> :
|
|
|
|
VOP1<op.VI, outs, ins, asm, []>,
|
2015-04-24 03:33:54 +08:00
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-24 03:33:54 +08:00
|
|
|
}
|
2015-03-20 23:14:21 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP1_m <vop1 op, string opName, VOPProfile p, list<dag> pattern,
|
|
|
|
string asm = opName#p.Asm32> {
|
|
|
|
def "" : VOP1_Pseudo <p.Outs, p.Ins32, pattern, opName>;
|
2014-10-08 07:51:34 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
def _si : VOP1_Real_si <opName, op, p.Outs, p.Ins32, asm>;
|
|
|
|
|
|
|
|
def _vi : VOP1_Real_vi <opName, op, p.Outs, p.Ins32, asm>;
|
2015-03-20 23:14:21 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2016-02-13 08:51:31 +08:00
|
|
|
class VOP1_DPP <vop1 op, string opName, VOPProfile p> :
|
|
|
|
VOP1_DPPe <op.VI>,
|
|
|
|
VOP_DPP <p.OutsDPP, p.InsDPP, opName#p.AsmDPP, []> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
|
|
|
let src0_modifiers = !if(p.HasModifiers, ?, 0);
|
|
|
|
let src1_modifiers = 0;
|
|
|
|
}
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP1SI_m <vop1 op, string opName, VOPProfile p, list<dag> pattern,
|
|
|
|
string asm = opName#p.Asm32> {
|
|
|
|
|
|
|
|
def "" : VOP1_Pseudo <p.Outs, p.Ins32, pattern, opName>;
|
2015-02-04 05:53:05 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
def _si : VOP1_Real_si <opName, op, p.Outs, p.Ins32, asm>;
|
2015-02-04 05:53:05 +08:00
|
|
|
}
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class VOP2_Pseudo <dag outs, dag ins, list<dag> pattern, string opName> :
|
|
|
|
VOP2Common <outs, ins, "", pattern>,
|
|
|
|
VOP <opName>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName#"_e32", SISubtarget.NONE>,
|
|
|
|
MnemonicAlias<opName#"_e32", opName> {
|
2014-12-07 20:18:57 +08:00
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2015-03-20 23:14:23 +08:00
|
|
|
class VOP2_Real_si <string opName, vop2 op, dag outs, dag ins, string asm> :
|
|
|
|
VOP2 <op.SI, outs, ins, opName#asm, []>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-03-20 23:14:23 +08:00
|
|
|
|
|
|
|
class VOP2_Real_vi <string opName, vop2 op, dag outs, dag ins, string asm> :
|
2015-03-28 03:10:06 +08:00
|
|
|
VOP2 <op.VI, outs, ins, opName#asm, []>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-03-20 23:14:23 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP2SI_m <vop2 op, string opName, VOPProfile p, list<dag> pattern,
|
|
|
|
string revOp> {
|
|
|
|
|
|
|
|
def "" : VOP2_Pseudo <p.Outs32, p.Ins32, pattern, opName>,
|
2015-02-04 01:38:05 +08:00
|
|
|
VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
|
2015-01-16 02:43:06 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
def _si : VOP2_Real_si <opName, op, p.Outs32, p.Ins32, p.Asm32>;
|
2015-01-16 02:43:06 +08:00
|
|
|
}
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP2_m <vop2 op, string opName, VOPProfile p, list <dag> pattern,
|
|
|
|
string revOp> {
|
|
|
|
|
|
|
|
def "" : VOP2_Pseudo <p.Outs32, p.Ins32, pattern, opName>,
|
2015-02-04 01:38:05 +08:00
|
|
|
VOP2_REV<revOp#"_e32", !eq(revOp, opName)>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
def _si : VOP2_Real_si <opName, op, p.Outs32, p.Ins32, p.Asm32>;
|
2015-03-20 23:14:23 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
def _vi : VOP2_Real_vi <opName, op, p.Outs32, p.Ins32, p.Asm32>;
|
2015-03-20 23:14:23 +08:00
|
|
|
|
2014-10-08 07:51:34 +08:00
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:39 +08:00
|
|
|
class VOP3DisableFields <bit HasSrc1, bit HasSrc2, bit HasModifiers> {
|
|
|
|
|
|
|
|
bits<2> src0_modifiers = !if(HasModifiers, ?, 0);
|
|
|
|
bits<2> src1_modifiers = !if(HasModifiers, !if(HasSrc1, ?, 0), 0);
|
2015-02-18 10:15:30 +08:00
|
|
|
bits<2> src2_modifiers = !if(HasModifiers, !if(HasSrc2, ?, 0), 0);
|
2014-08-01 08:32:39 +08:00
|
|
|
bits<2> omod = !if(HasModifiers, ?, 0);
|
|
|
|
bits<1> clamp = !if(HasModifiers, ?, 0);
|
|
|
|
bits<9> src1 = !if(HasSrc1, ?, 0);
|
|
|
|
bits<9> src2 = !if(HasSrc2, ?, 0);
|
|
|
|
}
|
|
|
|
|
2015-02-18 10:15:30 +08:00
|
|
|
class VOP3DisableModFields <bit HasSrc0Mods,
|
|
|
|
bit HasSrc1Mods = 0,
|
|
|
|
bit HasSrc2Mods = 0,
|
|
|
|
bit HasOutputMods = 0> {
|
|
|
|
bits<2> src0_modifiers = !if(HasSrc0Mods, ?, 0);
|
|
|
|
bits<2> src1_modifiers = !if(HasSrc1Mods, ?, 0);
|
|
|
|
bits<2> src2_modifiers = !if(HasSrc2Mods, ?, 0);
|
|
|
|
bits<2> omod = !if(HasOutputMods, ?, 0);
|
|
|
|
bits<1> clamp = !if(HasOutputMods, ?, 0);
|
|
|
|
}
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
class VOP3_Pseudo <dag outs, dag ins, list<dag> pattern, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, "", pattern, HasMods, VOP3Only>,
|
2014-07-22 01:44:29 +08:00
|
|
|
VOP <opName>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName#"_e64", SISubtarget.NONE>,
|
|
|
|
MnemonicAlias<opName#"_e64", opName> {
|
2014-07-22 01:44:29 +08:00
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2015-10-06 23:57:53 +08:00
|
|
|
|
|
|
|
field bit vdst;
|
|
|
|
field bit src0;
|
2014-07-22 01:44:29 +08:00
|
|
|
}
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
class VOP3_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3e <op>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName#"_e64", SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
class VOP3_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3e_vi <op>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName#"_e64", SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
class VOP3_C_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
|
|
|
VOP3ce <op>,
|
|
|
|
SIMCInstr<opName#"_e64", SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2016-02-17 02:14:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class VOP3_C_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
|
|
|
VOP3ce_vi <op>,
|
|
|
|
SIMCInstr <opName#"_e64", SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2016-02-17 02:14:56 +08:00
|
|
|
}
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
class VOP3b_Real_si <bits<9> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
2015-02-14 11:02:23 +08:00
|
|
|
VOP3be <op>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr<opName#"_e64", SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-02-14 11:02:23 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
class VOP3b_Real_vi <bits<10> op, dag outs, dag ins, string asm, string opName,
|
|
|
|
bit HasMods = 0, bit VOP3Only = 0> :
|
|
|
|
VOP3Common <outs, ins, asm, [], HasMods, VOP3Only>,
|
2015-02-14 11:02:23 +08:00
|
|
|
VOP3be_vi <op>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName#"_e64", SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-02-14 11:02:23 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
multiclass VOP3_m <vop op, dag outs, dag ins, string asm, list<dag> pattern,
|
2016-02-11 11:28:15 +08:00
|
|
|
string opName, int NumSrcArgs, bit HasMods = 1, bit VOP3Only = 0> {
|
2014-05-17 04:56:47 +08:00
|
|
|
|
2014-07-22 01:44:29 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName>;
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName, HasMods, VOP3Only>,
|
2014-08-01 08:32:39 +08:00
|
|
|
VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
|
|
|
|
!if(!eq(NumSrcArgs, 2), 0, 1),
|
|
|
|
HasMods>;
|
2016-02-11 11:28:15 +08:00
|
|
|
def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName, HasMods, VOP3Only>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3DisableFields<!if(!eq(NumSrcArgs, 1), 0, 1),
|
|
|
|
!if(!eq(NumSrcArgs, 2), 0, 1),
|
|
|
|
HasMods>;
|
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:34 +08:00
|
|
|
multiclass VOP3_1_m <vop op, dag outs, dag ins, string asm,
|
2014-08-01 08:32:39 +08:00
|
|
|
list<dag> pattern, string opName, bit HasMods = 1> {
|
2014-07-22 01:44:29 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods>;
|
2014-07-22 01:44:29 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName, HasMods>,
|
2014-08-01 08:32:39 +08:00
|
|
|
VOP3DisableFields<0, 0, HasMods>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName, HasMods>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3DisableFields<0, 0, HasMods>;
|
2014-07-22 01:44:29 +08:00
|
|
|
}
|
|
|
|
|
2015-02-04 05:53:05 +08:00
|
|
|
multiclass VOP3SI_1_m <vop op, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern, string opName, bit HasMods = 1> {
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods>;
|
2015-02-04 05:53:05 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName, HasMods>,
|
2015-02-04 05:53:05 +08:00
|
|
|
VOP3DisableFields<0, 0, HasMods>;
|
|
|
|
// No VI instruction. This class is for SI only.
|
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:38 +08:00
|
|
|
multiclass VOP3_2_m <vop op, dag outs, dag ins, string asm,
|
2015-02-04 01:38:05 +08:00
|
|
|
list<dag> pattern, string opName, string revOp,
|
2015-09-10 01:03:18 +08:00
|
|
|
bit HasMods = 1> {
|
2014-07-22 01:44:29 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods>,
|
2015-02-04 01:38:05 +08:00
|
|
|
VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
|
2014-07-22 01:44:29 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName, HasMods>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3DisableFields<1, 0, HasMods>;
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _vi : VOP3_Real_vi <op.VI3, outs, ins, asm, opName, HasMods>,
|
2014-08-01 08:32:39 +08:00
|
|
|
VOP3DisableFields<1, 0, HasMods>;
|
2014-05-17 04:56:47 +08:00
|
|
|
}
|
|
|
|
|
2015-02-04 01:38:12 +08:00
|
|
|
multiclass VOP3SI_2_m <vop op, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern, string opName, string revOp,
|
2015-09-10 01:03:18 +08:00
|
|
|
bit HasMods = 1> {
|
2015-02-04 01:38:12 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods>,
|
2015-02-04 01:38:12 +08:00
|
|
|
VOP2_REV<revOp#"_e64", !eq(revOp, opName)>;
|
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def _si : VOP3_Real_si <op.SI3, outs, ins, asm, opName, HasMods>,
|
2015-02-04 01:38:12 +08:00
|
|
|
VOP3DisableFields<1, 0, HasMods>;
|
|
|
|
|
|
|
|
// No VI instruction. This class is for SI only.
|
|
|
|
}
|
|
|
|
|
2015-09-09 05:15:00 +08:00
|
|
|
// Two operand VOP3b instruction that may have a 3rd SGPR bool operand
|
|
|
|
// instead of an implicit VCC as in the VOP2b format.
|
|
|
|
multiclass VOP3b_2_3_m <vop op, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern, string opName, string revOp,
|
[AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm, SamWot, nhaustov, vpykhtin
Differential Revision: http://reviews.llvm.org/D16995
Patch By: Artem Tamazov
llvm-svn: 260560
2016-02-12 02:25:26 +08:00
|
|
|
bit HasMods = 1, bit useSrc2Input = 0, bit VOP3Only = 0> {
|
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods, VOP3Only>;
|
2015-02-14 11:40:35 +08:00
|
|
|
|
[AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm, SamWot, nhaustov, vpykhtin
Differential Revision: http://reviews.llvm.org/D16995
Patch By: Artem Tamazov
llvm-svn: 260560
2016-02-12 02:25:26 +08:00
|
|
|
def _si : VOP3b_Real_si <op.SI3, outs, ins, asm, opName, HasMods, VOP3Only>,
|
2015-09-09 16:39:49 +08:00
|
|
|
VOP3DisableFields<1, useSrc2Input, HasMods>;
|
2015-02-14 11:40:35 +08:00
|
|
|
|
[AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm, SamWot, nhaustov, vpykhtin
Differential Revision: http://reviews.llvm.org/D16995
Patch By: Artem Tamazov
llvm-svn: 260560
2016-02-12 02:25:26 +08:00
|
|
|
def _vi : VOP3b_Real_vi <op.VI3, outs, ins, asm, opName, HasMods, VOP3Only>,
|
2015-09-09 16:39:49 +08:00
|
|
|
VOP3DisableFields<1, useSrc2Input, HasMods>;
|
2015-02-14 11:40:35 +08:00
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:39 +08:00
|
|
|
multiclass VOP3_C_m <vop op, dag outs, dag ins, string asm,
|
2014-08-01 08:32:39 +08:00
|
|
|
list<dag> pattern, string opName,
|
2015-09-26 00:58:25 +08:00
|
|
|
bit HasMods, bit defExec,
|
|
|
|
string revOp, list<SchedReadWrite> sched> {
|
2013-02-21 23:16:44 +08:00
|
|
|
|
2016-02-11 11:28:15 +08:00
|
|
|
def "" : VOP3_Pseudo <outs, ins, pattern, opName, HasMods>,
|
2015-09-26 00:58:25 +08:00
|
|
|
VOP2_REV<revOp#"_e64", !eq(revOp, opName)> {
|
2015-09-26 00:58:27 +08:00
|
|
|
let Defs = !if(defExec, [EXEC], []);
|
2015-09-26 00:58:25 +08:00
|
|
|
let SchedRW = sched;
|
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
def _si : VOP3_C_Real_si <op.SI3, outs, ins, asm, opName, HasMods>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3DisableFields<1, 0, HasMods> {
|
|
|
|
let Defs = !if(defExec, [EXEC], []);
|
2015-09-26 00:58:25 +08:00
|
|
|
let SchedRW = sched;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
def _vi : VOP3_C_Real_vi <op.VI3, outs, ins, asm, opName, HasMods>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VOP3DisableFields<1, 0, HasMods> {
|
2014-10-08 07:51:39 +08:00
|
|
|
let Defs = !if(defExec, [EXEC], []);
|
2015-09-26 00:58:25 +08:00
|
|
|
let SchedRW = sched;
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2015-01-16 02:42:55 +08:00
|
|
|
// An instruction that is VOP2 on SI and VOP3 on VI, no modifiers.
|
|
|
|
multiclass VOP2SI_3VI_m <vop3 op, string opName, dag outs, dag ins,
|
|
|
|
string asm, list<dag> pattern = []> {
|
2015-02-19 00:08:17 +08:00
|
|
|
let isPseudo = 1, isCodeGenOnly = 1 in {
|
2015-01-16 02:42:55 +08:00
|
|
|
def "" : VOPAnyCommon <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _si : VOP2 <op.SI3{5-0}, outs, ins, asm, []>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-01-16 02:42:55 +08:00
|
|
|
|
|
|
|
def _vi : VOP3Common <outs, ins, asm, []>,
|
|
|
|
VOP3e_vi <op.VI3>,
|
|
|
|
VOP3DisableFields <1, 0, 0>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2015-01-16 02:42:55 +08:00
|
|
|
}
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP1_Helper <vop1 op, string opName, VOPProfile p, list<dag> pat32,
|
|
|
|
list<dag> pat64> {
|
2013-02-21 23:16:53 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e32 : VOP1_m <op, opName, p, pat32>;
|
2013-02-21 23:16:53 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e64 : VOP3_1_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
|
|
|
|
p.HasModifiers>;
|
2016-02-13 08:51:31 +08:00
|
|
|
|
|
|
|
def _dpp : VOP1_DPP <op, opName, p>;
|
2014-08-01 08:32:39 +08:00
|
|
|
}
|
2013-08-09 00:06:08 +08:00
|
|
|
|
2014-10-08 07:51:34 +08:00
|
|
|
multiclass VOP1Inst <vop1 op, string opName, VOPProfile P,
|
2014-08-01 08:32:39 +08:00
|
|
|
SDPatternOperator node = null_frag> : VOP1_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, P, [],
|
2014-08-01 08:32:39 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
|
2014-10-01 03:49:48 +08:00
|
|
|
i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0))])
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
2013-08-09 00:06:08 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
multiclass VOP1InstSI <vop1 op, string opName, VOPProfile P,
|
|
|
|
SDPatternOperator node = null_frag> {
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e32 : VOP1SI_m <op, opName, P, []>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-02-04 05:53:05 +08:00
|
|
|
defm _e64 : VOP3SI_1_m <op, P.Outs, P.Ins64, opName#P.Asm64,
|
2014-12-07 20:18:57 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0,
|
2014-12-07 20:18:57 +08:00
|
|
|
i32:$src0_modifiers, i1:$clamp, i32:$omod))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0))]),
|
2015-02-04 05:53:05 +08:00
|
|
|
opName, P.HasModifiers>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP2_Helper <vop2 op, string opName, VOPProfile p, list<dag> pat32,
|
|
|
|
list<dag> pat64, string revOp> {
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e32 : VOP2_m <op, opName, p, pat32, revOp>;
|
|
|
|
|
|
|
|
defm _e64 : VOP3_2_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
|
|
|
|
revOp, p.HasModifiers>;
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:38 +08:00
|
|
|
multiclass VOP2Inst <vop2 op, string opName, VOPProfile P,
|
2014-08-01 08:32:39 +08:00
|
|
|
SDPatternOperator node = null_frag,
|
2015-02-04 01:38:05 +08:00
|
|
|
string revOp = opName> : VOP2_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, P, [],
|
2014-08-01 08:32:39 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2014-08-01 08:32:39 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
2014-10-01 03:49:48 +08:00
|
|
|
i1:$clamp, i32:$omod)),
|
2014-08-01 08:32:39 +08:00
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
|
2015-11-07 04:56:18 +08:00
|
|
|
revOp
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
2012-12-12 05:25:42 +08:00
|
|
|
|
2015-02-04 01:38:12 +08:00
|
|
|
multiclass VOP2InstSI <vop2 op, string opName, VOPProfile P,
|
|
|
|
SDPatternOperator node = null_frag,
|
|
|
|
string revOp = opName> {
|
2015-11-07 04:56:18 +08:00
|
|
|
|
|
|
|
defm _e32 : VOP2SI_m <op, opName, P, [], revOp>;
|
2015-02-04 01:38:12 +08:00
|
|
|
|
2015-03-13 05:34:22 +08:00
|
|
|
defm _e64 : VOP3SI_2_m <op, P.Outs, P.Ins64, opName#P.Asm64,
|
2015-02-04 01:38:12 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2015-02-04 01:38:12 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod)),
|
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
|
2015-02-04 01:38:12 +08:00
|
|
|
opName, revOp, P.HasModifiers>;
|
|
|
|
}
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP2b_Helper <vop2 op, string opName, VOPProfile p,
|
|
|
|
list<dag> pat32, list<dag> pat64,
|
|
|
|
string revOp, bit useSGPRInput> {
|
|
|
|
|
2015-09-26 10:25:45 +08:00
|
|
|
let SchedRW = [Write32Bit, WriteSALU] in {
|
|
|
|
let Uses = !if(useSGPRInput, [VCC, EXEC], [EXEC]), Defs = [VCC] in {
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e32 : VOP2_m <op, opName, p, pat32, revOp>;
|
2015-09-26 10:25:45 +08:00
|
|
|
}
|
2013-02-27 01:52:09 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e64 : VOP3b_2_3_m <op, p.Outs64, p.Ins64, opName#p.Asm64, pat64,
|
|
|
|
opName, revOp, p.HasModifiers, useSGPRInput>;
|
2015-09-09 05:15:00 +08:00
|
|
|
}
|
2013-02-27 01:52:09 +08:00
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:41 +08:00
|
|
|
multiclass VOP2bInst <vop2 op, string opName, VOPProfile P,
|
2014-08-01 08:32:39 +08:00
|
|
|
SDPatternOperator node = null_frag,
|
|
|
|
string revOp = opName> : VOP2b_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, P, [],
|
2014-08-01 08:32:39 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2014-08-01 08:32:39 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
2014-10-01 03:49:48 +08:00
|
|
|
i1:$clamp, i32:$omod)),
|
2014-08-01 08:32:39 +08:00
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
|
2015-11-07 04:56:18 +08:00
|
|
|
revOp, !eq(P.NumSrcArgs, 3)
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
2013-02-21 23:16:44 +08:00
|
|
|
|
2015-01-16 02:43:06 +08:00
|
|
|
// A VOP2 instruction that is VOP3-only on VI.
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOP2_VI3_Helper <vop23 op, string opName, VOPProfile p,
|
|
|
|
list<dag> pat32, list<dag> pat64, string revOp> {
|
2015-01-16 02:43:06 +08:00
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
defm _e32 : VOP2SI_m <op, opName, p, pat32, revOp>;
|
|
|
|
|
|
|
|
defm _e64 : VOP3_2_m <op, p.Outs, p.Ins64, opName#p.Asm64, pat64, opName,
|
|
|
|
revOp, p.HasModifiers>;
|
2015-01-16 02:43:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
multiclass VOP2_VI3_Inst <vop23 op, string opName, VOPProfile P,
|
|
|
|
SDPatternOperator node = null_frag,
|
2015-02-04 01:38:05 +08:00
|
|
|
string revOp = opName>
|
2015-01-16 02:43:06 +08:00
|
|
|
: VOP2_VI3_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, P, [],
|
2015-01-16 02:43:06 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2015-01-16 02:43:06 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod)),
|
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))]),
|
2015-11-07 04:56:18 +08:00
|
|
|
revOp
|
2015-01-16 02:43:06 +08:00
|
|
|
>;
|
|
|
|
|
2015-02-22 05:29:00 +08:00
|
|
|
multiclass VOP2MADK <vop2 op, string opName, list<dag> pattern = []> {
|
|
|
|
|
|
|
|
def "" : VOP2_Pseudo <VOP_MADK.Outs, VOP_MADK.Ins, pattern, opName>;
|
|
|
|
|
|
|
|
let isCodeGenOnly = 0 in {
|
|
|
|
def _si : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
|
|
|
|
!strconcat(opName, VOP_MADK.Asm), []>,
|
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.SI>,
|
2015-05-26 23:55:52 +08:00
|
|
|
VOP2_MADKe <op.SI> {
|
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-05-26 23:55:52 +08:00
|
|
|
}
|
2015-02-22 05:29:00 +08:00
|
|
|
|
|
|
|
def _vi : VOP2Common <VOP_MADK.Outs, VOP_MADK.Ins,
|
|
|
|
!strconcat(opName, VOP_MADK.Asm), []>,
|
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.VI>,
|
2015-05-26 23:55:52 +08:00
|
|
|
VOP2_MADKe <op.VI> {
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-05-26 23:55:52 +08:00
|
|
|
}
|
2015-02-22 05:29:00 +08:00
|
|
|
} // End isCodeGenOnly = 0
|
|
|
|
}
|
|
|
|
|
2015-08-07 23:34:27 +08:00
|
|
|
class VOPC_Pseudo <dag ins, list<dag> pattern, string opName> :
|
2014-12-07 20:18:57 +08:00
|
|
|
VOPCCommon <ins, "", pattern>,
|
|
|
|
VOP <opName>,
|
2015-08-08 06:00:56 +08:00
|
|
|
SIMCInstr<opName#"_e32", SISubtarget.NONE> {
|
2014-12-07 20:18:57 +08:00
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2015-08-08 06:00:56 +08:00
|
|
|
multiclass VOPC_m <vopc op, dag ins, string op_asm, list<dag> pattern,
|
|
|
|
string opName, bit DefExec, VOPProfile p,
|
2015-09-26 00:58:25 +08:00
|
|
|
list<SchedReadWrite> sched,
|
2015-08-08 06:00:56 +08:00
|
|
|
string revOpName = "", string asm = opName#"_e32 "#op_asm,
|
|
|
|
string alias_asm = opName#" "#op_asm> {
|
2016-01-27 23:53:52 +08:00
|
|
|
def "" : VOPC_Pseudo <ins, pattern, opName>,
|
|
|
|
VOP2_REV<revOpName#"_e32", !eq(revOpName, opName)> {
|
2015-09-26 00:58:27 +08:00
|
|
|
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
2015-09-26 00:58:25 +08:00
|
|
|
let SchedRW = sched;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-08-08 06:00:56 +08:00
|
|
|
let AssemblerPredicates = [isSICI] in {
|
2015-09-26 00:58:25 +08:00
|
|
|
def _si : VOPC<op.SI, ins, asm, []>,
|
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.SI> {
|
|
|
|
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
|
|
|
let hasSideEffects = DefExec;
|
|
|
|
let SchedRW = sched;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-09-26 00:58:25 +08:00
|
|
|
}
|
2015-08-08 06:00:56 +08:00
|
|
|
|
|
|
|
} // End AssemblerPredicates = [isSICI]
|
|
|
|
|
|
|
|
let AssemblerPredicates = [isVI] in {
|
2015-09-26 00:58:25 +08:00
|
|
|
def _vi : VOPC<op.VI, ins, asm, []>,
|
|
|
|
SIMCInstr <opName#"_e32", SISubtarget.VI> {
|
|
|
|
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
|
|
|
let hasSideEffects = DefExec;
|
|
|
|
let SchedRW = sched;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-09-26 00:58:25 +08:00
|
|
|
}
|
2015-08-08 06:00:56 +08:00
|
|
|
|
|
|
|
} // End AssemblerPredicates = [isVI]
|
2015-10-06 01:57:39 +08:00
|
|
|
|
|
|
|
defm : SIInstAliasBuilder<alias_asm, p>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOPC_Helper <vopc op, string opName, list<dag> pat32,
|
|
|
|
list<dag> pat64, bit DefExec, string revOp,
|
|
|
|
VOPProfile p, list<SchedReadWrite> sched> {
|
2016-01-27 23:53:52 +08:00
|
|
|
defm _e32 : VOPC_m <op, p.Ins32, p.Asm32, pat32, opName, DefExec, p, sched,
|
|
|
|
revOp>;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
defm _e64 : VOP3_C_m <op, (outs VOPDstS64:$sdst), p.Ins64, opName#p.Asm64, pat64,
|
2015-11-07 04:56:18 +08:00
|
|
|
opName, p.HasModifiers, DefExec, revOp, sched>;
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2015-02-18 10:15:30 +08:00
|
|
|
// Special case for class instructions which only have modifiers on
|
|
|
|
// the 1st source operand.
|
2015-11-07 04:56:18 +08:00
|
|
|
multiclass VOPC_Class_Helper <vopc op, string opName, list<dag> pat32,
|
|
|
|
list<dag> pat64, bit DefExec, string revOp,
|
|
|
|
VOPProfile p, list<SchedReadWrite> sched> {
|
|
|
|
defm _e32 : VOPC_m <op, p.Ins32, p.Asm32, pat32, opName, DefExec, p, sched>;
|
|
|
|
|
2016-02-17 02:14:56 +08:00
|
|
|
defm _e64 : VOP3_C_m <op, (outs VOPDstS64:$sdst), p.Ins64, opName#p.Asm64, pat64,
|
2015-11-07 04:56:18 +08:00
|
|
|
opName, p.HasModifiers, DefExec, revOp, sched>,
|
2015-02-18 10:15:30 +08:00
|
|
|
VOP3DisableModFields<1, 0, 0>;
|
|
|
|
}
|
|
|
|
|
2014-10-08 07:51:39 +08:00
|
|
|
multiclass VOPCInst <vopc op, string opName,
|
2014-08-01 08:32:39 +08:00
|
|
|
VOPProfile P, PatLeaf cond = COND_NULL,
|
2015-03-24 02:45:30 +08:00
|
|
|
string revOp = opName,
|
2015-09-26 00:58:25 +08:00
|
|
|
bit DefExec = 0,
|
|
|
|
list<SchedReadWrite> sched = [Write32Bit]> :
|
|
|
|
VOPC_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, [],
|
2014-08-01 08:32:39 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set i1:$sdst,
|
2014-08-01 08:32:39 +08:00
|
|
|
(setcc (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
2014-10-01 03:49:48 +08:00
|
|
|
i1:$clamp, i32:$omod)),
|
2014-08-01 08:32:39 +08:00
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
|
|
|
|
cond))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set i1:$sdst, (setcc P.Src0VT:$src0, P.Src1VT:$src1, cond))]),
|
2015-11-07 04:56:18 +08:00
|
|
|
DefExec, revOp, P, sched
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
2013-02-21 23:16:44 +08:00
|
|
|
|
2015-01-07 07:00:37 +08:00
|
|
|
multiclass VOPCClassInst <vopc op, string opName, VOPProfile P,
|
2015-09-26 00:58:25 +08:00
|
|
|
bit DefExec = 0,
|
|
|
|
list<SchedReadWrite> sched> : VOPC_Class_Helper <
|
2015-11-07 04:56:18 +08:00
|
|
|
op, opName, [],
|
2015-01-07 07:00:37 +08:00
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set i1:$sdst,
|
2015-01-07 07:00:37 +08:00
|
|
|
(AMDGPUfp_class (P.Src0VT (VOP3Mods0Clamp0OMod P.Src0VT:$src0, i32:$src0_modifiers)), P.Src1VT:$src1))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set i1:$sdst, (AMDGPUfp_class P.Src0VT:$src0, P.Src1VT:$src1))]),
|
2015-11-07 04:56:18 +08:00
|
|
|
DefExec, opName, P, sched
|
2015-01-07 07:00:37 +08:00
|
|
|
>;
|
|
|
|
|
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPC_F32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
2015-08-08 08:41:48 +08:00
|
|
|
VOPCInst <op, opName, VOPC_I1_F32_F32, cond, revOp>;
|
2013-02-21 23:16:44 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPC_F64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCInst <op, opName, VOPC_I1_F64_F64, cond, revOp, 0, [WriteDoubleAdd]>;
|
2014-06-19 00:53:48 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPC_I32 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
2015-08-08 08:41:48 +08:00
|
|
|
VOPCInst <op, opName, VOPC_I1_I32_I32, cond, revOp>;
|
2014-06-19 00:53:48 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPC_I64 <vopc op, string opName, PatLeaf cond = COND_NULL, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCInst <op, opName, VOPC_I1_I64_I64, cond, revOp, 0, [Write64Bit]>;
|
2013-02-21 23:17:09 +08:00
|
|
|
|
2013-05-20 23:02:12 +08:00
|
|
|
|
2014-10-08 07:51:39 +08:00
|
|
|
multiclass VOPCX <vopc op, string opName, VOPProfile P,
|
2015-03-24 02:45:30 +08:00
|
|
|
PatLeaf cond = COND_NULL,
|
2015-09-26 00:58:25 +08:00
|
|
|
list<SchedReadWrite> sched,
|
2015-03-24 02:45:30 +08:00
|
|
|
string revOp = "">
|
2015-09-26 00:58:25 +08:00
|
|
|
: VOPCInst <op, opName, P, cond, revOp, 1, sched>;
|
2013-05-20 23:02:12 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPCX_F32 <vopc op, string opName, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCX <op, opName, VOPC_I1_F32_F32, COND_NULL, [Write32Bit], revOp>;
|
2013-02-21 23:17:09 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPCX_F64 <vopc op, string opName, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCX <op, opName, VOPC_I1_F64_F64, COND_NULL, [WriteDoubleAdd], revOp>;
|
2014-06-24 02:28:28 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPCX_I32 <vopc op, string opName, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCX <op, opName, VOPC_I1_I32_I32, COND_NULL, [Write32Bit], revOp>;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
multiclass VOPCX_I64 <vopc op, string opName, string revOp = opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCX <op, opName, VOPC_I1_I64_I64, COND_NULL, [Write64Bit], revOp>;
|
2014-08-01 08:32:39 +08:00
|
|
|
|
2014-10-08 07:51:41 +08:00
|
|
|
multiclass VOP3_Helper <vop3 op, string opName, dag outs, dag ins, string asm,
|
2016-02-11 11:28:15 +08:00
|
|
|
list<dag> pat, int NumSrcArgs, bit HasMods,
|
|
|
|
bit VOP3Only = 0> : VOP3_m <
|
|
|
|
op, outs, ins, opName#" "#asm, pat, opName, NumSrcArgs, HasMods, VOP3Only
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
|
|
|
|
2015-01-07 07:00:37 +08:00
|
|
|
multiclass VOPC_CLASS_F32 <vopc op, string opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCClassInst <op, opName, VOPC_I1_F32_I32, 0, [Write32Bit]>;
|
2015-01-07 07:00:37 +08:00
|
|
|
|
|
|
|
multiclass VOPCX_CLASS_F32 <vopc op, string opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCClassInst <op, opName, VOPC_I1_F32_I32, 1, [Write32Bit]>;
|
2015-01-07 07:00:37 +08:00
|
|
|
|
|
|
|
multiclass VOPC_CLASS_F64 <vopc op, string opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCClassInst <op, opName, VOPC_I1_F64_I32, 0, [WriteDoubleAdd]>;
|
2015-01-07 07:00:37 +08:00
|
|
|
|
|
|
|
multiclass VOPCX_CLASS_F64 <vopc op, string opName> :
|
2015-09-26 00:58:25 +08:00
|
|
|
VOPCClassInst <op, opName, VOPC_I1_F64_I32, 1, [WriteDoubleAdd]>;
|
2015-01-07 07:00:37 +08:00
|
|
|
|
2014-10-08 07:51:41 +08:00
|
|
|
multiclass VOP3Inst <vop3 op, string opName, VOPProfile P,
|
2016-02-11 11:28:15 +08:00
|
|
|
SDPatternOperator node = null_frag, bit VOP3Only = 0> :
|
|
|
|
VOP3_Helper <
|
2016-02-17 02:14:56 +08:00
|
|
|
op, opName, (outs P.DstRC.RegClass:$vdst), P.Ins64, P.Asm64,
|
2014-12-07 20:18:57 +08:00
|
|
|
!if(!eq(P.NumSrcArgs, 3),
|
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2014-12-07 20:18:57 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod)),
|
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
|
|
|
|
(P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1,
|
2014-12-07 20:18:57 +08:00
|
|
|
P.Src2VT:$src2))]),
|
|
|
|
!if(!eq(P.NumSrcArgs, 2),
|
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2014-12-07 20:18:57 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod)),
|
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0, P.Src1VT:$src1))])
|
2014-12-07 20:18:57 +08:00
|
|
|
/* P.NumSrcArgs == 1 */,
|
|
|
|
!if(P.HasModifiers,
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst,
|
2014-12-07 20:18:57 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod))))],
|
2016-02-17 02:14:56 +08:00
|
|
|
[(set P.DstVT:$vdst, (node P.Src0VT:$src0))]))),
|
2016-02-11 11:28:15 +08:00
|
|
|
P.NumSrcArgs, P.HasModifiers, VOP3Only
|
2014-12-07 20:18:57 +08:00
|
|
|
>;
|
|
|
|
|
2015-02-14 12:22:00 +08:00
|
|
|
// Special case for v_div_fmas_{f32|f64}, since it seems to be the
|
|
|
|
// only VOP instruction that implicitly reads VCC.
|
|
|
|
multiclass VOP3_VCC_Inst <vop3 op, string opName,
|
|
|
|
VOPProfile P,
|
|
|
|
SDPatternOperator node = null_frag> : VOP3_Helper <
|
|
|
|
op, opName,
|
2016-02-17 02:14:56 +08:00
|
|
|
(outs P.DstRC.RegClass:$vdst),
|
2015-02-14 12:22:00 +08:00
|
|
|
(ins InputModsNoDefault:$src0_modifiers, P.Src0RC64:$src0,
|
|
|
|
InputModsNoDefault:$src1_modifiers, P.Src1RC64:$src1,
|
|
|
|
InputModsNoDefault:$src2_modifiers, P.Src2RC64:$src2,
|
|
|
|
ClampMod:$clamp,
|
|
|
|
omod:$omod),
|
2016-02-17 02:14:56 +08:00
|
|
|
"$vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers"#"$clamp"#"$omod",
|
|
|
|
[(set P.DstVT:$vdst,
|
2015-02-14 12:22:00 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers,
|
|
|
|
i1:$clamp, i32:$omod)),
|
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
|
|
|
|
(P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers)),
|
|
|
|
(i1 VCC)))],
|
|
|
|
3, 1
|
|
|
|
>;
|
|
|
|
|
[AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm, SamWot, nhaustov, vpykhtin
Differential Revision: http://reviews.llvm.org/D16995
Patch By: Artem Tamazov
llvm-svn: 260560
2016-02-12 02:25:26 +08:00
|
|
|
multiclass VOP3bInst <vop op, string opName, VOPProfile P, list<dag> pattern = [], bit VOP3Only = 0> :
|
2015-09-09 05:15:00 +08:00
|
|
|
VOP3b_2_3_m <
|
2015-09-26 10:25:48 +08:00
|
|
|
op, P.Outs64, P.Ins64,
|
|
|
|
opName#" "#P.Asm64, pattern,
|
[AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".
Reviewers: tstellarAMD, arsenm
Subscribers: arsenm, SamWot, nhaustov, vpykhtin
Differential Revision: http://reviews.llvm.org/D16995
Patch By: Artem Tamazov
llvm-svn: 260560
2016-02-12 02:25:26 +08:00
|
|
|
opName, "", 1, 1, VOP3Only
|
2014-08-01 08:32:39 +08:00
|
|
|
>;
|
2014-06-24 02:28:28 +08:00
|
|
|
|
2014-08-30 00:01:14 +08:00
|
|
|
class Vop3ModPat<Instruction Inst, VOPProfile P, SDPatternOperator node> : Pat<
|
2014-10-01 03:49:48 +08:00
|
|
|
(node (P.Src0VT (VOP3Mods0 P.Src0VT:$src0, i32:$src0_modifiers, i1:$clamp, i32:$omod)),
|
2014-08-30 00:01:14 +08:00
|
|
|
(P.Src1VT (VOP3Mods P.Src1VT:$src1, i32:$src1_modifiers)),
|
|
|
|
(P.Src2VT (VOP3Mods P.Src2VT:$src2, i32:$src2_modifiers))),
|
|
|
|
(Inst i32:$src0_modifiers, P.Src0VT:$src0,
|
|
|
|
i32:$src1_modifiers, P.Src1VT:$src1,
|
|
|
|
i32:$src2_modifiers, P.Src2VT:$src2,
|
2014-10-01 03:49:48 +08:00
|
|
|
i1:$clamp,
|
2014-08-30 00:01:14 +08:00
|
|
|
i32:$omod)>;
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Interpolation opcodes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-01-28 01:25:11 +08:00
|
|
|
class VINTRP_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
VINTRPCommon <outs, ins, "", pattern>,
|
2014-12-07 20:18:57 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class VINTRP_Real_si <bits <2> op, string opName, dag outs, dag ins,
|
2015-01-28 01:25:11 +08:00
|
|
|
string asm> :
|
|
|
|
VINTRPCommon <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VINTRPe <op>,
|
2016-02-18 11:42:32 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let DecoderNamespace = "SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
class VINTRP_Real_vi <bits <2> op, string opName, dag outs, dag ins,
|
2015-01-28 01:25:11 +08:00
|
|
|
string asm> :
|
|
|
|
VINTRPCommon <outs, ins, asm, []>,
|
2014-12-07 20:18:57 +08:00
|
|
|
VINTRPe_vi <op>,
|
2016-02-18 11:42:32 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let DecoderNamespace = "VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-05-26 00:15:50 +08:00
|
|
|
multiclass VINTRP_m <bits <2> op, dag outs, dag ins, string asm,
|
2015-05-26 00:15:56 +08:00
|
|
|
list<dag> pattern = []> {
|
|
|
|
def "" : VINTRP_Pseudo <NAME, outs, ins, pattern>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-05-26 00:15:56 +08:00
|
|
|
def _si : VINTRP_Real_si <op, NAME, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-05-26 00:15:56 +08:00
|
|
|
def _vi : VINTRP_Real_vi <op, NAME, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
2013-02-21 23:16:44 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Vector I/O classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class DS_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
DS <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr <opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class DS_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
DS <outs, ins, asm, []>,
|
|
|
|
DSe <op>,
|
2015-04-08 09:09:26 +08:00
|
|
|
SIMCInstr <opName, SISubtarget.SI> {
|
|
|
|
let isCodeGenOnly = 0;
|
2016-02-23 03:17:53 +08:00
|
|
|
let AssemblerPredicates = [isSICI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-04-08 09:09:26 +08:00
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
class DS_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
DS <outs, ins, asm, []>,
|
|
|
|
DSe_vi <op>,
|
2016-02-18 11:42:32 +08:00
|
|
|
SIMCInstr <opName, SISubtarget.VI> {
|
2016-02-23 03:17:53 +08:00
|
|
|
let isCodeGenOnly = 0;
|
|
|
|
let AssemblerPredicates = [isVI];
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
class DS_Off16_Real_si <bits<8> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
DS_Real_si <op,opName, outs, ins, asm> {
|
2014-12-07 20:18:57 +08:00
|
|
|
|
|
|
|
// Single load interpret the 2 i8imm operands as a single i16 offset.
|
2014-03-20 06:19:39 +08:00
|
|
|
bits<16> offset;
|
2014-12-07 20:18:57 +08:00
|
|
|
let offset0 = offset{7-0};
|
|
|
|
let offset1 = offset{15-8};
|
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
class DS_Off16_Real_vi <bits<8> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
DS_Real_vi <op, opName, outs, ins, asm> {
|
2014-03-20 06:19:39 +08:00
|
|
|
|
2014-03-20 06:19:49 +08:00
|
|
|
// Single load interpret the 2 i8imm operands as a single i16 offset.
|
2014-12-07 20:18:57 +08:00
|
|
|
bits<16> offset;
|
2014-03-20 06:19:39 +08:00
|
|
|
let offset0 = offset{7-0};
|
|
|
|
let offset1 = offset{15-8};
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2014-11-19 07:57:33 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A_RET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
dag outs = (outs rc:$vdst),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst, $addr"#"$offset$gds"> {
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
let data0 = 0, data1 = 0 in {
|
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2014-03-20 06:19:39 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A_Off8_RET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
dag outs = (outs rc:$vdst),
|
2015-03-10 02:49:54 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, ds_offset0:$offset0, ds_offset1:$offset1,
|
2015-05-12 23:00:49 +08:00
|
|
|
gds01:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst, $addr"#"$offset0"#"$offset1$gds"> {
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
let data0 = 0, data1 = 0, AsmMatchConverter = "cvtDSOffset01" in {
|
2015-03-10 02:49:45 +08:00
|
|
|
def _si : DS_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2013-07-11 00:36:43 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A1D_NORET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
dag outs = (outs),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $addr, $data0"#"$offset$gds"> {
|
2014-03-20 06:19:56 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>,
|
|
|
|
AtomicNoRet<opName, 0>;
|
|
|
|
|
|
|
|
let data1 = 0, vdst = 0 in {
|
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
2014-12-07 20:18:57 +08:00
|
|
|
}
|
2013-07-11 00:36:43 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A1D_Off8_NORET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
dag outs = (outs),
|
2015-03-10 02:49:54 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
|
2015-05-12 23:00:49 +08:00
|
|
|
ds_offset0:$offset0, ds_offset1:$offset1, gds01:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $addr, $data0, $data1"#"$offset0"#"$offset1"#"$gds"> {
|
2015-03-10 02:49:45 +08:00
|
|
|
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
let vdst = 0, AsmMatchConverter = "cvtDSOffset01" in {
|
2015-03-10 02:49:45 +08:00
|
|
|
def _si : DS_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
|
2015-01-28 01:25:07 +08:00
|
|
|
}
|
2014-03-20 06:19:56 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A1D_RET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
string noRetOp = "",
|
|
|
|
dag outs = (outs rc:$vdst),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, rc:$data0, ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst, $addr, $data0"#"$offset$gds"> {
|
2015-03-10 02:49:45 +08:00
|
|
|
|
2015-09-26 13:06:48 +08:00
|
|
|
let hasPostISelHook = 1 in {
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>,
|
|
|
|
AtomicNoRet<noRetOp, 1>;
|
2015-03-10 02:49:45 +08:00
|
|
|
|
2015-09-26 13:06:48 +08:00
|
|
|
let data1 = 0 in {
|
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
}
|
2015-01-28 01:25:07 +08:00
|
|
|
}
|
2013-09-06 02:38:09 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A2D_RET_m <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
string noRetOp = "", dag ins,
|
|
|
|
dag outs = (outs rc:$vdst),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst, $addr, $data0, $data1"#"$offset"#"$gds"> {
|
2015-01-28 01:25:07 +08:00
|
|
|
|
2015-09-26 13:06:48 +08:00
|
|
|
let hasPostISelHook = 1 in {
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>,
|
|
|
|
AtomicNoRet<noRetOp, 1>;
|
2015-03-10 02:49:45 +08:00
|
|
|
|
2015-09-26 13:06:48 +08:00
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
}
|
2015-01-28 01:25:07 +08:00
|
|
|
}
|
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A2D_RET <bits<8> op, string asm, RegisterClass rc,
|
|
|
|
string noRetOp = "", RegisterClass src = rc> :
|
|
|
|
DS_1A2D_RET_m <op, asm, rc, noRetOp,
|
2015-03-10 02:49:54 +08:00
|
|
|
(ins VGPR_32:$addr, src:$data0, src:$data1,
|
2015-05-12 23:00:49 +08:00
|
|
|
ds_offset:$offset, gds:$gds)
|
2015-03-10 02:49:45 +08:00
|
|
|
>;
|
2014-06-12 02:08:39 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
multiclass DS_1A2D_NORET <bits<8> op, string opName, RegisterClass rc,
|
|
|
|
string noRetOp = opName,
|
|
|
|
dag outs = (outs),
|
2015-03-10 02:49:54 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, rc:$data0, rc:$data1,
|
2015-05-12 23:00:49 +08:00
|
|
|
ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $addr, $data0, $data1"#"$offset"#"$gds"> {
|
2015-01-28 01:25:07 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>,
|
|
|
|
AtomicNoRet<noRetOp, 0>;
|
|
|
|
|
|
|
|
let vdst = 0 in {
|
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
2015-01-28 01:25:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-10 00:03:45 +08:00
|
|
|
multiclass DS_0A_RET <bits<8> op, string opName,
|
|
|
|
dag outs = (outs VGPR_32:$vdst),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst"#"$offset"#"$gds"> {
|
2015-03-10 00:03:45 +08:00
|
|
|
|
|
|
|
let mayLoad = 1, mayStore = 1 in {
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
let addr = 0, data0 = 0, data1 = 0 in {
|
2015-03-10 02:49:45 +08:00
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
2015-03-10 00:03:45 +08:00
|
|
|
} // end addr = 0, data0 = 0, data1 = 0
|
|
|
|
} // end mayLoad = 1, mayStore = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass DS_1A_RET_GDS <bits<8> op, string opName,
|
|
|
|
dag outs = (outs VGPR_32:$vdst),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, ds_offset_gds:$offset),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $vdst, $addr"#"$offset gds"> {
|
2015-03-10 00:03:45 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
2015-03-10 00:03:45 +08:00
|
|
|
|
2015-03-10 02:49:45 +08:00
|
|
|
let data0 = 0, data1 = 0, gds = 1 in {
|
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
} // end data0 = 0, data1 = 0, gds = 1
|
2015-03-10 00:03:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
multiclass DS_1A_GDS <bits<8> op, string opName,
|
|
|
|
dag outs = (outs),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr),
|
2015-03-10 00:03:45 +08:00
|
|
|
string asm = opName#" $addr gds"> {
|
|
|
|
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
let vdst = 0, data0 = 0, data1 = 0, offset0 = 0, offset1 = 0, gds = 1 in {
|
|
|
|
def _si : DS_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
} // end vdst = 0, data = 0, data1 = 0, gds = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass DS_1A <bits<8> op, string opName,
|
|
|
|
dag outs = (outs),
|
2015-05-12 23:00:49 +08:00
|
|
|
dag ins = (ins VGPR_32:$addr, ds_offset:$offset, gds:$gds),
|
2015-03-10 02:49:54 +08:00
|
|
|
string asm = opName#" $addr"#"$offset"#"$gds"> {
|
2015-03-10 00:03:45 +08:00
|
|
|
|
|
|
|
let mayLoad = 1, mayStore = 1 in {
|
|
|
|
def "" : DS_Pseudo <opName, outs, ins, []>;
|
|
|
|
|
|
|
|
let vdst = 0, data0 = 0, data1 = 0 in {
|
2015-03-10 02:49:45 +08:00
|
|
|
def _si : DS_Off16_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
def _vi : DS_Off16_Real_vi <op, opName, outs, ins, asm>;
|
2015-03-10 00:03:45 +08:00
|
|
|
} // let vdst = 0, data0 = 0, data1 = 0
|
|
|
|
} // end mayLoad = 1, mayStore = 1
|
|
|
|
}
|
|
|
|
|
2014-10-01 22:44:43 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MTBUF classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
2014-08-12 06:18:17 +08:00
|
|
|
|
2014-10-01 22:44:43 +08:00
|
|
|
class MTBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
MTBUF <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2014-08-12 06:18:17 +08:00
|
|
|
}
|
|
|
|
|
2014-10-01 22:44:43 +08:00
|
|
|
class MTBUF_Real_si <bits<3> op, string opName, dag outs, dag ins,
|
|
|
|
string asm> :
|
|
|
|
MTBUF <outs, ins, asm, []>,
|
|
|
|
MTBUFe <op>,
|
2016-02-18 11:42:32 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let DecoderNamespace="SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
|
|
|
}
|
2014-10-01 22:44:43 +08:00
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
class MTBUF_Real_vi <bits<4> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
MTBUF <outs, ins, asm, []>,
|
|
|
|
MTBUFe_vi <op>,
|
2016-02-18 11:42:32 +08:00
|
|
|
SIMCInstr <opName, SISubtarget.VI> {
|
|
|
|
let DecoderNamespace="VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
|
|
|
}
|
2014-12-07 20:18:57 +08:00
|
|
|
|
2014-10-01 22:44:43 +08:00
|
|
|
multiclass MTBUF_m <bits<3> op, string opName, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern> {
|
|
|
|
|
|
|
|
def "" : MTBUF_Pseudo <opName, outs, ins, pattern>;
|
|
|
|
|
|
|
|
def _si : MTBUF_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
def _vi : MTBUF_Real_vi <{0, op{2}, op{1}, op{0}}, opName, outs, ins, asm>;
|
|
|
|
|
2014-10-01 22:44:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
let mayStore = 1, mayLoad = 0 in {
|
|
|
|
|
|
|
|
multiclass MTBUF_Store_Helper <bits<3> op, string opName,
|
|
|
|
RegisterClass regClass> : MTBUF_m <
|
|
|
|
op, opName, (outs),
|
2014-04-16 06:32:49 +08:00
|
|
|
(ins regClass:$vdata, u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc,
|
2015-01-08 04:59:25 +08:00
|
|
|
i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr,
|
2014-12-20 06:15:30 +08:00
|
|
|
SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
|
2014-10-01 22:44:43 +08:00
|
|
|
opName#" $vdata, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
|
|
|
|
#" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
|
|
|
|
>;
|
|
|
|
|
|
|
|
} // mayStore = 1, mayLoad = 0
|
|
|
|
|
|
|
|
let mayLoad = 1, mayStore = 0 in {
|
|
|
|
|
|
|
|
multiclass MTBUF_Load_Helper <bits<3> op, string opName,
|
|
|
|
RegisterClass regClass> : MTBUF_m <
|
|
|
|
op, opName, (outs regClass:$dst),
|
|
|
|
(ins u16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64,
|
2015-01-08 04:59:25 +08:00
|
|
|
i8imm:$dfmt, i8imm:$nfmt, VGPR_32:$vaddr, SReg_128:$srsrc,
|
2014-12-20 06:15:30 +08:00
|
|
|
i1imm:$slc, i1imm:$tfe, SCSrc_32:$soffset),
|
2014-10-01 22:44:43 +08:00
|
|
|
opName#" $dst, $offset, $offen, $idxen, $glc, $addr64, $dfmt,"
|
|
|
|
#" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []
|
|
|
|
>;
|
|
|
|
|
|
|
|
} // mayLoad = 1, mayStore = 0
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MUBUF classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
class mubuf <bits<7> si, bits<7> vi = si> {
|
|
|
|
field bits<7> SI = si;
|
|
|
|
field bits<7> VI = vi;
|
|
|
|
}
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
let isCodeGenOnly = 0 in {
|
|
|
|
|
|
|
|
class MUBUF_si <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
|
|
|
|
MUBUF <outs, ins, asm, pattern>, MUBUFe <op> {
|
|
|
|
let lds = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End let isCodeGenOnly = 0
|
|
|
|
|
|
|
|
class MUBUF_vi <bits<7> op, dag outs, dag ins, string asm, list<dag> pattern> :
|
|
|
|
MUBUF <outs, ins, asm, pattern>, MUBUFe_vi <op> {
|
|
|
|
let lds = 0;
|
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:54 +08:00
|
|
|
class MUBUFAddr64Table <bit is_addr64, string suffix = ""> {
|
|
|
|
bit IsAddr64 = is_addr64;
|
|
|
|
string OpName = NAME # suffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MUBUF_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
MUBUF <outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
2015-02-19 00:08:17 +08:00
|
|
|
let isCodeGenOnly = 1;
|
2015-01-28 01:24:54 +08:00
|
|
|
|
|
|
|
// dummy fields, so that we can use let statements around multiclasses
|
|
|
|
bits<1> offen;
|
|
|
|
bits<1> idxen;
|
|
|
|
bits<8> vaddr;
|
|
|
|
bits<1> glc;
|
|
|
|
bits<1> slc;
|
|
|
|
bits<1> tfe;
|
|
|
|
bits<8> soffset;
|
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
class MUBUF_Real_si <mubuf op, string opName, dag outs, dag ins,
|
2015-01-28 01:24:54 +08:00
|
|
|
string asm> :
|
|
|
|
MUBUF <outs, ins, asm, []>,
|
2015-01-28 01:24:58 +08:00
|
|
|
MUBUFe <op.SI>,
|
2015-01-28 01:24:54 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let lds = 0;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="SICI";
|
|
|
|
let DisableDecoder = DisableSIDecoder;
|
2015-01-28 01:24:54 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
class MUBUF_Real_vi <mubuf op, string opName, dag outs, dag ins,
|
2015-01-28 01:24:54 +08:00
|
|
|
string asm> :
|
|
|
|
MUBUF <outs, ins, asm, []>,
|
2015-01-28 01:24:58 +08:00
|
|
|
MUBUFe_vi <op.VI>,
|
2015-01-28 01:24:54 +08:00
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let lds = 0;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2015-01-28 01:24:54 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
multiclass MUBUF_m <mubuf op, string opName, dag outs, dag ins, string asm,
|
2015-01-28 01:24:54 +08:00
|
|
|
list<dag> pattern> {
|
|
|
|
|
|
|
|
def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
|
|
|
|
MUBUFAddr64Table <0>;
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
let addr64 = 0, isCodeGenOnly = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
}
|
2015-01-28 01:24:58 +08:00
|
|
|
|
|
|
|
def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
|
2015-01-28 01:24:54 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
multiclass MUBUFAddr64_m <mubuf op, string opName, dag outs,
|
2015-01-28 01:24:54 +08:00
|
|
|
dag ins, string asm, list<dag> pattern> {
|
|
|
|
|
|
|
|
def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
|
|
|
|
MUBUFAddr64Table <1>;
|
|
|
|
|
2015-04-08 09:09:26 +08:00
|
|
|
let addr64 = 1, isCodeGenOnly = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// There is no VI version. If the pseudo is selected, it should be lowered
|
|
|
|
// for VI appropriately.
|
|
|
|
}
|
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
multiclass MUBUFAtomicOffset_m <mubuf op, string opName, dag outs, dag ins,
|
|
|
|
string asm, list<dag> pattern, bit is_return> {
|
2014-09-26 02:30:26 +08:00
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
|
|
|
|
MUBUFAddr64Table <0, !if(is_return, "_RTN", "")>,
|
|
|
|
AtomicNoRet<NAME#"_OFFSET", is_return>;
|
|
|
|
|
|
|
|
let offen = 0, idxen = 0, tfe = 0, vaddr = 0 in {
|
|
|
|
let addr64 = 0 in {
|
|
|
|
def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : MUBUF_Real_vi <op, opName, outs, ins, asm>;
|
|
|
|
}
|
2014-09-26 02:30:26 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
multiclass MUBUFAtomicAddr64_m <mubuf op, string opName, dag outs, dag ins,
|
|
|
|
string asm, list<dag> pattern, bit is_return> {
|
|
|
|
|
|
|
|
def "" : MUBUF_Pseudo <opName, outs, ins, pattern>,
|
|
|
|
MUBUFAddr64Table <1, !if(is_return, "_RTN", "")>,
|
|
|
|
AtomicNoRet<NAME#"_ADDR64", is_return>;
|
|
|
|
|
2015-02-11 08:34:32 +08:00
|
|
|
let offen = 0, idxen = 0, addr64 = 1, tfe = 0 in {
|
2015-01-28 01:25:02 +08:00
|
|
|
def _si : MUBUF_Real_si <op, opName, outs, ins, asm>;
|
|
|
|
}
|
2014-09-26 02:30:26 +08:00
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
// There is no VI version. If the pseudo is selected, it should be lowered
|
|
|
|
// for VI appropriately.
|
2014-09-26 02:30:26 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
multiclass MUBUF_Atomic <mubuf op, string name, RegisterClass rc,
|
2014-09-26 02:30:26 +08:00
|
|
|
ValueType vt, SDPatternOperator atomic> {
|
|
|
|
|
|
|
|
let mayStore = 1, mayLoad = 1, hasPostISelHook = 1 in {
|
|
|
|
|
|
|
|
// No return variants
|
|
|
|
let glc = 0 in {
|
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
defm _ADDR64 : MUBUFAtomicAddr64_m <
|
|
|
|
op, name#"_addr64", (outs),
|
2015-11-05 10:46:53 +08:00
|
|
|
(ins rc:$vdata, VReg_64:$vaddr, SReg_128:$srsrc,
|
2015-02-27 22:59:44 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
|
2015-02-18 10:04:35 +08:00
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#"$slc", [], 0
|
2015-01-28 01:25:02 +08:00
|
|
|
>;
|
2014-09-26 02:30:26 +08:00
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
defm _OFFSET : MUBUFAtomicOffset_m <
|
|
|
|
op, name#"_offset", (outs),
|
2015-02-27 22:59:44 +08:00
|
|
|
(ins rc:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset, mbuf_offset:$offset,
|
|
|
|
slc:$slc),
|
2015-01-28 01:25:02 +08:00
|
|
|
name#" $vdata, $srsrc, $soffset"#"$offset"#"$slc", [], 0
|
|
|
|
>;
|
2014-09-26 02:30:26 +08:00
|
|
|
} // glc = 0
|
|
|
|
|
|
|
|
// Variant that return values
|
|
|
|
let glc = 1, Constraints = "$vdata = $vdata_in",
|
|
|
|
DisableEncoding = "$vdata_in" in {
|
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
defm _RTN_ADDR64 : MUBUFAtomicAddr64_m <
|
|
|
|
op, name#"_rtn_addr64", (outs rc:$vdata),
|
2015-11-05 10:46:53 +08:00
|
|
|
(ins rc:$vdata_in, VReg_64:$vaddr, SReg_128:$srsrc,
|
2015-02-27 22:59:44 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, slc:$slc),
|
2015-02-11 08:34:32 +08:00
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#" glc"#"$slc",
|
2014-09-26 02:30:26 +08:00
|
|
|
[(set vt:$vdata,
|
2015-02-11 08:34:32 +08:00
|
|
|
(atomic (MUBUFAddr64Atomic v4i32:$srsrc, i64:$vaddr, i32:$soffset,
|
|
|
|
i16:$offset, i1:$slc), vt:$vdata_in))], 1
|
2015-01-28 01:25:02 +08:00
|
|
|
>;
|
2014-09-26 02:30:26 +08:00
|
|
|
|
2015-01-28 01:25:02 +08:00
|
|
|
defm _RTN_OFFSET : MUBUFAtomicOffset_m <
|
|
|
|
op, name#"_rtn_offset", (outs rc:$vdata),
|
2015-02-27 22:59:44 +08:00
|
|
|
(ins rc:$vdata_in, SReg_128:$srsrc, SCSrc_32:$soffset,
|
|
|
|
mbuf_offset:$offset, slc:$slc),
|
2015-09-24 15:51:17 +08:00
|
|
|
name#" $vdata, $srsrc, $soffset"#"$offset"#" glc$slc",
|
2014-09-26 02:30:26 +08:00
|
|
|
[(set vt:$vdata,
|
|
|
|
(atomic (MUBUFOffsetAtomic v4i32:$srsrc, i32:$soffset, i16:$offset,
|
2015-01-28 01:25:02 +08:00
|
|
|
i1:$slc), vt:$vdata_in))], 1
|
|
|
|
>;
|
2014-09-26 02:30:26 +08:00
|
|
|
|
|
|
|
} // glc = 1
|
|
|
|
|
|
|
|
} // mayStore = 1, mayLoad = 1, hasPostISelHook = 1
|
|
|
|
}
|
|
|
|
|
2015-11-05 10:46:56 +08:00
|
|
|
// FIXME: tfe can't be an operand because it requires a separate
|
|
|
|
// opcode because it needs an N+1 register class dest register.
|
2015-01-28 01:24:58 +08:00
|
|
|
multiclass MUBUF_Load_Helper <mubuf op, string name, RegisterClass regClass,
|
2014-07-03 04:53:56 +08:00
|
|
|
ValueType load_vt = i32,
|
|
|
|
SDPatternOperator ld = null_frag> {
|
2013-05-20 23:02:31 +08:00
|
|
|
|
2014-12-09 08:03:54 +08:00
|
|
|
let mayLoad = 1, mayStore = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
let offen = 0, idxen = 0, vaddr = 0 in {
|
|
|
|
defm _OFFSET : MUBUF_m <op, name#"_offset", (outs regClass:$vdata),
|
2015-02-27 22:59:44 +08:00
|
|
|
(ins SReg_128:$srsrc, SCSrc_32:$soffset,
|
|
|
|
mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
|
2015-01-28 01:24:54 +08:00
|
|
|
name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
|
|
|
|
[(set load_vt:$vdata, (ld (MUBUFOffset v4i32:$srsrc,
|
|
|
|
i32:$soffset, i16:$offset,
|
|
|
|
i1:$glc, i1:$slc, i1:$tfe)))]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let offen = 1, idxen = 0 in {
|
|
|
|
defm _OFFEN : MUBUF_m <op, name#"_offen", (outs regClass:$vdata),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins VGPR_32:$vaddr, SReg_128:$srsrc,
|
2015-01-28 01:24:54 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc, slc:$slc,
|
|
|
|
tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
|
|
|
|
}
|
2014-01-27 15:20:51 +08:00
|
|
|
|
2015-01-28 01:24:54 +08:00
|
|
|
let offen = 0, idxen = 1 in {
|
|
|
|
defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs regClass:$vdata),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins VGPR_32:$vaddr, SReg_128:$srsrc,
|
2015-02-27 22:59:44 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
|
2015-01-28 01:24:54 +08:00
|
|
|
slc:$slc, tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let offen = 1, idxen = 1 in {
|
|
|
|
defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs regClass:$vdata),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
|
2015-02-27 22:59:44 +08:00
|
|
|
mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
|
2015-02-18 10:04:38 +08:00
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
|
2014-01-27 15:20:51 +08:00
|
|
|
}
|
2013-05-20 23:02:31 +08:00
|
|
|
|
2015-02-27 22:59:41 +08:00
|
|
|
let offen = 0, idxen = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs regClass:$vdata),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins VReg_64:$vaddr, SReg_128:$srsrc,
|
2015-02-27 22:59:41 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset,
|
|
|
|
glc:$glc, slc:$slc, tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset addr64"#"$offset"#
|
|
|
|
"$glc"#"$slc"#"$tfe",
|
2014-07-03 04:53:56 +08:00
|
|
|
[(set load_vt:$vdata, (ld (MUBUFAddr64 v4i32:$srsrc,
|
2015-02-11 08:34:32 +08:00
|
|
|
i64:$vaddr, i32:$soffset,
|
2015-02-27 22:59:41 +08:00
|
|
|
i16:$offset, i1:$glc, i1:$slc,
|
|
|
|
i1:$tfe)))]>;
|
2014-01-27 15:20:51 +08:00
|
|
|
}
|
2013-05-20 23:02:31 +08:00
|
|
|
}
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2015-01-28 01:24:58 +08:00
|
|
|
multiclass MUBUF_Store_Helper <mubuf op, string name, RegisterClass vdataClass,
|
2015-02-27 22:59:46 +08:00
|
|
|
ValueType store_vt = i32, SDPatternOperator st = null_frag> {
|
2015-01-14 23:42:31 +08:00
|
|
|
let mayLoad = 0, mayStore = 1 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
defm : MUBUF_m <op, name, (outs),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
|
2015-01-28 01:24:54 +08:00
|
|
|
mbuf_offset:$offset, offen:$offen, idxen:$idxen, glc:$glc, slc:$slc,
|
|
|
|
tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset"#"$offen"#"$idxen"#"$offset"#
|
2015-02-27 22:59:41 +08:00
|
|
|
"$glc"#"$slc"#"$tfe", []>;
|
2014-08-12 06:18:14 +08:00
|
|
|
|
2014-08-12 06:18:17 +08:00
|
|
|
let offen = 0, idxen = 0, vaddr = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
defm _OFFSET : MUBUF_m <op, name#"_offset",(outs),
|
2015-02-27 22:59:44 +08:00
|
|
|
(ins vdataClass:$vdata, SReg_128:$srsrc, SCSrc_32:$soffset,
|
|
|
|
mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
|
2015-01-28 01:24:54 +08:00
|
|
|
name#" $vdata, $srsrc, $soffset"#"$offset"#"$glc"#"$slc"#"$tfe",
|
|
|
|
[(st store_vt:$vdata, (MUBUFOffset v4i32:$srsrc, i32:$soffset,
|
|
|
|
i16:$offset, i1:$glc, i1:$slc, i1:$tfe))]>;
|
2014-08-12 06:18:17 +08:00
|
|
|
} // offen = 0, idxen = 0, vaddr = 0
|
|
|
|
|
2014-08-12 06:18:14 +08:00
|
|
|
let offen = 1, idxen = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
defm _OFFEN : MUBUF_m <op, name#"_offen", (outs),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
|
2015-02-27 22:59:44 +08:00
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
|
|
|
|
slc:$slc, tfe:$tfe),
|
2015-01-28 01:24:54 +08:00
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset offen"#"$offset"#
|
|
|
|
"$glc"#"$slc"#"$tfe", []>;
|
2014-08-12 06:18:14 +08:00
|
|
|
} // end offen = 1, idxen = 0
|
|
|
|
|
2015-03-11 00:16:51 +08:00
|
|
|
let offen = 0, idxen = 1 in {
|
|
|
|
defm _IDXEN : MUBUF_m <op, name#"_idxen", (outs),
|
|
|
|
(ins vdataClass:$vdata, VGPR_32:$vaddr, SReg_128:$srsrc,
|
|
|
|
SCSrc_32:$soffset, mbuf_offset:$offset, glc:$glc,
|
|
|
|
slc:$slc, tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset idxen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
|
|
|
|
}
|
|
|
|
|
|
|
|
let offen = 1, idxen = 1 in {
|
|
|
|
defm _BOTHEN : MUBUF_m <op, name#"_bothen", (outs),
|
|
|
|
(ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc, SCSrc_32:$soffset,
|
|
|
|
mbuf_offset:$offset, glc:$glc, slc:$slc, tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset idxen offen"#"$offset"#"$glc"#"$slc"#"$tfe", []>;
|
|
|
|
}
|
|
|
|
|
2015-02-27 22:59:41 +08:00
|
|
|
let offen = 0, idxen = 0 in {
|
2015-01-28 01:24:54 +08:00
|
|
|
defm _ADDR64 : MUBUFAddr64_m <op, name#"_addr64", (outs),
|
2015-03-11 00:16:49 +08:00
|
|
|
(ins vdataClass:$vdata, VReg_64:$vaddr, SReg_128:$srsrc,
|
|
|
|
SCSrc_32:$soffset,
|
2015-02-27 22:59:41 +08:00
|
|
|
mbuf_offset:$offset, glc:$glc, slc:$slc,
|
|
|
|
tfe:$tfe),
|
|
|
|
name#" $vdata, $vaddr, $srsrc, $soffset addr64"#
|
|
|
|
"$offset"#"$glc"#"$slc"#"$tfe",
|
2015-01-28 01:24:54 +08:00
|
|
|
[(st store_vt:$vdata,
|
2015-02-11 08:34:32 +08:00
|
|
|
(MUBUFAddr64 v4i32:$srsrc, i64:$vaddr,
|
2015-02-27 22:59:41 +08:00
|
|
|
i32:$soffset, i16:$offset,
|
|
|
|
i1:$glc, i1:$slc, i1:$tfe))]>;
|
2015-01-28 01:24:54 +08:00
|
|
|
}
|
|
|
|
} // End mayLoad = 0, mayStore = 1
|
2013-04-06 07:31:51 +08:00
|
|
|
}
|
|
|
|
|
2015-09-25 03:52:21 +08:00
|
|
|
// For cache invalidation instructions.
|
|
|
|
multiclass MUBUF_Invalidate <mubuf op, string opName, SDPatternOperator node> {
|
|
|
|
let hasSideEffects = 1, mayStore = 1, AsmMatchConverter = "" in {
|
|
|
|
def "" : MUBUF_Pseudo <opName, (outs), (ins), [(node)]>;
|
|
|
|
|
|
|
|
// Set everything to 0.
|
|
|
|
let offset = 0, offen = 0, idxen = 0, glc = 0, vaddr = 0,
|
|
|
|
vdata = 0, srsrc = 0, slc = 0, tfe = 0, soffset = 0 in {
|
|
|
|
let addr64 = 0 in {
|
|
|
|
def _si : MUBUF_Real_si <op, opName, (outs), (ins), opName>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def _vi : MUBUF_Real_vi <op, opName, (outs), (ins), opName>;
|
|
|
|
}
|
|
|
|
} // End hasSideEffects = 1, mayStore = 1, AsmMatchConverter = ""
|
|
|
|
}
|
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// FLAT classes
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class flat <bits<7> ci, bits<7> vi = ci> {
|
|
|
|
field bits<7> CI = ci;
|
|
|
|
field bits<7> VI = vi;
|
2014-09-15 23:41:53 +08:00
|
|
|
}
|
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
class FLAT_Pseudo <string opName, dag outs, dag ins, list<dag> pattern> :
|
|
|
|
FLAT <0, outs, ins, "", pattern>,
|
|
|
|
SIMCInstr<opName, SISubtarget.NONE> {
|
|
|
|
let isPseudo = 1;
|
|
|
|
let isCodeGenOnly = 1;
|
|
|
|
}
|
2014-09-15 23:41:53 +08:00
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
class FLAT_Real_ci <bits<7> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
FLAT <op, outs, ins, asm, []>,
|
|
|
|
SIMCInstr<opName, SISubtarget.SI> {
|
|
|
|
let AssemblerPredicate = isCIOnly;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="CI";
|
2015-12-24 11:18:18 +08:00
|
|
|
}
|
2014-09-15 23:41:53 +08:00
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
class FLAT_Real_vi <bits<7> op, string opName, dag outs, dag ins, string asm> :
|
|
|
|
FLAT <op, outs, ins, asm, []>,
|
|
|
|
SIMCInstr<opName, SISubtarget.VI> {
|
|
|
|
let AssemblerPredicate = VIAssemblerPredicate;
|
2016-02-18 11:42:32 +08:00
|
|
|
let DecoderNamespace="VI";
|
|
|
|
let DisableDecoder = DisableVIDecoder;
|
2014-09-15 23:41:53 +08:00
|
|
|
}
|
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
multiclass FLAT_AtomicRet_m <flat op, dag outs, dag ins, string asm,
|
|
|
|
list<dag> pattern> {
|
|
|
|
def "" : FLAT_Pseudo <NAME#"_RTN", outs, ins, pattern>,
|
|
|
|
AtomicNoRet <NAME, 1>;
|
2015-06-13 04:47:06 +08:00
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
def _ci : FLAT_Real_ci <op.CI, NAME#"_RTN", outs, ins, asm>;
|
2015-06-13 04:47:06 +08:00
|
|
|
|
2015-12-24 11:18:18 +08:00
|
|
|
def _vi : FLAT_Real_vi <op.VI, NAME#"_RTN", outs, ins, asm>;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass FLAT_Load_Helper <flat op, string asm_name,
|
|
|
|
RegisterClass regClass,
|
|
|
|
dag outs = (outs regClass:$vdst),
|
|
|
|
dag ins = (ins VReg_64:$addr, glc_flat:$glc, slc_flat:$slc, tfe_flat:$tfe),
|
|
|
|
string asm = asm_name#" $vdst, $addr"#"$glc"#"$slc"#"$tfe"> {
|
|
|
|
|
|
|
|
let data = 0, mayLoad = 1 in {
|
|
|
|
|
|
|
|
def "" : FLAT_Pseudo <NAME, outs, ins, []>;
|
|
|
|
|
|
|
|
def _ci : FLAT_Real_ci <op.CI, NAME, outs, ins, asm>;
|
|
|
|
|
|
|
|
def _vi : FLAT_Real_vi <op.VI, NAME, outs, ins, asm>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass FLAT_Store_Helper <flat op, string asm_name,
|
|
|
|
RegisterClass vdataClass,
|
|
|
|
dag outs = (outs),
|
2016-02-13 01:57:54 +08:00
|
|
|
dag ins = (ins VReg_64:$addr, vdataClass:$data, glc_flat:$glc,
|
2015-12-24 11:18:18 +08:00
|
|
|
slc_flat:$slc, tfe_flat:$tfe),
|
2016-02-13 01:57:54 +08:00
|
|
|
string asm = asm_name#" $addr, $data"#"$glc"#"$slc"#"$tfe"> {
|
2015-12-24 11:18:18 +08:00
|
|
|
|
|
|
|
let mayLoad = 0, mayStore = 1, vdst = 0 in {
|
|
|
|
|
|
|
|
def "" : FLAT_Pseudo <NAME, outs, ins, []>;
|
|
|
|
|
|
|
|
def _ci : FLAT_Real_ci <op.CI, NAME, outs, ins, asm>;
|
|
|
|
|
|
|
|
def _vi : FLAT_Real_vi <op.VI, NAME, outs, ins, asm>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass FLAT_ATOMIC <flat op, string asm_name, RegisterClass vdst_rc,
|
|
|
|
RegisterClass data_rc = vdst_rc,
|
|
|
|
dag outs_noret = (outs),
|
|
|
|
string asm_noret = asm_name#" $addr, $data"#"$slc"#"$tfe"> {
|
|
|
|
|
2016-02-25 16:35:27 +08:00
|
|
|
let mayLoad = 1, mayStore = 1, glc = 0, vdst = 0 in {
|
2015-12-24 11:18:18 +08:00
|
|
|
def "" : FLAT_Pseudo <NAME, outs_noret,
|
|
|
|
(ins VReg_64:$addr, data_rc:$data,
|
|
|
|
slc_flat_atomic:$slc, tfe_flat_atomic:$tfe), []>,
|
|
|
|
AtomicNoRet <NAME, 0>;
|
|
|
|
|
|
|
|
def _ci : FLAT_Real_ci <op.CI, NAME, outs_noret,
|
|
|
|
(ins VReg_64:$addr, data_rc:$data,
|
|
|
|
slc_flat_atomic:$slc, tfe_flat_atomic:$tfe),
|
|
|
|
asm_noret>;
|
|
|
|
|
|
|
|
def _vi : FLAT_Real_vi <op.VI, NAME, outs_noret,
|
|
|
|
(ins VReg_64:$addr, data_rc:$data,
|
|
|
|
slc_flat_atomic:$slc, tfe_flat_atomic:$tfe),
|
|
|
|
asm_noret>;
|
|
|
|
}
|
|
|
|
|
2016-02-25 16:35:27 +08:00
|
|
|
let glc = 1, hasPostISelHook = 1 in {
|
2015-12-24 11:18:18 +08:00
|
|
|
defm _RTN : FLAT_AtomicRet_m <op, (outs vdst_rc:$vdst),
|
|
|
|
(ins VReg_64:$addr, data_rc:$data, slc_flat_atomic:$slc,
|
|
|
|
tfe_flat_atomic:$tfe),
|
|
|
|
asm_name#" $vdst, $addr, $data glc"#"$slc"#"$tfe", []>;
|
2015-06-13 04:47:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-11 01:11:24 +08:00
|
|
|
class MIMG_Mask <string op, int channels> {
|
|
|
|
string Op = op;
|
|
|
|
int Channels = channels;
|
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
class MIMG_Helper <bits<7> op, dag outs, dag ins, string asm,
|
|
|
|
string dns=""> : MIMG<op, outs, ins, asm,[]> {
|
|
|
|
let mayLoad = 1;
|
|
|
|
let mayStore = 0;
|
|
|
|
let hasPostISelHook = 1;
|
|
|
|
let DecoderNamespace = dns;
|
|
|
|
let isAsmParserOnly = !if(!eq(dns,""), 1, 0);
|
|
|
|
}
|
|
|
|
|
2013-08-15 07:24:17 +08:00
|
|
|
class MIMG_NoSampler_Helper <bits<7> op, string asm,
|
2013-10-11 01:11:24 +08:00
|
|
|
RegisterClass dst_rc,
|
2016-02-19 00:44:18 +08:00
|
|
|
RegisterClass addr_rc,
|
2016-02-18 11:42:32 +08:00
|
|
|
string dns=""> : MIMG_Helper <
|
2013-05-07 07:02:12 +08:00
|
|
|
op,
|
2013-10-11 01:11:24 +08:00
|
|
|
(outs dst_rc:$vdata),
|
2013-05-07 07:02:12 +08:00
|
|
|
(ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
|
2016-02-19 00:44:18 +08:00
|
|
|
i1imm:$tfe, i1imm:$lwe, i1imm:$slc, addr_rc:$vaddr,
|
2013-05-07 07:02:12 +08:00
|
|
|
SReg_256:$srsrc),
|
|
|
|
asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
|
|
|
|
#" $tfe, $lwe, $slc, $vaddr, $srsrc",
|
2016-02-18 11:42:32 +08:00
|
|
|
dns> {
|
2015-02-18 10:15:35 +08:00
|
|
|
let ssamp = 0;
|
2013-05-07 07:02:12 +08:00
|
|
|
}
|
|
|
|
|
2013-10-11 01:11:24 +08:00
|
|
|
multiclass MIMG_NoSampler_Src_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass dst_rc,
|
|
|
|
int channels> {
|
2016-02-18 11:42:32 +08:00
|
|
|
def _V1 : MIMG_NoSampler_Helper <op, asm, dst_rc, VGPR_32,
|
|
|
|
!if(!eq(channels, 1), "AMDGPU", "")>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V1", channels>;
|
|
|
|
def _V2 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_64>,
|
|
|
|
MIMG_Mask<asm#"_V2", channels>;
|
|
|
|
def _V4 : MIMG_NoSampler_Helper <op, asm, dst_rc, VReg_128>,
|
|
|
|
MIMG_Mask<asm#"_V4", channels>;
|
|
|
|
}
|
|
|
|
|
2013-08-15 07:24:17 +08:00
|
|
|
multiclass MIMG_NoSampler <bits<7> op, string asm> {
|
2015-01-08 04:59:25 +08:00
|
|
|
defm _V1 : MIMG_NoSampler_Src_Helper <op, asm, VGPR_32, 1>;
|
2013-10-11 01:11:24 +08:00
|
|
|
defm _V2 : MIMG_NoSampler_Src_Helper <op, asm, VReg_64, 2>;
|
|
|
|
defm _V3 : MIMG_NoSampler_Src_Helper <op, asm, VReg_96, 3>;
|
|
|
|
defm _V4 : MIMG_NoSampler_Src_Helper <op, asm, VReg_128, 4>;
|
2013-08-15 07:24:17 +08:00
|
|
|
}
|
|
|
|
|
2016-02-19 00:44:18 +08:00
|
|
|
class MIMG_Store_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass data_rc,
|
|
|
|
RegisterClass addr_rc> : MIMG_Helper <
|
|
|
|
op,
|
|
|
|
(outs),
|
|
|
|
(ins data_rc:$vdata, i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
|
|
|
|
i1imm:$tfe, i1imm:$lwe, i1imm:$slc, addr_rc:$vaddr,
|
|
|
|
SReg_256:$srsrc),
|
|
|
|
asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
|
|
|
|
#" $tfe, $lwe, $slc, $vaddr, $srsrc"> {
|
|
|
|
let ssamp = 0;
|
|
|
|
let mayLoad = 1; // TableGen requires this for matching with the intrinsics
|
|
|
|
let mayStore = 1;
|
|
|
|
let hasSideEffects = 1;
|
|
|
|
let hasPostISelHook = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MIMG_Store_Addr_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass data_rc,
|
|
|
|
int channels> {
|
|
|
|
def _V1 : MIMG_Store_Helper <op, asm, data_rc, VGPR_32>,
|
|
|
|
MIMG_Mask<asm#"_V1", channels>;
|
|
|
|
def _V2 : MIMG_Store_Helper <op, asm, data_rc, VReg_64>,
|
|
|
|
MIMG_Mask<asm#"_V2", channels>;
|
|
|
|
def _V4 : MIMG_Store_Helper <op, asm, data_rc, VReg_128>,
|
|
|
|
MIMG_Mask<asm#"_V4", channels>;
|
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MIMG_Store <bits<7> op, string asm> {
|
|
|
|
defm _V1 : MIMG_Store_Addr_Helper <op, asm, VGPR_32, 1>;
|
|
|
|
defm _V2 : MIMG_Store_Addr_Helper <op, asm, VReg_64, 2>;
|
|
|
|
defm _V3 : MIMG_Store_Addr_Helper <op, asm, VReg_96, 3>;
|
|
|
|
defm _V4 : MIMG_Store_Addr_Helper <op, asm, VReg_128, 4>;
|
|
|
|
}
|
|
|
|
|
2013-08-15 07:24:17 +08:00
|
|
|
class MIMG_Sampler_Helper <bits<7> op, string asm,
|
2013-10-11 01:11:24 +08:00
|
|
|
RegisterClass dst_rc,
|
2016-02-18 11:42:32 +08:00
|
|
|
RegisterClass src_rc,
|
|
|
|
int wqm,
|
|
|
|
string dns=""> : MIMG_Helper <
|
2013-02-21 23:16:44 +08:00
|
|
|
op,
|
2013-10-11 01:11:24 +08:00
|
|
|
(outs dst_rc:$vdata),
|
2013-02-21 23:16:44 +08:00
|
|
|
(ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
|
2013-08-15 07:24:17 +08:00
|
|
|
i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
|
2013-03-01 17:46:17 +08:00
|
|
|
SReg_256:$srsrc, SReg_128:$ssamp),
|
2013-02-21 23:17:17 +08:00
|
|
|
asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
|
|
|
|
#" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
|
2016-02-18 11:42:32 +08:00
|
|
|
dns> {
|
2015-02-06 10:51:20 +08:00
|
|
|
let WQM = wqm;
|
2012-12-12 05:25:42 +08:00
|
|
|
}
|
|
|
|
|
2013-10-11 01:11:24 +08:00
|
|
|
multiclass MIMG_Sampler_Src_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass dst_rc,
|
2015-02-06 10:51:20 +08:00
|
|
|
int channels, int wqm> {
|
2016-02-18 11:42:32 +08:00
|
|
|
def _V1 : MIMG_Sampler_Helper <op, asm, dst_rc, VGPR_32, wqm,
|
|
|
|
!if(!eq(channels, 1), "AMDGPU", "")>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V1", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V2 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_64, wqm>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V2", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V4 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_128, wqm>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V4", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V8 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_256, wqm>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V8", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V16 : MIMG_Sampler_Helper <op, asm, dst_rc, VReg_512, wqm>,
|
2013-10-11 01:11:24 +08:00
|
|
|
MIMG_Mask<asm#"_V16", channels>;
|
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
multiclass MIMG_Sampler <bits<7> op, string asm, int wqm=0> {
|
|
|
|
defm _V1 : MIMG_Sampler_Src_Helper<op, asm, VGPR_32, 1, wqm>;
|
|
|
|
defm _V2 : MIMG_Sampler_Src_Helper<op, asm, VReg_64, 2, wqm>;
|
|
|
|
defm _V3 : MIMG_Sampler_Src_Helper<op, asm, VReg_96, 3, wqm>;
|
|
|
|
defm _V4 : MIMG_Sampler_Src_Helper<op, asm, VReg_128, 4, wqm>;
|
2015-02-06 10:51:20 +08:00
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
multiclass MIMG_Sampler_WQM <bits<7> op, string asm> : MIMG_Sampler<op, asm, 1>;
|
2013-08-15 07:24:17 +08:00
|
|
|
|
2014-06-19 06:00:29 +08:00
|
|
|
class MIMG_Gather_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass dst_rc,
|
2015-02-06 10:51:20 +08:00
|
|
|
RegisterClass src_rc, int wqm> : MIMG <
|
2014-06-19 06:00:29 +08:00
|
|
|
op,
|
|
|
|
(outs dst_rc:$vdata),
|
|
|
|
(ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128,
|
|
|
|
i1imm:$tfe, i1imm:$lwe, i1imm:$slc, src_rc:$vaddr,
|
|
|
|
SReg_256:$srsrc, SReg_128:$ssamp),
|
|
|
|
asm#" $vdata, $dmask, $unorm, $glc, $da, $r128,"
|
|
|
|
#" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp",
|
|
|
|
[]> {
|
|
|
|
let mayLoad = 1;
|
|
|
|
let mayStore = 0;
|
|
|
|
|
|
|
|
// DMASK was repurposed for GATHER4. 4 components are always
|
|
|
|
// returned and DMASK works like a swizzle - it selects
|
|
|
|
// the component to fetch. The only useful DMASK values are
|
|
|
|
// 1=red, 2=green, 4=blue, 8=alpha. (e.g. 1 returns
|
|
|
|
// (red,red,red,red) etc.) The ISA document doesn't mention
|
|
|
|
// this.
|
|
|
|
// Therefore, disable all code which updates DMASK by setting these two:
|
|
|
|
let MIMG = 0;
|
|
|
|
let hasPostISelHook = 0;
|
2015-02-06 10:51:20 +08:00
|
|
|
let WQM = wqm;
|
2016-02-18 11:42:32 +08:00
|
|
|
|
|
|
|
let isAsmParserOnly = 1; // TBD: fix it later
|
2014-06-19 06:00:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
multiclass MIMG_Gather_Src_Helper <bits<7> op, string asm,
|
|
|
|
RegisterClass dst_rc,
|
2015-02-06 10:51:20 +08:00
|
|
|
int channels, int wqm> {
|
|
|
|
def _V1 : MIMG_Gather_Helper <op, asm, dst_rc, VGPR_32, wqm>,
|
2014-06-19 06:00:29 +08:00
|
|
|
MIMG_Mask<asm#"_V1", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V2 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_64, wqm>,
|
2014-06-19 06:00:29 +08:00
|
|
|
MIMG_Mask<asm#"_V2", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V4 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_128, wqm>,
|
2014-06-19 06:00:29 +08:00
|
|
|
MIMG_Mask<asm#"_V4", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V8 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_256, wqm>,
|
2014-06-19 06:00:29 +08:00
|
|
|
MIMG_Mask<asm#"_V8", channels>;
|
2015-02-06 10:51:20 +08:00
|
|
|
def _V16 : MIMG_Gather_Helper <op, asm, dst_rc, VReg_512, wqm>,
|
2014-06-19 06:00:29 +08:00
|
|
|
MIMG_Mask<asm#"_V16", channels>;
|
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
multiclass MIMG_Gather <bits<7> op, string asm, int wqm=0> {
|
|
|
|
defm _V1 : MIMG_Gather_Src_Helper<op, asm, VGPR_32, 1, wqm>;
|
|
|
|
defm _V2 : MIMG_Gather_Src_Helper<op, asm, VReg_64, 2, wqm>;
|
|
|
|
defm _V3 : MIMG_Gather_Src_Helper<op, asm, VReg_96, 3, wqm>;
|
|
|
|
defm _V4 : MIMG_Gather_Src_Helper<op, asm, VReg_128, 4, wqm>;
|
2015-02-06 10:51:20 +08:00
|
|
|
}
|
|
|
|
|
2016-02-18 11:42:32 +08:00
|
|
|
multiclass MIMG_Gather_WQM <bits<7> op, string asm> : MIMG_Gather<op, asm, 1>;
|
2014-06-19 06:00:29 +08:00
|
|
|
|
2013-02-27 01:52:42 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Vector instruction mappings
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// Maps an opcode in e32 form to its e64 equivalent
|
|
|
|
def getVOPe64 : InstrMapping {
|
|
|
|
let FilterClass = "VOP";
|
|
|
|
let RowFields = ["OpName"];
|
|
|
|
let ColFields = ["Size"];
|
|
|
|
let KeyCol = ["4"];
|
|
|
|
let ValueCols = [["8"]];
|
|
|
|
}
|
|
|
|
|
2014-07-22 00:55:33 +08:00
|
|
|
// Maps an opcode in e64 form to its e32 equivalent
|
|
|
|
def getVOPe32 : InstrMapping {
|
|
|
|
let FilterClass = "VOP";
|
|
|
|
let RowFields = ["OpName"];
|
|
|
|
let ColFields = ["Size"];
|
|
|
|
let KeyCol = ["8"];
|
|
|
|
let ValueCols = [["4"]];
|
|
|
|
}
|
|
|
|
|
2013-10-11 01:11:24 +08:00
|
|
|
def getMaskedMIMGOp : InstrMapping {
|
|
|
|
let FilterClass = "MIMG_Mask";
|
|
|
|
let RowFields = ["Op"];
|
|
|
|
let ColFields = ["Channels"];
|
|
|
|
let KeyCol = ["4"];
|
|
|
|
let ValueCols = [["1"], ["2"], ["3"] ];
|
|
|
|
}
|
|
|
|
|
2013-03-27 17:12:59 +08:00
|
|
|
// Maps an commuted opcode to its original version
|
|
|
|
def getCommuteOrig : InstrMapping {
|
|
|
|
let FilterClass = "VOP2_REV";
|
|
|
|
let RowFields = ["RevOp"];
|
|
|
|
let ColFields = ["IsOrig"];
|
|
|
|
let KeyCol = ["0"];
|
|
|
|
let ValueCols = [["1"]];
|
|
|
|
}
|
|
|
|
|
2015-03-24 02:45:30 +08:00
|
|
|
// Maps an original opcode to its commuted version
|
|
|
|
def getCommuteRev : InstrMapping {
|
|
|
|
let FilterClass = "VOP2_REV";
|
|
|
|
let RowFields = ["RevOp"];
|
|
|
|
let ColFields = ["IsOrig"];
|
|
|
|
let KeyCol = ["1"];
|
|
|
|
let ValueCols = [["0"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def getCommuteCmpOrig : InstrMapping {
|
2015-03-24 02:45:41 +08:00
|
|
|
let FilterClass = "VOP2_REV";
|
2015-03-24 02:45:30 +08:00
|
|
|
let RowFields = ["RevOp"];
|
|
|
|
let ColFields = ["IsOrig"];
|
|
|
|
let KeyCol = ["0"];
|
|
|
|
let ValueCols = [["1"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Maps an original opcode to its commuted version
|
|
|
|
def getCommuteCmpRev : InstrMapping {
|
2015-03-24 02:45:41 +08:00
|
|
|
let FilterClass = "VOP2_REV";
|
2015-03-24 02:45:30 +08:00
|
|
|
let RowFields = ["RevOp"];
|
|
|
|
let ColFields = ["IsOrig"];
|
|
|
|
let KeyCol = ["1"];
|
|
|
|
let ValueCols = [["0"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-07 20:18:57 +08:00
|
|
|
def getMCOpcodeGen : InstrMapping {
|
2014-05-17 04:56:47 +08:00
|
|
|
let FilterClass = "SIMCInstr";
|
|
|
|
let RowFields = ["PseudoInstr"];
|
|
|
|
let ColFields = ["Subtarget"];
|
|
|
|
let KeyCol = [!cast<string>(SISubtarget.NONE)];
|
2014-12-07 20:18:57 +08:00
|
|
|
let ValueCols = [[!cast<string>(SISubtarget.SI)],[!cast<string>(SISubtarget.VI)]];
|
2014-05-17 04:56:47 +08:00
|
|
|
}
|
|
|
|
|
2014-08-12 06:18:17 +08:00
|
|
|
def getAddr64Inst : InstrMapping {
|
|
|
|
let FilterClass = "MUBUFAddr64Table";
|
2014-09-26 02:30:26 +08:00
|
|
|
let RowFields = ["OpName"];
|
2014-08-12 06:18:17 +08:00
|
|
|
let ColFields = ["IsAddr64"];
|
|
|
|
let KeyCol = ["0"];
|
|
|
|
let ValueCols = [["1"]];
|
|
|
|
}
|
|
|
|
|
2014-09-08 23:07:27 +08:00
|
|
|
// Maps an atomic opcode to its version with a return value.
|
|
|
|
def getAtomicRetOp : InstrMapping {
|
|
|
|
let FilterClass = "AtomicNoRet";
|
|
|
|
let RowFields = ["NoRetOp"];
|
|
|
|
let ColFields = ["IsRet"];
|
|
|
|
let KeyCol = ["0"];
|
|
|
|
let ValueCols = [["1"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Maps an atomic opcode to its returnless version.
|
|
|
|
def getAtomicNoRetOp : InstrMapping {
|
|
|
|
let FilterClass = "AtomicNoRet";
|
|
|
|
let RowFields = ["NoRetOp"];
|
|
|
|
let ColFields = ["IsRet"];
|
|
|
|
let KeyCol = ["1"];
|
|
|
|
let ValueCols = [["0"]];
|
|
|
|
}
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
include "SIInstructions.td"
|
2014-12-07 20:18:57 +08:00
|
|
|
include "CIInstructions.td"
|
|
|
|
include "VIInstructions.td"
|