compiler(amd64): return false on SSE4 unsupported CPUs (#1121)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com> Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -10,6 +10,9 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// archRequirementsVerified is set by platform-specific init to true if the platform is supported
|
||||
var archRequirementsVerified bool
|
||||
|
||||
// CompilerSupported is exported for tests and includes constraints here and also the assembler.
|
||||
func CompilerSupported() bool {
|
||||
switch runtime.GOOS {
|
||||
@@ -18,13 +21,7 @@ func CompilerSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
switch runtime.GOARCH {
|
||||
case "amd64", "arm64":
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return archRequirementsVerified
|
||||
}
|
||||
|
||||
// MmapCodeSegment copies the code into the executable region and returns the byte slice of the region.
|
||||
|
||||
7
internal/platform/platform_amd64.go
Normal file
7
internal/platform/platform_amd64.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package platform
|
||||
|
||||
// init verifies that the current CPU supports the required AMD64 instructions
|
||||
func init() {
|
||||
// Ensure SSE4.1 is supported.
|
||||
archRequirementsVerified = CpuFeatures.Has(CpuFeatureSSE4_1)
|
||||
}
|
||||
7
internal/platform/platform_arm64.go
Normal file
7
internal/platform/platform_arm64.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package platform
|
||||
|
||||
// init verifies that the current CPU supports the required ARM64 features
|
||||
func init() {
|
||||
// No further checks currently needed.
|
||||
archRequirementsVerified = true
|
||||
}
|
||||
Reference in New Issue
Block a user