You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
561 B

  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package cpu_test
  5. import (
  6. "runtime"
  7. "testing"
  8. "golang.org/x/sys/cpu"
  9. )
  10. func TestAMD64minimalFeatures(t *testing.T) {
  11. if runtime.GOARCH == "amd64" {
  12. if !cpu.X86.HasSSE2 {
  13. t.Fatal("HasSSE2 expected true, got false")
  14. }
  15. }
  16. }
  17. func TestAVX2hasAVX(t *testing.T) {
  18. if runtime.GOARCH == "amd64" {
  19. if cpu.X86.HasAVX2 && !cpu.X86.HasAVX {
  20. t.Fatal("HasAVX expected true, got false")
  21. }
  22. }
  23. }