mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
make the codegen test also cover an ill-behaved arch, and add links
This commit is contained in:
parent
697787a92d
commit
75743dc5a0
@ -737,6 +737,8 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
// a hint, and use regular stores everywhere else.
|
||||
// (In the future, we could alternatively ensure that an sfence gets emitted after a sequence of movnt
|
||||
// before any kind of synchronizing operation. But it's not clear how to do that with LLVM.)
|
||||
// For more context, see <https://github.com/rust-lang/rust/issues/114582> and
|
||||
// <https://github.com/llvm/llvm-project/issues/64521>.
|
||||
const WELL_BEHAVED_NONTEMPORAL_ARCHS: &[&str] =
|
||||
&["aarch64", "arm", "riscv32", "riscv64"];
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
//@ compile-flags: -O
|
||||
//@ compile-flags: --target aarch64-unknown-linux-gnu
|
||||
//@ needs-llvm-components: aarch64
|
||||
//@revisions: with_nontemporal without_nontemporal
|
||||
//@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu
|
||||
//@[with_nontemporal] needs-llvm-components: aarch64
|
||||
//@[without_nontemporal] compile-flags: --target x86_64-unknown-linux-gnu
|
||||
//@[without_nontemporal] needs-llvm-components: x86
|
||||
|
||||
// Ensure that we *do* emit the `!nontemporal` flag on architectures where it
|
||||
// is well-behaved, but do *not* emit it on architectures where it is ill-behaved.
|
||||
// For more context, see <https://github.com/rust-lang/rust/issues/114582> and
|
||||
// <https://github.com/llvm/llvm-project/issues/64521>.
|
||||
|
||||
#![feature(no_core, lang_items, intrinsics)]
|
||||
#![no_core]
|
||||
@ -21,7 +29,8 @@ extern "rust-intrinsic" {
|
||||
#[no_mangle]
|
||||
pub fn a(a: &mut u32, b: u32) {
|
||||
// CHECK-LABEL: define{{.*}}void @a
|
||||
// CHECK: store i32 %b, ptr %a, align 4, !nontemporal
|
||||
// with_nontemporal: store i32 %b, ptr %a, align 4, !nontemporal
|
||||
// without_nontemporal-NOT: nontemporal
|
||||
unsafe {
|
||||
nontemporal_store(a, b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user