[llvm] [AMDGPU] Lower uniform usubsat to SOP (PR #203155)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 13:56:39 PDT 2026


LU-JOHN wrote:

> * i16: route uniform `usubsat` through `promoteUniformOpToI32` instead of a TableGen pattern that hard-codes the 0xffff masks. This exposes the zero-extends as real DAG nodes so KnownBits can fold the masks when the high bits are already known zero; the promoted i32 usubsat then reuses the scalar pattern. Promote-and-truncate is safe for usubsat because the result always fits in the narrow type (unlike uaddsat).

Could i16 `uaddsat` be implemented with truncate(min(zero-extend(a) + zero-extend(b), 0xffff))?

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


More information about the llvm-commits mailing list