static int
dest(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
{
- unsigned elem_size = brw_element_size(devinfo, inst, dst);
+ enum brw_reg_type type = brw_inst_dst_type(devinfo, inst);
+ unsigned elem_size = brw_reg_type_to_size(type);
int err = 0;
if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
err |= control(file, "horiz stride", horiz_stride,
brw_inst_dst_hstride(devinfo, inst), NULL);
string(file, ">");
- string(file,
- brw_hw_reg_type_to_letters(devinfo,
- brw_inst_dst_reg_file(devinfo, inst),
- brw_inst_dst_reg_hw_type(devinfo, inst)));
+ string(file, brw_reg_type_to_letters(type));
} else {
string(file, "g[a0");
if (brw_inst_dst_ia_subreg_nr(devinfo, inst))
err |= control(file, "horiz stride", horiz_stride,
brw_inst_dst_hstride(devinfo, inst), NULL);
string(file, ">");
- string(file,
- brw_hw_reg_type_to_letters(devinfo,
- brw_inst_dst_reg_file(devinfo, inst),
- brw_inst_dst_reg_hw_type(devinfo, inst)));
+ string(file, brw_reg_type_to_letters(type));
}
} else {
if (brw_inst_dst_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
string(file, "<1>");
err |= control(file, "writemask", writemask,
brw_inst_da16_writemask(devinfo, inst), NULL);
- string(file,
- brw_hw_reg_type_to_letters(devinfo,
- brw_inst_dst_reg_file(devinfo, inst),
- brw_inst_dst_reg_hw_type(devinfo, inst)));
+ string(file, brw_reg_type_to_letters(type));
} else {
err = 1;
string(file, "Indirect align16 address mode not supported");
src_da1(FILE *file,
const struct gen_device_info *devinfo,
unsigned opcode,
- unsigned type, unsigned _reg_file,
+ enum brw_reg_type type, unsigned _reg_file,
unsigned _vert_stride, unsigned _width, unsigned _horiz_stride,
unsigned reg_num, unsigned sub_reg_num, unsigned __abs,
unsigned _negate)
if (err == -1)
return 0;
if (sub_reg_num) {
- unsigned elem_size = brw_hw_reg_type_to_size(devinfo, _reg_file, type);
+ unsigned elem_size = brw_reg_type_to_size(type);
format(file, ".%d", sub_reg_num / elem_size); /* use formal style like spec */
}
src_align1_region(file, _vert_stride, _width, _horiz_stride);
- string(file, brw_hw_reg_type_to_letters(devinfo, _reg_file, type));
+ string(file, brw_reg_type_to_letters(type));
return err;
}
src_ia1(FILE *file,
const struct gen_device_info *devinfo,
unsigned opcode,
- unsigned type,
+ enum brw_reg_type type,
unsigned _reg_file,
int _addr_imm,
unsigned _addr_subreg_nr,
format(file, " %d", _addr_imm);
string(file, "]");
src_align1_region(file, _vert_stride, _width, _horiz_stride);
- string(file, brw_hw_reg_type_to_letters(devinfo, _reg_file, type));
+ string(file, brw_reg_type_to_letters(type));
return err;
}
src_da16(FILE *file,
const struct gen_device_info *devinfo,
unsigned opcode,
- unsigned _reg_type,
+ enum brw_reg_type type,
unsigned _reg_file,
unsigned _vert_stride,
unsigned _reg_nr,
if (err == -1)
return 0;
if (_subreg_nr) {
- unsigned elem_size =
- brw_hw_reg_type_to_size(devinfo, _reg_file, _reg_type);
+ unsigned elem_size = brw_reg_type_to_size(type);
/* bit4 for subreg number byte addressing. Make this same meaning as
in da1 case, so output looks consistent. */
err |= control(file, "vert stride", vert_stride, _vert_stride, NULL);
string(file, ">");
err |= src_swizzle(file, BRW_SWIZZLE4(swz_x, swz_y, swz_z, swz_w));
- string(file, brw_hw_reg_type_to_letters(devinfo, _reg_file, _reg_type));
+ string(file, brw_reg_type_to_letters(type));
return err;
}
return src_da1(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src0_reg_hw_type(devinfo, inst),
+ brw_inst_src0_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
brw_inst_src0_vstride(devinfo, inst),
brw_inst_src0_width(devinfo, inst),
return src_ia1(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src0_reg_hw_type(devinfo, inst),
+ brw_inst_src0_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
brw_inst_src0_ia1_addr_imm(devinfo, inst),
brw_inst_src0_ia_subreg_nr(devinfo, inst),
return src_da16(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src0_reg_hw_type(devinfo, inst),
+ brw_inst_src0_type(devinfo, inst),
brw_inst_src0_reg_file(devinfo, inst),
brw_inst_src0_vstride(devinfo, inst),
brw_inst_src0_da_reg_nr(devinfo, inst),
return src_da1(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src1_reg_hw_type(devinfo, inst),
+ brw_inst_src1_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
brw_inst_src1_vstride(devinfo, inst),
brw_inst_src1_width(devinfo, inst),
return src_ia1(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src1_reg_hw_type(devinfo, inst),
+ brw_inst_src1_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
brw_inst_src1_ia1_addr_imm(devinfo, inst),
brw_inst_src1_ia_subreg_nr(devinfo, inst),
return src_da16(file,
devinfo,
brw_inst_opcode(devinfo, inst),
- brw_inst_src1_reg_hw_type(devinfo, inst),
+ brw_inst_src1_type(devinfo, inst),
brw_inst_src1_reg_file(devinfo, inst),
brw_inst_src1_vstride(devinfo, inst),
brw_inst_src1_da_reg_nr(devinfo, inst),
signed_type(unsigned type)
{
switch (type) {
- case BRW_HW_REG_TYPE_UD: return BRW_HW_REG_TYPE_D;
- case BRW_HW_REG_TYPE_UW: return BRW_HW_REG_TYPE_W;
- case BRW_HW_REG_TYPE_UB: return BRW_HW_REG_TYPE_B;
- case GEN8_HW_REG_TYPE_UQ: return GEN8_HW_REG_TYPE_Q;
- default: return type;
+ case BRW_REGISTER_TYPE_UD: return BRW_REGISTER_TYPE_D;
+ case BRW_REGISTER_TYPE_UW: return BRW_REGISTER_TYPE_W;
+ case BRW_REGISTER_TYPE_UB: return BRW_REGISTER_TYPE_B;
+ case BRW_REGISTER_TYPE_UQ: return BRW_REGISTER_TYPE_Q;
+ default: return type;
}
}
static bool
inst_is_raw_move(const struct gen_device_info *devinfo, const brw_inst *inst)
{
- unsigned dst_type = signed_type(brw_inst_dst_reg_hw_type(devinfo, inst));
- unsigned src_type = signed_type(brw_inst_src0_reg_hw_type(devinfo, inst));
+ unsigned dst_type = signed_type(brw_inst_dst_type(devinfo, inst));
+ unsigned src_type = signed_type(brw_inst_src0_type(devinfo, inst));
if (brw_inst_src0_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE) {
/* FIXME: not strictly true */
- if (brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_VF ||
- brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_UV ||
- brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_V) {
+ if (brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_VF ||
+ brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_UV ||
+ brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_V) {
return false;
}
} else if (brw_inst_src0_negate(devinfo, inst) ||
return brw_opcode_desc(devinfo, brw_inst_opcode(devinfo, inst)) == NULL;
}
-static unsigned
-execution_type_for_type(unsigned type, bool is_immediate)
+static enum brw_reg_type
+execution_type_for_type(enum brw_reg_type type)
{
- /* The meaning of the type bits is dependent on whether the operand is an
- * immediate, so normalize them first.
- */
- if (is_immediate) {
- switch (type) {
- case BRW_HW_IMM_TYPE_UV:
- case BRW_HW_IMM_TYPE_V:
- type = BRW_HW_REG_TYPE_W;
- break;
- case BRW_HW_IMM_TYPE_VF:
- type = BRW_HW_REG_TYPE_F;
- break;
- case GEN8_HW_IMM_TYPE_DF:
- type = GEN7_HW_REG_TYPE_DF;
- break;
- case GEN8_HW_IMM_TYPE_HF:
- type = GEN8_HW_IMM_TYPE_HF;
- break;
- default:
- break;
- }
- }
-
switch (type) {
- case BRW_HW_REG_TYPE_UD:
- case BRW_HW_REG_TYPE_D:
- return BRW_HW_REG_TYPE_D;
- case BRW_HW_REG_TYPE_UW:
- case BRW_HW_REG_TYPE_W:
- case BRW_HW_REG_TYPE_UB:
- case BRW_HW_REG_TYPE_B:
- return BRW_HW_REG_TYPE_W;
- case GEN8_HW_REG_TYPE_UQ:
- case GEN8_HW_REG_TYPE_Q:
- return GEN8_HW_REG_TYPE_Q;
- case BRW_HW_REG_TYPE_F:
- case GEN7_HW_REG_TYPE_DF:
- case GEN8_HW_REG_TYPE_HF:
+ case BRW_REGISTER_TYPE_DF:
+ case BRW_REGISTER_TYPE_F:
+ case BRW_REGISTER_TYPE_HF:
return type;
- default:
- unreachable("not reached");
+
+ case BRW_REGISTER_TYPE_VF:
+ return BRW_REGISTER_TYPE_F;
+
+ case BRW_REGISTER_TYPE_Q:
+ case BRW_REGISTER_TYPE_UQ:
+ return BRW_REGISTER_TYPE_Q;
+
+ case BRW_REGISTER_TYPE_D:
+ case BRW_REGISTER_TYPE_UD:
+ return BRW_REGISTER_TYPE_D;
+
+ case BRW_REGISTER_TYPE_W:
+ case BRW_REGISTER_TYPE_UW:
+ case BRW_REGISTER_TYPE_B:
+ case BRW_REGISTER_TYPE_UB:
+ case BRW_REGISTER_TYPE_V:
+ case BRW_REGISTER_TYPE_UV:
+ return BRW_REGISTER_TYPE_W;
}
+ unreachable("not reached");
}
/**
* Returns the execution type of an instruction \p inst
*/
-static unsigned
+static enum brw_reg_type
execution_type(const struct gen_device_info *devinfo, const brw_inst *inst)
{
unsigned num_sources = num_sources_from_inst(devinfo, inst);
- unsigned src0_exec_type, src1_exec_type;
- unsigned src0_type = brw_inst_src0_reg_hw_type(devinfo, inst);
- unsigned src1_type = brw_inst_src1_reg_hw_type(devinfo, inst);
-
- bool src0_is_immediate =
- brw_inst_src0_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE;
- bool src1_is_immediate =
- brw_inst_src1_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE;
+ enum brw_reg_type src0_exec_type, src1_exec_type;
+ enum brw_reg_type src0_type = brw_inst_src0_type(devinfo, inst);
+ enum brw_reg_type src1_type = brw_inst_src1_type(devinfo, inst);
/* Execution data type is independent of destination data type, except in
* mixed F/HF instructions on CHV and SKL+.
*/
- unsigned dst_exec_type = brw_inst_dst_reg_hw_type(devinfo, inst);
+ enum brw_reg_type dst_exec_type = brw_inst_dst_type(devinfo, inst);
- src0_exec_type = execution_type_for_type(src0_type, src0_is_immediate);
+ src0_exec_type = execution_type_for_type(src0_type);
if (num_sources == 1) {
if ((devinfo->gen >= 9 || devinfo->is_cherryview) &&
- src0_exec_type == GEN8_HW_REG_TYPE_HF) {
+ src0_exec_type == BRW_REGISTER_TYPE_HF) {
return dst_exec_type;
}
return src0_exec_type;
}
- src1_exec_type = execution_type_for_type(src1_type, src1_is_immediate);
+ src1_exec_type = execution_type_for_type(src1_type);
if (src0_exec_type == src1_exec_type)
return src0_exec_type;
* (and not allowed on later platforms)
*/
if (devinfo->gen < 6 &&
- (src0_exec_type == BRW_HW_REG_TYPE_F ||
- src1_exec_type == BRW_HW_REG_TYPE_F))
- return BRW_HW_REG_TYPE_F;
+ (src0_exec_type == BRW_REGISTER_TYPE_F ||
+ src1_exec_type == BRW_REGISTER_TYPE_F))
+ return BRW_REGISTER_TYPE_F;
- if (src0_exec_type == GEN8_HW_REG_TYPE_Q ||
- src1_exec_type == GEN8_HW_REG_TYPE_Q)
- return GEN8_HW_REG_TYPE_Q;
+ if (src0_exec_type == BRW_REGISTER_TYPE_Q ||
+ src1_exec_type == BRW_REGISTER_TYPE_Q)
+ return BRW_REGISTER_TYPE_Q;
- if (src0_exec_type == BRW_HW_REG_TYPE_D ||
- src1_exec_type == BRW_HW_REG_TYPE_D)
- return BRW_HW_REG_TYPE_D;
+ if (src0_exec_type == BRW_REGISTER_TYPE_D ||
+ src1_exec_type == BRW_REGISTER_TYPE_D)
+ return BRW_REGISTER_TYPE_D;
- if (src0_exec_type == BRW_HW_REG_TYPE_W ||
- src1_exec_type == BRW_HW_REG_TYPE_W)
- return BRW_HW_REG_TYPE_W;
+ if (src0_exec_type == BRW_REGISTER_TYPE_W ||
+ src1_exec_type == BRW_REGISTER_TYPE_W)
+ return BRW_REGISTER_TYPE_W;
- if (src0_exec_type == GEN7_HW_REG_TYPE_DF ||
- src1_exec_type == GEN7_HW_REG_TYPE_DF)
- return GEN7_HW_REG_TYPE_DF;
+ if (src0_exec_type == BRW_REGISTER_TYPE_DF ||
+ src1_exec_type == BRW_REGISTER_TYPE_DF)
+ return BRW_REGISTER_TYPE_DF;
if (devinfo->gen >= 9 || devinfo->is_cherryview) {
- if (dst_exec_type == BRW_HW_REG_TYPE_F ||
- src0_exec_type == BRW_HW_REG_TYPE_F ||
- src1_exec_type == BRW_HW_REG_TYPE_F) {
- return BRW_HW_REG_TYPE_F;
+ if (dst_exec_type == BRW_REGISTER_TYPE_F ||
+ src0_exec_type == BRW_REGISTER_TYPE_F ||
+ src1_exec_type == BRW_REGISTER_TYPE_F) {
+ return BRW_REGISTER_TYPE_F;
} else {
- return GEN8_HW_REG_TYPE_HF;
+ return BRW_REGISTER_TYPE_HF;
}
}
- assert(src0_exec_type == BRW_HW_REG_TYPE_F);
- return BRW_HW_REG_TYPE_F;
+ assert(src0_exec_type == BRW_REGISTER_TYPE_F);
+ return BRW_REGISTER_TYPE_F;
}
/**
*/
unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
+ enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
bool dst_type_is_byte =
- brw_inst_dst_reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_B ||
- brw_inst_dst_reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_UB;
+ brw_inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_B ||
+ brw_inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_UB;
if (dst_type_is_byte) {
if (is_packed(exec_size * dst_stride, exec_size, dst_stride)) {
}
unsigned exec_type = execution_type(devinfo, inst);
- unsigned exec_type_size =
- brw_hw_reg_type_to_size(devinfo, BRW_GENERAL_REGISTER_FILE, exec_type);
- unsigned dst_type_size = brw_element_size(devinfo, inst, dst);
+ unsigned exec_type_size = brw_reg_type_to_size(exec_type);
+ unsigned dst_type_size = brw_reg_type_to_size(dst_type);
/* On IVB/BYT, region parameters and execution size for DF are in terms of
* 32-bit elements, so they are doubled. For evaluating the validity of an
for (unsigned i = 0; i < num_sources; i++) {
unsigned vstride, width, hstride, element_size, subreg;
+ enum brw_reg_type type;
#define DO_SRC(n) \
if (brw_inst_src ## n ## _reg_file(devinfo, inst) == \
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
- element_size = brw_element_size(devinfo, inst, src ## n); \
+ type = brw_inst_src ## n ## _type(devinfo, inst); \
+ element_size = brw_reg_type_to_size(type); \
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst)
if (i == 0) {
for (unsigned i = 0; i < num_sources; i++) {
unsigned vstride, width, hstride, element_size, subreg;
+ enum brw_reg_type type;
/* In Direct Addressing mode, a source cannot span more than 2 adjacent
* GRF registers.
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
- element_size = brw_element_size(devinfo, inst, src ## n); \
+ type = brw_inst_src ## n ## _type(devinfo, inst); \
+ element_size = brw_reg_type_to_size(type); \
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst); \
align1_access_mask(src ## n ## _access_mask, \
exec_size, element_size, subreg, \
return error_msg;
unsigned stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
- unsigned element_size = brw_element_size(devinfo, inst, dst);
+ enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
+ unsigned element_size = brw_reg_type_to_size(dst_type);
unsigned subreg = brw_inst_dst_da1_subreg_nr(devinfo, inst);
unsigned offset = ((exec_size - 1) * stride * element_size) + subreg;
ERROR_IF(offset >= 64,
* is that the size of the destination type is 4 bytes.
*/
if (devinfo->gen <= 7 && dst_regs == 2) {
+ enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
bool dst_is_packed_dword =
is_packed(exec_size * stride, exec_size, stride) &&
- brw_element_size(devinfo, inst, dst) == 4;
+ brw_reg_type_to_size(dst_type) == 4;
for (unsigned i = 0; i < num_sources; i++) {
#define DO_SRC(n) \
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
bool src ## n ## _is_packed_word = \
is_packed(vstride, width, hstride) && \
- (brw_inst_src ## n ## _reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_W || \
- brw_inst_src ## n ## _reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_UW); \
+ (brw_inst_src ## n ## _type(devinfo, inst) == BRW_REGISTER_TYPE_W || \
+ brw_inst_src ## n ## _type(devinfo, inst) == BRW_REGISTER_TYPE_UW); \
\
ERROR_IF(src ## n ## _regs == 1 && \
!src ## n ## _has_scalar_region(devinfo, inst) && \
if (file != BRW_IMMEDIATE_VALUE)
return (struct string){};
- unsigned dst_type_size = brw_element_size(devinfo, inst, dst);
+ enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
+ unsigned dst_type_size = brw_reg_type_to_size(dst_type);
unsigned dst_subreg = brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1 ?
brw_inst_dst_da1_subreg_nr(devinfo, inst) : 0;
unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
- unsigned type = num_sources == 1 ?
- brw_inst_src0_reg_hw_type(devinfo, inst) :
- brw_inst_src1_reg_hw_type(devinfo, inst);
+ enum brw_reg_type type = num_sources == 1 ?
+ brw_inst_src0_type(devinfo, inst) :
+ brw_inst_src1_type(devinfo, inst);
/* The PRMs say:
*
* applies.
*/
switch (type) {
- case BRW_HW_IMM_TYPE_V:
- case BRW_HW_IMM_TYPE_UV:
- case BRW_HW_IMM_TYPE_VF:
+ case BRW_REGISTER_TYPE_V:
+ case BRW_REGISTER_TYPE_UV:
+ case BRW_REGISTER_TYPE_VF:
ERROR_IF(dst_subreg % (128 / 8) != 0,
"Destination must be 128-bit aligned in order to use immediate "
"vector types");
- if (type == BRW_HW_IMM_TYPE_VF) {
+ if (type == BRW_REGISTER_TYPE_VF) {
ERROR_IF(dst_type_size * dst_stride != 4,
"Destination must have stride equivalent to dword in order "
"to use the VF type");