aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-11-14 17:25:21 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-11-14 17:25:21 +0800
commit6ade49b750bd7c302d9ac8e244929b47916b731f (patch)
tree9f8afde5f90d3503435058a2869727670b90aa55
parentb0f23bb8fd7bacee2e416b6949256f49e32b0e7b (diff)
downloaddexon-mcl-6ade49b750bd7c302d9ac8e244929b47916b731f.tar.gz
dexon-mcl-6ade49b750bd7c302d9ac8e244929b47916b731f.tar.zst
dexon-mcl-6ade49b750bd7c302d9ac8e244929b47916b731f.zip
add mcl_fp_shr1 by llvm
-rw-r--r--src/gen.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gen.cpp b/src/gen.cpp
index 8818fba..0320e32 100644
--- a/src/gen.cpp
+++ b/src/gen.cpp
@@ -23,6 +23,7 @@ struct Code : public mcl::Generator {
Function makeNIST_P192;
Function mcl_fpDbl_mod_NIST_P192;
Function mcl_fp_sqr_NIST_P192;
+ FunctionMap mcl_fp_shr1_M;
FunctionMap mcl_fp_addPreM;
FunctionMap mcl_fp_subPreM;
FunctionMap mcl_fp_addM;
@@ -394,6 +395,21 @@ struct Code : public mcl::Generator {
endFunc();
}
#endif
+ void gen_mcl_fp_shr1()
+ {
+ resetGlobalIdx();
+ Operand py(IntPtr, unit);
+ Operand px(IntPtr, unit);
+ std::string name = "mcl_fp_shr1_" + cybozu::itoa(N) + "L";
+ mcl_fp_shr1_M[N] = Function(name, Void, py, px);
+ verifyAndSetPrivate(mcl_fp_shr1_M[N]);
+ beginFunc(mcl_fp_shr1_M[N]);
+ Operand x = loadN(px, N);
+ x = lshr(x, 1);
+ storeN(x, py);
+ ret(Void);
+ endFunc();
+ }
void gen_mcl_fp_add()
{
resetGlobalIdx();
@@ -779,6 +795,7 @@ struct Code : public mcl::Generator {
{
gen_mcl_fp_addsubPre(true);
gen_mcl_fp_addsubPre(false);
+ gen_mcl_fp_shr1();
}
void gen_addsub()
{