[llvm] [AMDGPU] selecting v_sat_pk instruction, version 2 (PR #123297)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 05:15:49 PST 2025


================
@@ -1982,8 +2004,10 @@ bool SITargetLowering::isTypeDesirableForOp(unsigned Op, EVT VT) const {
   if (VT == MVT::i1 && Op == ISD::SETCC)
     return false;
 
-  // v2i8 is illegal and only allowed in specific cases
-  if (VT == MVT::v2i8 && Op == ISD::TRUNCATE_SSAT_U)
+  // Special case for vNi8 handling where N is even
----------------
Shoreshen wrote:

Hi @arsenm , this function checks the destination type, while `TLI.isOperationLegalOrCustom` checks the source type.

The Dst type are vNi8, if we didn't return true here, it goes to the default function to check `isTypeLegal(DstVT)`

The backend haven't add register class for vNi8. We maybe can add the relevant register class, but makeing vNi8 legal for register class may cause unpredictable result. 

Personally I think we could add the relevant type when it is make formally legal in the backend. So I decide to handle it here for special case.

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


More information about the llvm-commits mailing list