gallivm: don't optimize fadd(a, 0.0) with signed zero preserve

Fixes: 540e84bedb ("gallivm: Preserve -0 and nan")
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
(cherry picked from commit 284b4143f7)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
Georg Lehmann 2026-03-19 18:33:22 +01:00 committed by Eric Engestrom
parent d5f9f12123
commit 6462dac37d
3 changed files with 10 additions and 5 deletions

View file

@ -3444,7 +3444,7 @@
"description": "gallivm: don't optimize fadd(a, 0.0) with signed zero preserve",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "540e84bedbfbc884ce982640f7da9319441a4aa0",
"notes": null

View file

@ -413,10 +413,12 @@ lp_build_add(struct lp_build_context *bld,
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
if (a == bld->zero)
return b;
if (b == bld->zero)
return a;
if (!type.floating || !type.signed_zero_preserve) {
if (a == bld->zero)
return b;
if (b == bld->zero)
return a;
}
if (a == bld->undef || b == bld->undef)
return bld->undef;

View file

@ -29,3 +29,6 @@ dEQP-VK.mesh_shader.ext.smoke.monolithic.depth_only_points_position_components,F
dEQP-VK.mesh_shader.ext.smoke.monolithic.depth_only_triangles_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.optimized_lib.depth_only_points_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.optimized_lib.depth_only_triangles_position_components,Fail
# CTS bug
dEQP-VK.spirv_assembly.instruction.graphics.float_controls2.fp32.input_args.reflect_testedWithout_NSZ_arg1_minusZero_arg2_one_res_minusZero_deco_vert,Fail