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

@ -2136,6 +2136,9 @@ const (
OpWasmI64TruncF64U
OpWasmF64ConvertI64S
OpWasmF64ConvertI64U
OpWasmI64Extend8S
OpWasmI64Extend16S
OpWasmI64Extend32S
OpWasmF64Sqrt
OpWasmF64Trunc
OpWasmF64Ceil
@ -28724,6 +28727,45 @@ var opcodeTable = [...]opInfo{
},
},
},
{
name: "I64Extend8S",
argLen: 1,
asm: wasm.AI64Extend8S,
reg: regInfo{
inputs: []inputInfo{
{0, 4295032831}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 SP
},
outputs: []outputInfo{
{0, 65535}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
},
},
},
{
name: "I64Extend16S",
argLen: 1,
asm: wasm.AI64Extend16S,
reg: regInfo{
inputs: []inputInfo{
{0, 4295032831}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 SP
},
outputs: []outputInfo{
{0, 65535}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
},
},
},
{
name: "I64Extend32S",
argLen: 1,
asm: wasm.AI64Extend32S,
reg: regInfo{
inputs: []inputInfo{
{0, 4295032831}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 SP
},
outputs: []outputInfo{
{0, 65535}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
},
},
},
{
name: "F64Sqrt",
argLen: 1,