[llvm] [WebAssembly] [Backend] Combine and(X, shuffle(X, pow 2 mask)) to all true (PR #145108)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 08:32:21 PDT 2025


folkertdev wrote:

I had a look at this myself, but can“t quite figure out how to check for the next operation being a `!= 0`: only then is the conversion to `all_true` actually valid.

I'm assuming the conversion to `i32` is because that would be more efficient in the scalar case, it's just half the number of operations. In the linked example the third version

```c
bool baz(v128_t a) {
    v128_t zero = wasm_i16x8_splat(0);
    return __builtin_reduce_and((a != zero));
}
```

Now actually does have the desired codegen, so the correct conversion is made, but somehow inhibited when using the explicit wasm comparison functions.


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


More information about the llvm-commits mailing list