-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make issue-122805.rs big endian compatible #126263
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
f2d4afd
to
562f184
Compare
@@ -39,7 +40,6 @@ | |||
// OPT3WINX64-NEXT: store <8 x i16> | |||
// CHECK-NEXT: ret void | |||
#[no_mangle] | |||
#[cfg(target_endian = "little")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in this file is just checking we emit bswap
, can't we instead make this something like
#[cfg(target_endian = "little")]
let bswap = u16::to_be;
#[cfg(target_endian = "big")]
let bswap = u16::to_le;
let addr16 = [
bswap(value[0]),
// etc.e
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea, done!
Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
562f184
to
26fa5c2
Compare
Thanks! @bors r+ rollup |
r? @jieyouxu |
…eyouxu Make issue-122805.rs big endian compatible Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
Rollup of 6 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#126127 (Spell out other trait diagnostic) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) r? `@ghost` `@rustbot` modify labels: rollup
…eyouxu Make issue-122805.rs big endian compatible Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
…kingjubilee Rollup of 8 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126242 (Simplify provider api to improve llvm ir) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.) r? `@ghost` `@rustbot` modify labels: rollup
…eyouxu Make issue-122805.rs big endian compatible Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
…kingjubilee Rollup of 16 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#124514 (Recommend to never display zero disambiguators when demangling v0 symbols) - rust-lang#125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking) - rust-lang#125980 (Nvptx remove direct passmode) - rust-lang#126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.) - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) - rust-lang#126281 (set_env: State the conclusion upfront) - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.) - rust-lang#126287 (Update a cranelift patch file for formatting changes.) - rust-lang#126301 (Use `tidy` to sort crate attributes for all compiler crates.) - rust-lang#126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`) - rust-lang#126310 (Migrate run make prefer rlib) - rust-lang#126314 (fix RELEASES: we do not support upcasting to auto traits) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126263 - nikic:s390x-codegen-test-fix, r=jieyouxu Make issue-122805.rs big endian compatible Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.
…kingjubilee Rollup of 16 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#124514 (Recommend to never display zero disambiguators when demangling v0 symbols) - rust-lang#125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking) - rust-lang#125980 (Nvptx remove direct passmode) - rust-lang#126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.) - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) - rust-lang#126281 (set_env: State the conclusion upfront) - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.) - rust-lang#126287 (Update a cranelift patch file for formatting changes.) - rust-lang#126301 (Use `tidy` to sort crate attributes for all compiler crates.) - rust-lang#126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`) - rust-lang#126310 (Migrate run make prefer rlib) - rust-lang#126314 (fix RELEASES: we do not support upcasting to auto traits) r? `@ghost` `@rustbot` modify labels: rollup
Instead of not generating the function at all on big endian (which makes the CHECK lines fail), instead use to_le() on big endian, so that we essentially perform a bswap for both endiannesses.