Open programmerjake opened 2 years ago
@llvm/issue-subscribers-backend-x86
Do you mean such code: https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/CodeGenPrepare.cpp#L2252-L2267 ?
It looks to me the lower to constant still requires the target supports scalable vectors. In a word, this intrinsic should be called at all on X86.
Do you mean such code: https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/CodeGenPrepare.cpp#L2252-L2267 ?
Yes, something like that.
It looks to me the lower to constant still requires the target supports scalable vectors. In a word, this intrinsic should be called at all on X86.
Well, @rust-lang/project-portable-simd will most likely want a way to use scalable vectors on any target (since we're trying to make completely portable simd viable), with llvm and/or rustc converting it to some fallback code on targets that don't natively support scalable vectors.
I think we can work around it, but it requires us to change our IR generation to get a lot more target-specific if/when we introduce scalable vector types, which is going to hurt our ability to diagnose optimization problems. And Vector Predication roadmap says that they intend to replace the masked intrinsics entirely, eventually, with VP intrinsics, and those are designed to work with vscale and an effective vector length. Though they don't require the former, and the latter notes, somewhat cryptically (to me):
Some targets, such as AVX512, do not support the %evl parameter in hardware. The use of an effective %evl is discouraged for those targets. The function TargetTransformInfo::hasActiveVectorLength() returns true when the target has native support for %evl.
iirc the call to
llvm.vscale.i64
should be lowered to a constant as part of legalization since x86_64 doesn't support scalable vectors, instead, instruction selection fails: https://llvm.godbolt.org/z/q987oTf94