[llvm] [RISCV][GISel] Lower G_ABDS and G_ABDU (PR #155888)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 31 11:52:56 PDT 2025


topperc wrote:

> > Isn't the code in LowerOperation only used for vectors?
> 
> From what I saw, `lowerAbsDiffToMinMax` works for both scalars and vectors. Should we keep it generic?

It does work, but if we don't have Zbb, I think SelectionDAG uses:

```
  // abds(lhs, rhs) -> select(sgt(lhs,rhs), sub(lhs,rhs), sub(rhs,lhs))          
  // abdu(lhs, rhs) -> select(ugt(lhs,rhs), sub(lhs,rhs), sub(rhs,lhs)) 
```

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


More information about the llvm-commits mailing list