From 9e01601dc6334c9a90697c4103369a233dbdb5ca Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 25 May 2016 17:08:54 +0900 Subject: [PATCH] add mcl_fp_add*S --- src/gen.cpp | 6 +++--- src/short.txt | 18 ------------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/gen.cpp b/src/gen.cpp index 873d527..a18d9ea 100644 --- a/src/gen.cpp +++ b/src/gen.cpp @@ -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(); } } }; diff --git a/src/short.txt b/src/short.txt index 0330671..2c1c6b4 100644 --- a/src/short.txt +++ b/src/short.txt @@ -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