[Mesa-dev] [PATCH 2/3] gallivm: don't try to use fast rcp for fdiv

Jose Fonseca jfonseca at vmware.com
Mon Jan 23 17:54:35 UTC 2017


On 23/01/17 17:47, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> The use of fast rcp instruction is disabled, and will always fall back
> to use a division instead (1 / x). Hence, if we get a division opcode,
> it doesn't make much sense trying to split that into rcp/mul.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_arit.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> index 5553cb1..04f86be 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
> @@ -1372,7 +1372,9 @@ lp_build_div(struct lp_build_context *bld,
>           return LLVMConstUDiv(a, b);
>     }
>
> -   if(((util_cpu_caps.has_sse && type.width == 32 && type.length == 4) ||
> +   /* fast rcp is disabled (just uses div), so makes no sense to try that */
> +   if(FALSE &&
> +      ((util_cpu_caps.has_sse && type.width == 32 && type.length == 4) ||
>         (util_cpu_caps.has_avx && type.width == 32 && type.length == 8)) &&
>        type.floating)
>        return lp_build_mul(bld, a, lp_build_rcp(bld, b));
>

Good catch.  Series looks good to me.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list