From e35d49b7964691831617faf54a9c3d5757d5367b Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 29 May 2016 17:20:32 +0900 Subject: [PATCH] fix generic_fpDbl_mul --- src/gen.cpp | 4 ++-- src/mul.txt | 26 -------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/gen.cpp b/src/gen.cpp index d3f3d70..23ecae8 100644 --- a/src/gen.cpp +++ b/src/gen.cpp @@ -545,7 +545,7 @@ struct Code : public mcl::Generator { ret(Void); endFunc(); } - void generic_fpDbl_mul(Operand& pz, Operand& px, Operand& py) + void generic_fpDbl_mul(Operand pz, const Operand& px, Operand py) { const int bu = bit + unit; Operand y = load(py); @@ -614,7 +614,7 @@ struct Code : public mcl::Generator { gen_mulPv(); gen_mcl_fp_mul_UnitPre(); gen_mcl_fpDbl_mulPre(); -// gen_mcl_fpDbl_sqrPre(); + gen_mcl_fpDbl_sqrPre(); } void setBit(uint32_t bit) { diff --git a/src/mul.txt b/src/mul.txt index 37a3f93..cbe2133 100644 --- a/src/mul.txt +++ b/src/mul.txt @@ -1,31 +1,5 @@ @define bu = bit + unit -define void @mcl_fpDbl_sqrPre$(bit)(i$(unit)* %py, i$(unit)* %px) { - %x0 = load i$(unit)* %px - %xx0 = call i$(bu) @mulPv$(bit)x$(unit)(i$(unit) *%px, i$(unit) %x0) - %s0 = trunc i$(bu) %xx0 to i$(unit) - store i$(unit) %s0, i$(unit)* %py - %t0 = lshr i$(bu) %xx0, $(unit) - -@for i, 1, N - %px$(i) = getelementptr i$(unit)* %px, i32 $(i) - %x$(i) = load i$(unit)* %px$(i) - %xx$(i) = call i$(bu) @mulPv$(bit)x$(unit)(i$(unit)* %px, i$(unit) %x$(i)) - %a$(i) = add i$(bu) %t$(i-1), %xx$(i) - %s$(i) = trunc i$(bu) %a$(i) to i$(unit) - %py$(i) = getelementptr i$(unit)* %py, i32 $(i) - @if i < N - 1 - store i$(unit) %s$(i), i$(unit)* %py$(i) - %t$(i) = lshr i$(bu) %a$(i), $(unit) - @endif -@endfor - - %py$(N-1)e = bitcast i$(unit)* %py$(N-1) to i$(bu)* - store i$(bu) %a$(N-1), i$(bu)* %py$(N-1)e - - ret void -} - @define bu = bit + unit @define bu2 = bit + unit * 2 define void @mcl_fp_mont$(bit)(i$(bit)* %pz, i$(unit)* %px, i$(unit)* %py, i$(unit)* %pp, i$(unit) %r) {