diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2015-07-29 21:40:52 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2015-07-29 21:40:52 +0000 |
commit | 4fa18fdde3a2b51b2371064bc27729fd1038c219 (patch) | |
tree | 087b40ee94913536a0911b0043069fca5e29ee7f | |
parent | a3b53beaa0351cf1322c6e1a580dc7cc3d0cad0c (diff) |
XXX: Fastmathfast-math
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 5e25819ac55..114e7da8e8c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -150,6 +150,15 @@ lp_set_store_alignment(LLVMValueRef Inst, llvm::unwrap<llvm::StoreInst>(Inst)->setAlignment(Align); } +extern "C" +void +lp_set_fast_math_flags(LLVMValueRef Inst) +{ + llvm::Instruction *I = llvm::unwrap<llvm::Instruction>(Inst); + llvm::FastMathFlags Flags; + Flags.setUnsafeAlgebra(); + I->setFastMathFlags(Flags); +} #if HAVE_LLVM < 0x0306 typedef llvm::JITMemoryManager BaseMemoryManager; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index 36923aa423f..23c14be1125 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -49,6 +49,8 @@ lp_set_target_options(void); extern LLVMValueRef lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal, const char *Name); +extern void +lp_set_fast_math_flags(LLVMValueRef Inst); extern int lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c index 0ad78b0ace2..cfc215c73bc 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c @@ -47,6 +47,7 @@ #include "lp_bld_const.h" #include "lp_bld_gather.h" #include "lp_bld_logic.h" +#include "lp_bld_misc.h" #include "tgsi/tgsi_exec.h" @@ -94,6 +95,7 @@ add_emit( emit_data->output[emit_data->chan] = LLVMBuildFAdd( bld_base->base.gallivm->builder, emit_data->args[0], emit_data->args[1], ""); + lp_set_fast_math_flags(emit_data->output[emit_data->chan]); } /* TGSI_OPCODE_ARR */ @@ -583,6 +585,7 @@ mul_emit( emit_data->output[emit_data->chan] = LLVMBuildFMul( bld_base->base.gallivm->builder, emit_data->args[0], emit_data->args[1], ""); + lp_set_fast_math_flags(emit_data->output[emit_data->chan]); } /*.TGSI_OPCODE_DIV.*/ @@ -702,6 +705,7 @@ sub_emit( LLVMBuildFSub(bld_base->base.gallivm->builder, emit_data->args[0], emit_data->args[1], ""); + lp_set_fast_math_flags(emit_data->output[emit_data->chan]); } /* TGSI_OPCODE_F2U */ |