[llvm] [RISCV] Optimize divide by constant for VP intrinsics (PR #125991)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 20:43:54 PST 2025


topperc wrote:

> Was there are particular reason for doing this in DAGCombiner as opposed to InstCombine? E.g. I think instcombine currently handles the udiv of max case:
> 
> ```llvm
> define <vscale x 2 x i64> @f(<vscale x 2 x i64> %v) {
>   %x = udiv <vscale x 2 x i64> %v, splat (i64 18446744073709551615)
>   ret <vscale x 2 x i64> %x
> }
> 
> ->
> 
> define <vscale x 2 x i64> @f(<vscale x 2 x i64> %v) {
>   %1 = icmp eq <vscale x 2 x i64> %v, splat (i64 -1)
>   %x = zext <vscale x 2 x i1> %1 to <vscale x 2 x i64>
>   ret <vscale x 2 x i64> %x
> }
> ```

Is this question about the max case or the entire patch?

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


More information about the llvm-commits mailing list