Skip to content

compiletest: ignore-endian-big, fixes #74829, fixes #74885 #74888

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

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/mir-opt/const-promotion-extern-static.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ignore-endian-big
extern "C" {
static X: i32;
}

static Y: i32 = 42;

// EMIT_MIR const_promotion_extern_static.BAR.PromoteTemps.diff
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/const_allocation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH

static FOO: &[(Option<i32>, &[&str])] =
&[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])];

Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/const_allocation2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH

// EMIT_MIR const_allocation2.main.ConstProp.after.mir
fn main() {
FOO;
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/const_allocation3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH

// EMIT_MIR const_allocation3.main.ConstProp.after.mir
fn main() {
FOO;
Expand Down
2 changes: 1 addition & 1 deletion src/test/mir-opt/inline/inline-into-box-place.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// ignore-endian-big
// ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -Z mir-opt-level=3
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(box_syntax)]

// EMIT_MIR inline_into_box_place.main.Inline.diff
fn main() {
let _x: Box<Vec<u32>> = box Vec::new();
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/simd/simd-intrinsic-generic-bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(non_camel_case_types)]

// ignore-emscripten
// ignore-endian-big behavior of simd_bitmask is endian-specific

// Test that the simd_bitmask intrinsic produces correct results.

Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/simd/simd-intrinsic-generic-select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#![allow(non_camel_case_types)]

// ignore-emscripten
// ignore-mips behavior of simd_select_bitmask is endian-specific
// ignore-mips64 behavior of simd_select_bitmask is endian-specific
// ignore-powerpc behavior of simd_select_bitmask is endian-specific
// ignore-powerpc64 behavior of simd_select_bitmask is endian-specific
// ignore-endian-big behavior of simd_select_bitmask is endian-specific

// Test that the simd_select intrinsics produces correct results.

Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ impl Config {
name == util::get_pointer_width(&self.target) || // pointer width
name == self.stage_id.split('-').next().unwrap() || // stage
(self.target != self.host && name == "cross-compile") ||
(name == "endian-big" && util::is_big_endian(&self.target)) ||
(self.remote_test_client.is_some() && name == "remote") ||
match self.compare_mode {
Some(CompareMode::Nll) => name == "compare-mode-nll",
Expand Down
20 changes: 20 additions & 0 deletions src/tools/compiletest/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ pub const MSAN_SUPPORTED_TARGETS: &'static [&'static str] =
pub const TSAN_SUPPORTED_TARGETS: &'static [&'static str] =
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];

const BIG_ENDIAN: &'static [&'static str] = &[
"armebv7r",
"mips",
"mips64",
"mipsisa32r6",
"mipsisa64r6",
"powerpc",
"powerpc64",
"s390x",
"sparc",
"sparc64",
"sparcv9",
];

pub fn matches_os(triple: &str, name: &str) -> bool {
// For the wasm32 bare target we ignore anything also ignored on emscripten
// and then we also recognize `wasm32-bare` as the os for the target
Expand All @@ -125,6 +139,12 @@ pub fn get_arch(triple: &str) -> &'static str {
panic!("Cannot determine Architecture from triple");
}

/// Determine the endianness from `triple`
pub fn is_big_endian(triple: &str) -> bool {
let triple_arch = triple.split('-').next().unwrap();
BIG_ENDIAN.contains(&triple_arch)
}

pub fn matches_env(triple: &str, name: &str) -> bool {
if let Some(env) = triple.split('-').nth(3) { env.starts_with(name) } else { false }
}
Expand Down