Mesa (master): gallivm: Use lp_build_div instead of lp_build_mul + lp_build_rcp.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Aug 11 14:23:13 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Aug 11 15:13:17 2010 +0100

gallivm: Use lp_build_div instead of lp_build_mul + lp_build_rcp.

Single divide, so let lp_build_div decide how to implement this.

This will save a multiplication in architectures which don't have
a RCP intrinsic.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 665b010..3075065 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1219,8 +1219,7 @@ lp_build_cube_ima(struct lp_build_context *coord_bld, LLVMValueRef coord)
    /* ima = -0.5 / abs(coord); */
    LLVMValueRef negHalf = lp_build_const_vec(coord_bld->type, -0.5);
    LLVMValueRef absCoord = lp_build_abs(coord_bld, coord);
-   LLVMValueRef ima = lp_build_mul(coord_bld, negHalf,
-                                   lp_build_rcp(coord_bld, absCoord));
+   LLVMValueRef ima = lp_build_div(coord_bld, negHalf, absCoord);
    return ima;
 }
 




More information about the mesa-commit mailing list