Realign mult generators with existing files in repo.

NB: fp_mul_comba32() is hand-optimized and has to be hand-crafted after
re-generation
This commit is contained in:
Steffen Jaeckel 2014-06-12 17:40:58 +02:00
parent 39b18f774c
commit 540e3ecbc1
4 changed files with 39 additions and 4 deletions

View File

@ -1,2 +1,8 @@
comba_mult_gen
comba_mult_smallgen
comba_sqr_gen
comba_sqr_smallgen
comba_mult_gen.exe
comba_mult_smallgen.exe
comba_sqr_gen.exe
comba_sqr_smallgen.exe

View File

@ -18,6 +18,10 @@ int main(int argc, char **argv)
/* print out preamble */
printf(
"#define TFM_DEFINES\n"
"#include \"fp_mul_comba.c\"\n"
"\n"
"#ifdef TFM_MUL%d\n"
"void fp_mul_comba%d(fp_int *A, fp_int *B, fp_int *C)\n"
"{\n"
" fp_digit c0, c1, c2, at[%d];\n"
@ -26,7 +30,7 @@ printf(
" memcpy(at+%d, B->dp, %d * sizeof(fp_digit));\n"
" COMBA_START;\n"
"\n"
" COMBA_CLEAR;\n", N, N+N, N, N, N);
" COMBA_CLEAR;\n", N, N, N+N, N, N, N);
/* now do the rows */
for (x = 0; x < (N+N-1); x++) {
@ -53,7 +57,11 @@ printf(
" C->sign = A->sign ^ B->sign;\n"
" fp_clamp(C);\n"
" COMBA_FINI;\n"
"}\n\n\n", N+N-1, N+N);
"}\n#endif\n\n\n"
"/* $Source$ */\n"
"/* $Revision$ */\n"
"/* $Date$ */\n"
, N+N-1, N+N);
return 0;
}

View File

@ -7,6 +7,10 @@ int main(int argc, char **argv)
/* print out preamble */
printf(
"#define TFM_DEFINES\n"
"#include \"fp_mul_comba.c\"\n"
"\n"
"#if defined(TFM_SMALL_SET)\n"
"void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C)\n"
"{\n"
" fp_digit c0, c1, c2, at[32];\n"
@ -51,7 +55,10 @@ printf(
" COMBA_FINI;\n"
" break;\n", N+N-1, N+N);
}
printf(" }\n}\n\n");
printf(" }\n}\n\n#endif\n\n\n"
"/* $Source$ */\n"
"/* $Revision$ */\n"
"/* $Date$ */\n");
return 0;
}

View File

@ -1,15 +1,29 @@
all: comba_sqr_gen comba_sqr_smallgen
clean:
rm -f comba_mult_gen
rm -f comba_mult_gen.exe
rm -f comba_mult_smallgen
rm -f comba_mult_smallgen.exe
rm -f comba_sqr_gen
rm -f comba_sqr_gen.exe
rm -f comba_sqr_smallgen
rm -f comba_sqr_smallgen.exe
comba_mult_gen: comba_mult_gen.c
gcc -o comba_mult_gen comba_mult_gen.c
comba_mult_smallgen: comba_mult_smallgen.c
gcc -o comba_mult_smallgen comba_mult_smallgen.c
comba_sqr_gen: comba_sqr_gen.c
gcc -o comba_sqr_gen comba_sqr_gen.c
comba_sqr_smallgen: comba_sqr_smallgen.c
gcc -o comba_sqr_smallgen comba_sqr_smallgen.c
regen: comba_sqr_gen comba_sqr_smallgen
regen: comba_mult_gen comba_mult_smallgen comba_sqr_gen comba_sqr_smallgen
for i in 3 4 6 7 8 9 12 17 20 24 28 32 48 64; do \
./comba_mult_gen $$i | sed -e 's/ *$$//' > ../mul/fp_mul_comba_$$i.c; \
done
./comba_mult_smallgen > ../mul/fp_mul_comba_small_set.c
for i in 3 4 6 7 8 9 12 17 20 24 28 32 48 64; do \
./comba_sqr_gen $$i | sed -e 's/ *$$//' > ../sqr/fp_sqr_comba_$$i.c; \
done