cmd/compile: add sign-extension operators on wasm

This change adds the GOWASM option "signext" to enable
the generation of experimental sign-extension operators.

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/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md

Change-Id: I6b30069390a8699fbecd9fb4d1d61e13c59b0333
Reviewed-on: https://go-review.googlesource.com/c/go/+/168882
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Richard Musiol 2019-03-23 15:25:42 +01:00 committed by Richard Musiol
parent d23bf3daa9
commit 4d23cbc671
12 changed files with 151 additions and 7 deletions

View file

@ -78,19 +78,22 @@ func goppc64() int {
}
type gowasmFeatures struct {
// no features yet
SignExt bool
}
func (f *gowasmFeatures) String() string {
var flags []string
// no features yet
if f.SignExt {
flags = append(flags, "signext")
}
return strings.Join(flags, ",")
}
func gowasm() (f gowasmFeatures) {
for _, opt := range strings.Split(envOr("GOWASM", ""), ",") {
switch opt {
// no features yet
case "signext":
f.SignExt = true
case "":
// ignore
default: