NIR_PASS(progress, shader, nir_opt_copy_prop_vars);
NIR_PASS(progress, shader, nir_opt_dead_write_vars);
- NIR_PASS_V(shader, nir_lower_alu_to_scalar);
+ NIR_PASS_V(shader, nir_lower_alu_to_scalar, NULL);
NIR_PASS_V(shader, nir_lower_phis_to_scalar);
NIR_PASS(progress, shader, nir_copy_prop);
progress = false;
NIR_PASS_V(s, nir_lower_vars_to_ssa);
- NIR_PASS(progress, s, nir_lower_alu_to_scalar);
+ NIR_PASS(progress, s, nir_lower_alu_to_scalar, NULL);
NIR_PASS(progress, s, nir_lower_phis_to_scalar);
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_remove_phis);
bool nir_lower_flrp(nir_shader *shader, unsigned lowering_mask,
bool always_precise, bool have_ffma);
-bool nir_lower_alu_to_scalar(nir_shader *shader);
+bool nir_lower_alu_to_scalar(nir_shader *shader, BITSET_WORD *lower_set);
bool nir_lower_bool_to_float(nir_shader *shader);
bool nir_lower_bool_to_int32(nir_shader *shader);
bool nir_lower_int_to_float(nir_shader *shader);
}
static bool
-lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
+lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b, BITSET_WORD *lower_set)
{
unsigned num_src = nir_op_infos[instr->op].num_inputs;
unsigned i, chan;
b->cursor = nir_before_instr(&instr->instr);
b->exact = instr->exact;
+ if (lower_set && !BITSET_TEST(lower_set, instr->op))
+ return false;
+
#define LOWER_REDUCTION(name, chan, merge) \
case name##2: \
case name##3: \
}
static bool
-nir_lower_alu_to_scalar_impl(nir_function_impl *impl)
+nir_lower_alu_to_scalar_impl(nir_function_impl *impl, BITSET_WORD *lower_set)
{
nir_builder builder;
nir_builder_init(&builder, impl);
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_alu) {
progress = lower_alu_instr_scalar(nir_instr_as_alu(instr),
- &builder) || progress;
+ &builder,
+ lower_set) || progress;
}
}
}
}
bool
-nir_lower_alu_to_scalar(nir_shader *shader)
+nir_lower_alu_to_scalar(nir_shader *shader, BITSET_WORD *lower_set)
{
bool progress = false;
nir_foreach_function(function, shader) {
if (function->impl)
- progress = nir_lower_alu_to_scalar_impl(function->impl) || progress;
+ progress = nir_lower_alu_to_scalar_impl(function->impl,
+ lower_set) || progress;
}
return progress;
OPT_V(s, nir_lower_vars_to_ssa);
progress |= OPT(s, nir_opt_copy_prop_vars);
progress |= OPT(s, nir_opt_dead_write_vars);
- progress |= OPT(s, nir_lower_alu_to_scalar);
+ progress |= OPT(s, nir_lower_alu_to_scalar, NULL);
progress |= OPT(s, nir_lower_phis_to_scalar);
progress |= OPT(s, nir_copy_prop);
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
if (scalar) {
- NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+ NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL);
NIR_PASS_V(nir, nir_lower_phis_to_scalar);
}
progress = false;
NIR_PASS_V(s, nir_lower_vars_to_ssa);
- NIR_PASS(progress, s, nir_lower_alu_to_scalar);
+ NIR_PASS(progress, s, nir_lower_alu_to_scalar, NULL);
NIR_PASS(progress, s, nir_lower_phis_to_scalar);
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_remove_phis);
progress = false;
NIR_PASS_V(s, nir_lower_vars_to_ssa);
- //NIR_PASS(progress, s, nir_lower_alu_to_scalar);
+ //NIR_PASS(progress, s, nir_lower_alu_to_scalar, NULL);
NIR_PASS(progress, s, nir_lower_phis_to_scalar);
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_remove_phis);
NIR_PASS_V(nir, nir_lower_regs_to_ssa);
NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
- NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+ NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL);
NIR_PASS_V(nir, nir_lower_phis_to_scalar);
do {
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
NIR_PASS(progress, nir, nir_opt_dead_write_vars);
- NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+ NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL);
NIR_PASS_V(nir, nir_lower_phis_to_scalar);
/* (Constant) copy propagation is needed for txf with offsets. */
progress = false;
NIR_PASS_V(s, nir_lower_vars_to_ssa);
- NIR_PASS(progress, s, nir_lower_alu_to_scalar);
+ NIR_PASS(progress, s, nir_lower_alu_to_scalar, NULL);
NIR_PASS(progress, s, nir_lower_phis_to_scalar);
NIR_PASS(progress, s, nir_copy_prop);
NIR_PASS(progress, s, nir_opt_remove_phis);
OPT(nir_opt_combine_stores, nir_var_all);
if (is_scalar) {
- OPT(nir_lower_alu_to_scalar);
+ OPT(nir_lower_alu_to_scalar, NULL);
}
OPT(nir_copy_prop);
const bool is_scalar = compiler->scalar_stage[nir->info.stage];
if (is_scalar) {
- OPT(nir_lower_alu_to_scalar);
+ OPT(nir_lower_alu_to_scalar, NULL);
}
if (nir->info.stage == MESA_SHADER_GEOMETRY)
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
if (scalar) {
- NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+ NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL);
NIR_PASS_V(nir, nir_lower_phis_to_scalar);
}
NIR_PASS_V(nir, nir_lower_var_copies);
if (is_scalar) {
- NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+ NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL);
}
/* before buffers and vars_to_ssa */