[llvm] [MIPS] [MSA] Widen v2i8, v216 and v2i32 vectors (PR #123040)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 01:43:05 PST 2025


================
@@ -59,6 +60,29 @@ static cl::opt<bool> NoDPLoadStore("mno-ldc1-sdc1", cl::init(false),
                                             "stores to their single precision "
                                             "counterparts"));
 
+// Widen the v2 vectors to the register width, i.e. v2i16 -> v8i16,
+// v2i32 -> v4i32, etc, to ensure the correct rail size is used, i.e.
+// INST.h for v16, INST.w for v32, INST.d for v64.
+TargetLoweringBase::LegalizeTypeAction
+MipsSETargetLowering::getPreferredVectorAction(MVT VT) const {
+  if (this->Subtarget.hasMSA() && this->Subtarget.isGP64bit()) {
+    switch (VT.SimpleTy) {
+    // Leave v2i1s to be promoted to larger ones.
+    case MVT::v2i1:
+      return TypePromoteInteger;
+    case MVT::v2i8:
+    case MVT::v2i16:
+    case MVT::v2i32:
+      return TypeWidenVector;
+      break;
+    // v2i64 is already 128-bit wide.
+    default:
----------------
wzssyqa wrote:

How about something like `v4i16` or `v2i32` etc?


https://github.com/llvm/llvm-project/pull/123040


More information about the llvm-commits mailing list