Mesa (master): spirv: Implement IsInf using an integer comparison

Dave Airlie airlied at kemper.freedesktop.org
Mon Mar 20 04:08:33 UTC 2017


Module: Mesa
Branch: master
Commit: fcca6a83cddfdd7b82b9a7e0412c060d0830e3c3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fcca6a83cddfdd7b82b9a7e0412c060d0830e3c3

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Mar 16 21:18:10 2017 -0700

spirv: Implement IsInf using an integer comparison

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 at redhat.com>
Reviewed-by: Elie Tournier <elie.tournier at collabora.com>
Reviewed-by: 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 0738fe0cf9..9e4beedf92 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;
 




More information about the mesa-commit mailing list