summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorJose Fonseca <[email protected]>2016-05-24 22:36:28 +0900
committerJose Fonseca <[email protected]>2016-06-10 13:47:35 +0100
commit9e8edfa19034ae69139ef10b88f958b4f58d57ea (patch)
tree03fa0133cad7b88ba0eeb364b1b969576d71935a /src/gallium/auxiliary/gallivm
parent54f755fa0fda14c578022767bcef2f27b2e89707 (diff)
util,gallivm: Explicitly enable/disable fma attribute.
As suggested by Roland Scheidegger. Use the same logic as f16c, since fma requires VEX encoding. But disable FMA on LLVM 3.3 without MCJIT. Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index cf21ab0653b..22340c081f2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -420,6 +420,7 @@ lp_build_init(void)
util_cpu_caps.has_avx = 0;
util_cpu_caps.has_avx2 = 0;
util_cpu_caps.has_f16c = 0;
+ util_cpu_caps.has_fma = 0;
}
#endif
@@ -454,6 +455,7 @@ lp_build_init(void)
util_cpu_caps.has_avx = 0;
util_cpu_caps.has_avx2 = 0;
util_cpu_caps.has_f16c = 0;
+ util_cpu_caps.has_fma = 0;
}
#ifdef PIPE_ARCH_PPC_64
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 805a50be099..5ffe09c9a1b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -570,6 +570,15 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
*/
MAttrs.push_back(util_cpu_caps.has_avx ? "+avx" : "-avx");
MAttrs.push_back(util_cpu_caps.has_f16c ? "+f16c" : "-f16c");
+ if (HAVE_LLVM >= 0x0304 || useMCJIT) {
+ MAttrs.push_back(util_cpu_caps.has_fma ? "+fma" : "-fma");
+ } else {
+ /*
+ * The old JIT in LLVM 3.3 has a bug encoding llvm.fmuladd.f32 and
+ * llvm.fmuladd.v2f32 intrinsics when FMA is available.
+ */
+ MAttrs.push_back("-fma");
+ }
MAttrs.push_back(util_cpu_caps.has_avx2 ? "+avx2" : "-avx2");
/* disable avx512 and all subvariants */
#if HAVE_LLVM >= 0x0304