aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/config.go
diff options
context:
space:
mode:
authorRichard Musiol <mail@richard-musiol.de>2018-03-09 00:06:33 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2018-03-30 21:34:26 +0000
commita9ba3e30acf004a57fbc1288d5cea6bae74d06e8 (patch)
treefd4fb239422e43e5f9baf0524658e5288f9ca994 /src/cmd/compile/internal/ssa/config.go
parent80e69220c8274223b98247b879df3c57b0dbc476 (diff)
downloadgo-a9ba3e30acf004a57fbc1288d5cea6bae74d06e8.tar.gz
go-a9ba3e30acf004a57fbc1288d5cea6bae74d06e8.zip
cmd/compile: add SSA config options useAvg and useHmul
This commit allows architectures to disable optimizations that need the Avg* and Hmul* operations. WebAssembly has no such operations, so using them as an optimization but then having to emulate them with multiple instructions makes no sense, especially since the WebAssembly compiler may do the same optimizations internally. Updates #18892 Change-Id: If57b59e3235482a9e0ec334a7312b3e3b5fc2b61 Reviewed-on: https://go-review.googlesource.com/103256 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/config.go')
-rw-r--r--src/cmd/compile/internal/ssa/config.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go
index ad8416e9e1..6ae1c5a870 100644
--- a/src/cmd/compile/internal/ssa/config.go
+++ b/src/cmd/compile/internal/ssa/config.go
@@ -34,6 +34,8 @@ type Config struct {
optimize bool // Do optimization
noDuffDevice bool // Don't use Duff's device
useSSE bool // Use SSE for non-float operations
+ useAvg bool // Use optimizations that need Avg* operations
+ useHmul bool // Use optimizations that need Hmul* operations
nacl bool // GOOS=nacl
use387 bool // GO386=387
SoftFloat bool //
@@ -190,6 +192,8 @@ const (
// NewConfig returns a new configuration object for the given architecture.
func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config {
c := &Config{arch: arch, Types: types}
+ c.useAvg = true
+ c.useHmul = true
switch arch {
case "amd64":
c.PtrSize = 8