add mcl_fp_add*S

dev
MITSUNARI Shigeo 9 years ago
parent cbbb7b40f6
commit 9e01601dc6
  1. 6
      src/gen.cpp
  2. 18
      src/short.txt

@ -302,7 +302,7 @@ struct Code : public mcl::Generator {
Operand px(IntPtr, bit);
Operand py(IntPtr, bit);
Operand pp(IntPtr, bit);
std::string name = "mcl_fp_add" + cybozu::itoa(bit);
std::string name = "mcl_fp_add" + cybozu::itoa(bit) + "S";
mcl_fp_addM[bit] = Function(name, Void, pz, px, py, pp);
beginFunc(mcl_fp_addM[bit]);
Operand x = load(px);
@ -354,7 +354,7 @@ struct Code : public mcl::Generator {
void gen_short()
{
gen_mcl_fp_add();
gen_mcl_fp_sub();
// gen_mcl_fp_sub();
}
void setBit(uint32_t bit)
{
@ -374,7 +374,7 @@ struct Code : public mcl::Generator {
for (uint32_t i = 64; i <= end; i += unit) {
setBit(i);
gen_all();
// gen_short();
gen_short();
}
}
};

@ -1,21 +1,3 @@
define void @mcl_fp_add$(bit)S(i$(bit)* %pz, i$(bit)* %px, i$(bit)* %py, i$(bit)* %pp) {
entry:
%x = load i$(bit)* %px
%y = load i$(bit)* %py
%p = load i$(bit)* %pp
%x1 = zext i$(bit) %x to i$(bit+unit)
%y1 = zext i$(bit) %y to i$(bit+unit)
%p1 = zext i$(bit) %p to i$(bit+unit)
%t0 = add i$(bit+unit) %x1, %y1 ; x + y
%t1 = sub i$(bit+unit) %t0, %p1 ; x + y - p
%t2 = lshr i$(bit+unit) %t1, $(bit)
%t3 = trunc i$(bit+unit) %t2 to i1
%t4 = select i1 %t3, i$(bit+unit) %t0, i$(bit+unit) %t1
%t5 = trunc i$(bit+unit) %t4 to i$(bit)
store i$(bit) %t5, i$(bit)* %pz
ret void
}
define void @mcl_fp_sub$(bit)S(i$(bit)* %pz, i$(bit)* %px, i$(bit)* %py, i$(bit)* %pp) {
%x = load i$(bit)* %px
%y = load i$(bit)* %py

Loading…
Cancel
Save