Skip to content

Commit b9a1c87

Browse files
committed
Enable tests that were skipped on PowerPC
Most of these were skipped because of a bug with the platform implementation, or some kind of crash unwinding. Since the upgrade to Ubuntu 25.04, these all seem to be resolved with the exception of a bug in the host `__floatundisf`. [1] #384 (comment)
1 parent 3fa5a8c commit b9a1c87

File tree

7 files changed

+34
-115
lines changed

7 files changed

+34
-115
lines changed

builtins-test-intrinsics/src/main.rs

Lines changed: 16 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ mod intrinsics {
4040
x as f64
4141
}
4242

43-
#[cfg(all(
44-
f16_enabled,
45-
f128_enabled,
46-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
47-
))]
43+
#[cfg(all(f16_enabled, f128_enabled))]
4844
pub fn extendhftf(x: f16) -> f128 {
4945
x as f128
5046
}
@@ -201,11 +197,7 @@ mod intrinsics {
201197

202198
/* f128 operations */
203199

204-
#[cfg(all(
205-
f16_enabled,
206-
f128_enabled,
207-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
208-
))]
200+
#[cfg(all(f16_enabled, f128_enabled))]
209201
pub fn trunctfhf(x: f128) -> f16 {
210202
x as f16
211203
}
@@ -220,50 +212,32 @@ mod intrinsics {
220212
x as f64
221213
}
222214

223-
#[cfg(all(
224-
f128_enabled,
225-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
226-
))]
215+
#[cfg(f128_enabled)]
227216
pub fn fixtfsi(x: f128) -> i32 {
228217
x as i32
229218
}
230219

231-
#[cfg(all(
232-
f128_enabled,
233-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
234-
))]
220+
#[cfg(f128_enabled)]
235221
pub fn fixtfdi(x: f128) -> i64 {
236222
x as i64
237223
}
238224

239-
#[cfg(all(
240-
f128_enabled,
241-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
242-
))]
225+
#[cfg(f128_enabled)]
243226
pub fn fixtfti(x: f128) -> i128 {
244227
x as i128
245228
}
246229

247-
#[cfg(all(
248-
f128_enabled,
249-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
250-
))]
230+
#[cfg(f128_enabled)]
251231
pub fn fixunstfsi(x: f128) -> u32 {
252232
x as u32
253233
}
254234

255-
#[cfg(all(
256-
f128_enabled,
257-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
258-
))]
235+
#[cfg(f128_enabled)]
259236
pub fn fixunstfdi(x: f128) -> u64 {
260237
x as u64
261238
}
262239

263-
#[cfg(all(
264-
f128_enabled,
265-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
266-
))]
240+
#[cfg(f128_enabled)]
267241
pub fn fixunstfti(x: f128) -> u128 {
268242
x as u128
269243
}
@@ -540,47 +514,25 @@ fn run() {
540514
bb(extendhfdf(bb(2.)));
541515
#[cfg(f16_enabled)]
542516
bb(extendhfsf(bb(2.)));
543-
#[cfg(all(
544-
f16_enabled,
545-
f128_enabled,
546-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
547-
))]
517+
#[cfg(all(f16_enabled, f128_enabled))]
548518
bb(extendhftf(bb(2.)));
549519
#[cfg(f128_enabled)]
550520
bb(extendsftf(bb(2.)));
551521
bb(fixdfti(bb(2.)));
552522
bb(fixsfti(bb(2.)));
553-
#[cfg(all(
554-
f128_enabled,
555-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
556-
))]
523+
#[cfg(f128_enabled)]
557524
bb(fixtfdi(bb(2.)));
558-
#[cfg(all(
559-
f128_enabled,
560-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
561-
))]
525+
#[cfg(f128_enabled)]
562526
bb(fixtfsi(bb(2.)));
563-
#[cfg(all(
564-
f128_enabled,
565-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
566-
))]
527+
#[cfg(f128_enabled)]
567528
bb(fixtfti(bb(2.)));
568529
bb(fixunsdfti(bb(2.)));
569530
bb(fixunssfti(bb(2.)));
570-
#[cfg(all(
571-
f128_enabled,
572-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
573-
))]
531+
#[cfg(f128_enabled)]
574532
bb(fixunstfdi(bb(2.)));
575-
#[cfg(all(
576-
f128_enabled,
577-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
578-
))]
533+
#[cfg(f128_enabled)]
579534
bb(fixunstfsi(bb(2.)));
580-
#[cfg(all(
581-
f128_enabled,
582-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
583-
))]
535+
#[cfg(f128_enabled)]
584536
bb(fixunstfti(bb(2.)));
585537
#[cfg(f128_enabled)]
586538
bb(floatditf(bb(2)));
@@ -616,11 +568,7 @@ fn run() {
616568
bb(truncsfhf(bb(2.)));
617569
#[cfg(f128_enabled)]
618570
bb(trunctfdf(bb(2.)));
619-
#[cfg(all(
620-
f16_enabled,
621-
f128_enabled,
622-
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
623-
))]
571+
#[cfg(all(f16_enabled, f128_enabled))]
624572
bb(trunctfhf(bb(2.)));
625573
#[cfg(f128_enabled)]
626574
bb(trunctfsf(bb(2.)));

