| 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 |
|
| 5 |
//go:build (386 || amd64 || amd64p32) && gccgo |
| 6 |
// +build 386 amd64 amd64p32 |
| 7 |
// +build gccgo |
| 8 |
|
| 9 |
package cpu |
| 10 |
|
| 11 |
//extern gccgoGetCpuidCount |
| 12 |
func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) |
| 13 |
|
| 14 |
func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { |
| 15 |
var a, b, c, d uint32 |
| 16 |
gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) |
| 17 |
return a, b, c, d |
| 18 |
} |
| 19 |
|
| 20 |
//extern gccgoXgetbv |
| 21 |
func gccgoXgetbv(eax, edx *uint32) |
| 22 |
|
| 23 |
func xgetbv() (eax, edx uint32) { |
| 24 |
var a, d uint32 |
| 25 |
gccgoXgetbv(&a, &d) |
| 26 |
return a, d |
| 27 |
} |
| 28 |
|
| 29 |
// gccgo doesn't build on Darwin, per: |
| 30 |
// https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76 |
| 31 |
func darwinSupportsAVX512() bool { |
| 32 |
return false |
| 33 |
} |