i965: Stop using hardware register types directly
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
This commit is contained in:
@@ -707,7 +707,8 @@ reg(FILE *file, unsigned _reg_file, unsigned _reg_nr)
|
|||||||
static int
|
static int
|
||||||
dest(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
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;
|
int err = 0;
|
||||||
|
|
||||||
if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
|
if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
|
||||||
@@ -723,10 +724,7 @@ dest(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
err |= control(file, "horiz stride", horiz_stride,
|
err |= control(file, "horiz stride", horiz_stride,
|
||||||
brw_inst_dst_hstride(devinfo, inst), NULL);
|
brw_inst_dst_hstride(devinfo, inst), NULL);
|
||||||
string(file, ">");
|
string(file, ">");
|
||||||
string(file,
|
string(file, brw_reg_type_to_letters(type));
|
||||||
brw_hw_reg_type_to_letters(devinfo,
|
|
||||||
brw_inst_dst_reg_file(devinfo, inst),
|
|
||||||
brw_inst_dst_reg_hw_type(devinfo, inst)));
|
|
||||||
} else {
|
} else {
|
||||||
string(file, "g[a0");
|
string(file, "g[a0");
|
||||||
if (brw_inst_dst_ia_subreg_nr(devinfo, inst))
|
if (brw_inst_dst_ia_subreg_nr(devinfo, inst))
|
||||||
@@ -738,10 +736,7 @@ dest(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
err |= control(file, "horiz stride", horiz_stride,
|
err |= control(file, "horiz stride", horiz_stride,
|
||||||
brw_inst_dst_hstride(devinfo, inst), NULL);
|
brw_inst_dst_hstride(devinfo, inst), NULL);
|
||||||
string(file, ">");
|
string(file, ">");
|
||||||
string(file,
|
string(file, brw_reg_type_to_letters(type));
|
||||||
brw_hw_reg_type_to_letters(devinfo,
|
|
||||||
brw_inst_dst_reg_file(devinfo, inst),
|
|
||||||
brw_inst_dst_reg_hw_type(devinfo, inst)));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (brw_inst_dst_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
|
if (brw_inst_dst_address_mode(devinfo, inst) == BRW_ADDRESS_DIRECT) {
|
||||||
@@ -754,10 +749,7 @@ dest(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
string(file, "<1>");
|
string(file, "<1>");
|
||||||
err |= control(file, "writemask", writemask,
|
err |= control(file, "writemask", writemask,
|
||||||
brw_inst_da16_writemask(devinfo, inst), NULL);
|
brw_inst_da16_writemask(devinfo, inst), NULL);
|
||||||
string(file,
|
string(file, brw_reg_type_to_letters(type));
|
||||||
brw_hw_reg_type_to_letters(devinfo,
|
|
||||||
brw_inst_dst_reg_file(devinfo, inst),
|
|
||||||
brw_inst_dst_reg_hw_type(devinfo, inst)));
|
|
||||||
} else {
|
} else {
|
||||||
err = 1;
|
err = 1;
|
||||||
string(file, "Indirect align16 address mode not supported");
|
string(file, "Indirect align16 address mode not supported");
|
||||||
@@ -812,7 +804,7 @@ static int
|
|||||||
src_da1(FILE *file,
|
src_da1(FILE *file,
|
||||||
const struct gen_device_info *devinfo,
|
const struct gen_device_info *devinfo,
|
||||||
unsigned opcode,
|
unsigned opcode,
|
||||||
unsigned type, unsigned _reg_file,
|
enum brw_reg_type type, unsigned _reg_file,
|
||||||
unsigned _vert_stride, unsigned _width, unsigned _horiz_stride,
|
unsigned _vert_stride, unsigned _width, unsigned _horiz_stride,
|
||||||
unsigned reg_num, unsigned sub_reg_num, unsigned __abs,
|
unsigned reg_num, unsigned sub_reg_num, unsigned __abs,
|
||||||
unsigned _negate)
|
unsigned _negate)
|
||||||
@@ -830,11 +822,11 @@ src_da1(FILE *file,
|
|||||||
if (err == -1)
|
if (err == -1)
|
||||||
return 0;
|
return 0;
|
||||||
if (sub_reg_num) {
|
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 */
|
format(file, ".%d", sub_reg_num / elem_size); /* use formal style like spec */
|
||||||
}
|
}
|
||||||
src_align1_region(file, _vert_stride, _width, _horiz_stride);
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,7 +834,7 @@ static int
|
|||||||
src_ia1(FILE *file,
|
src_ia1(FILE *file,
|
||||||
const struct gen_device_info *devinfo,
|
const struct gen_device_info *devinfo,
|
||||||
unsigned opcode,
|
unsigned opcode,
|
||||||
unsigned type,
|
enum brw_reg_type type,
|
||||||
unsigned _reg_file,
|
unsigned _reg_file,
|
||||||
int _addr_imm,
|
int _addr_imm,
|
||||||
unsigned _addr_subreg_nr,
|
unsigned _addr_subreg_nr,
|
||||||
@@ -866,7 +858,7 @@ src_ia1(FILE *file,
|
|||||||
format(file, " %d", _addr_imm);
|
format(file, " %d", _addr_imm);
|
||||||
string(file, "]");
|
string(file, "]");
|
||||||
src_align1_region(file, _vert_stride, _width, _horiz_stride);
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,7 +888,7 @@ static int
|
|||||||
src_da16(FILE *file,
|
src_da16(FILE *file,
|
||||||
const struct gen_device_info *devinfo,
|
const struct gen_device_info *devinfo,
|
||||||
unsigned opcode,
|
unsigned opcode,
|
||||||
unsigned _reg_type,
|
enum brw_reg_type type,
|
||||||
unsigned _reg_file,
|
unsigned _reg_file,
|
||||||
unsigned _vert_stride,
|
unsigned _vert_stride,
|
||||||
unsigned _reg_nr,
|
unsigned _reg_nr,
|
||||||
@@ -918,8 +910,7 @@ src_da16(FILE *file,
|
|||||||
if (err == -1)
|
if (err == -1)
|
||||||
return 0;
|
return 0;
|
||||||
if (_subreg_nr) {
|
if (_subreg_nr) {
|
||||||
unsigned elem_size =
|
unsigned elem_size = brw_reg_type_to_size(type);
|
||||||
brw_hw_reg_type_to_size(devinfo, _reg_file, _reg_type);
|
|
||||||
|
|
||||||
/* bit4 for subreg number byte addressing. Make this same meaning as
|
/* bit4 for subreg number byte addressing. Make this same meaning as
|
||||||
in da1 case, so output looks consistent. */
|
in da1 case, so output looks consistent. */
|
||||||
@@ -929,7 +920,7 @@ src_da16(FILE *file,
|
|||||||
err |= control(file, "vert stride", vert_stride, _vert_stride, NULL);
|
err |= control(file, "vert stride", vert_stride, _vert_stride, NULL);
|
||||||
string(file, ">");
|
string(file, ">");
|
||||||
err |= src_swizzle(file, BRW_SWIZZLE4(swz_x, swz_y, swz_z, swz_w));
|
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 err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,7 +1068,7 @@ src0(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_da1(file,
|
return src_da1(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src0_vstride(devinfo, inst),
|
brw_inst_src0_vstride(devinfo, inst),
|
||||||
brw_inst_src0_width(devinfo, inst),
|
brw_inst_src0_width(devinfo, inst),
|
||||||
@@ -1090,7 +1081,7 @@ src0(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_ia1(file,
|
return src_ia1(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src0_ia1_addr_imm(devinfo, inst),
|
brw_inst_src0_ia1_addr_imm(devinfo, inst),
|
||||||
brw_inst_src0_ia_subreg_nr(devinfo, inst),
|
brw_inst_src0_ia_subreg_nr(devinfo, inst),
|
||||||
@@ -1105,7 +1096,7 @@ src0(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_da16(file,
|
return src_da16(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src0_vstride(devinfo, inst),
|
brw_inst_src0_vstride(devinfo, inst),
|
||||||
brw_inst_src0_da_reg_nr(devinfo, inst),
|
brw_inst_src0_da_reg_nr(devinfo, inst),
|
||||||
@@ -1133,7 +1124,7 @@ src1(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_da1(file,
|
return src_da1(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src1_vstride(devinfo, inst),
|
brw_inst_src1_vstride(devinfo, inst),
|
||||||
brw_inst_src1_width(devinfo, inst),
|
brw_inst_src1_width(devinfo, inst),
|
||||||
@@ -1146,7 +1137,7 @@ src1(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_ia1(file,
|
return src_ia1(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src1_ia1_addr_imm(devinfo, inst),
|
brw_inst_src1_ia1_addr_imm(devinfo, inst),
|
||||||
brw_inst_src1_ia_subreg_nr(devinfo, inst),
|
brw_inst_src1_ia_subreg_nr(devinfo, inst),
|
||||||
@@ -1161,7 +1152,7 @@ src1(FILE *file, const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
return src_da16(file,
|
return src_da16(file,
|
||||||
devinfo,
|
devinfo,
|
||||||
brw_inst_opcode(devinfo, inst),
|
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_reg_file(devinfo, inst),
|
||||||
brw_inst_src1_vstride(devinfo, inst),
|
brw_inst_src1_vstride(devinfo, inst),
|
||||||
brw_inst_src1_da_reg_nr(devinfo, inst),
|
brw_inst_src1_da_reg_nr(devinfo, inst),
|
||||||
|
@@ -82,10 +82,10 @@ static unsigned
|
|||||||
signed_type(unsigned type)
|
signed_type(unsigned type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BRW_HW_REG_TYPE_UD: return BRW_HW_REG_TYPE_D;
|
case BRW_REGISTER_TYPE_UD: return BRW_REGISTER_TYPE_D;
|
||||||
case BRW_HW_REG_TYPE_UW: return BRW_HW_REG_TYPE_W;
|
case BRW_REGISTER_TYPE_UW: return BRW_REGISTER_TYPE_W;
|
||||||
case BRW_HW_REG_TYPE_UB: return BRW_HW_REG_TYPE_B;
|
case BRW_REGISTER_TYPE_UB: return BRW_REGISTER_TYPE_B;
|
||||||
case GEN8_HW_REG_TYPE_UQ: return GEN8_HW_REG_TYPE_Q;
|
case BRW_REGISTER_TYPE_UQ: return BRW_REGISTER_TYPE_Q;
|
||||||
default: return type;
|
default: return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,14 +93,14 @@ signed_type(unsigned type)
|
|||||||
static bool
|
static bool
|
||||||
inst_is_raw_move(const struct gen_device_info *devinfo, const brw_inst *inst)
|
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 dst_type = signed_type(brw_inst_dst_type(devinfo, inst));
|
||||||
unsigned src_type = signed_type(brw_inst_src0_reg_hw_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) {
|
if (brw_inst_src0_reg_file(devinfo, inst) == BRW_IMMEDIATE_VALUE) {
|
||||||
/* FIXME: not strictly true */
|
/* FIXME: not strictly true */
|
||||||
if (brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_VF ||
|
if (brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_VF ||
|
||||||
brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_UV ||
|
brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_UV ||
|
||||||
brw_inst_src0_reg_hw_type(devinfo, inst) == BRW_HW_IMM_TYPE_V) {
|
brw_inst_src0_type(devinfo, inst) == BRW_REGISTER_TYPE_V) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (brw_inst_src0_negate(devinfo, inst) ||
|
} else if (brw_inst_src0_negate(devinfo, inst) ||
|
||||||
@@ -261,84 +261,63 @@ is_unsupported_inst(const struct gen_device_info *devinfo,
|
|||||||
return brw_opcode_desc(devinfo, brw_inst_opcode(devinfo, inst)) == NULL;
|
return brw_opcode_desc(devinfo, brw_inst_opcode(devinfo, inst)) == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static enum brw_reg_type
|
||||||
execution_type_for_type(unsigned type, bool is_immediate)
|
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) {
|
switch (type) {
|
||||||
case BRW_HW_IMM_TYPE_UV:
|
case BRW_REGISTER_TYPE_DF:
|
||||||
case BRW_HW_IMM_TYPE_V:
|
case BRW_REGISTER_TYPE_F:
|
||||||
type = BRW_HW_REG_TYPE_W;
|
case BRW_REGISTER_TYPE_HF:
|
||||||
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:
|
|
||||||
return type;
|
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
|
* 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)
|
execution_type(const struct gen_device_info *devinfo, const brw_inst *inst)
|
||||||
{
|
{
|
||||||
unsigned num_sources = num_sources_from_inst(devinfo, inst);
|
unsigned num_sources = num_sources_from_inst(devinfo, inst);
|
||||||
unsigned src0_exec_type, src1_exec_type;
|
enum brw_reg_type src0_exec_type, src1_exec_type;
|
||||||
unsigned src0_type = brw_inst_src0_reg_hw_type(devinfo, inst);
|
enum brw_reg_type src0_type = brw_inst_src0_type(devinfo, inst);
|
||||||
unsigned src1_type = brw_inst_src1_reg_hw_type(devinfo, inst);
|
enum brw_reg_type src1_type = brw_inst_src1_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;
|
|
||||||
|
|
||||||
/* Execution data type is independent of destination data type, except in
|
/* Execution data type is independent of destination data type, except in
|
||||||
* mixed F/HF instructions on CHV and SKL+.
|
* 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 (num_sources == 1) {
|
||||||
if ((devinfo->gen >= 9 || devinfo->is_cherryview) &&
|
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 dst_exec_type;
|
||||||
}
|
}
|
||||||
return src0_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)
|
if (src0_exec_type == src1_exec_type)
|
||||||
return src0_exec_type;
|
return src0_exec_type;
|
||||||
|
|
||||||
@@ -346,38 +325,38 @@ execution_type(const struct gen_device_info *devinfo, const brw_inst *inst)
|
|||||||
* (and not allowed on later platforms)
|
* (and not allowed on later platforms)
|
||||||
*/
|
*/
|
||||||
if (devinfo->gen < 6 &&
|
if (devinfo->gen < 6 &&
|
||||||
(src0_exec_type == BRW_HW_REG_TYPE_F ||
|
(src0_exec_type == BRW_REGISTER_TYPE_F ||
|
||||||
src1_exec_type == BRW_HW_REG_TYPE_F))
|
src1_exec_type == BRW_REGISTER_TYPE_F))
|
||||||
return BRW_HW_REG_TYPE_F;
|
return BRW_REGISTER_TYPE_F;
|
||||||
|
|
||||||
if (src0_exec_type == GEN8_HW_REG_TYPE_Q ||
|
if (src0_exec_type == BRW_REGISTER_TYPE_Q ||
|
||||||
src1_exec_type == GEN8_HW_REG_TYPE_Q)
|
src1_exec_type == BRW_REGISTER_TYPE_Q)
|
||||||
return GEN8_HW_REG_TYPE_Q;
|
return BRW_REGISTER_TYPE_Q;
|
||||||
|
|
||||||
if (src0_exec_type == BRW_HW_REG_TYPE_D ||
|
if (src0_exec_type == BRW_REGISTER_TYPE_D ||
|
||||||
src1_exec_type == BRW_HW_REG_TYPE_D)
|
src1_exec_type == BRW_REGISTER_TYPE_D)
|
||||||
return BRW_HW_REG_TYPE_D;
|
return BRW_REGISTER_TYPE_D;
|
||||||
|
|
||||||
if (src0_exec_type == BRW_HW_REG_TYPE_W ||
|
if (src0_exec_type == BRW_REGISTER_TYPE_W ||
|
||||||
src1_exec_type == BRW_HW_REG_TYPE_W)
|
src1_exec_type == BRW_REGISTER_TYPE_W)
|
||||||
return BRW_HW_REG_TYPE_W;
|
return BRW_REGISTER_TYPE_W;
|
||||||
|
|
||||||
if (src0_exec_type == GEN7_HW_REG_TYPE_DF ||
|
if (src0_exec_type == BRW_REGISTER_TYPE_DF ||
|
||||||
src1_exec_type == GEN7_HW_REG_TYPE_DF)
|
src1_exec_type == BRW_REGISTER_TYPE_DF)
|
||||||
return GEN7_HW_REG_TYPE_DF;
|
return BRW_REGISTER_TYPE_DF;
|
||||||
|
|
||||||
if (devinfo->gen >= 9 || devinfo->is_cherryview) {
|
if (devinfo->gen >= 9 || devinfo->is_cherryview) {
|
||||||
if (dst_exec_type == BRW_HW_REG_TYPE_F ||
|
if (dst_exec_type == BRW_REGISTER_TYPE_F ||
|
||||||
src0_exec_type == BRW_HW_REG_TYPE_F ||
|
src0_exec_type == BRW_REGISTER_TYPE_F ||
|
||||||
src1_exec_type == BRW_HW_REG_TYPE_F) {
|
src1_exec_type == BRW_REGISTER_TYPE_F) {
|
||||||
return BRW_HW_REG_TYPE_F;
|
return BRW_REGISTER_TYPE_F;
|
||||||
} else {
|
} else {
|
||||||
return GEN8_HW_REG_TYPE_HF;
|
return BRW_REGISTER_TYPE_HF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(src0_exec_type == BRW_HW_REG_TYPE_F);
|
assert(src0_exec_type == BRW_REGISTER_TYPE_F);
|
||||||
return BRW_HW_REG_TYPE_F;
|
return BRW_REGISTER_TYPE_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -442,9 +421,10 @@ general_restrictions_based_on_operand_types(const struct gen_device_info *devinf
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
|
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 =
|
bool dst_type_is_byte =
|
||||||
brw_inst_dst_reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_B ||
|
brw_inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_B ||
|
||||||
brw_inst_dst_reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_UB;
|
brw_inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_UB;
|
||||||
|
|
||||||
if (dst_type_is_byte) {
|
if (dst_type_is_byte) {
|
||||||
if (is_packed(exec_size * dst_stride, exec_size, dst_stride)) {
|
if (is_packed(exec_size * dst_stride, exec_size, dst_stride)) {
|
||||||
@@ -458,9 +438,8 @@ general_restrictions_based_on_operand_types(const struct gen_device_info *devinf
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned exec_type = execution_type(devinfo, inst);
|
unsigned exec_type = execution_type(devinfo, inst);
|
||||||
unsigned exec_type_size =
|
unsigned exec_type_size = brw_reg_type_to_size(exec_type);
|
||||||
brw_hw_reg_type_to_size(devinfo, BRW_GENERAL_REGISTER_FILE, exec_type);
|
unsigned dst_type_size = brw_reg_type_to_size(dst_type);
|
||||||
unsigned dst_type_size = brw_element_size(devinfo, inst, dst);
|
|
||||||
|
|
||||||
/* On IVB/BYT, region parameters and execution size for DF are in terms of
|
/* 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
|
* 32-bit elements, so they are doubled. For evaluating the validity of an
|
||||||
@@ -558,6 +537,7 @@ general_restrictions_on_region_parameters(const struct gen_device_info *devinfo,
|
|||||||
|
|
||||||
for (unsigned i = 0; i < num_sources; i++) {
|
for (unsigned i = 0; i < num_sources; i++) {
|
||||||
unsigned vstride, width, hstride, element_size, subreg;
|
unsigned vstride, width, hstride, element_size, subreg;
|
||||||
|
enum brw_reg_type type;
|
||||||
|
|
||||||
#define DO_SRC(n) \
|
#define DO_SRC(n) \
|
||||||
if (brw_inst_src ## n ## _reg_file(devinfo, inst) == \
|
if (brw_inst_src ## n ## _reg_file(devinfo, inst) == \
|
||||||
@@ -569,7 +549,8 @@ general_restrictions_on_region_parameters(const struct gen_device_info *devinfo,
|
|||||||
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
|
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
|
||||||
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
|
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
|
||||||
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
|
(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)
|
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst)
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@@ -748,6 +729,7 @@ region_alignment_rules(const struct gen_device_info *devinfo,
|
|||||||
|
|
||||||
for (unsigned i = 0; i < num_sources; i++) {
|
for (unsigned i = 0; i < num_sources; i++) {
|
||||||
unsigned vstride, width, hstride, element_size, subreg;
|
unsigned vstride, width, hstride, element_size, subreg;
|
||||||
|
enum brw_reg_type type;
|
||||||
|
|
||||||
/* In Direct Addressing mode, a source cannot span more than 2 adjacent
|
/* In Direct Addressing mode, a source cannot span more than 2 adjacent
|
||||||
* GRF registers.
|
* GRF registers.
|
||||||
@@ -767,7 +749,8 @@ region_alignment_rules(const struct gen_device_info *devinfo,
|
|||||||
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
|
width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
|
||||||
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
|
hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
|
||||||
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
|
(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); \
|
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst); \
|
||||||
align1_access_mask(src ## n ## _access_mask, \
|
align1_access_mask(src ## n ## _access_mask, \
|
||||||
exec_size, element_size, subreg, \
|
exec_size, element_size, subreg, \
|
||||||
@@ -794,7 +777,8 @@ region_alignment_rules(const struct gen_device_info *devinfo,
|
|||||||
return error_msg;
|
return error_msg;
|
||||||
|
|
||||||
unsigned stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
|
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 subreg = brw_inst_dst_da1_subreg_nr(devinfo, inst);
|
||||||
unsigned offset = ((exec_size - 1) * stride * element_size) + subreg;
|
unsigned offset = ((exec_size - 1) * stride * element_size) + subreg;
|
||||||
ERROR_IF(offset >= 64,
|
ERROR_IF(offset >= 64,
|
||||||
@@ -1000,9 +984,10 @@ region_alignment_rules(const struct gen_device_info *devinfo,
|
|||||||
* is that the size of the destination type is 4 bytes.
|
* is that the size of the destination type is 4 bytes.
|
||||||
*/
|
*/
|
||||||
if (devinfo->gen <= 7 && dst_regs == 2) {
|
if (devinfo->gen <= 7 && dst_regs == 2) {
|
||||||
|
enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
|
||||||
bool dst_is_packed_dword =
|
bool dst_is_packed_dword =
|
||||||
is_packed(exec_size * stride, exec_size, stride) &&
|
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++) {
|
for (unsigned i = 0; i < num_sources; i++) {
|
||||||
#define DO_SRC(n) \
|
#define DO_SRC(n) \
|
||||||
@@ -1014,8 +999,8 @@ region_alignment_rules(const struct gen_device_info *devinfo,
|
|||||||
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
|
(1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
|
||||||
bool src ## n ## _is_packed_word = \
|
bool src ## n ## _is_packed_word = \
|
||||||
is_packed(vstride, width, hstride) && \
|
is_packed(vstride, width, hstride) && \
|
||||||
(brw_inst_src ## n ## _reg_hw_type(devinfo, inst) == BRW_HW_REG_TYPE_W || \
|
(brw_inst_src ## n ## _type(devinfo, inst) == BRW_REGISTER_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_UW); \
|
||||||
\
|
\
|
||||||
ERROR_IF(src ## n ## _regs == 1 && \
|
ERROR_IF(src ## n ## _regs == 1 && \
|
||||||
!src ## n ## _has_scalar_region(devinfo, inst) && \
|
!src ## n ## _has_scalar_region(devinfo, inst) && \
|
||||||
@@ -1052,13 +1037,14 @@ vector_immediate_restrictions(const struct gen_device_info *devinfo,
|
|||||||
if (file != BRW_IMMEDIATE_VALUE)
|
if (file != BRW_IMMEDIATE_VALUE)
|
||||||
return (struct string){};
|
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 ?
|
unsigned dst_subreg = brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1 ?
|
||||||
brw_inst_dst_da1_subreg_nr(devinfo, inst) : 0;
|
brw_inst_dst_da1_subreg_nr(devinfo, inst) : 0;
|
||||||
unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
|
unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
|
||||||
unsigned type = num_sources == 1 ?
|
enum brw_reg_type type = num_sources == 1 ?
|
||||||
brw_inst_src0_reg_hw_type(devinfo, inst) :
|
brw_inst_src0_type(devinfo, inst) :
|
||||||
brw_inst_src1_reg_hw_type(devinfo, inst);
|
brw_inst_src1_type(devinfo, inst);
|
||||||
|
|
||||||
/* The PRMs say:
|
/* The PRMs say:
|
||||||
*
|
*
|
||||||
@@ -1072,14 +1058,14 @@ vector_immediate_restrictions(const struct gen_device_info *devinfo,
|
|||||||
* applies.
|
* applies.
|
||||||
*/
|
*/
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BRW_HW_IMM_TYPE_V:
|
case BRW_REGISTER_TYPE_V:
|
||||||
case BRW_HW_IMM_TYPE_UV:
|
case BRW_REGISTER_TYPE_UV:
|
||||||
case BRW_HW_IMM_TYPE_VF:
|
case BRW_REGISTER_TYPE_VF:
|
||||||
ERROR_IF(dst_subreg % (128 / 8) != 0,
|
ERROR_IF(dst_subreg % (128 / 8) != 0,
|
||||||
"Destination must be 128-bit aligned in order to use immediate "
|
"Destination must be 128-bit aligned in order to use immediate "
|
||||||
"vector types");
|
"vector types");
|
||||||
|
|
||||||
if (type == BRW_HW_IMM_TYPE_VF) {
|
if (type == BRW_REGISTER_TYPE_VF) {
|
||||||
ERROR_IF(dst_type_size * dst_stride != 4,
|
ERROR_IF(dst_type_size * dst_stride != 4,
|
||||||
"Destination must have stride equivalent to dword in order "
|
"Destination must have stride equivalent to dword in order "
|
||||||
"to use the VF type");
|
"to use the VF type");
|
||||||
|
@@ -95,14 +95,10 @@ brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the element size given a hardware register type and file.
|
* Return the element size given a register type.
|
||||||
*
|
|
||||||
* The hardware encoding may depend on whether the value is an immediate.
|
|
||||||
*/
|
*/
|
||||||
unsigned
|
unsigned
|
||||||
brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
|
brw_reg_type_to_size(enum brw_reg_type type)
|
||||||
enum brw_reg_file file,
|
|
||||||
unsigned hw_type)
|
|
||||||
{
|
{
|
||||||
static const unsigned type_size[] = {
|
static const unsigned type_size[] = {
|
||||||
[BRW_REGISTER_TYPE_DF] = 8,
|
[BRW_REGISTER_TYPE_DF] = 8,
|
||||||
@@ -121,7 +117,6 @@ brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
|
|||||||
[BRW_REGISTER_TYPE_V] = 2,
|
[BRW_REGISTER_TYPE_V] = 2,
|
||||||
[BRW_REGISTER_TYPE_UV] = 2,
|
[BRW_REGISTER_TYPE_UV] = 2,
|
||||||
};
|
};
|
||||||
enum brw_reg_type type = brw_hw_type_to_reg_type(devinfo, file, hw_type);
|
|
||||||
return type_size[type];
|
return type_size[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,11 +149,3 @@ brw_reg_type_to_letters(enum brw_reg_type type)
|
|||||||
assert(type < ARRAY_SIZE(letters));
|
assert(type < ARRAY_SIZE(letters));
|
||||||
return letters[type];
|
return letters[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
brw_hw_reg_type_to_letters(const struct gen_device_info *devinfo,
|
|
||||||
enum brw_reg_file file, unsigned hw_type)
|
|
||||||
{
|
|
||||||
enum brw_reg_type type = brw_hw_type_to_reg_type(devinfo, file, hw_type);
|
|
||||||
return brw_reg_type_to_letters(type);
|
|
||||||
}
|
|
||||||
|
@@ -67,21 +67,12 @@ enum brw_reg_type
|
|||||||
brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
|
brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
|
||||||
enum brw_reg_file file, unsigned hw_type);
|
enum brw_reg_file file, unsigned hw_type);
|
||||||
|
|
||||||
#define brw_element_size(devinfo, inst, operand) \
|
|
||||||
brw_hw_reg_type_to_size(devinfo, \
|
|
||||||
brw_inst_ ## operand ## _reg_file(devinfo, inst), \
|
|
||||||
brw_inst_ ## operand ## _reg_hw_type(devinfo, inst))
|
|
||||||
unsigned
|
unsigned
|
||||||
brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
|
brw_reg_type_to_size(enum brw_reg_type type);
|
||||||
enum brw_reg_file file, unsigned hw_type);
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
brw_reg_type_to_letters(enum brw_reg_type type);
|
brw_reg_type_to_letters(enum brw_reg_type type);
|
||||||
|
|
||||||
const char *
|
|
||||||
brw_hw_reg_type_to_letters(const struct gen_device_info *devinfo,
|
|
||||||
enum brw_reg_file file, unsigned hw_type);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user