From: Brandon Potter Date: Fri, 2 Dec 2016 23:01:52 +0000 (-0500) Subject: hsail: add a wavesize case statement to register operand code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3bb3db6194bae29f03dfa40f589ff024232ee96c;p=gem5.git hsail: add a wavesize case statement to register operand code --- diff --git a/src/arch/hsail/operand.cc b/src/arch/hsail/operand.cc index d0e6c5541..747382a33 100644 --- a/src/arch/hsail/operand.cc +++ b/src/arch/hsail/operand.cc @@ -224,43 +224,51 @@ findRegDataType(unsigned opOffset, const BrigObject *obj) } break; + case BRIG_KIND_OPERAND_WAVESIZE: + { + BrigRegisterKind reg_kind = BRIG_REGISTER_KIND_DOUBLE; + return BrigRegOperandInfo((BrigKind16_t)baseOp->kind, reg_kind); + } + case BRIG_KIND_OPERAND_OPERAND_LIST: { - const BrigOperandOperandList *op = - (BrigOperandOperandList*)baseOp; - const BrigData *data_p = (BrigData*)obj->getData(op->elements); - - - int num_operands = 0; - BrigRegisterKind reg_kind = (BrigRegisterKind)0; - for (int offset = 0; offset < data_p->byteCount; offset += 4) { - const BrigOperand *op_p = (const BrigOperand *) - obj->getOperand(((int *)data_p->bytes)[offset/4]); - - if (op_p->kind == BRIG_KIND_OPERAND_REGISTER) { - const BrigOperandRegister *brigRegOp = - (const BrigOperandRegister*)op_p; - reg_kind = (BrigRegisterKind)brigRegOp->regKind; - } else if (op_p->kind == BRIG_KIND_OPERAND_CONSTANT_BYTES) { - uint16_t num_bytes = - ((Brig::BrigOperandConstantBytes*)op_p)->base.byteCount - - sizeof(BrigBase); - if (num_bytes == sizeof(uint32_t)) { - reg_kind = BRIG_REGISTER_KIND_SINGLE; - } else if (num_bytes == sizeof(uint64_t)) { - reg_kind = BRIG_REGISTER_KIND_DOUBLE; - } else { - fatal("OperandList: bad operand size %d\n", num_bytes); - } - } else { - fatal("OperandList: bad operand kind %d\n", op_p->kind); - } - - num_operands++; - } - assert(baseOp->kind == BRIG_KIND_OPERAND_OPERAND_LIST); - - return BrigRegOperandInfo((BrigKind16_t)baseOp->kind, reg_kind); + const BrigOperandOperandList *op = + (BrigOperandOperandList*)baseOp; + const BrigData *data_p = (BrigData*)obj->getData(op->elements); + + + int num_operands = 0; + BrigRegisterKind reg_kind = (BrigRegisterKind)0; + for (int offset = 0; offset < data_p->byteCount; offset += 4) { + const BrigOperand *op_p = (const BrigOperand *) + obj->getOperand(((int *)data_p->bytes)[offset/4]); + + if (op_p->kind == BRIG_KIND_OPERAND_REGISTER) { + const BrigOperandRegister *brigRegOp = + (const BrigOperandRegister*)op_p; + reg_kind = (BrigRegisterKind)brigRegOp->regKind; + } else if (op_p->kind == BRIG_KIND_OPERAND_CONSTANT_BYTES) { + uint16_t num_bytes = + ((Brig::BrigOperandConstantBytes*)op_p)->base.byteCount + - sizeof(BrigBase); + if (num_bytes == sizeof(uint32_t)) { + reg_kind = BRIG_REGISTER_KIND_SINGLE; + } else if (num_bytes == sizeof(uint64_t)) { + reg_kind = BRIG_REGISTER_KIND_DOUBLE; + } else { + fatal("OperandList: bad operand size %d\n", num_bytes); + } + } else if (op_p->kind == BRIG_KIND_OPERAND_WAVESIZE) { + reg_kind = BRIG_REGISTER_KIND_DOUBLE; + } else { + fatal("OperandList: bad operand kind %d\n", op_p->kind); + } + + num_operands++; + } + assert(baseOp->kind == BRIG_KIND_OPERAND_OPERAND_LIST); + + return BrigRegOperandInfo((BrigKind16_t)baseOp->kind, reg_kind); } break;