From 3c0bf423818858f88bed9a0c252c0f8bdac734b2 Mon Sep 17 00:00:00 2001 From: David Heidelberg Date: Thu, 3 Oct 2024 00:13:46 +0900 Subject: [PATCH] util: add aarch64 fast half-float to float conversion Reviewed-by: Christian Gmeiner Signed-off-by: David Heidelberg Part-of: --- src/util/half_float.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/half_float.h b/src/util/half_float.h index 779cf08bccd..a74d9a632dc 100644 --- a/src/util/half_float.h +++ b/src/util/half_float.h @@ -81,6 +81,16 @@ _mesa_half_to_float(uint16_t val) __asm volatile("vcvtph2ps %1, %0" : "=v"(out) : "v"(in)); return out[0]; } +#elif defined(USE_AARCH64_ASM) + float result; + uint16_t in = val; + + __asm volatile( + "fcvt %s0, %h1\n" + : "=w"(result) + : "w"(in) + ); + return result; #endif return _mesa_half_to_float_slow(val); }