Source file src/simd/cpu.go
1 // Code generated by x/arch/internal/simdgen using 'go run . -xedPath $XED_PATH -o godefs -goroot $GOROOT go.yaml types.yaml categories.yaml'; DO NOT EDIT. 2 3 //go:build goexperiment.simd 4 5 package simd 6 7 import "internal/cpu" 8 9 type X86Features struct{} 10 11 var X86 X86Features 12 13 // AES returns whether the CPU supports the AES feature. 14 // 15 // AES is defined on all GOARCHes, but will only return true on 16 // GOARCH amd64. 17 func (X86Features) AES() bool { 18 return cpu.X86.HasAES 19 } 20 21 // AVX returns whether the CPU supports the AVX feature. 22 // 23 // AVX is defined on all GOARCHes, but will only return true on 24 // GOARCH amd64. 25 func (X86Features) AVX() bool { 26 return cpu.X86.HasAVX 27 } 28 29 // AVX2 returns whether the CPU supports the AVX2 feature. 30 // 31 // AVX2 is defined on all GOARCHes, but will only return true on 32 // GOARCH amd64. 33 func (X86Features) AVX2() bool { 34 return cpu.X86.HasAVX2 35 } 36 37 // AVX512 returns whether the CPU supports the AVX512F+CD+BW+DQ+VL features. 38 // 39 // These five CPU features are bundled together, and no use of AVX-512 40 // is allowed unless all of these features are supported together. 41 // Nearly every CPU that has shipped with any support for AVX-512 has 42 // supported all five of these features. 43 // 44 // AVX512 is defined on all GOARCHes, but will only return true on 45 // GOARCH amd64. 46 func (X86Features) AVX512() bool { 47 return cpu.X86.HasAVX512 48 } 49 50 // AVX512BITALG returns whether the CPU supports the AVX512BITALG feature. 51 // 52 // AVX512BITALG is defined on all GOARCHes, but will only return true on 53 // GOARCH amd64. 54 func (X86Features) AVX512BITALG() bool { 55 return cpu.X86.HasAVX512BITALG 56 } 57 58 // AVX512GFNI returns whether the CPU supports the AVX512GFNI feature. 59 // 60 // AVX512GFNI is defined on all GOARCHes, but will only return true on 61 // GOARCH amd64. 62 func (X86Features) AVX512GFNI() bool { 63 return cpu.X86.HasAVX512GFNI 64 } 65 66 // AVX512VAES returns whether the CPU supports the AVX512VAES feature. 67 // 68 // AVX512VAES is defined on all GOARCHes, but will only return true on 69 // GOARCH amd64. 70 func (X86Features) AVX512VAES() bool { 71 return cpu.X86.HasAVX512VAES 72 } 73 74 // AVX512VBMI returns whether the CPU supports the AVX512VBMI feature. 75 // 76 // AVX512VBMI is defined on all GOARCHes, but will only return true on 77 // GOARCH amd64. 78 func (X86Features) AVX512VBMI() bool { 79 return cpu.X86.HasAVX512VBMI 80 } 81 82 // AVX512VBMI2 returns whether the CPU supports the AVX512VBMI2 feature. 83 // 84 // AVX512VBMI2 is defined on all GOARCHes, but will only return true on 85 // GOARCH amd64. 86 func (X86Features) AVX512VBMI2() bool { 87 return cpu.X86.HasAVX512VBMI2 88 } 89 90 // AVX512VNNI returns whether the CPU supports the AVX512VNNI feature. 91 // 92 // AVX512VNNI is defined on all GOARCHes, but will only return true on 93 // GOARCH amd64. 94 func (X86Features) AVX512VNNI() bool { 95 return cpu.X86.HasAVX512VNNI 96 } 97 98 // AVX512VPOPCNTDQ returns whether the CPU supports the AVX512VPOPCNTDQ feature. 99 // 100 // AVX512VPOPCNTDQ is defined on all GOARCHes, but will only return true on 101 // GOARCH amd64. 102 func (X86Features) AVX512VPOPCNTDQ() bool { 103 return cpu.X86.HasAVX512VPOPCNTDQ 104 } 105 106 // AVXVNNI returns whether the CPU supports the AVXVNNI feature. 107 // 108 // AVXVNNI is defined on all GOARCHes, but will only return true on 109 // GOARCH amd64. 110 func (X86Features) AVXVNNI() bool { 111 return cpu.X86.HasAVXVNNI 112 } 113 114 // SHA returns whether the CPU supports the SHA feature. 115 // 116 // SHA is defined on all GOARCHes, but will only return true on 117 // GOARCH amd64. 118 func (X86Features) SHA() bool { 119 return cpu.X86.HasSHA 120 } 121