diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-08-12 17:09:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-12 17:09:14 +0200 |
| commit | ef74616e4411f86bf38a0215ba4348709fd81666 (patch) | |
| tree | 5d53790a7357a98741f1c96887589850dffbb926 | |
| parent | 3de829e4e5cd937d71b760a07462842b20258987 (diff) | |
| parent | 80a7d5f61d981170c98f86d1716e2f325c86a1e2 (diff) | |
| download | rust-ef74616e4411f86bf38a0215ba4348709fd81666.tar.gz rust-ef74616e4411f86bf38a0215ba4348709fd81666.zip | |
Rollup merge of #128149 - RalfJung:nontemporal_store, r=jieyouxu,Amanieu,Jubilee
nontemporal_store: make sure that the intrinsic is truly just a hint The `!nontemporal` flag for stores in LLVM *sounds* like it is just a hint, but actually, it is not -- at least on x86, non-temporal stores need very special treatment by the programmer or else the Rust memory model breaks down. LLVM still treats these stores as-if they were normal stores for optimizations, which is [highly dubious](https://github.com/llvm/llvm-project/issues/64521). Let's avoid all that dubiousness by making our own non-temporal stores be truly just a hint, which is possible on some targets (e.g. ARM). On all other targets, non-temporal stores become regular stores. ~~Blocked on https://github.com/rust-lang/stdarch/pull/1541 propagating to the rustc repo, to make sure the `_mm_stream` intrinsics are unaffected by this change.~~ Fixes https://github.com/rust-lang/rust/issues/114582 Cc `@Amanieu` `@workingjubilee`
| -rw-r--r-- | src/intrinsics/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index b21c559e668..29deac60730 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -725,7 +725,8 @@ fn codegen_regular_intrinsic_call<'tcx>( // Cranelift treats stores as volatile by default // FIXME correctly handle unaligned_volatile_store - // FIXME actually do nontemporal stores if requested + // FIXME actually do nontemporal stores if requested (but do not just emit MOVNT on x86; + // see the LLVM backend for details) let dest = CPlace::for_ptr(Pointer::new(ptr), val.layout()); dest.write_cvalue(fx, val); } |
