[llvm] [LoopVectorize] Support vectorization of frexp intrinsic (PR #172957)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 23 05:20:09 PST 2025
================
@@ -1695,8 +1695,18 @@ void VPWidenIntrinsicRecipe::execute(VPTransformState &State) {
SmallVector<Type *, 2> TysForDecl;
// Add return type if intrinsic is overloaded on it.
- if (isVectorIntrinsicWithOverloadTypeAtArg(VectorIntrinsicID, -1, State.TTI))
- TysForDecl.push_back(VectorType::get(getResultType(), State.VF));
+ if (isVectorIntrinsicWithOverloadTypeAtArg(VectorIntrinsicID, -1,
+ State.TTI)) {
+ // If the return type is a struct, we need to unpack its elements and
+ // vectorize them individually for the overloaded declaration.
+ Type *RetTy = getResultType();
+ if (auto *ST = dyn_cast<StructType>(RetTy)) {
+ for (Type *ElemTy : ST->elements())
+ TysForDecl.push_back(VectorType::get(ElemTy, State.VF));
+ } else {
+ TysForDecl.push_back(VectorType::get(RetTy, State.VF));
+ }
----------------
MacDue wrote:
nit: I think you may be able to use the existing helpers for this:
```c++
Type *RetTy = toVectorizedTy(getResultType(), State.VF)
append_range(TysForDecl, getContainedTypes(RetTy));
```
https://github.com/llvm/llvm-project/pull/172957
More information about the llvm-commits
mailing list