WebAssembly / WebAssembly/binaryen

Add sign bit tacking for floating points

Open
#4,253 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Similar to known maximum bits getMaxBits for integers we could track sign for floats. It's quite useful and deterministic (except NaN ofc). This will allow you to do more optimizations for floating points. For example x + 0 -> x if we know x never has sign bits so -0 is not possible. LLVM already do this:
https://github.com/llvm/llvm-project/commit/727a891ec8c42b134dfd9ac8b830fb6072d34ef3

Also f64.sqrt(x) -> sNaN if we know hasSignBit(x) == 1 and etc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing getMaxBits integer analysis and compare its scope with the LLVM commit linked in the issue. Trace how floating-point facts reach optimizations such as x + 0 and f64.sqrt, then define completion by deterministic sign-bit tracking for floats while preserving the stated NaN caveat and enabling the described optimizations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.