aco: disable omod if the sign of zeros should be preserved

The RDNA ISA doc says that omod doesn't preserve -0.0 in 6.2.2. LLVM
appears to always disable omod in this situation, but clamp is unaffected.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: df645fa369 ("aco: implement VK_KHR_shader_float_controls")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7605>
This commit is contained in:
Rhys Perry 2020-11-13 15:10:58 +00:00 committed by Dylan Baker
parent 944bdf259c
commit e902dd8696
2 changed files with 6 additions and 2 deletions

View file

@ -7546,7 +7546,7 @@
"description": "aco: disable omod if the sign of zeros should be preserved",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 3,
"master_sha": null,
"because_sha": "df645fa369d12be4d5e0fd9e4f6d4455caf2f4c3"
},

View file

@ -2539,7 +2539,11 @@ bool apply_omod_clamp(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
/* apply omod / clamp modifiers if the def is used only once and the instruction can have modifiers */
if (!instr->definitions.empty() && ctx.uses[instr->definitions[0].tempId()] == 1 &&
can_use_VOP3(ctx, instr) && instr_info.can_use_output_modifiers[(int)instr->opcode]) {
bool can_use_omod = (instr->definitions[0].bytes() == 4 ? block.fp_mode.denorm32 : block.fp_mode.denorm16_64) == 0;
bool can_use_omod;
if (instr->definitions[0].bytes() == 4)
can_use_omod = block.fp_mode.denorm32 == 0 && !block.fp_mode.preserve_signed_zero_inf_nan32;
else
can_use_omod = block.fp_mode.denorm16_64 == 0 && !block.fp_mode.preserve_signed_zero_inf_nan16_64;
ssa_info& def_info = ctx.info[instr->definitions[0].tempId()];
if (can_use_omod && def_info.is_omod2() && ctx.uses[def_info.temp.id()]) {
to_VOP3(ctx, instr);