From 66f48f2216168e2de0dbe2041b8ddf73b12f6ac9 Mon Sep 17 00:00:00 2001 From: Aleksi Sapon Date: Fri, 26 Jul 2024 10:00:54 -0400 Subject: [PATCH] llvmpipe: half_to_float use LLVM fpext when fp16 is available Generalize the use of LLVM's fpext for converting fp16 <-> fp32 to any target machine that supports fp16, instead of only checking for a specific x86 extension. This enables the use of fcvtl on Aarch64. More architectures could be supported by updating lp_has_fp16(). Reviewed-by: Konstantin Seurer Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index cee1bb19626..de2d9fbcbdf 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -76,6 +76,7 @@ #include "lp_bld_intr.h" #include "lp_bld_printf.h" #include "lp_bld_format.h" +#include "lp_bld_limits.h" /* the lp_test_format test fails on mingw/i686 at -O2 with gcc 10.x @@ -111,9 +112,8 @@ lp_build_half_to_float(struct gallivm_state *gallivm, LLVMTypeRef ext_int_vec_type = lp_build_vec_type(gallivm, i32_type); LLVMValueRef h; - if (util_get_cpu_caps()->has_f16c && - (src_length == 4 || src_length == 8)) { - if (LLVM_VERSION_MAJOR < 11) { + if (lp_has_fp16() && (src_length == 4 || src_length == 8)) { + if (util_get_cpu_caps()->has_f16c && LLVM_VERSION_MAJOR < 11) { const char *intrinsic = NULL; if (src_length == 4) { src = lp_build_pad_vector(gallivm, src, 8);