[llvm] [WebAssembly] Add support for avgr_u in loops (PR #153252)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 22:26:06 PDT 2025


================

----------------
lukel97 wrote:

> I think the point of the having the loop vectorizer test case is that the loop vectorizer will vectorize the loop into ISD::AVGCEIL_U at DAG, where we can match to it to produce avgr_u.

The loop vectorizer operates at the LLVM IR level, it wouldn't be aware of ISD::AVGCEIL_U.

That makes sense about the udiv already being combined to a lshr though.

But maybe the diff in this PR is because it's in a wider type, <16 x i16>. What happens if we add a test in `simd-arith.ll` for that? Does this patch make a difference to its codegen?

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


More information about the llvm-commits mailing list