We previously only matched (min (max ...))
Depends on D144728
Paths
| Differential D145159
[AMDGPU] Match med3 for (max (min ..)) ClosedPublic Authored by Pierre-vh on Mar 2 2023, 6:42 AM.
Details
Summary We previously only matched (min (max ...)) Depends on D144728
Diff Detail
Event TimelineComment Actions Is there a reason this is implemented in C++ instead of instruction selection patterns? Comment Actions
It's a DAG combine, it isn't creating a V_MED3 directly but the AMDGPUsmed3 DAG op so it can be matched by other ISel pattern Comment Actions
I think the constant value case would just be more annoying to handle in tablegen, but I think it's possible. If there's value in other patterns checking the med3, it makes sense to keep as a combine
Pierre-vh marked 4 inline comments as done. Comment ActionsRemove ext to i32 if med3_16 is not available This revision is now accepted and ready to land.Mar 6 2023, 5:05 AM This revision was landed with ongoing or failed builds.Mar 7 2023, 2:14 AM Closed by commit rGedca49cfb766: [AMDGPU] Match med3 for (max (min ..)) (authored by Pierre-vh). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 502963 llvm/lib/Target/AMDGPU/SIISelLowering.h
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/test/CodeGen/AMDGPU/mad_uint24.ll
llvm/test/CodeGen/AMDGPU/saddsat.ll
llvm/test/CodeGen/AMDGPU/smed3.ll
llvm/test/CodeGen/AMDGPU/ssubsat.ll
llvm/test/CodeGen/AMDGPU/umed3.ll
llvm/test/CodeGen/AMDGPU/v_sat_pk_u8_i16.ll
|
Probably fine if both constants have multiple uses already, not worth it for this particular patch