gallivm: Use lp_build_div instead of lp_build_mul + lp_build_rcp.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 11 Aug 2010 14:13:17 +0000 (15:13 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 11 Aug 2010 14:14:10 +0000 (15:14 +0100)
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

index 665b010ecec88d96dfd94444814b5bc4a3475d1b..307506507dec2fae00c4c7a1f3cc7cdd50db4a6d 100644 (file)
@@ -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;
 }