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

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 00:11:28 PST 2025


================
@@ -15184,6 +15205,16 @@ SDValue SITargetLowering::PerformDAGCombine(SDNode *N,
       return Widened;
     [[fallthrough]];
   }
+  case ISD::BITCAST: {
+    // This is possible beause for (i16 bitcase (v2i8 trunc ...))
+    // It may be replaced bu (i16 bitcase (v2i8 truncssat_u ...))
+    // And then (i16 bitcase (i16 AMDGPUsat_pk_cast ...))
+    // There is no instruction of casting to the same type
+    SDValue Src = N->getOperand(0);
+    if (N->getValueType(0) == Src.getValueType()) {
+      return Src;
+    }
----------------
Pierre-vh wrote:

```suggestion
    if (N->getValueType(0) == Src.getValueType()) 
      return Src;
```

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


More information about the llvm-commits mailing list