diff options
| author | George Adams <georgeadams1995@gmail.com> | 2026-03-11 08:35:03 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-17 11:49:27 -0700 |
| commit | 65f76a20a32fc2a63f22f681591813e568506c9d (patch) | |
| tree | cf4ae5e565e46051555d808744260900273a649b /src/os/exec/exec.go | |
| parent | 75fdbda51799a9f867b58a61004685d8637413e6 (diff) | |
| download | go-65f76a20a32fc2a63f22f681591813e568506c9d.tar.xz | |
cmd/compile: eliminate redundant sign-extensions for wasm
Add rules to eliminate redundant I64Extend sign-extension operations
in the wasm backend:
Idempotent (applying the same extend twice is redundant):
(I64Extend32S (I64Extend32S x)) => (I64Extend32S x)
(I64Extend16S (I64Extend16S x)) => (I64Extend16S x)
(I64Extend8S (I64Extend8S x)) => (I64Extend8S x)
Narrower-subsumes-wider (a narrower sign-extend already determines
all the bits that a wider one would set):
(I64Extend32S (I64Extend16S x)) => (I64Extend16S x)
(I64Extend32S (I64Extend8S x)) => (I64Extend8S x)
(I64Extend16S (I64Extend8S x)) => (I64Extend8S x)
These patterns arise from nested sub-word type conversions. For
example, converting int8 -> int16 -> int32 -> int64 lowers to
I64Extend8S -> I64Extend16S -> I64Extend32S, but the I64Extend8S
alone is sufficient since it already sign-extends from 8 to 64 bits.
Cq-Include-Trybots: luci.golang.try:gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Change-Id: I1637687df31893b1ffa36915a3bd2e10d455f4ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/754040
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/os/exec/exec.go')
0 files changed, 0 insertions, 0 deletions
