Skip to content
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 testcrate/benches/float_conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ pub fn float_conv() {
conv_f64_i64(&mut criterion);
conv_f64_i128(&mut criterion);

#[cfg(all(f128_enabled))]
#[cfg(f128_enabled)]
// FIXME: ppc64le has a sporadic overflow panic in the crate functions
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
Expand Down
31 changes: 24 additions & 7 deletions testcrate/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use std::collections::HashSet;

mod builtins_configure {
include!("../configure.rs");
}

/// Features to enable
#[derive(Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
enum Feature {
NoSysF128,
NoSysF128IntConvert,
Expand All @@ -10,8 +14,16 @@ enum Feature {
NoSysF16F128Convert,
}

mod builtins_configure {
include!("../configure.rs");
impl Feature {
fn implies(self) -> &'static [Self] {
match self {
Self::NoSysF128 => [Self::NoSysF128IntConvert, Self::NoSysF16F128Convert].as_slice(),
Self::NoSysF128IntConvert => [].as_slice(),
Self::NoSysF16 => [Self::NoSysF16F64Convert, Self::NoSysF16F128Convert].as_slice(),
Self::NoSysF16F64Convert => [].as_slice(),
Self::NoSysF16F128Convert => [].as_slice(),
}
}
}

fn main() {
Expand Down Expand Up @@ -40,8 +52,6 @@ fn main() {
|| target.arch == "powerpc64"
{
features.insert(Feature::NoSysF128);
features.insert(Feature::NoSysF128IntConvert);
features.insert(Feature::NoSysF16F128Convert);
}

if target.arch == "x86" {
Expand All @@ -67,15 +77,22 @@ fn main() {
|| target.arch == "wasm64"
{
features.insert(Feature::NoSysF16);
features.insert(Feature::NoSysF16F64Convert);
features.insert(Feature::NoSysF16F128Convert);
}

// These platforms are missing either `__extendhfdf2` or `__truncdfhf2`.
if target.vendor == "apple" || target.os == "windows" {
features.insert(Feature::NoSysF16F64Convert);
}

// Add implied features. Collection is required for borrows.
features.extend(
features
.iter()
.flat_map(|x| x.implies())
.copied()
.collect::<Vec<_>>(),
);

for feature in features {
let (name, warning) = match feature {
Feature::NoSysF128 => ("no-sys-f128", "using apfloat fallback for f128"),
Expand Down