Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7b6e8c9

Browse files
committed
Auto merge of rust-lang#131581 - tgross35:rollup-vul4kol, r=tgross35
Rollup of 7 pull requests Successful merges: - rust-lang#124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics) - rust-lang#130962 (Migrate lib's `&Option<T>` into `Option<&T>`) - rust-lang#131289 (stabilize duration_consts_float) - rust-lang#131310 (Support clobber_abi in MSP430 inline assembly) - rust-lang#131546 (Make unused_parens's suggestion considering expr's attributes.) - rust-lang#131565 (Remove deprecation note in the `non_local_definitions` lint) - rust-lang#131576 (Flatten redundant test module `run_make_support::diff::tests::tests`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fb20e4d + 5e477c9 commit 7b6e8c9

File tree

41 files changed

+395
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+395
-119
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ fn codegen_float_intrinsic_call<'tcx>(
328328
sym::fabsf64 => ("fabs", 1, fx.tcx.types.f64, types::F64),
329329
sym::fmaf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32),
330330
sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64),
331+
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
332+
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32
333+
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64
331334
sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32),
332335
sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64),
333336
sym::floorf32 => ("floorf", 1, fx.tcx.types.f32, types::F32),
@@ -381,7 +384,7 @@ fn codegen_float_intrinsic_call<'tcx>(
381384

