r300: add some more early bool lowering

We can't call nir_lower_bool_to_float too early, because some other
passes like nir_opt_peephole_select will blow up, but we can still do
some selected parts to enable some optimiazions at a later point
(like fcsel(a,b,0) into fmul), etc.

No change in shader-db with RV370 or RV530 at this point.

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26816>
This commit is contained in:
Pavel Ondračka
2023-09-21 21:53:04 +02:00
parent 024491f60f
commit ddcf29202d
@@ -126,6 +126,14 @@ def main():
(('bcsel@32(is_only_used_as_float)', ignore_exact('fge', 'a@32', 'b@32'), c, d),
('fadd', ('fmul', c, ('sge', a, b)), ('fsub', d, ('fmul', d, ('sge', a, b)))),
"!options->has_fused_comp_and_csel"),
(('bcsel@32(is_only_used_as_float)', ('feq', 'a@32', 'b@32'), c, d),
('fcsel', ('seq', a, b), c, d), "options->has_fused_comp_and_csel"),
(('bcsel@32(is_only_used_as_float)', ('fneu', 'a@32', 'b@32'), c, d),
('fcsel', ('sne', a, b), c, d), "options->has_fused_comp_and_csel"),
(('bcsel@32(is_only_used_as_float)', ('flt', 'a@32', 'b@32'), c, d),
('fcsel', ('slt', a, b), c, d), "options->has_fused_comp_and_csel"),
(('bcsel@32(is_only_used_as_float)', ('fge', 'a@32', 'b@32'), c, d),
('fcsel', ('sge', a, b), c, d), "options->has_fused_comp_and_csel"),
]
with open(args.output, 'w') as f: