rust/library/core
Simonas Kazlauskas 5d22b18bf2 Improve codegen of align_offset when stride == 1
Previously checking for `pmoda == 0` would get LLVM to generate branchy
code, when, for `stride = 1` the offset can be computed without such a
branch by doing effectively a `-p % a`.

For well-known (constant) alignments, with the new ordering of these
conditionals, we end up generating 2 to 3 cheap instructions on x86_64:

    movq    %rdi, %rax
    negl    %eax
    andl    $7, %eax

instead of 5+ as previously.

For unknown alignments the new code also generates just 3 instructions:

    negq    %rdi
    leaq    -1(%rsi), %rax
    andq    %rdi, %rax
2020-08-16 21:31:48 +03:00
..
benches mv std libs to library/ 2020-07-27 19:51:13 -05:00
src Improve codegen of align_offset when stride == 1 2020-08-16 21:31:48 +03:00
tests Add drop check test & MaybeUninit::first_ptr_mut 2020-08-13 03:51:08 +00:00
Cargo.toml mv std libs to library/ 2020-07-27 19:51:13 -05:00