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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 23:03:09 PST 2026


topperc 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://alive2.llvm.org/ce/z/sDb3_V

Alternative alive2 proof use the max-min form for absd https://alive2.llvm.org/ce/z/9_Nhe9

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


More information about the llvm-commits mailing list