Source file src/simd/tofrom_amd64.go

     1  // Code generated by 'go run -C $GOROOT/src/simd/archsimd/_gen/midway'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd && amd64
     4  
     5  package simd
     6  
     7  import (
     8  	"simd/archsimd"
     9  	"simd/internal/bridge"
    10  )
    11  
    12  func (x Int8s) ToArch() any
    13  
    14  type archSimdInt8s interface {
    15  	archsimd.Int8x16 | archsimd.Int8x32 | archsimd.Int8x64
    16  }
    17  
    18  func Int8sFromArch[T archSimdInt8s](x T) Int8s {
    19  	switch a := any(x).(type) {
    20  	// The return expression is written this way because the code will be rewritten
    21  	// with Int8s replaced by one of the arch types, and without the any-assert
    22  	// hack the rewritten code would not pass type checking.
    23  	// The backend of the compiler will eat this and turn it into no code at all,
    24  	// assuming it inlines.
    25  	case archsimd.Int8x16:
    26  		var t bridge.Int8x16 = bridge.Int8x16(a)
    27  		return (any(t)).(Int8s)
    28  	case archsimd.Int8x32:
    29  		var t bridge.Int8x32 = bridge.Int8x32(a)
    30  		return (any(t)).(Int8s)
    31  	case archsimd.Int8x64:
    32  		var t bridge.Int8x64 = bridge.Int8x64(a)
    33  		return (any(t)).(Int8s)
    34  	}
    35  	panic("wrong type")
    36  }
    37  
    38  func (x Int16s) ToArch() any
    39  
    40  type archSimdInt16s interface {
    41  	archsimd.Int16x8 | archsimd.Int16x16 | archsimd.Int16x32
    42  }
    43  
    44  func Int16sFromArch[T archSimdInt16s](x T) Int16s {
    45  	switch a := any(x).(type) {
    46  	// The return expression is written this way because the code will be rewritten
    47  	// with Int16s replaced by one of the arch types, and without the any-assert
    48  	// hack the rewritten code would not pass type checking.
    49  	// The backend of the compiler will eat this and turn it into no code at all,
    50  	// assuming it inlines.
    51  	case archsimd.Int16x8:
    52  		var t bridge.Int16x8 = bridge.Int16x8(a)
    53  		return (any(t)).(Int16s)
    54  	case archsimd.Int16x16:
    55  		var t bridge.Int16x16 = bridge.Int16x16(a)
    56  		return (any(t)).(Int16s)
    57  	case archsimd.Int16x32:
    58  		var t bridge.Int16x32 = bridge.Int16x32(a)
    59  		return (any(t)).(Int16s)
    60  	}
    61  	panic("wrong type")
    62  }
    63  
    64  func (x Int32s) ToArch() any
    65  
    66  type archSimdInt32s interface {
    67  	archsimd.Int32x4 | archsimd.Int32x8 | archsimd.Int32x16
    68  }
    69  
    70  func Int32sFromArch[T archSimdInt32s](x T) Int32s {
    71  	switch a := any(x).(type) {
    72  	// The return expression is written this way because the code will be rewritten
    73  	// with Int32s replaced by one of the arch types, and without the any-assert
    74  	// hack the rewritten code would not pass type checking.
    75  	// The backend of the compiler will eat this and turn it into no code at all,
    76  	// assuming it inlines.
    77  	case archsimd.Int32x4:
    78  		var t bridge.Int32x4 = bridge.Int32x4(a)
    79  		return (any(t)).(Int32s)
    80  	case archsimd.Int32x8:
    81  		var t bridge.Int32x8 = bridge.Int32x8(a)
    82  		return (any(t)).(Int32s)
    83  	case archsimd.Int32x16:
    84  		var t bridge.Int32x16 = bridge.Int32x16(a)
    85  		return (any(t)).(Int32s)
    86  	}
    87  	panic("wrong type")
    88  }
    89  
    90  func (x Int64s) ToArch() any
    91  
    92  type archSimdInt64s interface {
    93  	archsimd.Int64x2 | archsimd.Int64x4 | archsimd.Int64x8
    94  }
    95  
    96  func Int64sFromArch[T archSimdInt64s](x T) Int64s {
    97  	switch a := any(x).(type) {
    98  	// The return expression is written this way because the code will be rewritten
    99  	// with Int64s replaced by one of the arch types, and without the any-assert
   100  	// hack the rewritten code would not pass type checking.
   101  	// The backend of the compiler will eat this and turn it into no code at all,
   102  	// assuming it inlines.
   103  	case archsimd.Int64x2:
   104  		var t bridge.Int64x2 = bridge.Int64x2(a)
   105  		return (any(t)).(Int64s)
   106  	case archsimd.Int64x4:
   107  		var t bridge.Int64x4 = bridge.Int64x4(a)
   108  		return (any(t)).(Int64s)
   109  	case archsimd.Int64x8:
   110  		var t bridge.Int64x8 = bridge.Int64x8(a)
   111  		return (any(t)).(Int64s)
   112  	}
   113  	panic("wrong type")
   114  }
   115  
   116  func (x Uint8s) ToArch() any
   117  
   118  type archSimdUint8s interface {
   119  	archsimd.Uint8x16 | archsimd.Uint8x32 | archsimd.Uint8x64
   120  }
   121  
   122  func Uint8sFromArch[T archSimdUint8s](x T) Uint8s {
   123  	switch a := any(x).(type) {
   124  	// The return expression is written this way because the code will be rewritten
   125  	// with Uint8s replaced by one of the arch types, and without the any-assert
   126  	// hack the rewritten code would not pass type checking.
   127  	// The backend of the compiler will eat this and turn it into no code at all,
   128  	// assuming it inlines.
   129  	case archsimd.Uint8x16:
   130  		var t bridge.Uint8x16 = bridge.Uint8x16(a)
   131  		return (any(t)).(Uint8s)
   132  	case archsimd.Uint8x32:
   133  		var t bridge.Uint8x32 = bridge.Uint8x32(a)
   134  		return (any(t)).(Uint8s)
   135  	case archsimd.Uint8x64:
   136  		var t bridge.Uint8x64 = bridge.Uint8x64(a)
   137  		return (any(t)).(Uint8s)
   138  	}
   139  	panic("wrong type")
   140  }
   141  
   142  func (x Uint16s) ToArch() any
   143  
   144  type archSimdUint16s interface {
   145  	archsimd.Uint16x8 | archsimd.Uint16x16 | archsimd.Uint16x32
   146  }
   147  
   148  func Uint16sFromArch[T archSimdUint16s](x T) Uint16s {
   149  	switch a := any(x).(type) {
   150  	// The return expression is written this way because the code will be rewritten
   151  	// with Uint16s replaced by one of the arch types, and without the any-assert
   152  	// hack the rewritten code would not pass type checking.
   153  	// The backend of the compiler will eat this and turn it into no code at all,
   154  	// assuming it inlines.
   155  	case archsimd.Uint16x8:
   156  		var t bridge.Uint16x8 = bridge.Uint16x8(a)
   157  		return (any(t)).(Uint16s)
   158  	case archsimd.Uint16x16:
   159  		var t bridge.Uint16x16 = bridge.Uint16x16(a)
   160  		return (any(t)).(Uint16s)
   161  	case archsimd.Uint16x32:
   162  		var t bridge.Uint16x32 = bridge.Uint16x32(a)
   163  		return (any(t)).(Uint16s)
   164  	}
   165  	panic("wrong type")
   166  }
   167  
   168  func (x Uint32s) ToArch() any
   169  
   170  type archSimdUint32s interface {
   171  	archsimd.Uint32x4 | archsimd.Uint32x8 | archsimd.Uint32x16
   172  }
   173  
   174  func Uint32sFromArch[T archSimdUint32s](x T) Uint32s {
   175  	switch a := any(x).(type) {
   176  	// The return expression is written this way because the code will be rewritten
   177  	// with Uint32s replaced by one of the arch types, and without the any-assert
   178  	// hack the rewritten code would not pass type checking.
   179  	// The backend of the compiler will eat this and turn it into no code at all,
   180  	// assuming it inlines.
   181  	case archsimd.Uint32x4:
   182  		var t bridge.Uint32x4 = bridge.Uint32x4(a)
   183  		return (any(t)).(Uint32s)
   184  	case archsimd.Uint32x8:
   185  		var t bridge.Uint32x8 = bridge.Uint32x8(a)
   186  		return (any(t)).(Uint32s)
   187  	case archsimd.Uint32x16:
   188  		var t bridge.Uint32x16 = bridge.Uint32x16(a)
   189  		return (any(t)).(Uint32s)
   190  	}
   191  	panic("wrong type")
   192  }
   193  
   194  func (x Uint64s) ToArch() any
   195  
   196  type archSimdUint64s interface {
   197  	archsimd.Uint64x2 | archsimd.Uint64x4 | archsimd.Uint64x8
   198  }
   199  
   200  func Uint64sFromArch[T archSimdUint64s](x T) Uint64s {
   201  	switch a := any(x).(type) {
   202  	// The return expression is written this way because the code will be rewritten
   203  	// with Uint64s replaced by one of the arch types, and without the any-assert
   204  	// hack the rewritten code would not pass type checking.
   205  	// The backend of the compiler will eat this and turn it into no code at all,
   206  	// assuming it inlines.
   207  	case archsimd.Uint64x2:
   208  		var t bridge.Uint64x2 = bridge.Uint64x2(a)
   209  		return (any(t)).(Uint64s)
   210  	case archsimd.Uint64x4:
   211  		var t bridge.Uint64x4 = bridge.Uint64x4(a)
   212  		return (any(t)).(Uint64s)
   213  	case archsimd.Uint64x8:
   214  		var t bridge.Uint64x8 = bridge.Uint64x8(a)
   215  		return (any(t)).(Uint64s)
   216  	}
   217  	panic("wrong type")
   218  }
   219  
   220  func (x Float32s) ToArch() any
   221  
   222  type archSimdFloat32s interface {
   223  	archsimd.Float32x4 | archsimd.Float32x8 | archsimd.Float32x16
   224  }
   225  
   226  func Float32sFromArch[T archSimdFloat32s](x T) Float32s {
   227  	switch a := any(x).(type) {
   228  	// The return expression is written this way because the code will be rewritten
   229  	// with Float32s replaced by one of the arch types, and without the any-assert
   230  	// hack the rewritten code would not pass type checking.
   231  	// The backend of the compiler will eat this and turn it into no code at all,
   232  	// assuming it inlines.
   233  	case archsimd.Float32x4:
   234  		var t bridge.Float32x4 = bridge.Float32x4(a)
   235  		return (any(t)).(Float32s)
   236  	case archsimd.Float32x8:
   237  		var t bridge.Float32x8 = bridge.Float32x8(a)
   238  		return (any(t)).(Float32s)
   239  	case archsimd.Float32x16:
   240  		var t bridge.Float32x16 = bridge.Float32x16(a)
   241  		return (any(t)).(Float32s)
   242  	}
   243  	panic("wrong type")
   244  }
   245  
   246  func (x Float64s) ToArch() any
   247  
   248  type archSimdFloat64s interface {
   249  	archsimd.Float64x2 | archsimd.Float64x4 | archsimd.Float64x8
   250  }
   251  
   252  func Float64sFromArch[T archSimdFloat64s](x T) Float64s {
   253  	switch a := any(x).(type) {
   254  	// The return expression is written this way because the code will be rewritten
   255  	// with Float64s replaced by one of the arch types, and without the any-assert
   256  	// hack the rewritten code would not pass type checking.
   257  	// The backend of the compiler will eat this and turn it into no code at all,
   258  	// assuming it inlines.
   259  	case archsimd.Float64x2:
   260  		var t bridge.Float64x2 = bridge.Float64x2(a)
   261  		return (any(t)).(Float64s)
   262  	case archsimd.Float64x4:
   263  		var t bridge.Float64x4 = bridge.Float64x4(a)
   264  		return (any(t)).(Float64s)
   265  	case archsimd.Float64x8:
   266  		var t bridge.Float64x8 = bridge.Float64x8(a)
   267  		return (any(t)).(Float64s)
   268  	}
   269  	panic("wrong type")
   270  }
   271  
   272  func (x Mask8s) ToArch() any
   273  
   274  type archSimdMask8s interface {
   275  	archsimd.Mask8x16 | archsimd.Mask8x32 | archsimd.Mask8x64
   276  }
   277  
   278  func Mask8sFromArch[T archSimdMask8s](x T) Mask8s {
   279  	switch a := any(x).(type) {
   280  	// The return expression is written this way because the code will be rewritten
   281  	// with Mask8s replaced by one of the arch types, and without the any-assert
   282  	// hack the rewritten code would not pass type checking.
   283  	// The backend of the compiler will eat this and turn it into no code at all,
   284  	// assuming it inlines.
   285  	case archsimd.Mask8x16:
   286  		var t bridge.Mask8x16 = bridge.Mask8x16(a)
   287  		return (any(t)).(Mask8s)
   288  	case archsimd.Mask8x32:
   289  		var t bridge.Mask8x32 = bridge.Mask8x32(a)
   290  		return (any(t)).(Mask8s)
   291  	case archsimd.Mask8x64:
   292  		var t bridge.Mask8x64 = bridge.Mask8x64(a)
   293  		return (any(t)).(Mask8s)
   294  	}
   295  	panic("wrong type")
   296  }
   297  
   298  func (x Mask16s) ToArch() any
   299  
   300  type archSimdMask16s interface {
   301  	archsimd.Mask16x8 | archsimd.Mask16x16 | archsimd.Mask16x32
   302  }
   303  
   304  func Mask16sFromArch[T archSimdMask16s](x T) Mask16s {
   305  	switch a := any(x).(type) {
   306  	// The return expression is written this way because the code will be rewritten
   307  	// with Mask16s replaced by one of the arch types, and without the any-assert
   308  	// hack the rewritten code would not pass type checking.
   309  	// The backend of the compiler will eat this and turn it into no code at all,
   310  	// assuming it inlines.
   311  	case archsimd.Mask16x8:
   312  		var t bridge.Mask16x8 = bridge.Mask16x8(a)
   313  		return (any(t)).(Mask16s)
   314  	case archsimd.Mask16x16:
   315  		var t bridge.Mask16x16 = bridge.Mask16x16(a)
   316  		return (any(t)).(Mask16s)
   317  	case archsimd.Mask16x32:
   318  		var t bridge.Mask16x32 = bridge.Mask16x32(a)
   319  		return (any(t)).(Mask16s)
   320  	}
   321  	panic("wrong type")
   322  }
   323  
   324  func (x Mask32s) ToArch() any
   325  
   326  type archSimdMask32s interface {
   327  	archsimd.Mask32x4 | archsimd.Mask32x8 | archsimd.Mask32x16
   328  }
   329  
   330  func Mask32sFromArch[T archSimdMask32s](x T) Mask32s {
   331  	switch a := any(x).(type) {
   332  	// The return expression is written this way because the code will be rewritten
   333  	// with Mask32s replaced by one of the arch types, and without the any-assert
   334  	// hack the rewritten code would not pass type checking.
   335  	// The backend of the compiler will eat this and turn it into no code at all,
   336  	// assuming it inlines.
   337  	case archsimd.Mask32x4:
   338  		var t bridge.Mask32x4 = bridge.Mask32x4(a)
   339  		return (any(t)).(Mask32s)
   340  	case archsimd.Mask32x8:
   341  		var t bridge.Mask32x8 = bridge.Mask32x8(a)
   342  		return (any(t)).(Mask32s)
   343  	case archsimd.Mask32x16:
   344  		var t bridge.Mask32x16 = bridge.Mask32x16(a)
   345  		return (any(t)).(Mask32s)
   346  	}
   347  	panic("wrong type")
   348  }
   349  
   350  func (x Mask64s) ToArch() any
   351  
   352  type archSimdMask64s interface {
   353  	archsimd.Mask64x2 | archsimd.Mask64x4 | archsimd.Mask64x8
   354  }
   355  
   356  func Mask64sFromArch[T archSimdMask64s](x T) Mask64s {
   357  	switch a := any(x).(type) {
   358  	// The return expression is written this way because the code will be rewritten
   359  	// with Mask64s replaced by one of the arch types, and without the any-assert
   360  	// hack the rewritten code would not pass type checking.
   361  	// The backend of the compiler will eat this and turn it into no code at all,
   362  	// assuming it inlines.
   363  	case archsimd.Mask64x2:
   364  		var t bridge.Mask64x2 = bridge.Mask64x2(a)
   365  		return (any(t)).(Mask64s)
   366  	case archsimd.Mask64x4:
   367  		var t bridge.Mask64x4 = bridge.Mask64x4(a)
   368  		return (any(t)).(Mask64s)
   369  	case archsimd.Mask64x8:
   370  		var t bridge.Mask64x8 = bridge.Mask64x8(a)
   371  		return (any(t)).(Mask64s)
   372  	}
   373  	panic("wrong type")
   374  }
   375  

View as plain text