spirv: Implement IsInf using an integer comparison
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 17 Mar 2017 04:18:10 +0000 (21:18 -0700)
committerDave Airlie <airlied@redhat.com>
Mon, 20 Mar 2017 04:08:19 +0000 (14:08 +1000)
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.

Cc: Dave Airlie <airlied@redhat.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/compiler/spirv/vtn_alu.c

index 0738fe0..9e4beed 100644 (file)
@@ -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;