[PATCH] D148096: [AMDGPU][GlobalISel] Widen the vector operand in G_BUILD/INSERT/EXTRACT_VECTOR

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 06:35:03 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:1455-1457
+          const LLT Ty = Query.Types[VecTypeIdx];
+          return Ty.getSizeInBits() < 1024 &&
+                 !SIRegisterInfo::getSGPRClassForBitWidth(Ty.getSizeInBits());
----------------
Put this in a named LegalityPredicate - or can you just use the existing isRegisterType?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:1459-1467
+        const LLT Ty = Query.Types[VecTypeIdx];
+        unsigned NumElts = Ty.getNumElements();
+        unsigned EltSize = Ty.getElementType().getSizeInBits();
+
+        // Find the nearest legal RegClass that is larger than the current type.
+        while (!SIRegisterInfo::getSGPRClassForBitWidth(NumElts * EltSize))
+          ++NumElts;
----------------
Put this in a named LegalizeMutation


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:1593
 
   BuildVector.legalIf(isRegisterType(0));
 
----------------
We're already checking isRegisterType here. Perhaps we just need to improve isRegisterSize so that it knows about the missing vector types?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148096/new/

https://reviews.llvm.org/D148096



More information about the llvm-commits mailing list