about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/snippet.rs
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2020-08-16 17:10:54 +0300
committerSimonas Kazlauskas <git@kazlauskas.me>2020-08-16 21:31:48 +0300
commit5d22b18bf28a54586008e9d8d4bfd72012c00e2e (patch)
tree4ca3500e0654687aee1d933df544dd4dcdeda021 /compiler/rustc_errors/src/snippet.rs
parente7271da69a7f69d9aef931f30fbb403ffd49436e (diff)
downloadrust-5d22b18bf28a54586008e9d8d4bfd72012c00e2e.tar.gz
rust-5d22b18bf28a54586008e9d8d4bfd72012c00e2e.zip
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
Diffstat (limited to 'compiler/rustc_errors/src/snippet.rs')
0 files changed, 0 insertions, 0 deletions