Mesa (master): gallivm: (trivial) don't try to use rcp when the division 1 /x is integer

Roland Scheidegger sroland at kemper.freedesktop.org
Mon Sep 8 23:45:25 UTC 2014


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Mon Sep  8 13:56:13 2014 +0200

gallivm: (trivial) don't try to use rcp when the division 1/x is integer

This would just crash. Noticed by accident while checking int divisions by zero
with a quickly hacked piglit test.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 8f3b568..f9c0799 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1073,7 +1073,7 @@ lp_build_div(struct lp_build_context *bld,
 
    if(a == bld->zero)
       return bld->zero;
-   if(a == bld->one)
+   if(a == bld->one && type.floating)
       return lp_build_rcp(bld, b);
    if(b == bld->zero)
       return bld->undef;




More information about the mesa-commit mailing list