fn my_shuffle[T: DType, width: Int, p: StaticIntTuple[width]](v: SIMD[T, width]) -> SIMD[T, width]:
@parameter
if width == 8:
return v.shuffle[
p[0],
p[1],
p[2],
p[3],
p[4],
p[5],
p[6],
p[7],
]()
elif width == 16:
return v.shuffle[
p[0],
...
p[15],
]()
elif width == 32:
return v.shuffle[
p[0],
...
p[31],
]()
elif width == 64:
return v.shuffle[
p[0],
...
p[63],
]()
elif width == 128:
return v.shuffle[
p[0],
...
p[127],
]()
elif width == 256:
return v.shuffle[
p[0],
...
p[255],
]()
else:
constrained[False]()
return v
fn my_shuffle[T: DType, width: Int, p: StaticIntTuple[width]](v: SIMD[T, width]) -> SIMD[T, width]:
@parameter
if width == 8:
return v.shuffle[
p[0],
p[1],
p[2],
p[3],
p[4],
p[5],
p[6],
p[7],
]()
elif width == 16:
return v.shuffle[
p[0],
...
p[15],
]()
elif width == 32:
return v.shuffle[
p[0],
...
p[31],
]()
elif width == 64:
return v.shuffle[
p[0],
...
p[63],
]()
elif width == 128:
return v.shuffle[
p[0],
...
p[127],
]()
elif width == 256:
return v.shuffle[
p[0],
...
p[255],
]()
else:
constrained[False]()
return v