rename macro ; default define MCL_USE_XBYAK, MCL_USE_LLVM

dev
MITSUNARI Shigeo 10 years ago
parent 6e24b6aef1
commit 0c447ebaf5
  1. 10
      common.mk
  2. 8
      include/mcl/fp.hpp
  3. 2
      sample/bench.cpp
  4. 8
      src/fp.cpp
  5. 5
      test/ec_test.cpp

@ -66,13 +66,13 @@ endif
LIB=$(TOPDIR)lib/libmcl$(OBJSUF).a
LDFLAGS += -lpthread -m$(BIT) -lgmp -lgmpxx -lcrypto
ifeq ($(USE_MONT_FP),1)
CFLAGS += -DUSE_MONT_FP
ifeq ($(MARCH),)
ifeq ($(BIT),64)
CFLAGS += -DMCL_USE_XBYAK
endif
endif
ifeq ($(USE_LLVM),1)
CFLAGS += -DMCL_USE_LLVM
endif
CFLAGS += -DMCL_USE_LLVM
####################################################

@ -69,10 +69,10 @@ public:
op_.sub = subW;
op_.mul = mulW;
/*
priority : USE_MONT_FP > MCL_USE_LLVM > none
priority : MCL_USE_XBYAK > MCL_USE_LLVM > none
Xbyak > llvm_opt > llvm > gmp
*/
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
if (mode == fp::FP_AUTO) mode = fp::FP_XBYAK;
#else
if (mode == fp::FP_XBYAK) mode = fp::FP_AUTO;
@ -90,8 +90,8 @@ public:
}
#if 0
fprintf(stderr, "mode=%d, useMont=%d"
#ifdef USE_MONT_FP
" ,USE_MONT_FP"
#ifdef MCL_USE_XBYAK
" ,MCL_USE_XBYAK"
#endif
#ifdef MCL_USE_LLVM
" ,MCL_USE_LLVM"

@ -68,7 +68,7 @@ void benchFp(size_t bitSize, int mode)
if (mode & (1 << 1)) benchFpSub(tbl[i].p, tbl[i].x, tbl[i].y, mcl::fp::FP_LLVM);
if (mode & (1 << 2)) benchFpSub(tbl[i].p, tbl[i].x, tbl[i].y, mcl::fp::FP_LLVM_MONT);
#endif
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
if (mode & (1 << 3)) benchFpSub(tbl[i].p, tbl[i].x, tbl[i].y, mcl::fp::FP_XBYAK);
#endif
}

@ -1,14 +1,14 @@
#include <mcl/op.hpp>
#include <mcl/util.hpp>
#include <mcl/conversion.hpp>
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
#include <mcl/fp_generator.hpp>
#endif
#include <mcl/fp_proto.hpp>
namespace mcl { namespace fp {
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
FpGenerator *Op::createFpGenerator()
{
return new FpGenerator();
@ -203,7 +203,7 @@ struct OpeFunc {
modP = OpeFunc<n>::modC; \
SET_OP_LLVM(n)
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
inline void invOpForMont(Unit *y, const Unit *x, const Op& op)
{
Unit r[maxOpUnitSize];
@ -247,7 +247,7 @@ static void initForMont(Op& op, const Unit *p, Mode mode)
}
op.rp = getMontgomeryCoeff(p[0]);
if (mode != FP_XBYAK) return;
#ifdef USE_MONT_FP
#ifdef MCL_USE_XBYAK
FpGenerator *fg = op.fg;
if (fg == 0) return;
fg->init(p, (int)N);

@ -281,11 +281,6 @@ int g_partial = -1;
CYBOZU_TEST_AUTO(all)
{
#ifdef USE_MONT_FP
puts("use MontFp");
#else
puts("use GMP");
#endif
if (g_partial & (1 << 3)) {
const struct mcl::EcParam para3[] = {
// mcl::ecparam::p160_1,

Loading…
Cancel
Save