glsl: Drop the dead MOD_TO_FLOOR path.
It's now called lower_fmod in NIR. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
This commit is contained in:
@@ -38,7 +38,6 @@ struct gl_shader_program;
|
||||
#define FDIV_TO_MUL_RCP 0x02
|
||||
#define EXP_TO_EXP2 0x04
|
||||
#define LOG_TO_LOG2 0x10
|
||||
#define MOD_TO_FLOOR 0x20
|
||||
#define INT_DIV_TO_MUL_RCP 0x40
|
||||
#define LDEXP_TO_ARITH 0x80
|
||||
#define CARRY_TO_ARITH 0x100
|
||||
|
@@ -35,7 +35,6 @@
|
||||
* - INT_DIV_TO_MUL_RCP
|
||||
* - EXP_TO_EXP2
|
||||
* - LOG_TO_LOG2
|
||||
* - MOD_TO_FLOOR
|
||||
* - LDEXP_TO_ARITH
|
||||
* - CARRY_TO_ARITH
|
||||
* - BORROW_TO_ARITH
|
||||
@@ -74,10 +73,6 @@
|
||||
* do have base 2 versions, so this pass converts exp and log to exp2
|
||||
* and log2 operations.
|
||||
*
|
||||
* MOD_TO_FLOOR:
|
||||
* -------------
|
||||
* Breaks an ir_binop_mod expression down to (op0 - op1 * floor(op0 / op1))
|
||||
*
|
||||
* Many GPUs don't have a MOD instruction (945 and 965 included), and
|
||||
* if we have to break it down like this anyway, it gives an
|
||||
* opportunity to do things like constant fold the (1.0 / op1) easily.
|
||||
@@ -138,7 +133,6 @@ private:
|
||||
void sub_to_add_neg(ir_expression *);
|
||||
void div_to_mul_rcp(ir_expression *);
|
||||
void int_div_to_mul_rcp(ir_expression *);
|
||||
void mod_to_floor(ir_expression *);
|
||||
void exp_to_exp2(ir_expression *);
|
||||
void log_to_log2(ir_expression *);
|
||||
void ldexp_to_arith(ir_expression *);
|
||||
@@ -292,56 +286,6 @@ lower_instructions_visitor::log_to_log2(ir_expression *ir)
|
||||
this->progress = true;
|
||||
}
|
||||
|
||||
void
|
||||
lower_instructions_visitor::mod_to_floor(ir_expression *ir)
|
||||
{
|
||||
ir_variable *x = new(ir) ir_variable(ir->operands[0]->type, "mod_x",
|
||||
ir_var_temporary);
|
||||
ir_variable *y = new(ir) ir_variable(ir->operands[1]->type, "mod_y",
|
||||
ir_var_temporary);
|
||||
this->base_ir->insert_before(x);
|
||||
this->base_ir->insert_before(y);
|
||||
|
||||
ir_assignment *const assign_x =
|
||||
new(ir) ir_assignment(new(ir) ir_dereference_variable(x),
|
||||
ir->operands[0]);
|
||||
ir_assignment *const assign_y =
|
||||
new(ir) ir_assignment(new(ir) ir_dereference_variable(y),
|
||||
ir->operands[1]);
|
||||
|
||||
this->base_ir->insert_before(assign_x);
|
||||
this->base_ir->insert_before(assign_y);
|
||||
|
||||
ir_expression *const div_expr =
|
||||
new(ir) ir_expression(ir_binop_div, x->type,
|
||||
new(ir) ir_dereference_variable(x),
|
||||
new(ir) ir_dereference_variable(y));
|
||||
|
||||
/* Don't generate new IR that would need to be lowered in an additional
|
||||
* pass.
|
||||
*/
|
||||
if ((lowering(FDIV_TO_MUL_RCP) && ir->type->is_float_16_32()) ||
|
||||
(lowering(DDIV_TO_MUL_RCP) && ir->type->is_double()))
|
||||
div_to_mul_rcp(div_expr);
|
||||
|
||||
ir_expression *const floor_expr =
|
||||
new(ir) ir_expression(ir_unop_floor, x->type, div_expr);
|
||||
|
||||
if (lowering(DOPS_TO_DFRAC) && ir->type->is_double())
|
||||
dfloor_to_dfrac(floor_expr);
|
||||
|
||||
ir_expression *const mul_expr =
|
||||
new(ir) ir_expression(ir_binop_mul,
|
||||
new(ir) ir_dereference_variable(y),
|
||||
floor_expr);
|
||||
|
||||
ir->operation = ir_binop_sub;
|
||||
ir->init_num_operands();
|
||||
ir->operands[0] = new(ir) ir_dereference_variable(x);
|
||||
ir->operands[1] = mul_expr;
|
||||
this->progress = true;
|
||||
}
|
||||
|
||||
void
|
||||
lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
|
||||
{
|
||||
@@ -1766,11 +1710,6 @@ lower_instructions_visitor::visit_leave(ir_expression *ir)
|
||||
log_to_log2(ir);
|
||||
break;
|
||||
|
||||
case ir_binop_mod:
|
||||
if (lowering(MOD_TO_FLOOR) && ir->type->is_float_16_32_64())
|
||||
mod_to_floor(ir);
|
||||
break;
|
||||
|
||||
case ir_binop_ldexp:
|
||||
if (lowering(LDEXP_TO_ARITH) && ir->type->is_float())
|
||||
ldexp_to_arith(ir);
|
||||
|
@@ -1900,7 +1900,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
|
||||
unreachable("not reached: should be lowered by DIV_TO_MUL_RCP in the compiler");
|
||||
|
||||
case nir_op_fmod:
|
||||
unreachable("not reached: should be lowered by MOD_TO_FLOOR in the compiler");
|
||||
unreachable("not reached: should be lowered by lower_fmod in the compiler");
|
||||
|
||||
case nir_op_fsub:
|
||||
case nir_op_isub:
|
||||
|
Reference in New Issue
Block a user