[llvm] [AMDGPU] Lower uniform uaddsat to SALU instructions (PR #210156)

Anshil Gandhi via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 18:54:19 PDT 2026


gandhi56 wrote:

> Does [#203155 (comment)](https://github.com/llvm/llvm-project/pull/203155#issuecomment-4936521314) work?

It would be incorrect for the i16 case because SGPRs are 32 bits wide. Consider a = 0xF000, b = 0x2000.

min(add(a, b), 0xFFFF) = min(0x11000, 0xFFFF) = 0xFFFF
add(min(a, ~b), b) = add(min(0xF000, 0xFFFFDFFF), 0x2000) = add(0xF000, 0x2000) = 0x11000.

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


More information about the llvm-commits mailing list