[llvm] [AMDGPU] Use `v_cvt_pk_*` instructions for i8_f32 saturated conversions (PR #206522)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 05:05:01 PDT 2026


================
@@ -3932,6 +3933,14 @@ SDValue AMDGPUTargetLowering::LowerFP_TO_INT_SAT(const SDValue Op,
       return Op;
   }
 
+  // Native selection also applies to some 8-bit width cases to allow use of
+  // packed instructions.
+  if (SatWidth == 8 &&
+      ((DstVT == MVT::i16 && SrcVT == MVT::f32) ||
+       (DstVT == MVT::v2i16 && SrcVT == MVT::v2f32)) &&
----------------
jayfoad wrote:

If you prefer you could also write this as:
```
  DstVT.getScalarType() == MVT::i16 && SrcVT.getScalarType() == MVT::f32
```

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


More information about the llvm-commits mailing list