about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-01 10:01:25 -0800
committerbors <bors@rust-lang.org>2014-02-01 10:01:25 -0800
commit60ffbeb2a495d097e38f51348ebcf5a884947c25 (patch)
treed6049b7fe28567da6922a28d0b38d87c7d7467e2 /src/libsyntax/parse/parser.rs
parentdf044ea4ac8fb7f99622948f4f8c40fbd24eda13 (diff)
parent5afc63a2aef113d49944b6ee5f7a743198a6aff1 (diff)
downloadrust-60ffbeb2a495d097e38f51348ebcf5a884947c25.tar.gz
rust-60ffbeb2a495d097e38f51348ebcf5a884947c25.zip
auto merge of #11973 : dotdash/rust/u64_to_bytes, r=huonw
LLVM fails to properly optimize the shifts used to convert the source
value to the right endianess. The resulting assembly copies the value
to the stack one byte at a time even when there's no conversion required
(e.g. u64_to_le_bytes on a little endian machine).

Instead of doing the conversion ourselves using shifts, we can use the
existing intrinsics to perform the endianess conversion and then
transmute the value to get a fixed vector of its bytes.

Before:
````
test be_i8  ... bench:     21442 ns/iter (+/- 70)
test be_i16 ... bench:     21447 ns/iter (+/- 45)
test be_i32 ... bench:     23832 ns/iter (+/- 63)
test be_i64 ... bench:     26887 ns/iter (+/- 267)

test le_i8  ... bench:     21442 ns/iter (+/- 56)
test le_i16 ... bench:     21448 ns/iter (+/- 36)
test le_i32 ... bench:     23825 ns/iter (+/- 153)
test le_i64 ... bench:     26271 ns/iter (+/- 138)
````
After:
````
test be_i8  ... bench:     21438 ns/iter (+/- 10)
test be_i16 ... bench:     21441 ns/iter (+/- 15)
test be_i32 ... bench:     19057 ns/iter (+/- 6)
test be_i64 ... bench:     21439 ns/iter (+/- 34)

test le_i8  ... bench:     21438 ns/iter (+/- 19)
test le_i16 ... bench:     21439 ns/iter (+/- 8)
test le_i32 ... bench:     21439 ns/iter (+/- 19)
test le_i64 ... bench:     21438 ns/iter (+/- 22)
````
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
0 files changed, 0 insertions, 0 deletions