i965: Pass devinfo pointer to is_3src() helpers.

This is not strictly required for the following changes because none
of the three-source opcodes we support at the moment in the compiler
back-end has been removed or redefined, but that's likely to change in
the future.  In any case having hardware instructions specified as a
pair of hardware device and opcode number explicitly in all cases will
simplify the opcode look-up interface introduced in a subsequent
commit, since the opcode number alone is in general ambiguous.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Francisco Jerez 2016-04-28 00:19:13 -07:00 committed by Matt Turner
parent c55dc77ab1
commit 1cc7573162
8 changed files with 11 additions and 10 deletions

View file

@ -546,7 +546,7 @@ next_offset(const struct brw_device_info *devinfo, void *store, int offset)
}
static inline bool
is_3src(enum opcode opcode)
is_3src(const struct brw_device_info *devinfo, enum opcode opcode)
{
return opcode_descs[opcode].nsrc == 3;
}

View file

@ -968,7 +968,7 @@ brw_try_compact_instruction(const struct brw_device_info *devinfo,
assert(brw_inst_cmpt_control(devinfo, src) == 0);
if (is_3src(brw_inst_opcode(devinfo, src))) {
if (is_3src(devinfo, brw_inst_opcode(devinfo, src))) {
if (devinfo->gen >= 8) {
memset(&temp, 0, sizeof(temp));
if (brw_try_compact_3src_instruction(devinfo, &temp, src)) {
@ -1202,7 +1202,8 @@ brw_uncompact_instruction(const struct brw_device_info *devinfo, brw_inst *dst,
{
memset(dst, 0, sizeof(*dst));
if (devinfo->gen >= 8 && is_3src(brw_compact_inst_3src_opcode(devinfo, src))) {
if (devinfo->gen >= 8 &&
is_3src(devinfo, brw_compact_inst_3src_opcode(devinfo, src))) {
brw_uncompact_3src_instruction(devinfo, dst, src);
return;
}

View file

@ -5372,7 +5372,7 @@ fs_visitor::fixup_3src_null_dest()
bool progress = false;
foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
if (inst->is_3src() && inst->dst.is_null()) {
if (inst->is_3src(devinfo) && inst->dst.is_null()) {
inst->dst = fs_reg(VGRF, alloc.allocate(dispatch_width / 8),
inst->dst.type);
progress = true;

View file

@ -293,7 +293,7 @@ can_take_stride(fs_inst *inst, unsigned arg, unsigned stride,
* This is applicable to 32b datatypes and 16b datatype. 64b datatypes
* cannot use the replicate control.
*/
if (inst->is_3src()) {
if (inst->is_3src(devinfo)) {
if (type_sz(inst->src[arg].type) > 4)
return stride == 1;
else

View file

@ -737,9 +737,9 @@ backend_instruction::is_commutative() const
}
bool
backend_instruction::is_3src() const
backend_instruction::is_3src(const struct brw_device_info *devinfo) const
{
return ::is_3src(opcode);
return ::is_3src(devinfo, opcode);
}
bool

View file

@ -101,7 +101,7 @@ struct bblock_t;
#ifdef __cplusplus
struct backend_instruction : public exec_node {
bool is_3src() const;
bool is_3src(const struct brw_device_info *devinfo) const;
bool is_tex() const;
bool is_math() const;
bool is_control_flow() const;

View file

@ -1868,7 +1868,7 @@ vec4_visitor::convert_to_hw_regs()
src = reg;
}
if (inst->is_3src()) {
if (inst->is_3src(devinfo)) {
/* 3-src instructions with scalar sources support arbitrary subnr,
* but don't actually use swizzles. Convert swizzle into subnr.
*/

View file

@ -324,7 +324,7 @@ try_copy_propagate(const struct brw_device_info *devinfo,
unsigned composed_swizzle = brw_compose_swizzle(inst->src[arg].swizzle,
value.swizzle);
if (inst->is_3src() &&
if (inst->is_3src(devinfo) &&
(value.file == UNIFORM ||
(value.file == ATTR && attributes_per_reg != 1)) &&
!brw_is_single_value_swizzle(composed_swizzle))