From 2091206ad3764c94317bd700cc551f9c31a2847d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 15 Jan 2018 14:51:43 +0100 Subject: ac: import lp_create_builder() from gallivm Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 29 ---------------------- src/gallium/auxiliary/gallivm/lp_bld_misc.h | 9 ------- .../drivers/radeonsi/si_shader_tgsi_setup.c | 8 +++--- 3 files changed, 4 insertions(+), 42 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 13194072902..79dbedbb565 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -813,32 +813,3 @@ lp_is_function(LLVMValueRef v) return llvm::isa(llvm::unwrap(v)); #endif } - -extern "C" LLVMBuilderRef -lp_create_builder(LLVMContextRef ctx, enum lp_float_mode float_mode) -{ - LLVMBuilderRef builder = LLVMCreateBuilderInContext(ctx); - -#if HAVE_LLVM >= 0x0308 - llvm::FastMathFlags flags; - - switch (float_mode) { - case LP_FLOAT_MODE_DEFAULT: - break; - case LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH: - flags.setNoSignedZeros(); - llvm::unwrap(builder)->setFastMathFlags(flags); - break; - case LP_FLOAT_MODE_UNSAFE_FP_MATH: -#if HAVE_LLVM >= 0x0600 - flags.setFast(); -#else - flags.setUnsafeAlgebra(); -#endif - llvm::unwrap(builder)->setFastMathFlags(flags); - break; - } -#endif - - return builder; -} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index 1b725d10d7c..ca5ba5c44f2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -76,15 +76,6 @@ lp_get_called_value(LLVMValueRef call); extern bool lp_is_function(LLVMValueRef v); -enum lp_float_mode { - LP_FLOAT_MODE_DEFAULT, - LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH, - LP_FLOAT_MODE_UNSAFE_FP_MATH, -}; - -extern LLVMBuilderRef -lp_create_builder(LLVMContextRef ctx, enum lp_float_mode float_mode); - #ifdef __cplusplus } #endif diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 2ca036e67d3..fc141ca1e03 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -1160,11 +1160,11 @@ void si_llvm_context_init(struct si_shader_context *ctx, LLVMDisposeMessage(data_layout_str); bool unsafe_fpmath = (sscreen->debug_flags & DBG(UNSAFE_MATH)) != 0; - enum lp_float_mode float_mode = - unsafe_fpmath ? LP_FLOAT_MODE_UNSAFE_FP_MATH : - LP_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH; + enum ac_float_mode float_mode = + unsafe_fpmath ? AC_FLOAT_MODE_UNSAFE_FP_MATH : + AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH; - ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context, + ctx->gallivm.builder = ac_create_builder(ctx->gallivm.context, float_mode); ac_llvm_context_init(&ctx->ac, ctx->gallivm.context, -- cgit v1.2.3