MCL_LLVM_BMI2=0 disables bmi2

pull/2/head
MITSUNARI Shigeo 6 years ago
parent d02cc65749
commit 3adee27f18
  1. 2
      src/fp.cpp
  2. 10
      src/low_func.hpp
  3. 2
      src/low_func_llvm.hpp

@ -251,7 +251,7 @@ void setOp(Op& op, Mode mode)
setOp2<N, Gtag, true, false>(op); setOp2<N, Gtag, true, false>(op);
#ifdef MCL_USE_LLVM #ifdef MCL_USE_LLVM
if (mode != fp::FP_GMP && mode != fp::FP_GMP_MONT) { if (mode != fp::FP_GMP && mode != fp::FP_GMP_MONT) {
#if defined(MCL_USE_XBYAK) && CYBOZU_HOST == CYBOZU_HOST_INTEL #if MCL_LLVM_BMI2 == 1
const bool gmpIsFasterThanLLVM = false;//(N == 8 && MCL_SIZEOF_UNIT == 8); const bool gmpIsFasterThanLLVM = false;//(N == 8 && MCL_SIZEOF_UNIT == 8);
Xbyak::util::Cpu cpu; Xbyak::util::Cpu cpu;
if (cpu.has(Xbyak::util::Cpu::tBMI2)) { if (cpu.has(Xbyak::util::Cpu::tBMI2)) {

@ -15,17 +15,27 @@
#pragma warning(disable : 4127) #pragma warning(disable : 4127)
#endif #endif
#ifndef MCL_LLVM_BMI2
#if (CYBOZU_HOST == CYBOZU_HOST_INTEL) && defined(MCL_USE_XBYAK) && !defined(MCL_USE_VINT)
#define MCL_LLVM_BMI2 1
#endif
#endif
namespace mcl { namespace fp { namespace mcl { namespace fp {
struct Gtag; // GMP struct Gtag; // GMP
struct Ltag; // LLVM struct Ltag; // LLVM
#if MCL_LLVM_BMI2 == 1
struct LBMI2tag; // LLVM with Intel BMI2 instruction struct LBMI2tag; // LLVM with Intel BMI2 instruction
#endif
struct Atag; // asm struct Atag; // asm
template<class Tag> struct TagToStr { }; template<class Tag> struct TagToStr { };
template<> struct TagToStr<Gtag> { static const char *f() { return "Gtag"; } }; template<> struct TagToStr<Gtag> { static const char *f() { return "Gtag"; } };
template<> struct TagToStr<Ltag> { static const char *f() { return "Ltag"; } }; template<> struct TagToStr<Ltag> { static const char *f() { return "Ltag"; } };
#if MCL_LLVM_BMI2 == 1
template<> struct TagToStr<LBMI2tag> { static const char *f() { return "LBMI2tag"; } }; template<> struct TagToStr<LBMI2tag> { static const char *f() { return "LBMI2tag"; } };
#endif
template<> struct TagToStr<Atag> { static const char *f() { return "Atag"; } }; template<> struct TagToStr<Atag> { static const char *f() { return "Atag"; } };
template<size_t N> template<size_t N>

@ -41,7 +41,7 @@ template<>const void3u MontRed<n, tag>::f = &mcl_fp_montRed ## n ## suf; \
template<>const void4u DblAdd<n, tag>::f = &mcl_fpDbl_add ## n ## suf; \ template<>const void4u DblAdd<n, tag>::f = &mcl_fpDbl_add ## n ## suf; \
template<>const void4u DblSub<n, tag>::f = &mcl_fpDbl_sub ## n ## suf; \ template<>const void4u DblSub<n, tag>::f = &mcl_fpDbl_sub ## n ## suf; \
#if (CYBOZU_HOST == CYBOZU_HOST_INTEL) && !defined(MCL_USE_VINT) #if MCL_LLVM_BMI2 == 1
#define MCL_DEF_LLVM_FUNC(n) \ #define MCL_DEF_LLVM_FUNC(n) \
MCL_DEF_LLVM_FUNC2(n, Ltag, L) \ MCL_DEF_LLVM_FUNC2(n, Ltag, L) \
MCL_DEF_LLVM_FUNC2(n, LBMI2tag, Lbmi2) MCL_DEF_LLVM_FUNC2(n, LBMI2tag, Lbmi2)

Loading…
Cancel
Save