mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
gallivm: Fix LLVMPipe codegen issues discovered on Apple Silicon
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Roland Scheidegger <roland.scheidegger@broadcom.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30108>
This commit is contained in:
parent
2f49284cfa
commit
fd0592afd3
2 changed files with 20 additions and 6 deletions
|
|
@ -105,8 +105,10 @@ lp_build_half_to_float(struct gallivm_state *gallivm,
|
|||
LLVMGetVectorSize(src_type) : 1;
|
||||
|
||||
struct lp_type f32_type = lp_type_float_vec(32, 32 * src_length);
|
||||
struct lp_type i16_type = lp_type_int_vec(16, 16 * src_length);
|
||||
struct lp_type i32_type = lp_type_int_vec(32, 32 * src_length);
|
||||
LLVMTypeRef int_vec_type = lp_build_vec_type(gallivm, i32_type);
|
||||
LLVMTypeRef int_vec_type = lp_build_vec_type(gallivm, i16_type);
|
||||
LLVMTypeRef ext_int_vec_type = lp_build_vec_type(gallivm, i32_type);
|
||||
LLVMValueRef h;
|
||||
|
||||
if (util_get_cpu_caps()->has_f16c &&
|
||||
|
|
@ -140,7 +142,8 @@ lp_build_half_to_float(struct gallivm_state *gallivm,
|
|||
}
|
||||
}
|
||||
|
||||
h = LLVMBuildZExt(builder, src, int_vec_type, "");
|
||||
src = LLVMBuildBitCast(builder, src, int_vec_type, "");
|
||||
h = LLVMBuildZExt(builder, src, ext_int_vec_type, "");
|
||||
return lp_build_smallfloat_to_float(gallivm, f32_type, h, 10, 5, 0, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,25 @@
|
|||
#include "lp_bld_printf.h"
|
||||
#include "lp_bld_type.h"
|
||||
|
||||
|
||||
static LLVMTypeRef
|
||||
lp_build_printf_hook_type(struct gallivm_state *gallivm)
|
||||
{
|
||||
LLVMTypeRef format_type = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
|
||||
return LLVMFunctionType(LLVMVoidTypeInContext(gallivm->context), &format_type, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
void lp_init_printf_hook(struct gallivm_state *gallivm)
|
||||
{
|
||||
if (gallivm->debug_printf_hook)
|
||||
return;
|
||||
LLVMTypeRef printf_type = LLVMFunctionType(LLVMInt32TypeInContext(gallivm->context), NULL, 0, 1);
|
||||
gallivm->debug_printf_hook = LLVMAddFunction(gallivm->module, "debug_printf", printf_type);
|
||||
|
||||
gallivm->debug_printf_hook = LLVMAddFunction(gallivm->module, "debug_printf",
|
||||
lp_build_printf_hook_type(gallivm));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates LLVM IR to call debug_printf.
|
||||
*/
|
||||
|
|
@ -71,8 +82,8 @@ lp_build_print_args(struct gallivm_state* gallivm,
|
|||
}
|
||||
|
||||
lp_init_printf_hook(gallivm);
|
||||
LLVMTypeRef printf_type = LLVMFunctionType(LLVMInt32TypeInContext(gallivm->context), NULL, 0, 1);
|
||||
return LLVMBuildCall2(builder, printf_type, gallivm->debug_printf_hook, args, argcount, "");
|
||||
return LLVMBuildCall2(builder, lp_build_printf_hook_type(gallivm),
|
||||
gallivm->debug_printf_hook, args, argcount, "");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue