Rollup merge of #78361 - DevJPM:master, r=workingjubilee
Updated the list of white-listed target features for x86 This PR both adds in-source documentation on what to look out for when adding a new (X86) feature set and [adds all that are detectable at run-time in Rust stable as of 1.27.0](https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/src/detect/arch/x86.rs). This should only enable the use of the corresponding LLVM intrinsics. Actual intrinsics need to be added separately in rust-lang/stdarch. It also re-orders the run-time-detect test statements to be more consistent with the actual list of intrinsics whitelisted and removes underscores not present in the actual names (which might be mistaken as being part of the name) The reference for LLVM's feature names used is [this file](https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/X86TargetParser.def). This PR was motivated as the compiler end's part for allowing #67329 to be adressed over on rust-lang/stdarch
This commit is contained in:
commit
c7e9029b80
3 changed files with 68 additions and 25 deletions
|
@ -129,6 +129,13 @@ pub fn time_trace_profiler_finish(file_name: &str) {
|
|||
// WARNING: the features after applying `to_llvm_feature` must be known
|
||||
// to LLVM or the feature detection code will walk past the end of the feature
|
||||
// array, leading to crashes.
|
||||
// To find a list of LLVM's names, check llvm-project/llvm/include/llvm/Support/*TargetParser.def
|
||||
// where the * matches the architecture's name
|
||||
// Beware to not use the llvm github project for this, but check the git submodule
|
||||
// found in src/llvm-project
|
||||
// Though note that Rust can also be build with an external precompiled version of LLVM
|
||||
// which might lead to failures if the oldest tested / supported LLVM version
|
||||
// doesn't yet support the relevant intrinsics
|
||||
pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
|
||||
let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch };
|
||||
match (arch, s) {
|
||||
|
@ -136,6 +143,9 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
|
|||
("x86", "rdrand") => "rdrnd",
|
||||
("x86", "bmi1") => "bmi",
|
||||
("x86", "cmpxchg16b") => "cx16",
|
||||
("x86", "avx512vaes") => "vaes",
|
||||
("x86", "avx512gfni") => "gfni",
|
||||
("x86", "avx512vpclmulqdq") => "vpclmulqdq",
|
||||
("aarch64", "fp") => "fp-armv8",
|
||||
("aarch64", "fp16") => "fullfp16",
|
||||
(_, s) => s,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue