brw: Fix try_rebuild_source's ult32/ushr handling to use unsigned types

We were accidentally doing a signed integer comparison here for ult32,
or a sign-extending shift for ushr.

One notable bit of fallout was that load_global_uniform_block_intel
address calculations broke on platforms that don't have native 64-bit
integer support, as the iadd64 lowering for "do I need to carry?" was
using ult32...and performing the wrong comparison.  We spotted this in
Borderlands 3 on Alchemist once we turned on other optimizations.

Thanks to Lionel Landwerlin for helping spot the problem!

Fixes: c7b312ad45 ("brw: factor out source extraction for rematerialization")
Fixes: 339630ab05 ("brw: enable A64 loads source rematerialization")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31995>
This commit is contained in:
Kenneth Graunke 2024-11-18 01:29:50 -08:00 committed by Marge Bot
parent 0a376a672a
commit 5848035443

View file

@ -4816,7 +4816,7 @@ try_rebuild_source(nir_to_brw_state &ntb, const brw::fs_builder &bld,
}
case nir_op_ushr: {
enum brw_reg_type utype =
brw_type_with_size(srcs[0].type,
brw_type_with_size(BRW_TYPE_UD,
brw_type_size_bits(srcs[0].type));
ubld.SHR(retype(srcs[0], utype),
retype(srcs[1], utype),
@ -4834,10 +4834,10 @@ try_rebuild_source(nir_to_brw_state &ntb, const brw::fs_builder &bld,
case nir_op_ult32: {
if (brw_type_size_bits(srcs[0].type) != 32)
break;
brw_reg dst = ubld.vgrf(srcs[0].type);
enum brw_reg_type utype =
brw_type_with_size(srcs[0].type,
brw_type_with_size(BRW_TYPE_UD,
brw_type_size_bits(srcs[0].type));
brw_reg dst = ubld.vgrf(utype);
ntb.resource_insts[def->index] =
ubld.CMP(dst,
retype(srcs[0], utype),