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 Marge Bot
parent 5c8fc0b1f4
commit 558daa73f9

View file

@ -2606,9 +2606,14 @@ bool apply_omod_clamp(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
if (!instr->isSDWA() && !can_vop3)
return false;
/* omod has no effect if denormals are enabled */
bool can_use_omod = (instr->definitions[0].bytes() == 4 ? block.fp_mode.denorm32 : block.fp_mode.denorm16_64) == 0;
can_use_omod = can_use_omod && (can_vop3 || ctx.program->chip_class >= GFX9); /* SDWA omod is GFX9+ */
/* omod flushes -0 to +0 and has no effect if denormals are enabled */
bool can_use_omod = (can_vop3 || ctx.program->chip_class >= GFX9); /* SDWA omod is GFX9+ */
if (instr->definitions[0].bytes() == 4)
can_use_omod = can_use_omod && block.fp_mode.denorm32 == 0 &&
!block.fp_mode.preserve_signed_zero_inf_nan32;
else
can_use_omod = 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()];