[llvm] [AMDGPU] Improved Lowering of abs(i16) and -abs(i16) (PR #165626)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 31 21:14:06 PDT 2025
https://github.com/arsenm commented:
This doesn't really fit with the usual strategy for dealing with this sort of issue (it's sort of backwards). The usual strategy is something closer to treat the operation as legal, and deal with it later if it isn't.
There are a few options. What I suggest is to make ISD::ABS custom for i16. In the custom lowering, check if the input is divergent, return to use the default expansion.
That should get the right result most of the time. There's a possible edge case where SIFixVGPRCopies will need to deal s_abs_i16 with SGPR inputs
https://github.com/llvm/llvm-project/pull/165626
More information about the llvm-commits
mailing list