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

Implement intrinsic for swapping values #111744

Commits on Jun 12, 2023

  1. Implement intrinsic for swapping values

    This allows move target- and backend-specific optmization from library code to codegen.
    Also, this should make const eval/miri evaluation simpler.
    
    Main optimization implemented in this PR makes backend generate swap without using allocas
    removing unneccessary memory writes and reads and reducing stack usage.
    
    One of the main optimizations is using larger integer chunks for swapping in x86_64 by utilizing unaligned reads/writes. It reduces code size (especially for debug builds) and prevent cases of ineffective vectorizations like `load <4 x i8>` (LLVM doesn't vectorize it further despite vectorizing `load i32`).
    
    Also added more tests.
    AngelicosPhosphoros committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    c6db014 View commit details
    Browse the repository at this point in the history