Skip to content

Commit 170d6cb

Browse files
committed
Auto merge of rust-lang#130426 - workingjubilee:rollup-63xnjry, r=workingjubilee
Rollup of 5 pull requests Successful merges: - rust-lang#127879 (Document futility of printing temporary pointers) - rust-lang#130325 (Use -0.0 in `intrinsics::simd::reduce_add_unordered`) - rust-lang#130336 (simplify `Build::update_existing_submodule`) - rust-lang#130398 (Add system libs for LLVM when cross compiling for Windows) - rust-lang#130420 (Register tool docs for `src/tools/build_helper`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 39b7669 + f64d1c1 commit 170d6cb

File tree

7 files changed

+55
-10
lines changed

7 files changed

+55
-10
lines changed

Diff for: compiler/rustc_codegen_llvm/src/intrinsic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2066,14 +2066,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20662066
};
20672067
}
20682068

2069-
arith_red!(simd_reduce_add_ordered: vector_reduce_add, vector_reduce_fadd, true, add, 0.0);
2069+
arith_red!(simd_reduce_add_ordered: vector_reduce_add, vector_reduce_fadd, true, add, -0.0);
20702070
arith_red!(simd_reduce_mul_ordered: vector_reduce_mul, vector_reduce_fmul, true, mul, 1.0);
20712071
arith_red!(
20722072
simd_reduce_add_unordered: vector_reduce_add,
20732073
vector_reduce_fadd_reassoc,
20742074
false,
20752075
add,
2076-
0.0
2076+
-0.0
20772077
);
20782078
arith_red!(
20792079
simd_reduce_mul_unordered: vector_reduce_mul,

Diff for: compiler/rustc_llvm/build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ fn main() {
220220
let mut cmd = Command::new(&llvm_config);
221221
cmd.arg(llvm_link_arg).arg("--libs");
222222

223-
if !is_crossed {
223+
// Don't link system libs if cross-compiling unless targetting Windows.
224+
// On Windows system DLLs aren't linked directly, instead import libraries are used.
225+
// These import libraries are independent of the host.
226+
if !is_crossed || target.contains("windows") {
224227
cmd.arg("--system-libs");
225228
}
226229

Diff for: library/core/src/fmt/mod.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,17 @@ pub trait UpperHex {
975975
/// `p` formatting.
976976
///
977977
/// The `Pointer` trait should format its output as a memory location. This is commonly presented
978-
/// as hexadecimal.
978+
/// as hexadecimal. For more information on formatters, see [the module-level documentation][module].
979979
///
980-
/// For more information on formatters, see [the module-level documentation][module].
980+
/// Printing of pointers is not a reliable way to discover how Rust programs are implemented.
981+
/// The act of reading an address changes the program itself, and may change how the data is represented
982+
/// in memory, and may affect which optimizations are applied to the code.
983+
///
984+
/// The printed pointer values are not guaranteed to be stable nor unique identifiers of objects.
985+
/// Rust allows moving values to different memory locations, and may reuse the same memory locations
986+
/// for different purposes.
987+
///
988+
/// There is no guarantee that the printed value can be converted back to a pointer.
981989
///
982990
/// [module]: ../../std/fmt/index.html
983991
///

Diff for: src/bootstrap/src/core/build_steps/doc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,14 @@ macro_rules! tool_doc {
10131013
}
10141014
}
10151015

1016+
// NOTE: make sure to register these in `Builder::get_step_description`.
1017+
tool_doc!(
1018+
BuildHelper,
1019+
"src/tools/build_helper",
1020+
rustc_tool = false,
1021+
is_library = true,
1022+
crates = ["build_helper"]
1023+
);
10161024
tool_doc!(Rustdoc, "src/tools/rustdoc", crates = ["rustdoc", "rustdoc-json-types"]);
10171025
tool_doc!(Rustfmt, "src/tools/rustfmt", crates = ["rustfmt-nightly", "rustfmt-config_proc_macro"]);
10181026
tool_doc!(Clippy, "src/tools/clippy", crates = ["clippy_config", "clippy_utils"]);

Diff for: src/bootstrap/src/core/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@ impl<'a> Builder<'a> {
944944
doc::Bootstrap,
945945
doc::Releases,
946946
doc::RunMakeSupport,
947+
doc::BuildHelper,
947948
),
948949
Kind::Dist => describe!(
949950
dist::Docs,

Diff for: src/bootstrap/src/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,7 @@ impl Build {
552552
// Look for `submodule.$name.path = $path`
553553
// Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
554554
let submodule = line.split_once(' ').unwrap().1;
555-
let path = Path::new(submodule);
556-
// Don't update the submodule unless it's already been cloned.
557-
if GitInfo::new(false, path).is_managed_git_subrepository() {
558-
self.config.update_submodule(submodule);
559-
}
555+
self.update_existing_submodule(submodule);
560556
}
561557
}
562558

Diff for: tests/assembly/simd/reduce-fadd-unordered.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//@ revisions: x86_64 aarch64
2+
//@ assembly-output: emit-asm
3+
//@ compile-flags: --crate-type=lib -O
4+
//@[aarch64] only-aarch64
5+
//@[x86_64] only-x86_64
6+
//@[x86_64] compile-flags: -Ctarget-feature=+sse3
7+
#![feature(portable_simd)]
8+
#![feature(core_intrinsics)]
9+
use std::intrinsics::simd as intrinsics;
10+
use std::simd::*;
11+
// Regression test for https://github.com/rust-lang/rust/issues/130028
12+
// This intrinsic produces much worse code if you use +0.0 instead of -0.0 because
13+
// +0.0 isn't as easy to algebraically reassociate, even using LLVM's reassoc attribute!
14+
// It would emit about an extra fadd, depending on the architecture.
15+
16+
// CHECK-LABEL: reduce_fadd_negative_zero
17+
pub unsafe fn reduce_fadd_negative_zero(v: f32x4) -> f32 {
18+
// x86_64: addps
19+
// x86_64-NEXT: movshdup
20+
// x86_64-NEXT: addss
21+
// x86_64-NOT: xorps
22+
23+
// aarch64: faddp
24+
// aarch64-NEXT: faddp
25+
26+
// CHECK-NOT: {{f?}}add{{p?s*}}
27+
// CHECK: ret
28+
intrinsics::simd_reduce_add_unordered(v)
29+
}

0 commit comments

Comments
 (0)