vc4: Add a QIR helper for whether the op is a MUL type.

This commit is contained in:
Eric Anholt 2015-08-18 21:43:42 -07:00
parent fd74da11c4
commit 572a48366d
3 changed files with 16 additions and 4 deletions

View file

@ -169,6 +169,18 @@ qir_is_multi_instruction(struct qinst *inst)
return qir_op_info[inst->op].multi_instruction;
}
bool
qir_is_mul(struct qinst *inst)
{
switch (inst->op) {
case QOP_FMUL:
case QOP_MUL24:
return true;
default:
return false;
}
}
bool
qir_is_tex(struct qinst *inst)
{

View file

@ -452,6 +452,7 @@ bool qir_reg_equals(struct qreg a, struct qreg b);
bool qir_has_side_effects(struct vc4_compile *c, struct qinst *inst);
bool qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst);
bool qir_is_multi_instruction(struct qinst *inst);
bool qir_is_mul(struct qinst *inst);
bool qir_is_tex(struct qinst *inst);
bool qir_depends_on_flags(struct qinst *inst);
bool qir_writes_r4(struct qinst *inst);

View file

@ -179,10 +179,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
static const struct {
uint32_t op;
bool is_mul;
} translate[] = {
#define A(name) [QOP_##name] = {QPU_A_##name, false}
#define M(name) [QOP_##name] = {QPU_M_##name, true}
#define A(name) [QOP_##name] = {QPU_A_##name}
#define M(name) [QOP_##name] = {QPU_M_##name}
A(FADD),
A(FSUB),
A(FMIN),
@ -504,7 +503,7 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
fixup_raddr_conflict(c, dst, &src[0], &src[1]);
if (translate[qinst->op].is_mul) {
if (qir_is_mul(qinst)) {
queue(c, qpu_m_alu2(translate[qinst->op].op,
dst,
src[0], src[1]));