diff --git a/src/fp.cpp b/src/fp.cpp index df72d6d..bb7fbcd 100644 --- a/src/fp.cpp +++ b/src/fp.cpp @@ -251,7 +251,7 @@ void setOp(Op& op, Mode mode) setOp2(op); #ifdef MCL_USE_LLVM 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); Xbyak::util::Cpu cpu; if (cpu.has(Xbyak::util::Cpu::tBMI2)) { diff --git a/src/low_func.hpp b/src/low_func.hpp index 57c63cf..89a748e 100644 --- a/src/low_func.hpp +++ b/src/low_func.hpp @@ -15,17 +15,27 @@ #pragma warning(disable : 4127) #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 { struct Gtag; // GMP struct Ltag; // LLVM +#if MCL_LLVM_BMI2 == 1 struct LBMI2tag; // LLVM with Intel BMI2 instruction +#endif struct Atag; // asm template struct TagToStr { }; template<> struct TagToStr { static const char *f() { return "Gtag"; } }; template<> struct TagToStr { static const char *f() { return "Ltag"; } }; +#if MCL_LLVM_BMI2 == 1 template<> struct TagToStr { static const char *f() { return "LBMI2tag"; } }; +#endif template<> struct TagToStr { static const char *f() { return "Atag"; } }; template diff --git a/src/low_func_llvm.hpp b/src/low_func_llvm.hpp index 8a44c22..a9e8a98 100644 --- a/src/low_func_llvm.hpp +++ b/src/low_func_llvm.hpp @@ -41,7 +41,7 @@ template<>const void3u MontRed::f = &mcl_fp_montRed ## n ## suf; \ template<>const void4u DblAdd::f = &mcl_fpDbl_add ## n ## suf; \ template<>const void4u DblSub::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) \ MCL_DEF_LLVM_FUNC2(n, Ltag, L) \ MCL_DEF_LLVM_FUNC2(n, LBMI2tag, Lbmi2)