Skip to content

Commit 78f3946

Browse files
committed
ABI checks: add support for loongarch
LoongArch psABI[^1] specifies that LSX vector types are passed via general-purpose registers, while LASX vector types are passed indirectly through the stack. This patch addresses the following warnings: ``` warning: this function call uses a SIMD vector type that is not currently supported with the chosen ABI --> .../library/core/src/../../stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs:3695:5 | 3695 | __lsx_vreplgr2vr_b(a) | ^^^^^^^^^^^^^^^^^^^^^ function called here | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #116558 <#116558> = note: `#[warn(abi_unsupported_vector_types)]` on by default ``` [^1]: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc
1 parent 5a6036a commit 78f3946

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎compiler/rustc_target/src/target_features.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ const HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI: &'static [(u64, &'static str)] =
611611
&[/*(512, "hvx-length64b"),*/(1024,"hvx-length128b")];
612612
constMIPS_FEATURES_FOR_CORRECT_VECTOR_ABI:&'static[(u64,&'staticstr)] = &[(128,"msa")];
613613
constCSKY_FEATURES_FOR_CORRECT_VECTOR_ABI:&'static[(u64,&'staticstr)] = &[(128,"vdspv1")];
614+
constLOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI:&'static[(u64,&'staticstr)] =
615+
&[(128,"lsx"),(256,"lasx")];
614616

615617
implsuper::spec::Target{
616618
pubfnrust_target_features(&self) -> &'static[(&'staticstr,Stability,ImpliedFeatures)]{
@@ -638,7 +640,7 @@ impl super::spec::Target {
638640
"aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI,
639641
"arm" => ARM_FEATURES_FOR_CORRECT_VECTOR_ABI,
640642
"powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI,
641-
"loongarch64" => &[],// on-stack ABI, so we complain about all by-val vectors
643+
"loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI,
642644
"riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI,
643645
"wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_VECTOR_ABI,
644646
"s390x" => S390X_FEATURES_FOR_CORRECT_VECTOR_ABI,

0 commit comments

Comments
 (0)