-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: math: add math_pure_go flag to avoid assembly code #63270
Comments
The implementation for softfloat support in the math package can be found in this pull request: GitHub Pull Request #63271. |
We already have If softfloat support is really needed on WASM platforms, adding a |
This should be fixable without a proposal by just adding |
Are there still ongoing efforts on this topic? PR #23172 still seems to use the earlier proposed |
I don't see a problem with using the existing |
Introduction
In the current Go math package, when the architecture has a Floating-Point Unit (FPU), it accelerates floating-point computations using assembly code tailored to take advantage of the architecture's FPU. While this approach offers excellent performance, it creates compatibility issues with softfloat. To support softfloat, we can use
-gcflags=all=-d=softfloat
, which can convert floating-point calculations to softfloat within the compiler, but it doesn't impact any assembly code in the math package. (The related issue can be found here: [link to GitHub issue #62470].)To address this issue, we propose introducing a new build tag that disables the math package from utilizing FPU-related assembly code for performance optimization, thereby providing support for softfloat.
Proposed Solution
To support softfloat in the Go math package, we propose adding a new build tag, let's call it
math_pure_go
, that users can apply to disable the use of FPU-specific assembly code in the math package. We can use themath_pure_go
build tag to disable the assembly inmath
package. With the build tag-tags=math_pure_go
and-gcflags=all=-d=softfloat
, we can support softfloat for all platforms.Benefit
The text was updated successfully, but these errors were encountered: