Source file src/simd/archsimd/other_gen_arm64.go

     1  // Code generated by 'tmplgen'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd
     4  
     5  package archsimd
     6  
     7  // BroadcastInt8x16 returns a vector with the input
     8  // x assigned to all elements of the output.
     9  func BroadcastInt8x16(x int8) Int8x16 {
    10  	var z Int8x16
    11  	return z.SetElem(0, x).broadcast1To16()
    12  }
    13  
    14  // BroadcastInt16x8 returns a vector with the input
    15  // x assigned to all elements of the output.
    16  func BroadcastInt16x8(x int16) Int16x8 {
    17  	var z Int16x8
    18  	return z.SetElem(0, x).broadcast1To8()
    19  }
    20  
    21  // BroadcastInt32x4 returns a vector with the input
    22  // x assigned to all elements of the output.
    23  func BroadcastInt32x4(x int32) Int32x4 {
    24  	var z Int32x4
    25  	return z.SetElem(0, x).broadcast1To4()
    26  }
    27  
    28  // BroadcastInt64x2 returns a vector with the input
    29  // x assigned to all elements of the output.
    30  func BroadcastInt64x2(x int64) Int64x2 {
    31  	var z Int64x2
    32  	return z.SetElem(0, x).broadcast1To2()
    33  }
    34  
    35  // BroadcastUint8x16 returns a vector with the input
    36  // x assigned to all elements of the output.
    37  func BroadcastUint8x16(x uint8) Uint8x16 {
    38  	var z Uint8x16
    39  	return z.SetElem(0, x).broadcast1To16()
    40  }
    41  
    42  // BroadcastUint16x8 returns a vector with the input
    43  // x assigned to all elements of the output.
    44  func BroadcastUint16x8(x uint16) Uint16x8 {
    45  	var z Uint16x8
    46  	return z.SetElem(0, x).broadcast1To8()
    47  }
    48  
    49  // BroadcastUint32x4 returns a vector with the input
    50  // x assigned to all elements of the output.
    51  func BroadcastUint32x4(x uint32) Uint32x4 {
    52  	var z Uint32x4
    53  	return z.SetElem(0, x).broadcast1To4()
    54  }
    55  
    56  // BroadcastUint64x2 returns a vector with the input
    57  // x assigned to all elements of the output.
    58  func BroadcastUint64x2(x uint64) Uint64x2 {
    59  	var z Uint64x2
    60  	return z.SetElem(0, x).broadcast1To2()
    61  }
    62  
    63  // BroadcastFloat32x4 returns a vector with the input
    64  // x assigned to all elements of the output.
    65  func BroadcastFloat32x4(x float32) Float32x4 {
    66  	var z Float32x4
    67  	return z.SetElem(0, x).broadcast1To4()
    68  }
    69  
    70  // BroadcastFloat64x2 returns a vector with the input
    71  // x assigned to all elements of the output.
    72  func BroadcastFloat64x2(x float64) Float64x2 {
    73  	var z Float64x2
    74  	return z.SetElem(0, x).broadcast1To2()
    75  }
    76  
    77  // String returns a string representation of SIMD vector x.
    78  func (x Int8x16) String() string {
    79  	var s [16]int8
    80  	x.StoreArray(&s)
    81  	return sliceToString(s[:])
    82  }
    83  
    84  // String returns a string representation of SIMD vector x.
    85  func (x Int16x8) String() string {
    86  	var s [8]int16
    87  	x.StoreArray(&s)
    88  	return sliceToString(s[:])
    89  }
    90  
    91  // String returns a string representation of SIMD vector x.
    92  func (x Int32x4) String() string {
    93  	var s [4]int32
    94  	x.StoreArray(&s)
    95  	return sliceToString(s[:])
    96  }
    97  
    98  // String returns a string representation of SIMD vector x.
    99  func (x Int64x2) String() string {
   100  	var s [2]int64
   101  	x.StoreArray(&s)
   102  	return sliceToString(s[:])
   103  }
   104  
   105  // String returns a string representation of SIMD vector x.
   106  func (x Uint8x16) String() string {
   107  	var s [16]uint8
   108  	x.StoreArray(&s)
   109  	return sliceToString(s[:])
   110  }
   111  
   112  // String returns a string representation of SIMD vector x.
   113  func (x Uint16x8) String() string {
   114  	var s [8]uint16
   115  	x.StoreArray(&s)
   116  	return sliceToString(s[:])
   117  }
   118  
   119  // String returns a string representation of SIMD vector x.
   120  func (x Uint32x4) String() string {
   121  	var s [4]uint32
   122  	x.StoreArray(&s)
   123  	return sliceToString(s[:])
   124  }
   125  
   126  // String returns a string representation of SIMD vector x.
   127  func (x Uint64x2) String() string {
   128  	var s [2]uint64
   129  	x.StoreArray(&s)
   130  	return sliceToString(s[:])
   131  }
   132  
   133  // String returns a string representation of SIMD vector x.
   134  func (x Float32x4) String() string {
   135  	var s [4]float32
   136  	x.StoreArray(&s)
   137  	return sliceToString(s[:])
   138  }
   139  
   140  // String returns a string representation of SIMD vector x.
   141  func (x Float64x2) String() string {
   142  	var s [2]float64
   143  	x.StoreArray(&s)
   144  	return sliceToString(s[:])
   145  }
   146  
   147  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   148  // 64 bits replaced with the upper 64 bits of x.
   149  func (x Int8x16) HiToLo() Int8x16 {
   150  	var z Int8x16
   151  	return z.ToBits().ReshapeToUint64s().SetElem(0, x.ToBits().ReshapeToUint64s().GetElem(1)).ReshapeToUint8s().BitsToInt8()
   152  }
   153  
   154  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   155  // 64 bits replaced with the upper 64 bits of x.
   156  func (x Int16x8) HiToLo() Int16x8 {
   157  	var z Int16x8
   158  	return z.ToBits().ReshapeToUint64s().SetElem(0, x.ToBits().ReshapeToUint64s().GetElem(1)).ReshapeToUint16s().BitsToInt16()
   159  }
   160  
   161  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   162  // 64 bits replaced with the upper 64 bits of x.
   163  func (x Int32x4) HiToLo() Int32x4 {
   164  	var z Int32x4
   165  	return z.ToBits().ReshapeToUint64s().SetElem(0, x.ToBits().ReshapeToUint64s().GetElem(1)).ReshapeToUint32s().BitsToInt32()
   166  }
   167  
   168  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   169  // 64 bits replaced with the upper 64 bits of x.
   170  func (x Int64x2) HiToLo() Int64x2 {
   171  	var z Int64x2
   172  	return z.ToBits().SetElem(0, x.ToBits().GetElem(1)).BitsToInt64()
   173  }
   174  
   175  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   176  // 64 bits replaced with the upper 64 bits of x.
   177  func (x Uint8x16) HiToLo() Uint8x16 {
   178  	var z Uint8x16
   179  	return z.ReshapeToUint64s().SetElem(0, x.ReshapeToUint64s().GetElem(1)).ReshapeToUint8s()
   180  }
   181  
   182  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   183  // 64 bits replaced with the upper 64 bits of x.
   184  func (x Uint16x8) HiToLo() Uint16x8 {
   185  	var z Uint16x8
   186  	return z.ReshapeToUint64s().SetElem(0, x.ReshapeToUint64s().GetElem(1)).ReshapeToUint16s()
   187  }
   188  
   189  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   190  // 64 bits replaced with the upper 64 bits of x.
   191  func (x Uint32x4) HiToLo() Uint32x4 {
   192  	var z Uint32x4
   193  	return z.ReshapeToUint64s().SetElem(0, x.ReshapeToUint64s().GetElem(1)).ReshapeToUint32s()
   194  }
   195  
   196  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   197  // 64 bits replaced with the upper 64 bits of x.
   198  func (x Uint64x2) HiToLo() Uint64x2 {
   199  	var z Uint64x2
   200  	return z.SetElem(0, x.GetElem(1))
   201  }
   202  
   203  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   204  // 64 bits replaced with the upper 64 bits of x.
   205  func (x Float32x4) HiToLo() Float32x4 {
   206  	var z Float32x4
   207  	return z.ToBits().ReshapeToUint64s().SetElem(0, x.ToBits().ReshapeToUint64s().GetElem(1)).ReshapeToUint32s().BitsToFloat32()
   208  }
   209  
   210  // HiToLo returns a vector with the upper 64 bits zeroed and the lower
   211  // 64 bits replaced with the upper 64 bits of x.
   212  func (x Float64x2) HiToLo() Float64x2 {
   213  	var z Float64x2
   214  	return z.ToBits().SetElem(0, x.ToBits().GetElem(1)).BitsToFloat64()
   215  }
   216  
   217  // ToMask returns a mask whose i'th element is set if x[i] is non-zero.
   218  func (from Int8x16) ToMask() (to Mask8x16) {
   219  	return from.NotEqual(Int8x16{})
   220  }
   221  
   222  // ToMask returns a mask whose i'th element is set if x[i] is non-zero.
   223  func (from Int16x8) ToMask() (to Mask16x8) {
   224  	return from.NotEqual(Int16x8{})
   225  }
   226  
   227  // ToMask returns a mask whose i'th element is set if x[i] is non-zero.
   228  func (from Int32x4) ToMask() (to Mask32x4) {
   229  	return from.NotEqual(Int32x4{})
   230  }
   231  
   232  // ToMask returns a mask whose i'th element is set if x[i] is non-zero.
   233  func (from Int64x2) ToMask() (to Mask64x2) {
   234  	return from.NotEqual(Int64x2{})
   235  }
   236  
   237  // RotateAllLeft rotates all elements left by the specified amount
   238  //
   239  // Emulated
   240  func (x Int8x16) RotateAllLeft(dist uint64) Int8x16 {
   241  	dist = dist & (8 - 1)
   242  	ndist := 8 - dist
   243  	return x.ToBits().ShiftAllLeft(dist).Or(x.ToBits().ShiftAllRight(ndist)).BitsToInt8()
   244  }
   245  
   246  // RotateAllRight rotates all elements right by the specified amount
   247  //
   248  // Emulated
   249  func (x Int8x16) RotateAllRight(dist uint64) Int8x16 {
   250  	dist = dist & (8 - 1)
   251  	ndist := 8 - dist
   252  	return x.ToBits().ShiftAllLeft(ndist).Or(x.ToBits().ShiftAllRight(dist)).BitsToInt8()
   253  }
   254  
   255  // RotateAllLeft rotates all elements left by the specified amount
   256  //
   257  // Emulated
   258  func (x Int16x8) RotateAllLeft(dist uint64) Int16x8 {
   259  	dist = dist & (16 - 1)
   260  	ndist := 16 - dist
   261  	return x.ToBits().ShiftAllLeft(dist).Or(x.ToBits().ShiftAllRight(ndist)).BitsToInt16()
   262  }
   263  
   264  // RotateAllRight rotates all elements right by the specified amount
   265  //
   266  // Emulated
   267  func (x Int16x8) RotateAllRight(dist uint64) Int16x8 {
   268  	dist = dist & (16 - 1)
   269  	ndist := 16 - dist
   270  	return x.ToBits().ShiftAllLeft(ndist).Or(x.ToBits().ShiftAllRight(dist)).BitsToInt16()
   271  }
   272  
   273  // RotateAllLeft rotates all elements left by the specified amount
   274  //
   275  // Emulated
   276  func (x Int32x4) RotateAllLeft(dist uint64) Int32x4 {
   277  	dist = dist & (32 - 1)
   278  	ndist := 32 - dist
   279  	return x.ToBits().ShiftAllLeft(dist).Or(x.ToBits().ShiftAllRight(ndist)).BitsToInt32()
   280  }
   281  
   282  // RotateAllRight rotates all elements right by the specified amount
   283  //
   284  // Emulated
   285  func (x Int32x4) RotateAllRight(dist uint64) Int32x4 {
   286  	dist = dist & (32 - 1)
   287  	ndist := 32 - dist
   288  	return x.ToBits().ShiftAllLeft(ndist).Or(x.ToBits().ShiftAllRight(dist)).BitsToInt32()
   289  }
   290  
   291  // RotateAllLeft rotates all elements left by the specified amount
   292  //
   293  // Emulated
   294  func (x Int64x2) RotateAllLeft(dist uint64) Int64x2 {
   295  	dist = dist & (64 - 1)
   296  	ndist := 64 - dist
   297  	return x.ToBits().ShiftAllLeft(dist).Or(x.ToBits().ShiftAllRight(ndist)).BitsToInt64()
   298  }
   299  
   300  // RotateAllRight rotates all elements right by the specified amount
   301  //
   302  // Emulated
   303  func (x Int64x2) RotateAllRight(dist uint64) Int64x2 {
   304  	dist = dist & (64 - 1)
   305  	ndist := 64 - dist
   306  	return x.ToBits().ShiftAllLeft(ndist).Or(x.ToBits().ShiftAllRight(dist)).BitsToInt64()
   307  }
   308  
   309  // RotateAllLeft rotates all elements left by the specified amount
   310  //
   311  // Emulated
   312  func (x Uint8x16) RotateAllLeft(dist uint64) Uint8x16 {
   313  	dist = dist & (8 - 1)
   314  	ndist := 8 - dist
   315  	return x.ShiftAllLeft(dist).Or(x.ShiftAllRight(ndist))
   316  }
   317  
   318  // RotateAllRight rotates all elements right by the specified amount
   319  //
   320  // Emulated
   321  func (x Uint8x16) RotateAllRight(dist uint64) Uint8x16 {
   322  	dist = dist & (8 - 1)
   323  	ndist := 8 - dist
   324  	return x.ShiftAllLeft(ndist).Or(x.ShiftAllRight(dist))
   325  }
   326  
   327  // RotateAllLeft rotates all elements left by the specified amount
   328  //
   329  // Emulated
   330  func (x Uint16x8) RotateAllLeft(dist uint64) Uint16x8 {
   331  	dist = dist & (16 - 1)
   332  	ndist := 16 - dist
   333  	return x.ShiftAllLeft(dist).Or(x.ShiftAllRight(ndist))
   334  }
   335  
   336  // RotateAllRight rotates all elements right by the specified amount
   337  //
   338  // Emulated
   339  func (x Uint16x8) RotateAllRight(dist uint64) Uint16x8 {
   340  	dist = dist & (16 - 1)
   341  	ndist := 16 - dist
   342  	return x.ShiftAllLeft(ndist).Or(x.ShiftAllRight(dist))
   343  }
   344  
   345  // RotateAllLeft rotates all elements left by the specified amount
   346  //
   347  // Emulated
   348  func (x Uint32x4) RotateAllLeft(dist uint64) Uint32x4 {
   349  	dist = dist & (32 - 1)
   350  	ndist := 32 - dist
   351  	return x.ShiftAllLeft(dist).Or(x.ShiftAllRight(ndist))
   352  }
   353  
   354  // RotateAllRight rotates all elements right by the specified amount
   355  //
   356  // Emulated
   357  func (x Uint32x4) RotateAllRight(dist uint64) Uint32x4 {
   358  	dist = dist & (32 - 1)
   359  	ndist := 32 - dist
   360  	return x.ShiftAllLeft(ndist).Or(x.ShiftAllRight(dist))
   361  }
   362  
   363  // RotateAllLeft rotates all elements left by the specified amount
   364  //
   365  // Emulated
   366  func (x Uint64x2) RotateAllLeft(dist uint64) Uint64x2 {
   367  	dist = dist & (64 - 1)
   368  	ndist := 64 - dist
   369  	return x.ShiftAllLeft(dist).Or(x.ShiftAllRight(ndist))
   370  }
   371  
   372  // RotateAllRight rotates all elements right by the specified amount
   373  //
   374  // Emulated
   375  func (x Uint64x2) RotateAllRight(dist uint64) Uint64x2 {
   376  	dist = dist & (64 - 1)
   377  	ndist := 64 - dist
   378  	return x.ShiftAllLeft(ndist).Or(x.ShiftAllRight(dist))
   379  }
   380  
   381  // ReduceSum reduces x by summing all elements.
   382  //
   383  // Emulated, CPU Feature: NEON
   384  func (x Int8x16) ReduceSum() int8 {
   385  	return x.reduceSum().GetElem(0)
   386  }
   387  
   388  // ReduceSum reduces x by summing all elements.
   389  //
   390  // Emulated, CPU Feature: NEON
   391  func (x Int16x8) ReduceSum() int16 {
   392  	return x.reduceSum().GetElem(0)
   393  }
   394  
   395  // ReduceSum reduces x by summing all elements.
   396  //
   397  // Emulated, CPU Feature: NEON
   398  func (x Int32x4) ReduceSum() int32 {
   399  	return x.reduceSum().GetElem(0)
   400  }
   401  
   402  // ReduceSum reduces x by summing all elements.
   403  //
   404  // Emulated, CPU Feature: NEON
   405  func (x Uint8x16) ReduceSum() uint8 {
   406  	return x.reduceSum().GetElem(0)
   407  }
   408  
   409  // ReduceSum reduces x by summing all elements.
   410  //
   411  // Emulated, CPU Feature: NEON
   412  func (x Uint16x8) ReduceSum() uint16 {
   413  	return x.reduceSum().GetElem(0)
   414  }
   415  
   416  // ReduceSum reduces x by summing all elements.
   417  //
   418  // Emulated, CPU Feature: NEON
   419  func (x Uint32x4) ReduceSum() uint32 {
   420  	return x.reduceSum().GetElem(0)
   421  }
   422  
   423  // ReduceMax reduces x by taking the maximum of all elements.
   424  //
   425  // Emulated, CPU Feature: NEON
   426  func (x Int8x16) ReduceMax() int8 {
   427  	return x.reduceMax().GetElem(0)
   428  }
   429  
   430  // ReduceMin reduces x by taking the minimum of all elements.
   431  //
   432  // Emulated, CPU Feature: NEON
   433  func (x Int8x16) ReduceMin() int8 {
   434  	return x.reduceMin().GetElem(0)
   435  }
   436  
   437  // ReduceMax reduces x by taking the maximum of all elements.
   438  //
   439  // Emulated, CPU Feature: NEON
   440  func (x Int16x8) ReduceMax() int16 {
   441  	return x.reduceMax().GetElem(0)
   442  }
   443  
   444  // ReduceMin reduces x by taking the minimum of all elements.
   445  //
   446  // Emulated, CPU Feature: NEON
   447  func (x Int16x8) ReduceMin() int16 {
   448  	return x.reduceMin().GetElem(0)
   449  }
   450  
   451  // ReduceMax reduces x by taking the maximum of all elements.
   452  //
   453  // Emulated, CPU Feature: NEON
   454  func (x Int32x4) ReduceMax() int32 {
   455  	return x.reduceMax().GetElem(0)
   456  }
   457  
   458  // ReduceMin reduces x by taking the minimum of all elements.
   459  //
   460  // Emulated, CPU Feature: NEON
   461  func (x Int32x4) ReduceMin() int32 {
   462  	return x.reduceMin().GetElem(0)
   463  }
   464  
   465  // ReduceMax reduces x by taking the maximum of all elements.
   466  //
   467  // Emulated, CPU Feature: NEON
   468  func (x Uint8x16) ReduceMax() uint8 {
   469  	return x.reduceMax().GetElem(0)
   470  }
   471  
   472  // ReduceMin reduces x by taking the minimum of all elements.
   473  //
   474  // Emulated, CPU Feature: NEON
   475  func (x Uint8x16) ReduceMin() uint8 {
   476  	return x.reduceMin().GetElem(0)
   477  }
   478  
   479  // ReduceMax reduces x by taking the maximum of all elements.
   480  //
   481  // Emulated, CPU Feature: NEON
   482  func (x Uint16x8) ReduceMax() uint16 {
   483  	return x.reduceMax().GetElem(0)
   484  }
   485  
   486  // ReduceMin reduces x by taking the minimum of all elements.
   487  //
   488  // Emulated, CPU Feature: NEON
   489  func (x Uint16x8) ReduceMin() uint16 {
   490  	return x.reduceMin().GetElem(0)
   491  }
   492  
   493  // ReduceMax reduces x by taking the maximum of all elements.
   494  //
   495  // Emulated, CPU Feature: NEON
   496  func (x Uint32x4) ReduceMax() uint32 {
   497  	return x.reduceMax().GetElem(0)
   498  }
   499  
   500  // ReduceMin reduces x by taking the minimum of all elements.
   501  //
   502  // Emulated, CPU Feature: NEON
   503  func (x Uint32x4) ReduceMin() uint32 {
   504  	return x.reduceMin().GetElem(0)
   505  }
   506  
   507  // ReduceMax reduces x by taking the maximum of all elements.
   508  //
   509  // Emulated, CPU Feature: NEON
   510  func (x Float32x4) ReduceMax() float32 {
   511  	return x.reduceMax().GetElem(0)
   512  }
   513  
   514  // ReduceMin reduces x by taking the minimum of all elements.
   515  //
   516  // Emulated, CPU Feature: NEON
   517  func (x Float32x4) ReduceMin() float32 {
   518  	return x.reduceMin().GetElem(0)
   519  }
   520  

View as plain text