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 5package cpu_test 6 7import ( 8 "runtime" 9 "testing" 10 11 "gitlab.com/yawning/utls.git/cpu" 12) 13 14func TestAMD64minimalFeatures(t *testing.T) { 15 if runtime.GOARCH == "amd64" { 16 if !cpu.X86.HasSSE2 { 17 t.Fatalf("HasSSE2 expected true, got false") 18 } 19 } 20} 21 22func TestAVX2hasAVX(t *testing.T) { 23 if runtime.GOARCH == "amd64" { 24 if cpu.X86.HasAVX2 && !cpu.X86.HasAVX { 25 t.Fatalf("HasAVX expected true, got false") 26 } 27 } 28} 29 30func TestPPC64minimalFeatures(t *testing.T) { 31 if runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" { 32 if !cpu.PPC64.IsPOWER8 { 33 t.Fatalf("IsPOWER8 expected true, got false") 34 } 35 if !cpu.PPC64.HasVMX { 36 t.Fatalf("HasVMX expected true, got false") 37 } 38 if !cpu.PPC64.HasDFP { 39 t.Fatalf("HasDFP expected true, got false") 40 } 41 if !cpu.PPC64.HasVSX { 42 t.Fatalf("HasVSX expected true, got false") 43 } 44 if !cpu.PPC64.HasISEL { 45 t.Fatalf("HasISEL expected true, got false") 46 } 47 if !cpu.PPC64.HasVCRYPTO { 48 t.Fatalf("HasVCRYPTO expected true, got false") 49 } 50 } 51} 52