gallium/llvmpipe/test: Rename rsqrtf() to _rsqrtf()

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 <roland.scheidegger@broadcom.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37515>
This commit is contained in:
José Roberto de Souza
2025-09-22 09:48:13 -07:00
committed by Marge Bot
parent dd7ae41091
commit 5a482a7a3d
+3 -2
View File
@@ -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 },