about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-12 11:10:26 +0200
committerRalf Jung <post@ralfj.de>2024-08-12 11:42:38 +0200
commit75743dc5a057cdc0678d88523edbbf3fdd1bf901 (patch)
tree98316bab6ec77b2df1eb4b2d7e1319a495330fda /tests/codegen
parent697787a92d8858b17bfe3e55c3e82877149f8f83 (diff)
downloadrust-75743dc5a057cdc0678d88523edbbf3fdd1bf901.tar.gz
rust-75743dc5a057cdc0678d88523edbbf3fdd1bf901.zip
make the codegen test also cover an ill-behaved arch, and add links
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/intrinsics/nontemporal.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs
index 828cb7e8287..ff2d6296066 100644
--- a/tests/codegen/intrinsics/nontemporal.rs
+++ b/tests/codegen/intrinsics/nontemporal.rs
@@ -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);
     }