diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2020-02-24 13:53:53 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2020-02-27 20:34:49 +0000 |
commit | 2c859eae1da367ab292f65ca4fed4f6c89d644f9 (patch) | |
tree | 13a259b0ad341540709f06a07ea0205118fa2ef4 /src/cmd/compile/internal/ssa/rewriteWasm.go | |
parent | 4ae1879dda1a20176dddc62e827404c75a869fa0 (diff) | |
download | go-2c859eae1da367ab292f65ca4fed4f6c89d644f9.tar.gz go-2c859eae1da367ab292f65ca4fed4f6c89d644f9.zip |
cmd/compile: ignore div/mod in prove on non-x86 architectures
Instead of writing AuxInt during prove and then zeroing it during lower,
just don't write it in the first place.
Passes toolstash-check -all.
Change-Id: Iea4b555029a9d69332e835536f9cf3a42b8223db
Reviewed-on: https://go-review.googlesource.com/c/go/+/220682
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteWasm.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewriteWasm.go | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteWasm.go b/src/cmd/compile/internal/ssa/rewriteWasm.go index 65db3d9412..ea365f46b6 100644 --- a/src/cmd/compile/internal/ssa/rewriteWasm.go +++ b/src/cmd/compile/internal/ssa/rewriteWasm.go @@ -181,7 +181,8 @@ func rewriteValueWasm(v *Value) bool { case OpDiv32u: return rewriteValueWasm_OpDiv32u(v) case OpDiv64: - return rewriteValueWasm_OpDiv64(v) + v.Op = OpWasmI64DivS + return true case OpDiv64F: v.Op = OpWasmF64Div return true @@ -344,7 +345,8 @@ func rewriteValueWasm(v *Value) bool { case OpMod32u: return rewriteValueWasm_OpMod32u(v) case OpMod64: - return rewriteValueWasm_OpMod64(v) + v.Op = OpWasmI64RemS + return true case OpMod64u: v.Op = OpWasmI64RemU return true @@ -954,20 +956,6 @@ func rewriteValueWasm_OpDiv32u(v *Value) bool { return true } } -func rewriteValueWasm_OpDiv64(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (Div64 [a] x y) - // result: (I64DivS x y) - for { - x := v_0 - y := v_1 - v.reset(OpWasmI64DivS) - v.AddArg(x) - v.AddArg(y) - return true - } -} func rewriteValueWasm_OpDiv8(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] @@ -1871,20 +1859,6 @@ func rewriteValueWasm_OpMod32u(v *Value) bool { return true } } -func rewriteValueWasm_OpMod64(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (Mod64 [a] x y) - // result: (I64RemS x y) - for { - x := v_0 - y := v_1 - v.reset(OpWasmI64RemS) - v.AddArg(x) - v.AddArg(y) - return true - } -} func rewriteValueWasm_OpMod8(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] |