long.txt is removed

dev
MITSUNARI Shigeo 9 years ago
parent 73943fda79
commit bc08b9b3a4
  1. 2
      Makefile
  2. 32
      src/gen.cpp
  3. 1
      src/gen.py
  4. 21
      src/long.txt

@ -14,7 +14,7 @@ SAMPLE_SRC=bench.cpp ecdh.cpp random.cpp rawbench.cpp vote.cpp
MCL_LIB=$(LIB_DIR)/libmcl.a
all: $(MCL_LIB)
ASM_SRC_TXT=long.txt mul.txt
ASM_SRC_TXT=mul.txt
LIB_OBJ=$(OBJ_DIR)/$(CPU).o $(OBJ_DIR)/fp.o
LLVM_VER=-3.6
LLVM_LLC=llc$(LLVM_VER)

@ -379,6 +379,37 @@ struct Code : public mcl::Generator {
ret(Void);
endFunc();
}
void gen_mcl_fp_subL()
{
resetGlobalIdx();
Operand pz(IntPtr, bit);
Operand px(IntPtr, bit);
Operand py(IntPtr, bit);
Operand pp(IntPtr, bit);
std::string name = "mcl_fp_sub" + cybozu::itoa(bit) + "L";
mcl_fp_subM[bit] = Function(name, Void, pz, px, py, pp);
beginFunc(mcl_fp_subM[bit]);
Operand x = load(px);
Operand y = load(py);
x = zext(x, bit + unit);
y = zext(y, bit + unit);
Operand vc = sub(x, y);
Operand v = trunc(vc, bit);
Operand c = lshr(vc, bit + unit - 1);
c = trunc(c, 1);
store(v, pz);
Label carry("carry");
Label nocarry("nocarry");
br(c, carry, nocarry);
putLabel(nocarry);
ret(Void);
putLabel(carry);
Operand p = load(pp);
Operand t = add(v, p);
store(t, pz);
ret(Void);
endFunc();
}
void gen_mcl_fpDbl_add()
{
// QQQ : generate unnecessary memory copy for large bit
@ -463,6 +494,7 @@ struct Code : public mcl::Generator {
void gen_long()
{
gen_mcl_fp_addL();
gen_mcl_fp_subL();
}
void setBit(uint32_t bit)
{

@ -181,7 +181,6 @@ def main():
fo.write(a)
bitLL = range(unitL, 576 + 1, unitL)
gen(fo, 'long.txt', unitL, bitLL)
gen(fo, 'mul.txt', unitL, bitLL[1:])
fo.close()

@ -1,21 +0,0 @@
define void @mcl_fp_sub$(bit)L(i$(bit)* %pz, i$(bit)* %px, i$(bit)* %py, i$(bit)* %pp) {
%x = load i$(bit)* %px
%y = load i$(bit)* %py
%x1 = zext i$(bit) %x to i$(bit+unit)
%y1 = zext i$(bit) %y to i$(bit+unit)
%vc = sub i$(bit+unit) %x1, %y1
%v = trunc i$(bit+unit) %vc to i$(bit)
%c = lshr i$(bit+unit) %vc, $(bit+unit-1)
%c1 = trunc i$(bit+unit) %c to i1
store i$(bit) %v, i$(bit)* %pz
br i1 %c1, label %carry, label %nocarry
nocarry:
ret void
carry:
%p = load i$(bit)* %pp
%t = add i$(bit) %v, %p ; x - y + p
store i$(bit) %t, i$(bit)* %pz
ret void
}
Loading…
Cancel
Save