move mcl_fp_sub to gen.cpp

dev
MITSUNARI Shigeo 9 years ago
parent 9e01601dc6
commit a60019198b
  1. 4
      src/gen.cpp
  2. 16
      src/short.txt

@ -328,7 +328,7 @@ struct Code : public mcl::Generator {
Operand px(IntPtr, bit); Operand px(IntPtr, bit);
Operand py(IntPtr, bit); Operand py(IntPtr, bit);
Operand pp(IntPtr, bit); Operand pp(IntPtr, bit);
std::string name = "mcl_fp_sub" + cybozu::itoa(bit); std::string name = "mcl_fp_sub" + cybozu::itoa(bit) + "S";
mcl_fp_subM[bit] = Function(name, Void, pz, px, py, pp); mcl_fp_subM[bit] = Function(name, Void, pz, px, py, pp);
beginFunc(mcl_fp_subM[bit]); beginFunc(mcl_fp_subM[bit]);
Operand x = load(px); Operand x = load(px);
@ -354,7 +354,7 @@ struct Code : public mcl::Generator {
void gen_short() void gen_short()
{ {
gen_mcl_fp_add(); gen_mcl_fp_add();
// gen_mcl_fp_sub(); gen_mcl_fp_sub();
} }
void setBit(uint32_t bit) void setBit(uint32_t bit)
{ {

@ -1,19 +1,3 @@
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
%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
%p = load i$(bit)* %pp
%a = select i1 %c1, i$(bit) %p, i$(bit) 0
%v1 = add i$(bit) %v, %a
store i$(bit) %v1, i$(bit)* %pz
ret void
}
@define bu = bit + unit @define bu = bit + unit
@define b2 = bit * 2 @define b2 = bit * 2
@define b2u = b2 + unit @define b2u = b2 + unit

Loading…
Cancel
Save