diff options
author | Max Graey <maxgraey@gmail.com> | 2020-10-05 19:34:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 09:34:17 -0700 |
commit | 654cfca4fabda64dd91d2df9b07422b8bffc9357 (patch) | |
tree | 545adba4f335f770fc04570fe75c21a67f6a4ce4 /src/passes/pass.cpp | |
parent | 3da66481b94cba2d3f5717316755fe3a60fcbe52 (diff) | |
download | binaryen-654cfca4fabda64dd91d2df9b07422b8bffc9357.tar.gz binaryen-654cfca4fabda64dd91d2df9b07422b8bffc9357.tar.bz2 binaryen-654cfca4fabda64dd91d2df9b07422b8bffc9357.zip |
Generalize transforms for #3153 (#3193)
Implement a more general (additional) version of #3153 which also handles negative constant divisors:
`(int32)x % -4 == 0` --> `(x & 3) == 0`
`x % -C_pot == 0` --> `(x & (abs(C_pot) - 1)) == 0`
and special two-complement values as well:
`(int32)x % 0x80000000 == 0` --> `(x & 0x7fffffff) == 0`
`(int64)x % 0x8000000000000000 == 0` --> `(x & 0x7fffffffffffffff) == 0`
as separete rules:
`(int32)x % 0x80000000` --> `x & 0x7fffffff`
`(int64)x % 0x8000000000000000` --> `x & 0x7fffffffffffffff`
The [previous pr](https://github.com/WebAssembly/binaryen/pull/3153) didn't use these possibilities.
Diffstat (limited to 'src/passes/pass.cpp')
0 files changed, 0 insertions, 0 deletions