return target.opSize();
}
- int getRegisterIndex(int operandIndex) override {
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
+ {
assert(operandIndex >= 0 && operandIndex < getNumOperands());
return target.regIndex();
}
else
return 1;
}
- int getRegisterIndex(int operandIndex) override {
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
+ {
assert(operandIndex >= 0 && operandIndex < getNumOperands());
if (!operandIndex)
return target.regIndex();
assert(operandIndex >= 0 && operandIndex < getNumOperands());
return target.opSize();
}
- int getRegisterIndex(int operandIndex) override {
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
+ {
assert(operandIndex >= 0 && operandIndex < getNumOperands());
return target.regIndex();
}
else
return dest.opSize();
}
- int getRegisterIndex(int operandIndex) {
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
assert(operandIndex >= 0 && operandIndex < getNumOperands());
if (operandIndex < NumSrcOperands)
else
return dest.opSize();
}
- int getRegisterIndex(int operandIndex) {
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
if (!operandIndex)
return src0.regIndex();
else
return dest.opSize();
}
- int getRegisterIndex(int operandIndex) {
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
if (!operandIndex)
return src0.regIndex();
return -1;
//handle positive and negative numbers
- T tmp = (src0 < 0) ? (~src0) : (src0);
+ T tmp = ((int64_t)src0 < 0) ? (~src0) : (src0);
//the starting pos is MSB
int pos = 8 * sizeof(T) - 1;
bool isSrcOperand(int operandIndex) { return false; }
bool isDstOperand(int operandIndex) { return false; }
int getOperandSize(int operandIndex) { return 0; }
- int getRegisterIndex(int operandIndex) { return -1; }
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
+ return -1;
+ }
int numSrcRegOperands() { return 0; }
int numDstRegOperands() { return 0; }
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return dest.opSize();
}
- int getRegisterIndex(int operandIndex) {
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return dest.regIndex();
}
+
int numSrcRegOperands() { return 0; }
int numDstRegOperands() { return dest.isVectorRegister(); }
int getNumOperands() { return 1; }
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return dest.opSize();
}
- int getRegisterIndex(int operandIndex) {
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return dest.regIndex();
}
+
int numSrcRegOperands() { return 0; }
int numDstRegOperands() { return dest.isVectorRegister(); }
int getNumOperands() { return 1; }
bool isScalarRegister(int operandIndex) { return false; }
bool isSrcOperand(int operandIndex) { return false; }
bool isDstOperand(int operandIndex) { return false; }
- int getOperandSize(int operandIndex) { return 0; }
- int getRegisterIndex(int operandIndex) { return -1; }
+ int getOperandSize(int operandIndex) { return 0; }
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
+ {
+ return -1;
+ }
void
execute(GPUDynInstPtr gpuDynInst)
return((operandIndex == 0) ? dest.opSize() :
this->addr.opSize());
}
- int getRegisterIndex(int operandIndex) override
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
{
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return((operandIndex == 0) ? dest.regIndex() :
return((operandIndex == 0) ? dest.opSize() :
this->addr.opSize());
}
- int getRegisterIndex(int operandIndex) override
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
{
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
return((operandIndex == 0) ? dest.regIndex() :
AddrOperandType>::dest.opSize());
return 0;
}
- int getRegisterIndex(int operandIndex) override
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
{
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
if ((num_dest_operands != getNumOperands()) &&
assert(operandIndex >= 0 && operandIndex < getNumOperands());
return !operandIndex ? src.opSize() : this->addr.opSize();
}
- int getRegisterIndex(int operandIndex) override
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
{
assert(operandIndex >= 0 && operandIndex < getNumOperands());
return !operandIndex ? src.regIndex() : this->addr.regIndex();
AddrOperandType>::src.opSize();
return 0;
}
- int getRegisterIndex(int operandIndex) override
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
{
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
if (operandIndex == num_src_operands)
else
return(dest.opSize());
}
- int getRegisterIndex(int operandIndex)
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst)
{
assert((operandIndex >= 0) && (operandIndex < getNumOperands()));
if (operandIndex < NumSrcOperands)
}
void
-ConditionRegisterState::exec(GPUStaticInst *ii, Wavefront *w)
+ConditionRegisterState::exec(GPUDynInstPtr ii, Wavefront *w)
{
// iterate over all operands
for (auto i = 0; i < ii->getNumOperands(); ++i) {
// is this a condition register destination operand?
if (ii->isCondRegister(i) && ii->isDstOperand(i)) {
// mark the register as busy
- markReg(ii->getRegisterIndex(i), 1);
+ markReg(ii->getRegisterIndex(i, ii), 1);
uint32_t pipeLen = w->computeUnit->spBypassLength();
// schedule an event for marking the register as ready
w->computeUnit->
- registerEvent(w->simdId, ii->getRegisterIndex(i),
+ registerEvent(w->simdId, ii->getRegisterIndex(i, ii),
ii->getOperandSize(i),
w->computeUnit->shader->tick_cnt +
w->computeUnit->shader->ticks(pipeLen), 0);
}
int numRegs() { return c_reg.size(); }
- void exec(GPUStaticInst *ii, Wavefront *w);
+ void exec(GPUDynInstPtr ii, Wavefront *w);
private:
ComputeUnit* computeUnit;
return _staticInst->isScalarRegister(operandIdx);
}
+bool
+GPUDynInst::isCondRegister(int operandIdx)
+{
+ return _staticInst->isCondRegister(operandIdx);
+}
+
int
-GPUDynInst::getRegisterIndex(int operandIdx)
+GPUDynInst::getRegisterIndex(int operandIdx, GPUDynInstPtr gpuDynInst)
{
- return _staticInst->getRegisterIndex(operandIdx);
+ return _staticInst->getRegisterIndex(operandIdx, gpuDynInst);
}
int
int getNumOperands();
bool isVectorRegister(int operandIdx);
bool isScalarRegister(int operandIdx);
- int getRegisterIndex(int operandIdx);
+ bool isCondRegister(int operandIdx);
+ int getRegisterIndex(int operandIdx, GPUDynInstPtr gpuDynInst);
int getOperandSize(int operandIdx);
bool isDstOperand(int operandIdx);
bool isSrcOperand(int operandIdx);
virtual bool isSrcOperand(int operandIndex) = 0;
virtual bool isDstOperand(int operandIndex) = 0;
virtual int getOperandSize(int operandIndex) = 0;
- virtual int getRegisterIndex(int operandIndex) = 0;
+
+ virtual int getRegisterIndex(int operandIndex,
+ GPUDynInstPtr gpuDynInst) = 0;
+
virtual int numDstRegOperands() = 0;
virtual int numSrcRegOperands() = 0;
bool isSrcOperand(int operandIndex) { return false; }
bool isDstOperand(int operandIndex) { return false; }
int getOperandSize(int operandIndex) { return 0; }
- int getRegisterIndex(int operandIndex) { return 0; }
+
+ int
+ getRegisterIndex(int operandIndex, GPUDynInstPtr gpuDynInst) override
+ {
+ return 0;
+ }
+
int numDstRegOperands() { return 0; }
int numSrcRegOperands() { return 0; }
bool isValid() const { return true; }
{
for (int i = 0; i < ii->getNumOperands(); ++i) {
if (ii->isVectorRegister(i)) {
- uint32_t vgprIdx = ii->getRegisterIndex(i);
+ uint32_t vgprIdx = ii->getRegisterIndex(i, ii);
uint32_t pVgpr = w->remap(vgprIdx, ii->getOperandSize(i), 1);
if (regBusy(pVgpr, ii->getOperandSize(i)) == 1) {
// iterate over all register destination operands
for (int i = 0; i < ii->getNumOperands(); ++i) {
if (ii->isVectorRegister(i) && ii->isDstOperand(i)) {
- uint32_t physReg = w->remap(ii->getRegisterIndex(i),
+ uint32_t physReg = w->remap(ii->getRegisterIndex(i, ii),
ii->getOperandSize(i), 1);
// mark the destination vector register as busy
// iterate over all register destination operands
for (int i = 0; i < ii->getNumOperands(); ++i) {
if (ii->isVectorRegister(i) && ii->isDstOperand(i)) {
- uint32_t physReg = w->remap(ii->getRegisterIndex(i),
+ uint32_t physReg = w->remap(ii->getRegisterIndex(i, ii),
ii->getOperandSize(i), 1);
// set the in-flight status of the destination vector register
preMarkReg(physReg, ii->getOperandSize(i), 1);