1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:24:39 -07:00

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>
This commit is contained in:
Martin Möhrmann 2017-05-12 08:21:13 +02:00 committed by Brad Fitzpatrick
parent aaeb897338
commit 1c59bc354d
2 changed files with 6 additions and 13 deletions

View File

@ -69,10 +69,9 @@ func init() {
"(reflect.rtype).Out": ext۰reflect۰rtype۰Out, "(reflect.rtype).Out": ext۰reflect۰rtype۰Out,
"(reflect.rtype).Size": ext۰reflect۰rtype۰Size, "(reflect.rtype).Size": ext۰reflect۰rtype۰Size,
"(reflect.rtype).String": ext۰reflect۰rtype۰String, "(reflect.rtype).String": ext۰reflect۰rtype۰String,
"bytes.init": ext۰nop, // avoid asm dependency
"bytes.Equal": ext۰bytes۰Equal, "bytes.Equal": ext۰bytes۰Equal,
"bytes.IndexByte": ext۰bytes۰IndexByte, "bytes.IndexByte": ext۰bytes۰IndexByte,
"hash/crc32.haveSSE42": ext۰crc32۰haveSSE42, "internal/cpu.cpuid": ext۰cpu۰cpuid,
"math.Abs": ext۰math۰Abs, "math.Abs": ext۰math۰Abs,
"math.Exp": ext۰math۰Exp, "math.Exp": ext۰math۰Exp,
"math.Float32bits": ext۰math۰Float32bits, "math.Float32bits": ext۰math۰Float32bits,
@ -82,7 +81,6 @@ func init() {
"math.Ldexp": ext۰math۰Ldexp, "math.Ldexp": ext۰math۰Ldexp,
"math.Log": ext۰math۰Log, "math.Log": ext۰math۰Log,
"math.Min": ext۰math۰Min, "math.Min": ext۰math۰Min,
"math.hasSSE4": ext۰math۰hasSSE4,
"os.runtime_args": ext۰os۰runtime_args, "os.runtime_args": ext۰os۰runtime_args,
"os.runtime_beforeExit": ext۰nop, "os.runtime_beforeExit": ext۰nop,
"os/signal.init": ext۰nop, "os/signal.init": ext۰nop,
@ -112,7 +110,6 @@ func init() {
"(*runtime.Func).Name": ext۰runtime۰Func۰Name, "(*runtime.Func).Name": ext۰runtime۰Func۰Name,
"runtime.environ": ext۰runtime۰environ, "runtime.environ": ext۰runtime۰environ,
"runtime.getgoroot": ext۰runtime۰getgoroot, "runtime.getgoroot": ext۰runtime۰getgoroot,
"strings.init": ext۰nop, // avoid asm dependency
"strings.Count": ext۰strings۰Count, "strings.Count": ext۰strings۰Count,
"strings.Index": ext۰strings۰Index, "strings.Index": ext۰strings۰Index,
"strings.IndexByte": ext۰strings۰IndexByte, "strings.IndexByte": ext۰strings۰IndexByte,
@ -193,10 +190,6 @@ func ext۰bytes۰IndexByte(fr *frame, args []value) value {
return -1 return -1
} }
func ext۰crc32۰haveSSE42(fr *frame, args []value) value {
return false
}
func ext۰math۰Float64frombits(fr *frame, args []value) value { func ext۰math۰Float64frombits(fr *frame, args []value) value {
return math.Float64frombits(args[0].(uint64)) return math.Float64frombits(args[0].(uint64))
} }
@ -225,10 +218,6 @@ func ext۰math۰Min(fr *frame, args []value) value {
return math.Min(args[0].(float64), args[1].(float64)) 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 { func ext۰math۰Ldexp(fr *frame, args []value) value {
return math.Ldexp(args[0].(float64), args[1].(int)) return math.Ldexp(args[0].(float64), args[1].(int))
} }
@ -476,6 +465,10 @@ func ext۰atomic۰AddUint64(fr *frame, args []value) value {
return newv 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 } // Pretend: type runtime.Func struct { entry *ssa.Function }
func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value { func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value {

View File

@ -158,7 +158,7 @@ var gorootSrcTests = []string{
"encoding/hex", "encoding/hex",
// "encoding/pem", // TODO(adonovan): implement (reflect.Value).SetString // "encoding/pem", // TODO(adonovan): implement (reflect.Value).SetString
// "testing", // TODO(adonovan): implement runtime.Goexit correctly // "testing", // TODO(adonovan): implement runtime.Goexit correctly
// "hash/crc32", // TODO(adonovan): implement hash/crc32.haveCLMUL "hash/crc32",
// "log", // TODO(adonovan): implement runtime.Callers correctly // "log", // TODO(adonovan): implement runtime.Callers correctly
// Too slow: // Too slow: