hsail: add a wavesize case statement to register operand code

This commit is contained in:
Brandon Potter 2016-12-02 18:01:52 -05:00
parent 69c2d86d68
commit 3bb3db6194

View file

@ -224,43 +224,51 @@ findRegDataType(unsigned opOffset, const BrigObject *obj)
} }
break; 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: case BRIG_KIND_OPERAND_OPERAND_LIST:
{ {
const BrigOperandOperandList *op = const BrigOperandOperandList *op =
(BrigOperandOperandList*)baseOp; (BrigOperandOperandList*)baseOp;
const BrigData *data_p = (BrigData*)obj->getData(op->elements); const BrigData *data_p = (BrigData*)obj->getData(op->elements);
int num_operands = 0; int num_operands = 0;
BrigRegisterKind reg_kind = (BrigRegisterKind)0; BrigRegisterKind reg_kind = (BrigRegisterKind)0;
for (int offset = 0; offset < data_p->byteCount; offset += 4) { for (int offset = 0; offset < data_p->byteCount; offset += 4) {
const BrigOperand *op_p = (const BrigOperand *) const BrigOperand *op_p = (const BrigOperand *)
obj->getOperand(((int *)data_p->bytes)[offset/4]); obj->getOperand(((int *)data_p->bytes)[offset/4]);
if (op_p->kind == BRIG_KIND_OPERAND_REGISTER) { if (op_p->kind == BRIG_KIND_OPERAND_REGISTER) {
const BrigOperandRegister *brigRegOp = const BrigOperandRegister *brigRegOp =
(const BrigOperandRegister*)op_p; (const BrigOperandRegister*)op_p;
reg_kind = (BrigRegisterKind)brigRegOp->regKind; reg_kind = (BrigRegisterKind)brigRegOp->regKind;
} else if (op_p->kind == BRIG_KIND_OPERAND_CONSTANT_BYTES) { } else if (op_p->kind == BRIG_KIND_OPERAND_CONSTANT_BYTES) {
uint16_t num_bytes = uint16_t num_bytes =
((Brig::BrigOperandConstantBytes*)op_p)->base.byteCount ((Brig::BrigOperandConstantBytes*)op_p)->base.byteCount
- sizeof(BrigBase); - sizeof(BrigBase);
if (num_bytes == sizeof(uint32_t)) { if (num_bytes == sizeof(uint32_t)) {
reg_kind = BRIG_REGISTER_KIND_SINGLE; reg_kind = BRIG_REGISTER_KIND_SINGLE;
} else if (num_bytes == sizeof(uint64_t)) { } else if (num_bytes == sizeof(uint64_t)) {
reg_kind = BRIG_REGISTER_KIND_DOUBLE; reg_kind = BRIG_REGISTER_KIND_DOUBLE;
} else { } else {
fatal("OperandList: bad operand size %d\n", num_bytes); fatal("OperandList: bad operand size %d\n", num_bytes);
} }
} else { } else if (op_p->kind == BRIG_KIND_OPERAND_WAVESIZE) {
fatal("OperandList: bad operand kind %d\n", op_p->kind); reg_kind = BRIG_REGISTER_KIND_DOUBLE;
} } else {
fatal("OperandList: bad operand kind %d\n", op_p->kind);
}
num_operands++; num_operands++;
} }
assert(baseOp->kind == BRIG_KIND_OPERAND_OPERAND_LIST); assert(baseOp->kind == BRIG_KIND_OPERAND_OPERAND_LIST);
return BrigRegOperandInfo((BrigKind16_t)baseOp->kind, reg_kind); return BrigRegOperandInfo((BrigKind16_t)baseOp->kind, reg_kind);
} }
break; break;