aboutsummaryrefslogtreecommitdiff
path: root/zlib
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-04-05 20:47:34 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-21 10:34:22 +0200
commit4e128544abc14871388ca194e61d6c482d3a11a6 (patch)
tree1e40ee1db2526ca98aa7dc7ec9f32864816c8821 /zlib
parent3cc00ccf4b8a866e2265445aa560a2ca00f613b8 (diff)
downloadgcc-4e128544abc14871388ca194e61d6c482d3a11a6.zip
gcc-4e128544abc14871388ca194e61d6c482d3a11a6.tar.gz
gcc-4e128544abc14871388ca194e61d6c482d3a11a6.tar.bz2
ada: Implement fast modulo reduction for nonbinary modular multiplication
This implements modulo reduction for nonbinary modular multiplication with small moduli by means of the standard division-free algorithm also used in the optimizer, but with fewer constraints and therefore better results. For the sake of consistency, it is also used for the 'Mod attribute of the same modular types and, more generally, for the Mod (and Rem) operators of unsigned types if the second operand is static and not a power of two. gcc/ada/ * gcc-interface/gigi.h (fast_modulo_reduction): Declare. * gcc-interface/trans.cc (gnat_to_gnu) <N_Op_Mod>: In the unsigned case, call fast_modulo_reduction for {FLOOR,TRUNC}_MOD_EXPR if the RHS is a constant and not a power of two, and the precision is not larger than the word size. * gcc-interface/utils2.cc: Include expmed.h. (fast_modulo_reduction): New function. (nonbinary_modular_operation): Call fast_modulo_reduction for the multiplication if the precision is not larger than the word size.
Diffstat (limited to 'zlib')
0 files changed, 0 insertions, 0 deletions