diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 890d0a9bbdd..cee1bb19626 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -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); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 6c514838f0e..6f39c59b04b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -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, ""); }