-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LoongArch] SIMD intrinsics not fully inlined in caller with target feature globally enabled #133281
Comments
If the caller has a target feature attribute #![feature(stdarch_loongarch)]
#![feature(loongarch_target_feature)]
use std::arch::loongarch64::*;
#[target_feature(enable = "lsx")]
pub unsafe fn simd(s: i32) -> i32 {
lsx_vpickve2gr_b::<0>(lsx_vreplgr2vr_b(s))
} |
Even without target feature attributes, x86 is still inlined. use std::arch::x86_64::*;
pub unsafe fn simd(s: i32) -> i32 {
let a = _mm_set1_epi8(s as i8);
let b = _mm_srl_epi64(a, a);
_mm_movemask_epi8(b) as i32
} I strongly suspect this is an additional optimization from the LLVM backend, as the two are clearly different when compared to the Rust MIR.
|
@heiher Without having looked at the details here, this usually means you need to implement the areInlineCompatible() TTI hook. |
I agree with you. I just caught it. |
EDIT: LLVM PR: llvm/llvm-project#117493 |
I tried this code:
I expected to see this happen:
The
lsx
intrinsics are inlined withinsimd
functions when thelsx
target feature is globally enabled.Instead, this happened:
Meta
rustc --version --verbose
:rustc -Z unstable-options --print target-spec-json
:The text was updated successfully, but these errors were encountered: