summaryrefslogtreecommitdiff
path: root/src/support/bits.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix pow2 util and avoid pow2 for left shifting in ZeroRemover (#3293)Max Graey2020-10-281-1/+1
| | | | | | | | Fixes a fuzz bug that was triggered by https://github.com/WebAssembly/binaryen/pull/3015#issuecomment-718001620 but was actually a pre-existing bug in pow2, that that PR just happened to uncover.
* Avoid UB in pow2 func (#3243)Max Graey2020-10-231-1/+1
|
* Optimize comparisons with 0/1 in boolean context (#3240)Max Graey2020-10-181-3/+11
| | | | | | | | | | i32(bool(x)) != 0 ==> i32(bool(x)) i64(bool(x)) & 1 ==> i64(bool(x)) Also: * clean up related matching rules in optimizeWithConstantOnRight * add more explanations about isPowerOf2Float & rename to isPowerOfTwoInvertibleFloat
* Optimize power of two float divisions (#3018)Max Graey2020-10-131-0/+24
|
* Simplify some numeric code (#3186)Max Graey2020-10-011-15/+3
|
* Clean up support/bits.h (#3177)Thomas Lively2020-09-301-24/+23
| | | | | Use overloads instead of templates where applicable and change function names from PascalCase to camelCase. Also puts the functions in the Bits namespace to avoid naming conflicts.
* Implement more cases for getMaxBits (#2879)Max Graey2020-09-171-0/+8
| | | | | | | | | | | | | | | - Complete 64-bit cases in range `AddInt64` ... `ShrSInt64` - `ExtendSInt32` and `ExtendUInt32` for unary cases - For binary cases - `AddInt32` / `AddInt64` - `MulInt32` / `MulInt64` - `RemUInt32` / `RemUInt64` - `RemSInt32` / `RemSInt64` - `DivUInt32` / `DivUInt64` - `DivSInt32` / `DivSInt64` - and more Also more fast paths for some getMaxBits calculations
* Fix CountLeadingZeroes on MSVC (#3028)Alon Zakai2020-08-061-2/+5
| | | | | | | We just had the logic there wrong - MSVC's intrinsic returns the bit index, not the number of leading zeros. That's identical when scanning forward but not in reverse... Fixes #2942
* Fix build for win32 (#3001)Max Graey2020-07-291-2/+2
| | | | | Check for x64 before using a non-32bit operation. See #2955 for context.
* Avoid __popcnt and __popcnt64 intrinsics for MSVC (#2944)Max Graey2020-07-061-8/+6
| | | | We may need to check the CPU ID or something else before using those special things on MSVC. To be safe, avoid them for now.
* Optimize bit count polyfills (#2914)Max Graey2020-06-171-21/+66
|
* Add string parameter to WASM_UNREACHABLE (#2499)Sam Clegg2019-12-051-1/+2
| | | | | This works more like llvm's unreachable handler in that is preserves information even in release builds.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-45/+47
| | | Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
* optimize linear sums (#904)Alon Zakai2017-02-161-1/+1
|
* Fix signed integer overflow UB (#430)JF Bastien2016-05-031-1/+1
| | | This puts us back where #404 wanted to be: all UB that ubsan knows about now causes an abort. This ins't to say that it's all gone, merely that our tests don't trigger any more UB which ubsan knows how to find :-)
* add Log2 and Pow2 support methodsAlon Zakai2016-03-161-0/+25
|
* fix gcc 4.8.2 breakage due to 66da1ee9cc70e3848c45745c21a244e54512fa9cAlon Zakai2016-02-031-9/+13
|
* Move bits.h to support/JF Bastien2016-02-031-0/+98
Faster compiles.