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 <sroland@vmware.com>
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
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
*/
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
((regs2[2] >> 27) & 1) && // OSXSAVE
((xgetbv() & 6) == 6); // XMM & YMM
util_cpu_caps.has_f16c = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx;
+ util_cpu_caps.has_fma = ((regs2[2] >> 12) & 1) && util_cpu_caps.has_avx;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
#if defined(PIPE_ARCH_X86_64)
util_cpu_caps.has_daz = 1;
unsigned has_avx:1;
unsigned has_avx2:1;
unsigned has_f16c:1;
+ unsigned has_fma:1;
unsigned has_3dnow:1;
unsigned has_3dnow_ext:1;
unsigned has_xop:1;