[llvm] [AMDGPU] select v_sat_pk from two i16 or v2i16 (PR #121124)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 02:56:27 PST 2025


arsenm wrote:

> At the pattern matching stage of DAG (which is `DoInstructionSelection`), we are not going to have any type of v2i8. These are all optimized out during the combination stage.

They are not optimized out, they are legalized out. 

> 
> So I think unless we modify the pre-DAG optimization passes, otherwise only changing the TD file will not make use of v2i8.

You need to use setOperationAction(ISD::TRUNCATE_SSAT_S, MVT::v2i8, then make ReplaceNodeResults handle TRUNCATE_SSAT_S by replacing it with some AMDGPU specific operation, plus a bitcast to the original type. Theoretically you can select direct to the machine node, but it's probably better to introduce an AMDGPU variant of the node and select that 

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


More information about the llvm-commits mailing list