I have code snippets like
i32.const 1
i32.and
i32.eqz
br_if 1 (;@1;)
which could be optimised to
Similar analogous transformations:
i32.const 1; i32.and; i32.eqz; if to i32.ctz; if
i32.const 1; i32.and; if to i32.ctz; if (with legs swapped)
i32.const 2_147_483_648; i32.and; if to i32.clz; if (with legs swapped)
i32.const 31; i32.shr_u; if to i32.clz; if (with legs swapped)
- possibly 64-bit variants (but here probably instructions for truncation need to be added)
- what about signedness testing? (cmp against 0 -->
clz)