[Mesa-dev] [PATCH] spirv: Implement IsInf using an integer comparison

Dave Airlie airlied at gmail.com
Mon Mar 20 03:46:56 UTC 2017


On 17 March 2017 at 14:18, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Since we already do fabs on the one source, we're guaranteed to get
> positive infinity if we get any infinity at all.  Since +inf only has
> one IEEE 754 representation, we can use an integer comparison and avoid
> all of the ordered/unordered issues.

Seems to work fine here,

Reviewed-by: Dave Airlie <airlied at redhat.com>

>
> Cc: Dave Airlie <airlied at redhat.com>
> ---
>  src/compiler/spirv/vtn_alu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c
> index 0738fe0..9e4beed 100644
> --- a/src/compiler/spirv/vtn_alu.c
> +++ b/src/compiler/spirv/vtn_alu.c
> @@ -447,7 +447,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
>        break;
>
>     case SpvOpIsInf:
> -      val->ssa->def = nir_feq(&b->nb, nir_fabs(&b->nb, src[0]),
> +      val->ssa->def = nir_ieq(&b->nb, nir_fabs(&b->nb, src[0]),
>                                        nir_imm_float(&b->nb, INFINITY));
>        break;
>
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list