fix detection of mulx at mulPre2/sqrPre2

dev
MITSUNARI Shigeo 9 years ago
parent 7185167da7
commit 924dfecc7d
  1. 4
      include/mcl/fp_generator.hpp
  2. 1
      include/mcl/fp_proto.hpp
  3. 1
      src/fp.cpp
  4. 4
      src/once.txt

@ -253,12 +253,12 @@ struct FpGenerator : Xbyak::CodeGenerator {
op.fpDbl_mod = getCurr<void2u>();
gen_fpDbl_mod();
}
if (op.N == 2 || op.N == 3 || op.N == 4) {
if ((useMulx_ && op.N == 2) || op.N == 3 || op.N == 4) {
align(16);
op.fpDbl_mulPre = getCurr<void3u>();
gen_fpDbl_mulPre();
}
if (op.N == 2 || op.N == 3 || op.N == 4) {
if ((useMulx_ && op.N == 2) || op.N == 3 || op.N == 4) {
align(16);
op.fpDbl_sqrPre = getCurr<void2u>();
gen_fpDbl_sqrPre(op);

@ -55,6 +55,7 @@ MCL_FP_DEF_FUNC(576)
#undef MCL_FP_DEF_FUNC
void mcl_fpDbl_mod_NIST_P192(mcl::fp::Unit*, const mcl::fp::Unit*);
void mcl_fp_mul_NIST_P192(mcl::fp::Unit*, const mcl::fp::Unit*, const mcl::fp::Unit*);
}

@ -413,6 +413,7 @@ void Op::init(const std::string& mstr, int base, size_t maxBitSize, Mode mode)
#ifdef MCL_USE_LLVM
if ((mode == FP_AUTO || mode == FP_LLVM) && mp == mpz_class("0xfffffffffffffffffffffffffffffffeffffffffffffffff")) {
fp_mul = &mcl_fp_mul_NIST_P192;
// fpDbl_mod = &mcl_fpDbl_mod_NIST_P192;
isMont = false;
}
#endif

@ -30,7 +30,7 @@ define internal i64 @extract192to64(i192 %x, i192 %shift) {
ret i64 %t1
}
define internal void @fpDbl_modNIST_P192(i192* %out, i192* %px) {
define void @mcl_fpDbl_mod_NIST_P192(i192* %out, i192* %px) {
%L192 = load i192* %px
%L = zext i192 %L192 to i256
@ -69,6 +69,6 @@ define void @mcl_fp_mul_NIST_P192(i192* %pz, i192* %px, i192* %py) {
%buf = alloca i192, i32 2
%p = bitcast i192* %buf to i$(unit)*
call void @mcl_fpDbl_mulPre192(i$(unit)* %p, i192* %px, i192* %py)
call void @fpDbl_modNIST_P192(i192* %pz, i192* %buf)
call void @mcl_fpDbl_mod_NIST_P192(i192* %pz, i192* %buf)
ret void
}

Loading…
Cancel
Save