Skip to content

Commit

Permalink
aarch64: Support FEAT_LRCPC3/FEAT_LSE128 with pre-16 LLVM
Browse files Browse the repository at this point in the history
LLVM supports FEAT_LRCPC3/FEAT_LSE128 instructions on LLVM 16+, so use .inst directive on old LLVM.
llvm/llvm-project@a6aaa96
llvm/llvm-project@7fea6f2

AAarch64 .inst directive is portable since LLVM 7:
llvm/llvm-project@3e3d39d
  • Loading branch information
taiki-e committed Sep 15, 2024
1 parent 46f8260 commit 0ca59ec
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 60 deletions.
9 changes: 9 additions & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ kuser
ldar
ldaxp
ldclrp
ldclrpa
ldclrpal
ldclrpl
ldiapp
ldsetp
ldsetpa
ldsetpal
ldsetpl
ldxp
lghi
libatomic
Expand Down Expand Up @@ -149,6 +155,9 @@ subfe
subfic
subfze
swpp
swppa
swppal
swppl
syscall
sysctlbyname
sysctlnode
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ jobs:
target: aarch64-unknown-linux-gnu
# - rust: '1.64' # LLVM 14
# target: aarch64-unknown-linux-gnu
# - rust: '1.69' # LLVM 15
# target: aarch64-unknown-linux-gnu
- rust: '1.69' # LLVM 15
target: aarch64-unknown-linux-gnu
# - rust: '1.72' # LLVM 16
# target: aarch64-unknown-linux-gnu
- rust: stable
Expand Down
9 changes: 2 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,8 @@ fn main() {
let is_macos = target_os == "macos";
let mut has_lse = is_macos;
target_feature_fallback("lse2", is_macos);
// LLVM supports FEAT_LRCPC3 and FEAT_LSE128 on LLVM 16+:
// https://github.com/llvm/llvm-project/commit/a6aaa969f7caec58a994142f8d855861cf3a1463
// https://github.com/llvm/llvm-project/commit/7fea6f2e0e606e5339c3359568f680eaf64aa306
if version.llvm >= 16 {
has_lse |= target_feature_fallback("lse128", false);
target_feature_fallback("rcpc3", false);
}
has_lse |= target_feature_fallback("lse128", false);
target_feature_fallback("rcpc3", false);
// aarch64_target_feature stabilized in Rust 1.61.
if needs_target_feature_fallback(&version, Some(61)) {
target_feature_fallback("lse", has_lse);
Expand Down
Loading

0 comments on commit 0ca59ec

Please sign in to comment.