From be681fefed254c06139ab055b07cfd6f8b30bacf Mon Sep 17 00:00:00 2001 From: Jules Bertholet Date: Fri, 25 Mar 2022 02:44:16 -0400 Subject: Add `round_ties_even` to `f32` and `f64` --- compiler/rustc_codegen_gcc/src/intrinsic/mod.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/rustc_codegen_gcc/src') diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs index 49be6c649e6..35e650c65a0 100644 --- a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs +++ b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs @@ -68,6 +68,8 @@ fn get_simple_intrinsic<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, name: Symbol) -> sym::nearbyintf64 => "nearbyint", sym::roundf32 => "roundf", sym::roundf64 => "round", + sym::roundevenf32 => "roundevenf", + sym::roundevenf64 => "roundeven", sym::abort => "abort", _ => return None, }; -- cgit 1.4.1-3-g733a5 From 2c0c25dcc1598cd115838e1e1d74d9f32ffd8dbf Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sun, 5 Mar 2023 12:31:16 -0500 Subject: Fix for diagnostics --- compiler/rustc_codegen_gcc/locales/en-US.ftl | 3 +++ compiler/rustc_codegen_gcc/src/attributes.rs | 11 ++++++----- compiler/rustc_codegen_gcc/src/errors.rs | 9 +++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_codegen_gcc/src') diff --git a/compiler/rustc_codegen_gcc/locales/en-US.ftl b/compiler/rustc_codegen_gcc/locales/en-US.ftl index 2181d49eeef..0a94a08f8dc 100644 --- a/compiler/rustc_codegen_gcc/locales/en-US.ftl +++ b/compiler/rustc_codegen_gcc/locales/en-US.ftl @@ -63,3 +63,6 @@ codegen_gcc_invalid_monomorphization_unsupported_operation = codegen_gcc_invalid_minimum_alignment = invalid minimum global alignment: {$err} + +codegen_gcc_tied_target_features = the target features {$features} must all be either enabled or disabled together + .help = add the missing features in a `target_feature` attribute diff --git a/compiler/rustc_codegen_gcc/src/attributes.rs b/compiler/rustc_codegen_gcc/src/attributes.rs index 243a1a36dd0..db841b1b524 100644 --- a/compiler/rustc_codegen_gcc/src/attributes.rs +++ b/compiler/rustc_codegen_gcc/src/attributes.rs @@ -9,7 +9,7 @@ use rustc_session::Session; use rustc_span::symbol::sym; use smallvec::{smallvec, SmallVec}; -use crate::context::CodegenCx; +use crate::{context::CodegenCx, errors::TiedTargetFeatures}; // Given a map from target_features to whether they are enabled or disabled, // ensure only valid combinations are allowed. @@ -84,10 +84,11 @@ pub fn from_fn_attrs<'gcc, 'tcx>( let span = cx.tcx .get_attr(instance.def_id(), sym::target_feature) .map_or_else(|| cx.tcx.def_span(instance.def_id()), |a| a.span); - let msg = format!("the target features {} must all be either enabled or disabled together", features.join(", ")); - let mut err = cx.tcx.sess.struct_span_err(span, &msg); - err.help("add the missing features in a `target_feature` attribute"); - err.emit(); + cx.tcx.sess.create_err(TiedTargetFeatures { + features: features.join(", "), + span, + }) + .emit(); return; } diff --git a/compiler/rustc_codegen_gcc/src/errors.rs b/compiler/rustc_codegen_gcc/src/errors.rs index 5ea39606c08..9305bd1e043 100644 --- a/compiler/rustc_codegen_gcc/src/errors.rs +++ b/compiler/rustc_codegen_gcc/src/errors.rs @@ -227,3 +227,12 @@ pub(crate) struct UnwindingInlineAsm { pub(crate) struct InvalidMinimumAlignment { pub err: String, } + +#[derive(Diagnostic)] +#[diag(codegen_gcc_tied_target_features)] +#[help] +pub(crate) struct TiedTargetFeatures { + #[primary_span] + pub span: Span, + pub features: String, +} -- cgit 1.4.1-3-g733a5