go/ssa/interp: add internal/cpu.cpuid to fix short tests
http://golang.org/cl/41476 added the internal/cpu package
to unify cpu feature flag detection in the standard library.
Add a replacement for the assembler function internal/cpu.cpuid
that simulates a x86 cpu with no feature detection capabilities.
Remove bytes.init and strings.init from the external function list
because they do not depend on assembler functions anymore.
Remove hash/crc32.haveSSE42 and math.hasSSE4 because they
have been removed from the go standard library.
Change-Id: Icab6ed3cb13eb14b28d23f2b9c5ae94688f2dc95
Reviewed-on: https://go-review.googlesource.com/43350
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/go/ssa/interp/external.go b/go/ssa/interp/external.go
index 84c1dd8..7241522 100644
--- a/go/ssa/interp/external.go
+++ b/go/ssa/interp/external.go
@@ -69,10 +69,9 @@
"(reflect.rtype).Out": ext۰reflect۰rtype۰Out,
"(reflect.rtype).Size": ext۰reflect۰rtype۰Size,
"(reflect.rtype).String": ext۰reflect۰rtype۰String,
- "bytes.init": ext۰nop, // avoid asm dependency
"bytes.Equal": ext۰bytes۰Equal,
"bytes.IndexByte": ext۰bytes۰IndexByte,
- "hash/crc32.haveSSE42": ext۰crc32۰haveSSE42,
+ "internal/cpu.cpuid": ext۰cpu۰cpuid,
"math.Abs": ext۰math۰Abs,
"math.Exp": ext۰math۰Exp,
"math.Float32bits": ext۰math۰Float32bits,
@@ -82,7 +81,6 @@
"math.Ldexp": ext۰math۰Ldexp,
"math.Log": ext۰math۰Log,
"math.Min": ext۰math۰Min,
- "math.hasSSE4": ext۰math۰hasSSE4,
"os.runtime_args": ext۰os۰runtime_args,
"os.runtime_beforeExit": ext۰nop,
"os/signal.init": ext۰nop,
@@ -112,7 +110,6 @@
"(*runtime.Func).Name": ext۰runtime۰Func۰Name,
"runtime.environ": ext۰runtime۰environ,
"runtime.getgoroot": ext۰runtime۰getgoroot,
- "strings.init": ext۰nop, // avoid asm dependency
"strings.Count": ext۰strings۰Count,
"strings.Index": ext۰strings۰Index,
"strings.IndexByte": ext۰strings۰IndexByte,
@@ -193,10 +190,6 @@
return -1
}
-func ext۰crc32۰haveSSE42(fr *frame, args []value) value {
- return false
-}
-
func ext۰math۰Float64frombits(fr *frame, args []value) value {
return math.Float64frombits(args[0].(uint64))
}
@@ -225,10 +218,6 @@
return math.Min(args[0].(float64), args[1].(float64))
}
-func ext۰math۰hasSSE4(fr *frame, args []value) value {
- return false
-}
-
func ext۰math۰Ldexp(fr *frame, args []value) value {
return math.Ldexp(args[0].(float64), args[1].(int))
}
@@ -476,6 +465,10 @@
return newv
}
+func ext۰cpu۰cpuid(fr *frame, args []value) value {
+ return tuple{uint32(0), uint32(0), uint32(0), uint32(0)}
+}
+
// Pretend: type runtime.Func struct { entry *ssa.Function }
func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value {
diff --git a/go/ssa/interp/interp_test.go b/go/ssa/interp/interp_test.go
index 6e9f7b2..ea8fcca 100644
--- a/go/ssa/interp/interp_test.go
+++ b/go/ssa/interp/interp_test.go
@@ -158,7 +158,7 @@
"encoding/hex",
// "encoding/pem", // TODO(adonovan): implement (reflect.Value).SetString
// "testing", // TODO(adonovan): implement runtime.Goexit correctly
- // "hash/crc32", // TODO(adonovan): implement hash/crc32.haveCLMUL
+ "hash/crc32",
// "log", // TODO(adonovan): implement runtime.Callers correctly
// Too slow: