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 <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30267>
This commit is contained in:
Aleksi Sapon 2024-07-26 10:00:54 -04:00 committed by Marge Bot
parent 2db280b208
commit 66f48f2216

View file

@ -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);