2018-05-02 18:09:45 +02:00
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package cpu_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"golang.org/x/sys/cpu"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAMD64minimalFeatures(t *testing.T) {
|
|
|
|
if runtime.GOARCH == "amd64" {
|
|
|
|
if !cpu.X86.HasSSE2 {
|
2018-06-17 18:59:12 +02:00
|
|
|
t.Fatal("HasSSE2 expected true, got false")
|
2018-05-02 18:09:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAVX2hasAVX(t *testing.T) {
|
|
|
|
if runtime.GOARCH == "amd64" {
|
|
|
|
if cpu.X86.HasAVX2 && !cpu.X86.HasAVX {
|
2018-06-17 18:59:12 +02:00
|
|
|
t.Fatal("HasAVX expected true, got false")
|
2018-05-02 18:09:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|