All the current lowerings produce their result using a floating-point
multiply or add, so denorms should already be flushed (e.g.
nir_op_frcp), or they never produce a denorm (e.g. nir_op_ftrunc), so
I don't think this is necessary.
On Wed, Dec 5, 2018 at 4:56 PM Samuel Iglesias Gonsálvez
<sigles...@igalia.com> wrote:
>
> Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com>
> ---
>  src/compiler/nir/nir_lower_double_ops.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/compiler/nir/nir_lower_double_ops.c 
> b/src/compiler/nir/nir_lower_double_ops.c
> index b3543bc6963..97b825d2fdb 100644
> --- a/src/compiler/nir/nir_lower_double_ops.c
> +++ b/src/compiler/nir/nir_lower_double_ops.c
> @@ -558,6 +558,18 @@ lower_doubles_instr(nir_alu_instr *instr, 
> nir_lower_doubles_options options)
>        unreachable("unhandled opcode");
>     }
>
> +   bool denorm_flush_to_zero =
> +      bld.shader->info.shader_float_controls_execution_mode & 
> SHADER_DENORM_FLUSH_TO_ZERO_FP64;
> +   if (denorm_flush_to_zero) {
> +      /* TODO: add support for flushing negative denorms to -0.0 */
> +      /* Flush to zero if the result value is a denorm */
> +      result = nir_bcsel(&bld,
> +                      nir_flt(&bld, nir_fabs(&bld, result),
> +                              nir_imm_double(&bld, 
> 2.22507385850720138309023271733e-308)),
> +                      nir_imm_double(&bld, 0.0),
> +                      result);
> +   }
> +
>     nir_ssa_def_rewrite_uses(&instr->dest.dest.ssa, nir_src_for_ssa(result));
>     nir_instr_remove(&instr->instr);
>     return true;
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to