gallivm: (trivial) don't try to use rcp when the division 1/x is integer
authorRoland Scheidegger <sroland@vmware.com>
Mon, 8 Sep 2014 11:56:13 +0000 (13:56 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 8 Sep 2014 23:44:08 +0000 (01:44 +0200)
This would just crash. Noticed by accident while checking int divisions by zero
with a quickly hacked piglit test.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_arit.c

index 8f3b568775285b0698b89e20ce69e73e213135d9..f9c07998f28a321c66bd675a07c3d1e672814e74 100644 (file)
@@ -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;