about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-10-04 13:58:06 -0700
committerGitHub <noreply@github.com>2021-10-04 13:58:06 -0700
commit4e9cf04c98dd65a7f4baedc2984fae18d5fecfd1 (patch)
tree08e3d348f0cd16197d996b5fd27c549fabbac329 /compiler/rustc_codegen_llvm
parent175b8db73bfd078b4bcd3c28c8d6f51d5895ebf3 (diff)
parent0f9f241aac21bc77fb9e757da18207abefdc841d (diff)
downloadrust-4e9cf04c98dd65a7f4baedc2984fae18d5fecfd1.tar.gz
rust-4e9cf04c98dd65a7f4baedc2984fae18d5fecfd1.zip
Rollup merge of #83655 - sebpop:arm64-outline-atomics, r=workingjubilee
[aarch64] add target feature outline-atomics

Enable outline-atomics by default as enabled in clang by the following commit
https://reviews.llvm.org/rGc5e7e649d537067dec7111f3de1430d0fc8a4d11

Performance improves by several orders of magnitude when using the LSE instructions
instead of the ARMv8.0 compatible load/store exclusive instructions.

Tested on Graviton2 aarch64-linux with
x.py build && x.py install && x.py test
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index c5deb11edd0..b15efcd0dc2 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -416,6 +416,11 @@ pub fn llvm_global_features(sess: &Session) -> Vec<String> {
     // -Ctarget-features
     features.extend(sess.opts.cg.target_feature.split(',').flat_map(&filter));
 
+    // FIXME: Move outline-atomics to target definition when earliest supported LLVM is 12.
+    if get_version() >= (12, 0, 0) && sess.target.llvm_target.contains("aarch64-unknown-linux") {
+        features.push("+outline-atomics".to_string());
+    }
+
     features
 }