aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/wasm
diff options
context:
space:
mode:
authorRichard Musiol <mail@richard-musiol.de>2019-03-23 15:25:42 +0100
committerRichard Musiol <neelance@gmail.com>2019-03-28 20:23:05 +0000
commit4d23cbc67100c1ce50b7d4fcc67e50091f92eb5b (patch)
tree4f287374d425d181942392602db5c7b2e739aae2 /src/cmd/internal/obj/wasm
parentd23bf3daa9384a8c30d3231b5f02d0bea481415e (diff)
downloadgo-4d23cbc67100c1ce50b7d4fcc67e50091f92eb5b.tar.xz
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>
Diffstat (limited to 'src/cmd/internal/obj/wasm')
-rw-r--r--src/cmd/internal/obj/wasm/a.out.go7
-rw-r--r--src/cmd/internal/obj/wasm/anames.go6
-rw-r--r--src/cmd/internal/obj/wasm/wasmobj.go2
3 files changed, 13 insertions, 2 deletions
diff --git a/src/cmd/internal/obj/wasm/a.out.go b/src/cmd/internal/obj/wasm/a.out.go
index f1830ba036..29ea87f3b0 100644
--- a/src/cmd/internal/obj/wasm/a.out.go
+++ b/src/cmd/internal/obj/wasm/a.out.go
@@ -210,8 +210,13 @@ const (
AI64ReinterpretF64
AF32ReinterpretI32
AF64ReinterpretI64
+ AI32Extend8S
+ AI32Extend16S
+ AI64Extend8S
+ AI64Extend16S
+ AI64Extend32S
- // End of low-level WebAssembly instructions.
+ ALast // Sentinel: End of low-level WebAssembly instructions.
ARESUMEPOINT
// ACALLNORESUME is a call which is not followed by a resume point.
diff --git a/src/cmd/internal/obj/wasm/anames.go b/src/cmd/internal/obj/wasm/anames.go
index 7ef09d665e..fb4b72c398 100644
--- a/src/cmd/internal/obj/wasm/anames.go
+++ b/src/cmd/internal/obj/wasm/anames.go
@@ -177,6 +177,12 @@ var Anames = []string{
"I64ReinterpretF64",
"F32ReinterpretI32",
"F64ReinterpretI64",
+ "I32Extend8S",
+ "I32Extend16S",
+ "I64Extend8S",
+ "I64Extend16S",
+ "I64Extend32S",
+ "Last",
"RESUMEPOINT",
"CALLNORESUME",
"RETUNWIND",
diff --git a/src/cmd/internal/obj/wasm/wasmobj.go b/src/cmd/internal/obj/wasm/wasmobj.go
index ad98cfe90a..dded62a4be 100644
--- a/src/cmd/internal/obj/wasm/wasmobj.go
+++ b/src/cmd/internal/obj/wasm/wasmobj.go
@@ -886,7 +886,7 @@ func assemble(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
}
switch {
- case p.As < AUnreachable || p.As > AF64ReinterpretI64:
+ case p.As < AUnreachable || p.As >= ALast:
panic(fmt.Sprintf("unexpected assembler op: %s", p.As))
case p.As < AEnd:
w.WriteByte(byte(p.As - AUnreachable + 0x00))