| 1 |
// Copyright 2025 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 goexperiment.simd && amd64 |
| 6 |
|
| 7 |
package archsimd |
| 8 |
|
| 9 |
// ClearAVXUpperBits clears the high bits of Y0-Y15 and Z0-Z15 registers. |
| 10 |
// It is intended for transitioning from AVX to SSE, eliminating the |
| 11 |
// performance penalties caused by false dependencies. |
| 12 |
// |
| 13 |
// Note: in the future the compiler may automatically generate the |
| 14 |
// instruction, making this function unnecessary. |
| 15 |
// |
| 16 |
// Asm: VZEROUPPER, CPU Feature: AVX |
| 17 |
func ClearAVXUpperBits() |
| 18 |
|
| 19 |
// IsZero returns true if all elements of x are zeros. |
| 20 |
// |
| 21 |
// This method compiles to VPTEST x, x. |
| 22 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 23 |
// |
| 24 |
// Asm: VPTEST, CPU Feature: AVX |
| 25 |
func (x Int8x16) IsZero() bool |
| 26 |
|
| 27 |
// IsZero returns true if all elements of x are zeros. |
| 28 |
// |
| 29 |
// This method compiles to VPTEST x, x. |
| 30 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 31 |
// |
| 32 |
// Asm: VPTEST, CPU Feature: AVX |
| 33 |
func (x Int8x32) IsZero() bool |
| 34 |
|
| 35 |
// IsZero returns true if all elements of x are zeros. |
| 36 |
// |
| 37 |
// This method compiles to VPTEST x, x. |
| 38 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 39 |
// |
| 40 |
// Asm: VPTEST, CPU Feature: AVX |
| 41 |
func (x Int16x8) IsZero() bool |
| 42 |
|
| 43 |
// IsZero returns true if all elements of x are zeros. |
| 44 |
// |
| 45 |
// This method compiles to VPTEST x, x. |
| 46 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 47 |
// |
| 48 |
// Asm: VPTEST, CPU Feature: AVX |
| 49 |
func (x Int16x16) IsZero() bool |
| 50 |
|
| 51 |
// IsZero returns true if all elements of x are zeros. |
| 52 |
// |
| 53 |
// This method compiles to VPTEST x, x. |
| 54 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 55 |
// |
| 56 |
// Asm: VPTEST, CPU Feature: AVX |
| 57 |
func (x Int32x4) IsZero() bool |
| 58 |
|
| 59 |
// IsZero returns true if all elements of x are zeros. |
| 60 |
// |
| 61 |
// This method compiles to VPTEST x, x. |
| 62 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 63 |
// |
| 64 |
// Asm: VPTEST, CPU Feature: AVX |
| 65 |
func (x Int32x8) IsZero() bool |
| 66 |
|
| 67 |
// IsZero returns true if all elements of x are zeros. |
| 68 |
// |
| 69 |
// This method compiles to VPTEST x, x. |
| 70 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 71 |
// |
| 72 |
// Asm: VPTEST, CPU Feature: AVX |
| 73 |
func (x Int64x2) IsZero() bool |
| 74 |
|
| 75 |
// IsZero returns true if all elements of x are zeros. |
| 76 |
// |
| 77 |
// This method compiles to VPTEST x, x. |
| 78 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 79 |
// |
| 80 |
// Asm: VPTEST, CPU Feature: AVX |
| 81 |
func (x Int64x4) IsZero() bool |
| 82 |
|
| 83 |
// IsZero returns true if all elements of x are zeros. |
| 84 |
// |
| 85 |
// This method compiles to VPTEST x, x. |
| 86 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 87 |
// |
| 88 |
// Asm: VPTEST, CPU Feature: AVX |
| 89 |
func (x Uint8x16) IsZero() bool |
| 90 |
|
| 91 |
// IsZero returns true if all elements of x are zeros. |
| 92 |
// |
| 93 |
// This method compiles to VPTEST x, x. |
| 94 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 95 |
// |
| 96 |
// Asm: VPTEST, CPU Feature: AVX |
| 97 |
func (x Uint8x32) IsZero() bool |
| 98 |
|
| 99 |
// IsZero returns true if all elements of x are zeros. |
| 100 |
// |
| 101 |
// This method compiles to VPTEST x, x. |
| 102 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 103 |
// |
| 104 |
// Asm: VPTEST, CPU Feature: AVX |
| 105 |
func (x Uint16x8) IsZero() bool |
| 106 |
|
| 107 |
// IsZero returns true if all elements of x are zeros. |
| 108 |
// |
| 109 |
// This method compiles to VPTEST x, x. |
| 110 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 111 |
// |
| 112 |
// Asm: VPTEST, CPU Feature: AVX |
| 113 |
func (x Uint16x16) IsZero() bool |
| 114 |
|
| 115 |
// IsZero returns true if all elements of x are zeros. |
| 116 |
// |
| 117 |
// This method compiles to VPTEST x, x. |
| 118 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 119 |
// |
| 120 |
// Asm: VPTEST, CPU Feature: AVX |
| 121 |
func (x Uint32x4) IsZero() bool |
| 122 |
|
| 123 |
// IsZero returns true if all elements of x are zeros. |
| 124 |
// |
| 125 |
// This method compiles to VPTEST x, x. |
| 126 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 127 |
// |
| 128 |
// Asm: VPTEST, CPU Feature: AVX |
| 129 |
func (x Uint32x8) IsZero() bool |
| 130 |
|
| 131 |
// IsZero returns true if all elements of x are zeros. |
| 132 |
// |
| 133 |
// This method compiles to VPTEST x, x. |
| 134 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 135 |
// |
| 136 |
// Asm: VPTEST, CPU Feature: AVX |
| 137 |
func (x Uint64x2) IsZero() bool |
| 138 |
|
| 139 |
// IsZero returns true if all elements of x are zeros. |
| 140 |
// |
| 141 |
// This method compiles to VPTEST x, x. |
| 142 |
// x.And(y).IsZero() and x.AndNot(y).IsZero() will be optimized to VPTEST x, y. |
| 143 |
// |
| 144 |
// Asm: VPTEST, CPU Feature: AVX |
| 145 |
func (x Uint64x4) IsZero() bool |
| 146 |
|
| 147 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 148 |
// elements of x are NaN. |
| 149 |
// |
| 150 |
// Asm: VCMPPS, CPU Feature: AVX |
| 151 |
func (x Float32x4) IsNaN() Mask32x4 |
| 152 |
|
| 153 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 154 |
// elements of x are NaN. |
| 155 |
// |
| 156 |
// Asm: VCMPPS, CPU Feature: AVX |
| 157 |
func (x Float32x8) IsNaN() Mask32x8 |
| 158 |
|
| 159 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 160 |
// elements of x are NaN. |
| 161 |
// |
| 162 |
// Asm: VCMPPS, CPU Feature: AVX512 |
| 163 |
func (x Float32x16) IsNaN() Mask32x16 |
| 164 |
|
| 165 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 166 |
// elements of x are NaN. |
| 167 |
// |
| 168 |
// Asm: VCMPPD, CPU Feature: AVX |
| 169 |
func (x Float64x2) IsNaN() Mask64x2 |
| 170 |
|
| 171 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 172 |
// elements of x are NaN. |
| 173 |
// |
| 174 |
// Asm: VCMPPD, CPU Feature: AVX |
| 175 |
func (x Float64x4) IsNaN() Mask64x4 |
| 176 |
|
| 177 |
// IsNaN returns a mask whose elements indicate whether the corresponding |
| 178 |
// elements of x are NaN. |
| 179 |
// |
| 180 |
// Asm: VCMPPD, CPU Feature: AVX512 |
| 181 |
func (x Float64x8) IsNaN() Mask64x8 |