[llvm] [AMDGPU] selecting v_sat_pk instruction, version 2 (PR #123297)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 06:43:53 PST 2025
================
@@ -3309,6 +3309,21 @@ def : GCNPat <
(v2i16 (V_LSHL_OR_B32_e64 $src1, (i32 16), (i32 (V_AND_B32_e64 (i32 (V_MOV_B32_e32 (i32 0xffff))), $src0))))
>;
+multiclass V_SAT_PK_Pat<Instruction inst> {
+ def : GCNPat<
----------------
Shoreshen wrote:
Hi @arsenm , by adding the node I got the following:
```
def V_SAT_PK_U8_I16_e64: list<dag> Pattern = [(set i16:$vdst, (AMDGPUsat_pk_cast (i32 (VOP3Mods0 i32:$src0))))];
def V_SAT_PK_U8_I16_fake16_e64: list<dag> Pattern = [(set i16:$vdst, (AMDGPUsat_pk_cast (i32 (VOP3Mods0 i32:$src0))))];
def V_SAT_PK_U8_I16_t16_e64: list<dag> Pattern = [(set i16:$vdst, (AMDGPUsat_pk_cast (i32 (VOP3OpSelMods i32:$src0, i32:$src0_modifiers))))];
```
I think there are 2 problems:
1. The source is i32, instead of v2i16
2. It requires the operand of AMDGPUsat_pk_cast be complex pattern of VOP3Mods0 or VOP3OpSelMods
If the instruction cannot cover any type of (i16 (AMDGPUsat_pk_cast v2i8)), we risks that this may cause a failure in selection.
I also tried to create a new VOP_I16_V2I16 type, but it makes V_SAT_PK_U8_I16_e64 and V_SAT_PK_U8_I16_fake16_e64 4 operand instructions (with modifier, clamp and opsel)
https://github.com/llvm/llvm-project/pull/123297
More information about the llvm-commits
mailing list