intel/vec4: Refactor operand fixing for ffma and flrp
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -242,6 +242,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
src_reg emit_uniformize(const src_reg &src);
|
src_reg emit_uniformize(const src_reg &src);
|
||||||
|
|
||||||
|
/** Fix all float operands of a 3-source instruction. */
|
||||||
|
void fix_float_operands(src_reg op[3]);
|
||||||
|
|
||||||
src_reg fix_3src_operand(const src_reg &src);
|
src_reg fix_3src_operand(const src_reg &src);
|
||||||
src_reg resolve_source_modifiers(const src_reg &src);
|
src_reg resolve_source_modifiers(const src_reg &src);
|
||||||
|
|
||||||
|
@@ -1130,6 +1130,17 @@ try_immediate_source(const nir_alu_instr *instr, src_reg *op,
|
|||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vec4_visitor::fix_float_operands(src_reg op[3])
|
||||||
|
{
|
||||||
|
bool fixed[3] = { false, false, false };
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < 3; i++) {
|
||||||
|
if (!fixed[i])
|
||||||
|
op[i] = fix_3src_operand(op[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
||||||
{
|
{
|
||||||
@@ -1916,20 +1927,14 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
|||||||
inst = emit(ADD(dst, src_reg(mul_dst), op[2]));
|
inst = emit(ADD(dst, src_reg(mul_dst), op[2]));
|
||||||
inst->saturate = instr->dest.saturate;
|
inst->saturate = instr->dest.saturate;
|
||||||
} else {
|
} else {
|
||||||
op[0] = fix_3src_operand(op[0]);
|
fix_float_operands(op);
|
||||||
op[1] = fix_3src_operand(op[1]);
|
|
||||||
op[2] = fix_3src_operand(op[2]);
|
|
||||||
|
|
||||||
inst = emit(MAD(dst, op[2], op[1], op[0]));
|
inst = emit(MAD(dst, op[2], op[1], op[0]));
|
||||||
inst->saturate = instr->dest.saturate;
|
inst->saturate = instr->dest.saturate;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_op_flrp:
|
case nir_op_flrp:
|
||||||
op[0] = fix_3src_operand(op[0]);
|
fix_float_operands(op);
|
||||||
op[1] = fix_3src_operand(op[1]);
|
|
||||||
op[2] = fix_3src_operand(op[2]);
|
|
||||||
|
|
||||||
inst = emit(LRP(dst, op[2], op[1], op[0]));
|
inst = emit(LRP(dst, op[2], op[1], op[0]));
|
||||||
inst->saturate = instr->dest.saturate;
|
inst->saturate = instr->dest.saturate;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user