2fd060815f
core: add likely and unlikely intrinsics I'm no good at reading assembly, but I have tried a stage1 compiler with this patch, and it does cause different asm output. Additionally, testing this compiler on my httparse crate with some `likely` usage added in to the branches does affect benchmarks. However, I'm sure a codegen test should be included, if anyone knows what it should look like. There isn't an entry in `librustc_trans/context.rs` in this diff, because it already exists (`llvm.expect.i1` is used for array indices). ---- Even though this does affect httparse benchmarks, it doesn't seem to affect it the same way GCC's `__builtin_expect` affects picohttpparser. I was confused that the deviation on the benchmarks grew hugely when testing this, especially since I'm absolutely certain that the branchs where I added `likely` were always `true`. I chalk that up to GCC and LLVM handle branch prediction differently. cc #26179 |
||
---|---|---|
.. | ||
back | ||
debuginfo | ||
mir | ||
abi.rs | ||
adt.rs | ||
asm.rs | ||
assert_module_sources.rs | ||
attributes.rs | ||
base.rs | ||
basic_block.rs | ||
build.rs | ||
builder.rs | ||
cabi_aarch64.rs | ||
cabi_arm.rs | ||
cabi_asmjs.rs | ||
cabi_mips64.rs | ||
cabi_mips.rs | ||
cabi_powerpc64.rs | ||
cabi_powerpc.rs | ||
cabi_s390x.rs | ||
cabi_x86_64.rs | ||
cabi_x86_win64.rs | ||
cabi_x86.rs | ||
callee.rs | ||
Cargo.toml | ||
cleanup.rs | ||
closure.rs | ||
collector.rs | ||
common.rs | ||
consts.rs | ||
context.rs | ||
declare.rs | ||
diagnostics.rs | ||
disr.rs | ||
glue.rs | ||
intrinsic.rs | ||
lib.rs | ||
machine.rs | ||
macros.rs | ||
meth.rs | ||
monomorphize.rs | ||
partitioning.rs | ||
README.txt | ||
symbol_map.rs | ||
symbol_names_test.rs | ||
trans_item.rs | ||
tvec.rs | ||
type_.rs | ||
type_of.rs | ||
value.rs |
See the README.md in ../librustc.