[Mesa-dev] [PATCH 3/6] gallivm: Use INFINITY directly.

Matt Turner mattst88 at gmail.com
Wed Mar 18 10:12:20 PDT 2015


On Wed, Mar 18, 2015 at 9:34 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
> Already done below.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_arit.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> index cd05f11..0d4eaea 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> @@ -2564,16 +2564,9 @@ lp_build_rsqrt(struct lp_build_context *bld,
>            * All numbers smaller than FLT_MIN will result in +infinity
>            * (rsqrtps treats all denormals as zero).
>            */
> -         /*
> -          * Certain non-c99 compilers don't know INFINITY and might not support
> -          * hacks to evaluate it at compile time neither.
> -          */
> -         const unsigned posinf_int = 0x7F800000;
>           LLVMValueRef cmp;
>           LLVMValueRef flt_min = lp_build_const_vec(bld->gallivm, type, FLT_MIN);
> -         LLVMValueRef inf = lp_build_const_int_vec(bld->gallivm, type, posinf_int);
> -
> -         inf = LLVMBuildBitCast(builder, inf, lp_build_vec_type(bld->gallivm, type), "");
> +         LLVMValueRef inf = lp_build_const_vec(bld->gallivm, type, INFINITY);
>
>           for (i = 0; i < num_iterations; ++i) {
>              res = lp_build_rsqrt_refine(bld, a, res);
> --
> 2.1.0

Oh good. I noticed just yesterday that we avoid INFINITY and use
instead std::numeric_limits<float>::infinity() in the GLSL compiler,
presumably because of MSVC.

I'll send a patch for that.


More information about the mesa-dev mailing list