Source file src/simd/archsimd/maskmerge_gen_arm64.go

     1  // Code generated by 'tmplgen'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd
     4  
     5  package archsimd
     6  
     7  // Masked returns x but with elements zeroed where mask is false.
     8  func (x Int8x16) Masked(mask Mask8x16) Int8x16 {
     9  	im := mask.ToInt8x16()
    10  	return im.And(x)
    11  }
    12  
    13  // IfElse returns x but with elements set to y where mask is false.
    14  func (x Int8x16) IfElse(mask Mask8x16, y Int8x16) Int8x16 {
    15  	return x.bitSelect(y, mask.ToInt8x16())
    16  }
    17  
    18  // Masked returns x but with elements zeroed where mask is false.
    19  func (x Int16x8) Masked(mask Mask16x8) Int16x8 {
    20  	im := mask.ToInt16x8()
    21  	return im.And(x)
    22  }
    23  
    24  // IfElse returns x but with elements set to y where mask is false.
    25  func (x Int16x8) IfElse(mask Mask16x8, y Int16x8) Int16x8 {
    26  	im := mask.ToInt16x8().ToBits().ReshapeToUint8s().BitsToInt8()
    27  	ix := x.ToBits().ReshapeToUint8s().BitsToInt8()
    28  	iy := y.ToBits().ReshapeToUint8s().BitsToInt8()
    29  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint16s().BitsToInt16()
    30  }
    31  
    32  // Masked returns x but with elements zeroed where mask is false.
    33  func (x Int32x4) Masked(mask Mask32x4) Int32x4 {
    34  	im := mask.ToInt32x4()
    35  	return im.And(x)
    36  }
    37  
    38  // IfElse returns x but with elements set to y where mask is false.
    39  func (x Int32x4) IfElse(mask Mask32x4, y Int32x4) Int32x4 {
    40  	im := mask.ToInt32x4().ToBits().ReshapeToUint8s().BitsToInt8()
    41  	ix := x.ToBits().ReshapeToUint8s().BitsToInt8()
    42  	iy := y.ToBits().ReshapeToUint8s().BitsToInt8()
    43  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint32s().BitsToInt32()
    44  }
    45  
    46  // Masked returns x but with elements zeroed where mask is false.
    47  func (x Int64x2) Masked(mask Mask64x2) Int64x2 {
    48  	im := mask.ToInt64x2()
    49  	return im.And(x)
    50  }
    51  
    52  // IfElse returns x but with elements set to y where mask is false.
    53  func (x Int64x2) IfElse(mask Mask64x2, y Int64x2) Int64x2 {
    54  	im := mask.ToInt64x2().ToBits().ReshapeToUint8s().BitsToInt8()
    55  	ix := x.ToBits().ReshapeToUint8s().BitsToInt8()
    56  	iy := y.ToBits().ReshapeToUint8s().BitsToInt8()
    57  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint64s().BitsToInt64()
    58  }
    59  
    60  // Masked returns x but with elements zeroed where mask is false.
    61  func (x Uint8x16) Masked(mask Mask8x16) Uint8x16 {
    62  	im := mask.ToInt8x16()
    63  	return im.And(x.BitsToInt8()).ToBits()
    64  }
    65  
    66  // IfElse returns x but with elements set to y where mask is false.
    67  func (x Uint8x16) IfElse(mask Mask8x16, y Uint8x16) Uint8x16 {
    68  	return x.BitsToInt8().bitSelect(y.BitsToInt8(), mask.ToInt8x16()).ToBits()
    69  }
    70  
    71  // Masked returns x but with elements zeroed where mask is false.
    72  func (x Uint16x8) Masked(mask Mask16x8) Uint16x8 {
    73  	im := mask.ToInt16x8()
    74  	return im.And(x.BitsToInt16()).ToBits()
    75  }
    76  
    77  // IfElse returns x but with elements set to y where mask is false.
    78  func (x Uint16x8) IfElse(mask Mask16x8, y Uint16x8) Uint16x8 {
    79  	im := mask.ToInt16x8().ToBits().ReshapeToUint8s().BitsToInt8()
    80  	ix := x.ReshapeToUint8s().BitsToInt8()
    81  	iy := y.ReshapeToUint8s().BitsToInt8()
    82  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint16s()
    83  }
    84  
    85  // Masked returns x but with elements zeroed where mask is false.
    86  func (x Uint32x4) Masked(mask Mask32x4) Uint32x4 {
    87  	im := mask.ToInt32x4()
    88  	return im.And(x.BitsToInt32()).ToBits()
    89  }
    90  
    91  // IfElse returns x but with elements set to y where mask is false.
    92  func (x Uint32x4) IfElse(mask Mask32x4, y Uint32x4) Uint32x4 {
    93  	im := mask.ToInt32x4().ToBits().ReshapeToUint8s().BitsToInt8()
    94  	ix := x.ReshapeToUint8s().BitsToInt8()
    95  	iy := y.ReshapeToUint8s().BitsToInt8()
    96  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint32s()
    97  }
    98  
    99  // Masked returns x but with elements zeroed where mask is false.
   100  func (x Uint64x2) Masked(mask Mask64x2) Uint64x2 {
   101  	im := mask.ToInt64x2()
   102  	return im.And(x.BitsToInt64()).ToBits()
   103  }
   104  
   105  // IfElse returns x but with elements set to y where mask is false.
   106  func (x Uint64x2) IfElse(mask Mask64x2, y Uint64x2) Uint64x2 {
   107  	im := mask.ToInt64x2().ToBits().ReshapeToUint8s().BitsToInt8()
   108  	ix := x.ReshapeToUint8s().BitsToInt8()
   109  	iy := y.ReshapeToUint8s().BitsToInt8()
   110  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint64s()
   111  }
   112  
   113  // Masked returns x but with elements zeroed where mask is false.
   114  func (x Float32x4) Masked(mask Mask32x4) Float32x4 {
   115  	im := mask.ToInt32x4()
   116  	return im.And(x.ToBits().BitsToInt32()).ToBits().BitsToFloat32()
   117  }
   118  
   119  // IfElse returns x but with elements set to y where mask is false.
   120  func (x Float32x4) IfElse(mask Mask32x4, y Float32x4) Float32x4 {
   121  	im := mask.ToInt32x4().ToBits().ReshapeToUint8s().BitsToInt8()
   122  	ix := x.ToBits().ReshapeToUint8s().BitsToInt8()
   123  	iy := y.ToBits().ReshapeToUint8s().BitsToInt8()
   124  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint32s().BitsToFloat32()
   125  }
   126  
   127  // Masked returns x but with elements zeroed where mask is false.
   128  func (x Float64x2) Masked(mask Mask64x2) Float64x2 {
   129  	im := mask.ToInt64x2()
   130  	return im.And(x.ToBits().BitsToInt64()).ToBits().BitsToFloat64()
   131  }
   132  
   133  // IfElse returns x but with elements set to y where mask is false.
   134  func (x Float64x2) IfElse(mask Mask64x2, y Float64x2) Float64x2 {
   135  	im := mask.ToInt64x2().ToBits().ReshapeToUint8s().BitsToInt8()
   136  	ix := x.ToBits().ReshapeToUint8s().BitsToInt8()
   137  	iy := y.ToBits().ReshapeToUint8s().BitsToInt8()
   138  	return ix.bitSelect(iy, im).ToBits().ReshapeToUint64s().BitsToFloat64()
   139  }
   140  
   141  // String returns a string representation of SIMD mask x.
   142  func (x Mask8x16) String() string {
   143  	var s [16]int8
   144  	x.ToInt8x16().Neg().StoreArray(&s)
   145  	return sliceToString(s[:])
   146  }
   147  
   148  // String returns a string representation of SIMD mask x.
   149  func (x Mask16x8) String() string {
   150  	var s [8]int16
   151  	x.ToInt16x8().Neg().StoreArray(&s)
   152  	return sliceToString(s[:])
   153  }
   154  
   155  // String returns a string representation of SIMD mask x.
   156  func (x Mask32x4) String() string {
   157  	var s [4]int32
   158  	x.ToInt32x4().Neg().StoreArray(&s)
   159  	return sliceToString(s[:])
   160  }
   161  
   162  // String returns a string representation of SIMD mask x.
   163  func (x Mask64x2) String() string {
   164  	var s [2]int64
   165  	x.ToInt64x2().Neg().StoreArray(&s)
   166  	return sliceToString(s[:])
   167  }
   168  

View as plain text