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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 00:46:41 PST 2025


================
@@ -865,6 +865,19 @@ SITargetLowering::SITargetLowering(const TargetMachine &TM,
       setOperationAction({ISD::FMAXIMUM, ISD::FMINIMUM}, MVT::v2f16, Legal);
   }
 
+  // special case for v_sat_pk
+  if (AMDGPU::isGFX9(STI) || AMDGPU::isGFX11(STI) || AMDGPU::isGFX12(STI)) {
+    // Reasons for putting both {MVT::v2i16, MVT::v2i8}
+    // 1. In foldToSaturated during DAG combine
+    //    a. isOperationLegalOrCustom(Opc, SrcVT)
+    //       will check getOperationAction(Op, SrcVT) == Custom
+    //    b. isTypeDesirableForOp checks regclass for v2i8
+    //       (hooked now checking DstVT == v2i8)
+    // 2. In CustomLowerNode during legalizing, checks
+    //    getOperationAction(Op, DstVT) == Custom
----------------
arsenm wrote:

This comment is too specifically describing implementation details in the combiner instead of why these cases are relevant 

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


More information about the llvm-commits mailing list