Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 64-bit limbs on no-asm platforms #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 19, 2023

  1. Support 64-bit limbs on no-asm platforms

    Currently, platforms without assembler support always use 32-bit limbs,
    but the Rust bindings always assume 64-bit limbs.  This breaks on
    big-endian platforms like our IBM Z (s390x).
    
    This patch enables 64-bit limbs on 64-bit platforms even if there is
    no hand-written assembler, by using a 128-bit integer type in the
    C implementation (this is an extension that is widely supported on
    64-bit platforms with GCC or LLVM).
    
    Note that this means that the argument "n" to quot_rem_n is no
    longer guaranteed to always be a multiple of 2, so the corresponding
    assertion needs to be removed as well.
    
    This fixes the broken Rust bindings on IBM Z, and also improves
    performance by a factor or 3 or more, because compiler-generated
    code handling __int128 already uses the 64x64->128 multiply
    instruction our ISA provides.
    
    To improve performance of compiler-generated code a bit more, this
    also switches to the -O3 optimization level, which helps with
    unrolling of the Montgomery multiply core loop.
    uweigand committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    c2407b5 View commit details
    Browse the repository at this point in the history