Source file src/simd/tofrom_wasm.go

     1  // Code generated by 'go run -C $GOROOT/src/simd/archsimd/_gen/midway'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd && wasm
     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
    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  	}
    29  	panic("wrong type")
    30  }
    31  
    32  func (x Int16s) ToArch() any
    33  
    34  type archSimdInt16s interface {
    35  	archsimd.Int16x8
    36  }
    37  
    38  func Int16sFromArch[T archSimdInt16s](x T) Int16s {
    39  	switch a := any(x).(type) {
    40  	// The return expression is written this way because the code will be rewritten
    41  	// with Int16s replaced by one of the arch types, and without the any-assert
    42  	// hack the rewritten code would not pass type checking.
    43  	// The backend of the compiler will eat this and turn it into no code at all,
    44  	// assuming it inlines.
    45  	case archsimd.Int16x8:
    46  		var t bridge.Int16x8 = bridge.Int16x8(a)
    47  		return (any(t)).(Int16s)
    48  	}
    49  	panic("wrong type")
    50  }
    51  
    52  func (x Int32s) ToArch() any
    53  
    54  type archSimdInt32s interface {
    55  	archsimd.Int32x4
    56  }
    57  
    58  func Int32sFromArch[T archSimdInt32s](x T) Int32s {
    59  	switch a := any(x).(type) {
    60  	// The return expression is written this way because the code will be rewritten
    61  	// with Int32s replaced by one of the arch types, and without the any-assert
    62  	// hack the rewritten code would not pass type checking.
    63  	// The backend of the compiler will eat this and turn it into no code at all,
    64  	// assuming it inlines.
    65  	case archsimd.Int32x4:
    66  		var t bridge.Int32x4 = bridge.Int32x4(a)
    67  		return (any(t)).(Int32s)
    68  	}
    69  	panic("wrong type")
    70  }
    71  
    72  func (x Int64s) ToArch() any
    73  
    74  type archSimdInt64s interface {
    75  	archsimd.Int64x2
    76  }
    77  
    78  func Int64sFromArch[T archSimdInt64s](x T) Int64s {
    79  	switch a := any(x).(type) {
    80  	// The return expression is written this way because the code will be rewritten
    81  	// with Int64s replaced by one of the arch types, and without the any-assert
    82  	// hack the rewritten code would not pass type checking.
    83  	// The backend of the compiler will eat this and turn it into no code at all,
    84  	// assuming it inlines.
    85  	case archsimd.Int64x2:
    86  		var t bridge.Int64x2 = bridge.Int64x2(a)
    87  		return (any(t)).(Int64s)
    88  	}
    89  	panic("wrong type")
    90  }
    91  
    92  func (x Uint8s) ToArch() any
    93  
    94  type archSimdUint8s interface {
    95  	archsimd.Uint8x16
    96  }
    97  
    98  func Uint8sFromArch[T archSimdUint8s](x T) Uint8s {
    99  	switch a := any(x).(type) {
   100  	// The return expression is written this way because the code will be rewritten
   101  	// with Uint8s replaced by one of the arch types, and without the any-assert
   102  	// hack the rewritten code would not pass type checking.
   103  	// The backend of the compiler will eat this and turn it into no code at all,
   104  	// assuming it inlines.
   105  	case archsimd.Uint8x16:
   106  		var t bridge.Uint8x16 = bridge.Uint8x16(a)
   107  		return (any(t)).(Uint8s)
   108  	}
   109  	panic("wrong type")
   110  }
   111  
   112  func (x Uint16s) ToArch() any
   113  
   114  type archSimdUint16s interface {
   115  	archsimd.Uint16x8
   116  }
   117  
   118  func Uint16sFromArch[T archSimdUint16s](x T) Uint16s {
   119  	switch a := any(x).(type) {
   120  	// The return expression is written this way because the code will be rewritten
   121  	// with Uint16s replaced by one of the arch types, and without the any-assert
   122  	// hack the rewritten code would not pass type checking.
   123  	// The backend of the compiler will eat this and turn it into no code at all,
   124  	// assuming it inlines.
   125  	case archsimd.Uint16x8:
   126  		var t bridge.Uint16x8 = bridge.Uint16x8(a)
   127  		return (any(t)).(Uint16s)
   128  	}
   129  	panic("wrong type")
   130  }
   131  
   132  func (x Uint32s) ToArch() any
   133  
   134  type archSimdUint32s interface {
   135  	archsimd.Uint32x4
   136  }
   137  
   138  func Uint32sFromArch[T archSimdUint32s](x T) Uint32s {
   139  	switch a := any(x).(type) {
   140  	// The return expression is written this way because the code will be rewritten
   141  	// with Uint32s replaced by one of the arch types, and without the any-assert
   142  	// hack the rewritten code would not pass type checking.
   143  	// The backend of the compiler will eat this and turn it into no code at all,
   144  	// assuming it inlines.
   145  	case archsimd.Uint32x4:
   146  		var t bridge.Uint32x4 = bridge.Uint32x4(a)
   147  		return (any(t)).(Uint32s)
   148  	}
   149  	panic("wrong type")
   150  }
   151  
   152  func (x Uint64s) ToArch() any
   153  
   154  type archSimdUint64s interface {
   155  	archsimd.Uint64x2
   156  }
   157  
   158  func Uint64sFromArch[T archSimdUint64s](x T) Uint64s {
   159  	switch a := any(x).(type) {
   160  	// The return expression is written this way because the code will be rewritten
   161  	// with Uint64s replaced by one of the arch types, and without the any-assert
   162  	// hack the rewritten code would not pass type checking.
   163  	// The backend of the compiler will eat this and turn it into no code at all,
   164  	// assuming it inlines.
   165  	case archsimd.Uint64x2:
   166  		var t bridge.Uint64x2 = bridge.Uint64x2(a)
   167  		return (any(t)).(Uint64s)
   168  	}
   169  	panic("wrong type")
   170  }
   171  
   172  func (x Float32s) ToArch() any
   173  
   174  type archSimdFloat32s interface {
   175  	archsimd.Float32x4
   176  }
   177  
   178  func Float32sFromArch[T archSimdFloat32s](x T) Float32s {
   179  	switch a := any(x).(type) {
   180  	// The return expression is written this way because the code will be rewritten
   181  	// with Float32s replaced by one of the arch types, and without the any-assert
   182  	// hack the rewritten code would not pass type checking.
   183  	// The backend of the compiler will eat this and turn it into no code at all,
   184  	// assuming it inlines.
   185  	case archsimd.Float32x4:
   186  		var t bridge.Float32x4 = bridge.Float32x4(a)
   187  		return (any(t)).(Float32s)
   188  	}
   189  	panic("wrong type")
   190  }
   191  
   192  func (x Float64s) ToArch() any
   193  
   194  type archSimdFloat64s interface {
   195  	archsimd.Float64x2
   196  }
   197  
   198  func Float64sFromArch[T archSimdFloat64s](x T) Float64s {
   199  	switch a := any(x).(type) {
   200  	// The return expression is written this way because the code will be rewritten
   201  	// with Float64s replaced by one of the arch types, and without the any-assert
   202  	// hack the rewritten code would not pass type checking.
   203  	// The backend of the compiler will eat this and turn it into no code at all,
   204  	// assuming it inlines.
   205  	case archsimd.Float64x2:
   206  		var t bridge.Float64x2 = bridge.Float64x2(a)
   207  		return (any(t)).(Float64s)
   208  	}
   209  	panic("wrong type")
   210  }
   211  
   212  func (x Mask8s) ToArch() any
   213  
   214  type archSimdMask8s interface {
   215  	archsimd.Mask8x16
   216  }
   217  
   218  func Mask8sFromArch[T archSimdMask8s](x T) Mask8s {
   219  	switch a := any(x).(type) {
   220  	// The return expression is written this way because the code will be rewritten
   221  	// with Mask8s replaced by one of the arch types, and without the any-assert
   222  	// hack the rewritten code would not pass type checking.
   223  	// The backend of the compiler will eat this and turn it into no code at all,
   224  	// assuming it inlines.
   225  	case archsimd.Mask8x16:
   226  		var t bridge.Mask8x16 = bridge.Mask8x16(a)
   227  		return (any(t)).(Mask8s)
   228  	}
   229  	panic("wrong type")
   230  }
   231  
   232  func (x Mask16s) ToArch() any
   233  
   234  type archSimdMask16s interface {
   235  	archsimd.Mask16x8
   236  }
   237  
   238  func Mask16sFromArch[T archSimdMask16s](x T) Mask16s {
   239  	switch a := any(x).(type) {
   240  	// The return expression is written this way because the code will be rewritten
   241  	// with Mask16s replaced by one of the arch types, and without the any-assert
   242  	// hack the rewritten code would not pass type checking.
   243  	// The backend of the compiler will eat this and turn it into no code at all,
   244  	// assuming it inlines.
   245  	case archsimd.Mask16x8:
   246  		var t bridge.Mask16x8 = bridge.Mask16x8(a)
   247  		return (any(t)).(Mask16s)
   248  	}
   249  	panic("wrong type")
   250  }
   251  
   252  func (x Mask32s) ToArch() any
   253  
   254  type archSimdMask32s interface {
   255  	archsimd.Mask32x4
   256  }
   257  
   258  func Mask32sFromArch[T archSimdMask32s](x T) Mask32s {
   259  	switch a := any(x).(type) {
   260  	// The return expression is written this way because the code will be rewritten
   261  	// with Mask32s replaced by one of the arch types, and without the any-assert
   262  	// hack the rewritten code would not pass type checking.
   263  	// The backend of the compiler will eat this and turn it into no code at all,
   264  	// assuming it inlines.
   265  	case archsimd.Mask32x4:
   266  		var t bridge.Mask32x4 = bridge.Mask32x4(a)
   267  		return (any(t)).(Mask32s)
   268  	}
   269  	panic("wrong type")
   270  }
   271  
   272  func (x Mask64s) ToArch() any
   273  
   274  type archSimdMask64s interface {
   275  	archsimd.Mask64x2
   276  }
   277  
   278  func Mask64sFromArch[T archSimdMask64s](x T) Mask64s {
   279  	switch a := any(x).(type) {
   280  	// The return expression is written this way because the code will be rewritten
   281  	// with Mask64s 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.Mask64x2:
   286  		var t bridge.Mask64x2 = bridge.Mask64x2(a)
   287  		return (any(t)).(Mask64s)
   288  	}
   289  	panic("wrong type")
   290  }
   291  

View as plain text