382385
let layout = fx.layout_of(ty);
383386
let res = match intrinsic {
384-
sym::fmaf32 | sym::fmaf64 => {
387+
sym::fmaf32 | sym::fmaf64 | sym::fmuladdf32 | sym::fmuladdf64 => {
385388
CValue::by_val(fx.bcx.ins().fma(args[0], args[1], args[2]), layout)
386389
}
387390
sym::copysignf32 | sym::copysignf64 => {

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
6666
sym::log2f64 => "log2",
6767
sym::fmaf32 => "fmaf",
6868
sym::fmaf64 => "fma",
69+
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
70+
sym::fmuladdf32 => "fmaf", // TODO: use gcc intrinsic analogous to llvm.fmuladd.f32
71+
sym::fmuladdf64 => "fma", // TODO: use gcc intrinsic analogous to llvm.fmuladd.f64
6972
sym::fabsf32 => "fabsf",
7073
sym::fabsf64 => "fabs",
7174
sym::minnumf32 => "fminf",

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,11 @@ impl<'ll> CodegenCx<'ll, '_> {
884884
ifn!("llvm.fma.f64", fn(t_f64, t_f64, t_f64) -> t_f64);
885885
ifn!("llvm.fma.f128", fn(t_f128, t_f128, t_f128) -> t_f128);
886886

887+
ifn!("llvm.fmuladd.f16", fn(t_f16, t_f16, t_f16) -> t_f16);
888+
ifn!("llvm.fmuladd.f32", fn(t_f32, t_f32, t_f32) -> t_f32);
889+
ifn!("llvm.fmuladd.f64", fn(t_f64, t_f64, t_f64) -> t_f64);
890+
ifn!("llvm.fmuladd.f128", fn(t_f128, t_f128, t_f128) -> t_f128);
891+
887892
ifn!("llvm.fabs.f16", fn(t_f16) -> t_f16);
888893
ifn!("llvm.fabs.f32", fn(t_f32) -> t_f32);
889894
ifn!("llvm.fabs.f64", fn(t_f64) -> t_f64);

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ fn get_simple_intrinsic<'ll>(
8686
sym::fmaf64 => "llvm.fma.f64",
8787
sym::fmaf128 => "llvm.fma.f128",
8888

89+
sym::fmuladdf16 => "llvm.fmuladd.f16",
90+
sym::fmuladdf32 => "llvm.fmuladd.f32",
91+
sym::fmuladdf64 => "llvm.fmuladd.f64",
92+
sym::fmuladdf128 => "llvm.fmuladd.f128",
93+
8994
sym::fabsf16 => "llvm.fabs.f16",
9095
sym::fabsf32 => "llvm.fabs.f32",
9196
sym::fabsf64 => "llvm.fabs.f64",

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,19 @@ pub fn check_intrinsic_type(
357357
(0, 0, vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
358358
}
359359

360+
sym::fmuladdf16 => {
361+
(0, 0, vec![tcx.types.f16, tcx.types.f16, tcx.types.f16], tcx.types.f16)
362+
}
363+
sym::fmuladdf32 => {
364+
(0, 0, vec![tcx.types.f32, tcx.types.f32, tcx.types.f32], tcx.types.f32)
365+
}
366+
sym::fmuladdf64 => {
367+
(0, 0, vec![tcx.types.f64, tcx.types.f64, tcx.types.f64], tcx.types.f64)
368+
}
369+
sym::fmuladdf128 => {
370+
(0, 0, vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
371+
}
372+
360373
sym::fabsf16 => (0, 0, vec![tcx.types.f16], tcx.types.f16),
361374
sym::fabsf32 => (0, 0, vec![tcx.types.f32], tcx.types.f32),
362375
sym::fabsf64 => (0, 0, vec![tcx.types.f64], tcx.types.f64),

compiler/rustc_lint/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,6 @@ lint_non_glob_import_type_ir_inherent = non-glob import of `rustc_type_ir::inher
581581
582582
lint_non_local_definitions_cargo_update = the {$macro_kind} `{$macro_name}` may come from an old version of the `{$crate_name}` crate, try updating your dependency with `cargo update -p {$crate_name}`
583583
584-
lint_non_local_definitions_deprecation = this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
585-
586584
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
587585
.non_local = an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
588586
.doctest = make this doc-test a standalone test with its own `fn main() {"{"} ... {"}"}`

compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,8 +1430,6 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
14301430
);
14311431
}
14321432
}
1433-
1434-
diag.note(fluent::lint_non_local_definitions_deprecation);
14351433
}
14361434
NonLocalDefinitionsDiag::MacroRules {
14371435
depth,
@@ -1452,7 +1450,6 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
14521450
}
14531451

14541452
diag.note(fluent::lint_non_local);
1455-
diag.note(fluent::lint_non_local_definitions_deprecation);
14561453

14571454
if let Some(cargo_update) = cargo_update {
14581455
diag.subdiagnostic(cargo_update);

compiler/rustc_lint/src/unused.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,15 @@ trait UnusedDelimLint {
804804
.find_ancestor_inside(value.span)
805805
.map(|span| (value.span.with_hi(span.lo()), value.span.with_lo(span.hi()))),
806806
ast::ExprKind::Paren(ref expr) => {
807-
expr.span.find_ancestor_inside(value.span).map(|expr_span| {
807+
// For the expr with attributes, like `let _ = (#[inline] || println!("Hello!"));`,
808+
// the span should contains the attributes, or the suggestion will remove them.
809+
let expr_span_with_attrs =
810+
if let Some(attr_lo) = expr.attrs.iter().map(|attr| attr.span.lo()).min() {
811+
expr.span.with_lo(attr_lo)
812+
} else {
813+
expr.span
814+
};
815+
expr_span_with_attrs.find_ancestor_inside(value.span).map(|expr_span| {
808816
(value.span.with_hi(expr_span.lo()), value.span.with_lo(expr_span.hi()))
809817
})
810818
}

compiler/rustc_span/src/symbol.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,10 @@ symbols! {
914914
fmt_debug,
915915
fmul_algebraic,
916916
fmul_fast,
917+
fmuladdf128,
918+
fmuladdf16,
919+
fmuladdf32,
920+
fmuladdf64,
917921
fn_align,
918922
fn_delegation,
919923
fn_must_use,

compiler/rustc_target/src/asm/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ pub enum InlineAsmClobberAbi {
893893
RiscV,
894894
LoongArch,
895895
S390x,
896+
Msp430,
896897
}
897898

898899
impl InlineAsmClobberAbi {
@@ -946,6 +947,10 @@ impl InlineAsmClobberAbi {
946947
"C" | "system" => Ok(InlineAsmClobberAbi::S390x),
947948
_ => Err(&["C", "system"]),
948949
},
950+
InlineAsmArch::Msp430 => match name {
951+
"C" | "system" => Ok(InlineAsmClobberAbi::Msp430),
952+
_ => Err(&["C", "system"]),
953+
},
949954
_ => Err(&[]),
950955
}
951956
}
@@ -1125,6 +1130,11 @@ impl InlineAsmClobberAbi {
11251130
a8, a9, a10, a11, a12, a13, a14, a15,
11261131
}
11271132
},
1133+
InlineAsmClobberAbi::Msp430 => clobbered_regs! {
1134+
Msp430 Msp430InlineAsmReg {
1135+
r11, r12, r13, r14, r15,
1136+
}
1137+
},
11281138
}
11291139
}
11301140
}

0 commit comments

Comments
 (0)