[Mesa-dev] [PATCH 3/3] gallivm: (trivial) don't try to use rcp when the division 1/x is integer

Jose Fonseca jfonseca at vmware.com
Mon Sep 8 11:10:40 PDT 2014


Series looks good to me too.

Jose

________________________________________
From: sroland at vmware.com <sroland at vmware.com>
Sent: 08 September 2014 12:56
To: Jose Fonseca; mesa-dev at lists.freedesktop.org
Cc: Roland Scheidegger
Subject: [PATCH 3/3] gallivm: (trivial) don't try to use rcp when the division 1/x is integer

From: Roland Scheidegger <sroland at vmware.com>

This would just crash. Noticed by accident while checking int divisions by zero
with a quickly hacked piglit test.
---
 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;
--
1.9.1


More information about the mesa-dev mailing list