Stream: git-wasmtime

Topic: wasmtime / issue #3262 [proposal] Optimize lowering for p...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 29 2021 at 13:21):

MaxGraey edited issue #3262:

Feature

This is fairly common pattern that generates LLVM-based languages for power of two code (x != 0 & (x & (x - 1) == 0 => popcnt(x) == 1). This is a pretty compact and fast representation, but not for platforms which don't support popcnt instructions, such as armv8 or x86 before Nehalem architecture. AArch64 could also benefit from this.

Benefit

https://godbolt.org/z/dM4fqvozn

Implementation

During lowering I propose lower popcnt(x) == 1 pattern to (x != 0) & ((x & (x - 1) == 0) for some archs.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 29 2021 at 17:52):

MaxGraey edited issue #3262:

Feature

This is fairly common pattern that generates by LLVM-based languages for power of two code (x != 0 & (x & (x - 1) == 0 => popcnt(x) == 1). This is a pretty compact and fast representation, but not for platforms which don't support popcnt instructions, such as armv8 or x86 before Nehalem architecture. AArch64 could also benefit from this.

Benefit

https://godbolt.org/z/dM4fqvozn

Implementation

During lowering I propose lower popcnt(x) == 1 pattern to (x != 0) & ((x & (x - 1) == 0) for some archs.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 29 2021 at 17:53):

MaxGraey edited issue #3262:

Feature

This is fairly common pattern that generates by LLVM-based languages for power of two code
(x != 0 & (x & (x - 1) == 0 => popcnt(x) == 1). This is a pretty compact and fast representation, but not for platforms which don't support popcnt instructions, such as armv8 or x86 before Nehalem architecture. AArch64 could also benefit from this.

Benefit

https://godbolt.org/z/dM4fqvozn

Implementation

During lowering I propose lower popcnt(x) == 1 pattern to (x != 0) & ((x & (x - 1) == 0) for some archs.


Last updated: Nov 22 2024 at 16:03 UTC