github.com/zebozhuang/go@v0.0.0-20200207033046-f8a98f6f5c5d/src/internal/cpu/cpu_test.go (about)

     1  // Copyright 2017 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  
     5  package cpu_test
     6  
     7  import (
     8  	"internal/cpu"
     9  	"runtime"
    10  	"testing"
    11  )
    12  
    13  func TestAMD64minimalFeatures(t *testing.T) {
    14  	if runtime.GOARCH == "amd64" {
    15  		if !cpu.X86.HasSSE2 {
    16  			t.Fatalf("HasSSE2 expected true, got false")
    17  		}
    18  	}
    19  }
    20  
    21  func TestAVX2hasAVX(t *testing.T) {
    22  	if runtime.GOARCH == "amd64" {
    23  		if cpu.X86.HasAVX2 && !cpu.X86.HasAVX {
    24  			t.Fatalf("HasAVX expected true, got false")
    25  		}
    26  	}
    27  }