[llvm] [RISCV] Lower (abd[s|u] a, b) to (abs (sub a, b)) for i32/i64 element when `Zvabd` exists (PR #180494)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 22:55:42 PST 2026


wangpc-pp wrote:

> This transform isn't valid if the subtract has signed wrap.
> 
> absd(2, 0x8000) -> 0x8002
> 
> abs(sub(2, 0x8000)) -> (abs (0x8002)) -> 0x7ffe
> 
> https://alive2.llvm.org/ce/

The Alive2 link is not correct, can you share it again?

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


More information about the llvm-commits mailing list