aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi
diff options
context:
space:
mode:
authorRichard Musiol <mail@richard-musiol.de>2019-03-24 12:14:27 +0100
committerRichard Musiol <neelance@gmail.com>2019-04-04 16:10:12 +0000
commitcf8cc7f63c7ddefb666a6e8d99a4843d3277db9f (patch)
treeedc59cd956160ff6683a60e8848cacf841a20a3b /src/cmd/internal/objabi
parent1abf3aa55bb8b346bb1575ac8db5022f215df65a (diff)
downloadgo-cf8cc7f63c7ddefb666a6e8d99a4843d3277db9f.tar.xz
cmd/compile: add saturating conversions on wasm
This change adds the GOWASM option "satconv" to enable the generation of experimental saturating (non-trapping) float-to-int conversions. It improves the performance of the conversion by 42%. Previously the conversions had already been augmented with helper functions to have saturating behavior. Now Wasm.rules is always using the new operation names and wasm/ssa.go is falling back to the helpers if the feature is not enabled. The feature is in phase 4 of the WebAssembly proposal process: https://github.com/WebAssembly/meetings/blob/master/process/phases.md More information on the feature can be found at: https://github.com/WebAssembly/nontrapping-float-to-int-conversions/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md Change-Id: Ic6c3688017054ede804b02b6b0ffd4a02ef33ad7 Reviewed-on: https://go-review.googlesource.com/c/go/+/170119 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/objabi')
-rw-r--r--src/cmd/internal/objabi/util.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go
index 02f9d9273a..e28447d141 100644
--- a/src/cmd/internal/objabi/util.go
+++ b/src/cmd/internal/objabi/util.go
@@ -79,10 +79,14 @@ func goppc64() int {
type gowasmFeatures struct {
SignExt bool
+ SatConv bool
}
func (f *gowasmFeatures) String() string {
var flags []string
+ if f.SatConv {
+ flags = append(flags, "satconv")
+ }
if f.SignExt {
flags = append(flags, "signext")
}
@@ -92,6 +96,8 @@ func (f *gowasmFeatures) String() string {
func gowasm() (f gowasmFeatures) {
for _, opt := range strings.Split(envOr("GOWASM", ""), ",") {
switch opt {
+ case "satconv":
+ f.SatConv = true
case "signext":
f.SignExt = true
case "":