Skip to content

Commit 7f54cf2

Browse files
committed
compiletest: ignore-endian-big, fixes #74829, fixes #74885
1 parent 3a92b99 commit 7f54cf2

9 files changed

+28
-9
lines changed

src/test/mir-opt/const-promotion-extern-static.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
// ignore-endian-big
12
extern "C" {
23
static X: i32;
34
}
4-
55
static Y: i32 = 42;
66

77
// EMIT_MIR const_promotion_extern_static.BAR.PromoteTemps.diff

src/test/mir-opt/const_allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// ignore-endian-big
12
// EMIT_MIR_FOR_EACH_BIT_WIDTH
2-
33
static FOO: &[(Option<i32>, &[&str])] =
44
&[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])];
55

src/test/mir-opt/const_allocation2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// ignore-endian-big
12
// EMIT_MIR_FOR_EACH_BIT_WIDTH
2-
33
// EMIT_MIR const_allocation2.main.ConstProp.after.mir
44
fn main() {
55
FOO;

src/test/mir-opt/const_allocation3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// ignore-endian-big
12
// EMIT_MIR_FOR_EACH_BIT_WIDTH
2-
33
// EMIT_MIR const_allocation3.main.ConstProp.after.mir
44
fn main() {
55
FOO;

src/test/mir-opt/inline/inline-into-box-place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
// ignore-endian-big
12
// ignore-wasm32-bare compiled with panic=abort by default
23
// compile-flags: -Z mir-opt-level=3
34
// EMIT_MIR_FOR_EACH_BIT_WIDTH
45
#![feature(box_syntax)]
5-
66
// EMIT_MIR inline_into_box_place.main.Inline.diff
77
fn main() {
88
let _x: Box<Vec<u32>> = box Vec::new();

src/test/ui/simd/simd-intrinsic-generic-bitmask.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(non_camel_case_types)]
33

44
// ignore-emscripten
5+
// ignore-endian-big behavior of simd_bitmask is endian-specific
56

67
// Test that the simd_bitmask intrinsic produces correct results.
78

src/test/ui/simd/simd-intrinsic-generic-select.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
#![allow(non_camel_case_types)]
33

44
// ignore-emscripten
5-
// ignore-mips behavior of simd_select_bitmask is endian-specific
6-
// ignore-mips64 behavior of simd_select_bitmask is endian-specific
7-
// ignore-powerpc behavior of simd_select_bitmask is endian-specific
8-
// ignore-powerpc64 behavior of simd_select_bitmask is endian-specific
5+
// ignore-endian-big behavior of simd_select_bitmask is endian-specific
96

107
// Test that the simd_select intrinsics produces correct results.
118

src/tools/compiletest/src/header.rs

+1
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ impl Config {
815815
name == util::get_pointer_width(&self.target) || // pointer width
816816
name == self.stage_id.split('-').next().unwrap() || // stage
817817
(self.target != self.host && name == "cross-compile") ||
818+
(name == "endian-big" && util::is_big_endian(&self.target)) ||
818819
(self.remote_test_client.is_some() && name == "remote") ||
819820
match self.compare_mode {
820821
Some(CompareMode::Nll) => name == "compare-mode-nll",

src/tools/compiletest/src/util.rs

+20
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ pub const MSAN_SUPPORTED_TARGETS: &'static [&'static str] =
9999
pub const TSAN_SUPPORTED_TARGETS: &'static [&'static str] =
100100
&["aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"];
101101

102+
const BIG_ENDIAN: &'static [&'static str] = &[
103+
"armebv7r",
104+
"mips",
105+
"mips64",
106+
"mipsisa32r6",
107+
"mipsisa64r6",
108+
"powerpc",
109+
"powerpc64",
110+
"s390x",
111+
"sparc",
112+
"sparc64",
113+
"sparcv9",
114+
];
115+
102116
pub fn matches_os(triple: &str, name: &str) -> bool {
103117
// For the wasm32 bare target we ignore anything also ignored on emscripten
104118
// and then we also recognize `wasm32-bare` as the os for the target
@@ -125,6 +139,12 @@ pub fn get_arch(triple: &str) -> &'static str {
125139
panic!("Cannot determine Architecture from triple");
126140
}
127141

142+
/// Determine the endianness from `triple`
143+
pub fn is_big_endian(triple: &str) -> bool {
144+
let triple_arch = triple.split('-').next().unwrap();
145+
BIG_ENDIAN.contains(&triple_arch)
146+
}
147+
128148
pub fn matches_env(triple: &str, name: &str) -> bool {
129149
if let Some(env) = triple.split('-').nth(3) { env.starts_with(name) } else { false }
130150
}

0 commit comments

Comments
 (0)