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

Igor Wodiany via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 03:39:38 PDT 2026


================
@@ -3139,3 +3139,49 @@ defm V_DOT8_U32_U4  : VOP3P_Real_gfx10_gfx11_gfx12_gfx13<0x19>;
 
 defm V_DOT4_I32_I8  : VOP3P_Real_gfx10 <0x16>;
 defm V_DOT8_I32_I4  : VOP3P_Real_gfx10 <0x18>;
+
+//===----------------------------------------------------------------------===//
+// GFX11+ Patterns
+//===----------------------------------------------------------------------===//
+
+// Packed f32 -> i16 saturated conversion.
+multiclass CvtPkF32ToI16Pat<SDPatternOperator dagOp, Instruction inst> {
----------------
IgWod wrote:

It looks like we need both `SReg_64` and `VReg_64` case for GISel. I can't make it to select correctly otherwise, but I may be missing something. `zext` and `anyext` in `llvm/lib/Target/AMDGPU/SIInstructions.td` are similar in that sense, so I think keeping those two patterns for conversions is okay.

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


More information about the llvm-commits mailing list