This also fixes the inverted last parameter of nir_lower_flrp in most drivers.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6599>
- path: godot/Material Testers.x86_64_2020.04.08_13.38_frame799.rdc
expectations:
- device: gl-radeonsi-stoney
- checksum: 2ddcda6b1c136ce1448714a3ff8432eb
+ checksum: 5164e238381e7d77a64e3de771cc005f
- path: gputest/gimark.trace
expectations:
- device: gl-radeonsi-stoney
shader,
nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- shader->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, shader,
nir_opt_constant_folding);
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- s->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, s, nir_opt_constant_folding);
progress = true;
bool nir_lower_alu(nir_shader *shader);
bool nir_lower_flrp(nir_shader *shader, unsigned lowering_mask,
- bool always_precise, bool have_ffma);
+ bool always_precise);
bool nir_lower_alu_to_scalar(nir_shader *shader, nir_instr_filter_cb cb, const void *data);
bool nir_lower_bool_to_bitsize(nir_shader *shader);
convert_flrp_instruction(nir_builder *bld,
struct u_vector *dead_flrp,
nir_alu_instr *alu,
- bool always_precise,
- bool have_ffma)
+ bool always_precise)
{
+ bool have_ffma = !bld->shader->options->lower_ffma;
+
bld->cursor = nir_before_instr(&alu->instr);
/* There are two methods to implement flrp(x, y, t). The strictly correct
lower_flrp_impl(nir_function_impl *impl,
struct u_vector *dead_flrp,
unsigned lowering_mask,
- bool always_precise,
- bool have_ffma)
+ bool always_precise)
{
nir_builder b;
nir_builder_init(&b, impl);
if (alu->op == nir_op_flrp &&
(alu->dest.dest.ssa.bit_size & lowering_mask)) {
- convert_flrp_instruction(&b, dead_flrp, alu, always_precise,
- have_ffma);
+ convert_flrp_instruction(&b, dead_flrp, alu, always_precise);
}
}
}
bool
nir_lower_flrp(nir_shader *shader,
unsigned lowering_mask,
- bool always_precise,
- bool have_ffma)
+ bool always_precise)
{
struct u_vector dead_flrp;
nir_foreach_function(function, shader) {
if (function->impl) {
lower_flrp_impl(function->impl, &dead_flrp, lowering_mask,
- always_precise, have_ffma);
+ always_precise);
}
}
if (lower_flrp != 0) {
if (OPT(s, nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- s->options->lower_ffma)) {
+ false /* always_precise */)) {
OPT(s, nir_opt_constant_folding);
progress = true;
}
NIR_PASS_V(sel->nir, nir_lower_int64);
NIR_PASS_V(sel->nir, nir_opt_vectorize, NULL, NULL);
}
- NIR_PASS_V(sel->nir, nir_lower_flrp, ~0, false, false);
+ NIR_PASS_V(sel->nir, nir_lower_flrp, ~0, false);
}
nir_tgsi_scan_shader(sel->nir, &sel->info, true);
assert(lower_flrp);
bool lower_flrp_progress = false;
- NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */,
- nir->options->lower_ffma);
+ NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp, lower_flrp, false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir, nir_opt_constant_folding);
progress = true;
NIR_PASS(lower_flrp_progress, s, nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- s->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, s, nir_opt_constant_folding);
progress = true;
do {
progress = false;
- progress |= OPT(nir_lower_flrp, 32|64, true, false);
+ progress |= OPT(nir_lower_flrp, 32|64, true);
progress |= OPT(nir_split_array_vars, nir_var_function_temp);
progress |= OPT(nir_shrink_vec_array_vars, nir_var_function_temp);
progress |= OPT(nir_opt_deref);
if (lower_flrp != 0) {
if (OPT(nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- compiler->devinfo->gen >= 6)) {
+ false /* always_precise */)) {
OPT(nir_opt_constant_folding);
}
NIR_PASS(lower_flrp_progress, nir, nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- nir->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir,
nir_opt_constant_folding);
nir,
nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- nir->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir,
nir_opt_constant_folding);
nir,
nir_lower_flrp,
lower_flrp,
- false /* always_precise */,
- nir->options->lower_ffma);
+ false /* always_precise */);
if (lower_flrp_progress) {
NIR_PASS(progress, nir,
nir_opt_constant_folding);