add Fp2::neg for bls12

dev
MITSUNARI Shigeo 6 years ago
parent 9d275a8694
commit 1a0da46fd3
  1. 13
      src/fp_generator.hpp
  2. 3
      test/bls12_test.cpp

@ -3632,19 +3632,14 @@ private:
{ {
align(16); align(16);
void2u func = getCurr<void2u>(); void2u func = getCurr<void2u>();
if (pn_ == 4 && !isFullBit_) { if (pn_ <= 6) {
gen_fp2_neg4(); StackFrame sf(this, 2, UseRDX | pn_);
gen_raw_neg(sf.p[0], sf.p[1], sf.t);
gen_raw_neg(sf.p[0] + FpByte_, sf.p[1] + FpByte_, sf.t);
return func; return func;
} }
return 0; return 0;
} }
void gen_fp2_neg4()
{
assert(!isFullBit_);
StackFrame sf(this, 2, UseRDX | pn_);
gen_raw_neg(sf.p[0], sf.p[1], sf.t);
gen_raw_neg(sf.p[0] + FpByte_, sf.p[1] + FpByte_, sf.t);
}
void3u gen_fp2_mul() void3u gen_fp2_mul()
{ {
align(16); align(16);

@ -700,8 +700,7 @@ if(0){
puts("----------"); puts("----------");
// exit(1); // exit(1);
} }
CYBOZU_BENCH_C("Fp2::add", 10000000, Fp2::add, x2, x2, y2); CYBOZU_BENCH_C("Fp2::neg", 10000000, Fp2::neg, x2, x2);
CYBOZU_BENCH_C("Fp2::sub", 10000000, Fp2::sub, x2, x2, y2);
// CYBOZU_BENCH_C("mulPre", 100000000, FpDbl::mulPre, dx, xv[0], yv[0]); // CYBOZU_BENCH_C("mulPre", 100000000, FpDbl::mulPre, dx, xv[0], yv[0]);
// CYBOZU_BENCH_C("sqrPre", 100000000, FpDbl::sqrPre, dx, xv[0]); // CYBOZU_BENCH_C("sqrPre", 100000000, FpDbl::sqrPre, dx, xv[0]);
// CYBOZU_BENCH_C("mod ", 100000000, FpDbl::mod, xv[0], dx); // CYBOZU_BENCH_C("mod ", 100000000, FpDbl::mod, xv[0], dx);

Loading…
Cancel
Save