about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-01-17 12:25:01 +0000
committerGitHub <noreply@github.com>2021-01-17 12:25:01 +0000
commit801684620bd4e0bc12b98a071851e3d3064429e4 (patch)
treeda13b95b2c674428e79620e1eaad4aec53b5e9f7 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent7e2425ab73b40f042975a0911a976220bf62d083 (diff)
parent3e16e9211ef7eff4d421f384140e729df1120372 (diff)
downloadrust-801684620bd4e0bc12b98a071851e3d3064429e4.tar.gz
rust-801684620bd4e0bc12b98a071851e3d3064429e4.zip
Rollup merge of #81107 - scottmcm:nonzero-is_power_of_two, r=kennytm
Add NonZeroUn::is_power_of_two

This saves instructions on both new and old machines <https://rust.godbolt.org/z/4fjTMz>
- On the default x64 target (with no fancy instructions available) it saves a few instructions by not needing to also check for zero.
- On newer targets (with BMI1) it uses `BLSR` for super-short assembly.

This can be used for things like checks against alignments stored in `NonZeroUsize`.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions