[llvm] wasm: recognize `any_true` and `all_true` (PR #155885)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 15:45:36 PDT 2025


folkertdev wrote:

I wasn't sure that that would be accurate, based on:

https://llvm.org/docs/LangRef.html#llvm-vector-reduce-and-intrinsic

> The `llvm.vector.reduce.and.*` intrinsics do a bitwise AND reduction of a vector, returning the result as a scalar. The return type matches the element-type of the vector input.

While the wasm spec says that `all_true` specifically produces a boolean, so just 0 or 1:

https://www.w3.org/TR/2025/CRD-wasm-core-2-20250616/#-hrefsyntax-shapemathitshapemathsfhrefsyntax-instr-vecmathsfall_true

Maybe I'm missing something though?

---

I'm open to other suggestions, of course, if marking those operations as legal is not a good approach. Marking them as `Custom` instead seems like it would work, it just requires a bunch of C++ code. The patterns are much more elegant, but maybe there is no other way.

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


More information about the llvm-commits mailing list