From 5a482a7a3d1973f9c86a22f31050e2d2acbc8450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Mon, 22 Sep 2025 09:48:13 -0700 Subject: [PATCH] gallium/llvmpipe/test: Rename rsqrtf() to _rsqrtf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some versions of math.h exports rsqrtf() while others don't, so this was causing compilation to fail when it is supported. I have not found a easy way to detect if rsqrtf() is supported and as this is only used in a llvmpipe tests it is not worthy do changes in Meson files to detected if it is supported. So here just renaming the Mesa function to _rsqrtf() and fixing the build for both math.h versions. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13797 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12934 Reviewed-by: Roland Scheidegger Signed-off-by: José Roberto de Souza Part-of: --- src/gallium/drivers/llvmpipe/lp_test_arit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index 671a7cc56a5..971f33a70da 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -197,7 +197,8 @@ const float rcp_values[] = { }; -static float rsqrtf(float x) +/* Some versions of math.h exports rsqrtf() while others don't. */ +static float _rsqrtf(float x) { return 1.0/(float)sqrt(x); } @@ -323,7 +324,7 @@ unary_tests[] = { {"exp", &lp_build_exp, &expf, exp2_values, ARRAY_SIZE(exp2_values), 18.0 }, {"log", &lp_build_log_safe, &logf, log2_values, ARRAY_SIZE(log2_values), 20.0 }, {"rcp", &lp_build_rcp, &rcpf, rcp_values, ARRAY_SIZE(rcp_values), 20.0 }, - {"rsqrt", &lp_build_rsqrt, &rsqrtf, rsqrt_values, ARRAY_SIZE(rsqrt_values), 20.0 }, + {"rsqrt", &lp_build_rsqrt, &_rsqrtf, rsqrt_values, ARRAY_SIZE(rsqrt_values), 20.0 }, {"sin", &lp_build_sin, &sinf, sincos_values, ARRAY_SIZE(sincos_values), 20.0 }, {"cos", &lp_build_cos, &cosf, sincos_values, ARRAY_SIZE(sincos_values), 20.0 }, {"sgn", &lp_build_sgn, &sgnf, sgn_values, ARRAY_SIZE(sgn_values), 20.0 },