diff options
author | tangaac <tangyan01@loongson.cn> | 2025-03-03 10:26:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-03 10:26:11 +0800 |
commit | cb7030dbe7f3f1947c31b3059958ff3968cc22ff (patch) | |
tree | a56bf82a1ca17a993809a3d014f7efa07648653e /llvm/lib | |
parent | f5f3612453fb3568a76056daea41f67df82636af (diff) | |
download | llvm-cb7030dbe7f3f1947c31b3059958ff3968cc22ff.zip llvm-cb7030dbe7f3f1947c31b3059958ff3968cc22ff.tar.gz llvm-cb7030dbe7f3f1947c31b3059958ff3968cc22ff.tar.bz2 |
[LoongArch] use TypeWidenVector for most illegal vector types (#126456)
`TypeWidenVector` makes an illegal vector a larger one
e.g. in lsx
v2i32 -> v4i32
v4i16 -> v8i16
With this we can make good use of `vilvh`, `vilvl` instructions in
vector `sext`, `zext` in later pr.
Previous action is `TypePromoteInteger`, which replaces integer with a
larger one
e.g. in lsx
v2i32 -> v2i64
v4i16 -> v4i32
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/LoongArch/LoongArchISelLowering.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp index 2282dc8..dceb3c6 100644 --- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp +++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp @@ -6570,3 +6570,12 @@ bool LoongArchTargetLowering::shouldAlignPointerArgs(CallInst *CI, return true; } + +TargetLoweringBase::LegalizeTypeAction +LoongArchTargetLowering::getPreferredVectorAction(MVT VT) const { + if (!VT.isScalableVector() && VT.getVectorNumElements() != 1 && + VT.getVectorElementType() != MVT::i1) + return TypeWidenVector; + + return TargetLoweringBase::getPreferredVectorAction(VT); +}
\ No newline at end of file diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.h b/llvm/lib/Target/LoongArch/LoongArchISelLowering.h index a215ab5..f8d4cef 100644 --- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.h +++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.h @@ -281,6 +281,7 @@ public: Align &PrefAlign) const override; bool isFPImmVLDILegal(const APFloat &Imm, EVT VT) const; + LegalizeTypeAction getPreferredVectorAction(MVT VT) const override; private: /// Target-specific function used to lower LoongArch calling conventions. |