builtins-test/benches/float_conv.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ float_bench! {
365365

366366
/* float -> unsigned int */
367367

368-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
369368
float_bench! {
370369
name: conv_f32_u32,
371370
sig: (a: f32) -> u32,
@@ -387,7 +386,6 @@ float_bench! {
387386
],
388387
}
389388

390-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
391389
float_bench! {
392390
name: conv_f32_u64,
393391
sig: (a: f32) -> u64,
@@ -409,7 +407,6 @@ float_bench! {
409407
],
410408
}
411409

412-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
413410
float_bench! {
414411
name: conv_f32_u128,
415412
sig: (a: f32) -> u128,
@@ -505,7 +502,6 @@ float_bench! {
505502

506503
/* float -> signed int */
507504

508-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
509505
float_bench! {
510506
name: conv_f32_i32,
511507
sig: (a: f32) -> i32,
@@ -527,7 +523,6 @@ float_bench! {
527523
],
528524
}
529525

530-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
531526
float_bench! {
532527
name: conv_f32_i64,
533528
sig: (a: f32) -> i64,
@@ -549,7 +544,6 @@ float_bench! {
549544
],
550545
}
551546

552-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
553547
float_bench! {
554548
name: conv_f32_i128,
555549
sig: (a: f32) -> i128,
@@ -666,9 +660,6 @@ pub fn float_conv() {
666660
conv_f64_i128(&mut criterion);
667661

668662
#[cfg(f128_enabled)]
669-
// FIXME: ppc64le has a sporadic overflow panic in the crate functions
670-
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
671-
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
672663
{
673664
conv_u32_f128(&mut criterion);
674665
conv_u64_f128(&mut criterion);

builtins-test/benches/float_extend.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ float_bench! {
110110
pub fn float_extend() {
111111
let mut criterion = Criterion::default().configure_from_args();
112112

113-
// FIXME(#655): `f16` tests disabled until we can bootstrap symbols
114113
#[cfg(f16_enabled)]
115-
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
116114
{
117115
extend_f16_f32(&mut criterion);
118116
extend_f16_f64(&mut criterion);

builtins-test/src/bench.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
2323
"mul_f64",
2424
];
2525

26-
// FIXME(f16_f128): error on LE ppc64. There are more tests that are cfg-ed out completely
27-
// in their benchmark modules due to runtime panics.
28-
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
29-
const PPC64LE_SKIPPED: &[&str] = &["extend_f32_f128"];
30-
3126
// FIXME(f16_f128): system symbols have incorrect results
3227
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
3328
const X86_NO_SSE_SKIPPED: &[&str] = &[
@@ -57,12 +52,6 @@ pub fn skip_sys_checks(test_name: &str) -> bool {
5752
return true;
5853
}
5954

60-
if cfg!(all(target_arch = "powerpc64", target_endian = "little"))
61-
&& PPC64LE_SKIPPED.contains(&test_name)
62-
{
63-
return true;
64-
}
65-
6655
if cfg!(all(target_arch = "x86", not(target_feature = "sse")))
6756
&& X86_NO_SSE_SKIPPED.contains(&test_name)
6857
{

builtins-test/tests/conv.rs

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,28 @@ mod i_to_f {
5959
|| ((error_minus == error || error_plus == error)
6060
&& ((f0.to_bits() & 1) != 0))
6161
{
62-
if !cfg!(any(
63-
target_arch = "powerpc",
64-
target_arch = "powerpc64"
65-
)) {
66-
panic!(
67-
"incorrect rounding by {}({}): {}, ({}, {}, {}), errors ({}, {}, {})",
68-
stringify!($fn),
69-
x,
70-
f1.to_bits(),
71-
y_minus_ulp,
72-
y,
73-
y_plus_ulp,
74-
error_minus,
75-
error,
76-
error_plus,
77-
);
78-
}
62+
panic!(
63+
"incorrect rounding by {}({}): {}, ({}, {}, {}), errors ({}, {}, {})",
64+
stringify!($fn),
65+
x,
66+
f1.to_bits(),
67+
y_minus_ulp,
68+
y,
69+
y_plus_ulp,
70+
error_minus,
71+
error,
72+
error_plus,
73+
);
7974
}
8075
}
8176

82-
// Test against native conversion. We disable testing on all `x86` because of
83-
// rounding bugs with `i686`. `powerpc` also has the same rounding bug.
77+
// Test against native conversion.
78+
// FIXME(x86,ppc): the platform version has rounding bugs on i686 and
79+
// PowerPC64le (for PPC this only shows up in Docker, not the native runner).
80+
// https://github.com/rust-lang/compiler-builtins/pull/384#issuecomment-740413334
8481
if !Float::eq_repr(f0, f1) && !cfg!(any(
8582
target_arch = "x86",
86-
target_arch = "powerpc",
87-
target_arch = "powerpc64"
83+
all(target_arch = "powerpc64", target_endian = "little")
8884
)) {
8985
panic!(
9086
"{}({}): std: {:?}, builtins: {:?}",

crates/musl-math-sys/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ macro_rules! functions {
4040
) => {
4141
// Run a simple check to ensure we can link and call the function without crashing.
4242
#[test]
43-
// FIXME(#309): LE PPC crashes calling some musl functions
44-
#[cfg_attr(all(target_arch = "powerpc64", target_endian = "little"), ignore)]
4543
fn $name() {
4644
<fn($($aty),+) -> $rty>::check(super::$name);
4745
}

libm/src/math/j1f.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ fn qonef(x: f32) -> f32 {
361361
return (0.375 + r / s) / x;
362362
}
363363

364-
// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520
365-
#[cfg(not(target_arch = "powerpc64"))]
366364
#[cfg(test)]
367365
mod tests {
368366
use super::{j1f, y1f};
@@ -371,6 +369,7 @@ mod tests {
371369
// 0x401F3E49
372370
assert_eq!(j1f(2.4881766_f32), 0.49999475_f32);
373371
}
372+
374373
#[test]
375374
fn test_y1f_2002() {
376375
//allow slightly different result on x87

0 commit comments

Comments
 (0)