module experimental.simd
¶
Source: stdlib/experimental/simd.codon
Vec[T,N]
@tuple Class is named tuple (cannot write fields) ¶
Fields¶
ZERO_16x8i
¶
FF_16x8i
¶
ZERO_32x8i
¶
FF_32x8i
¶
ZERO_4x64f
¶
T
: type
¶
N
: Literal[int]
¶
Magic methods¶
__new__(x, T: type, N: Literal[int])
¶
__new__(x: str, offset: int = 0)
¶
__new__(x: List[T], offset: int = 0)
¶
__new__(x)
¶
__eq__(self: Vec[u8, float32], other: Vec[u8, float32])
¶
__eq__(self: Vec[u8, Tuple], other: Vec[u8, Tuple])
¶
__ne__(self: Vec[u8, float32], other: Vec[u8, float32])
¶
__ne__(self: Vec[u8, Tuple], other: Vec[u8, Tuple])
¶
__eq__(self: Vec[u8, float32], other: bool)
¶
__eq__(self: Vec[u8, Tuple], other: bool)
¶
__and__(self: Vec[u8, float32], other: Vec[u8, float32])
¶
__and__(self: Vec[u8, Tuple], other: Vec[u8, Tuple])
¶
__and__(self: Vec[u64, ?], other: Vec[u64, ?])
¶
__and__(self: Vec[f32, unrealized_type], other: Vec[f32, unrealized_type])
¶
__and__(self: Vec[f32, float32], other: Vec[f32, float32])
¶
__or__(self: Vec[u8, float32], other: Vec[u8, float32])
¶
__or__(self: Vec[u8, Tuple], other: Vec[u8, Tuple])
¶
__or__(self: Vec[f32, unrealized_type], other: Vec[f32, unrealized_type])
¶
__or__(self: Vec[f32, float32], other: Vec[f32, float32])
¶
__rshift__(self: Vec[u8, float32], shift: Literal[int])
¶
__rshift__(self: Vec[u8, Tuple], shift: Literal[int])
¶
__repr__(self)
¶
__and__(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = and <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
__and__(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = and <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
__or__(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = or <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
__or__(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = or <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
__xor__(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = xor <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
__xor__(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = xor <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
__lshift__(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = shl <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
__lshift__(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = shl <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
__rshift__(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = lshr <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
__rshift__(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = lshr <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
__ge__(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = icmp uge <{=N} x i64> %self, %other
ret <{=N} x i1> %0
__ge__(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%1 = shufflevector <{=N} x i64> %0, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%2 = icmp uge <{=N} x i64> %self, %1
ret <{=N} x i1> %2
__ge__(self: Vec[f64, N], other: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = fcmp oge <{=N} x double> %self, %other
ret <{=N} x i1> %0
__ge__(self: Vec[f64, N], other: f64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x double> undef, double %other, i32 0
%1 = shufflevector <{=N} x double> %0, <{=N} x double> undef, <{=N} x i32> zeroinitializer
%2 = fcmp oge <{=N} x double> %self, %1
ret <{=N} x i1> %2
__le__(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = icmp ule <{=N} x i64> %self, %other
ret <{=N} x i1> %0
__le__(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%1 = shufflevector <{=N} x i64> %0, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%2 = icmp ule <{=N} x i64> %self, %1
ret <{=N} x i1> %2
__neg__(self: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = sub <{=N} x {=T}> zeroinitializer, %self
ret <{=N} x {=T}> %0
__mod__(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = urem <{=N} x i64> %self, %other
ret <{=N} x i64> %0
__mod__(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%1 = shufflevector <{=N} x i64> %0, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%2 = urem <{=N} x i64> %self, %1
ret <{=N} x i64> %2
__add__(self: Vec[T, N], other)
¶
__sub__(self: Vec[T, N], other)
¶
__mul__(self: Vec[T, N], other)
¶
__truediv__(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = uitofp <{=N} x i64> %self to <{=N} x double>
%1 = uitofp <{=N} x i64> %other to <{=N} x double>
%2 = fdiv <{=N} x double> %0, %1
ret <{=N} x double> %2
__truediv__(self: Vec[u64, ?], other: Vec[u64, ?])
@llvm Function is implemented with inline LLVM IR ¶
%0 = uitofp <4 x i64> %self to <4 x double>
%1 = uitofp <4 x i64> %other to <4 x double>
%2 = fdiv <4 x double> %0, %1
ret <4 x double> %2
__truediv__(self: Vec[u64, unrealized_type], other: Vec[u64, unrealized_type])
@llvm Function is implemented with inline LLVM IR ¶
%0 = uitofp <8 x i64> %self to <8 x double>
%1 = uitofp <8 x i64> %other to <8 x double>
%2 = fdiv <8 x double> %0, %1
ret <8 x double> %2
__truediv__(self: Vec[u64, unrealized_type], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = uitofp <8 x i64> %self to <8 x double>
%1 = uitofp i64 %other to double
%2 = insertelement <8 x double> undef, double %1, i32 0
%3 = shufflevector <8 x double> %0, <8 x double> undef, <8 x i32> zeroinitializer
%4 = fdiv <8 x double> %0, %3
ret <8 x double> %4
__getitem__(self: Vec[T, N], idx)
@llvm Function is implemented with inline LLVM IR ¶
%0 = extractelement <{=N} x {=T}> %self, i64 %idx
ret {=T} %0
Methods¶
sum(self: Vec[f32, unrealized_type], x: f32 = f32(0.0))
¶
generic_init(val: T, SLS: Literal[int])
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=SLS} x {=T}> undef, {=T} %val, i32 0
%1 = shufflevector <{=SLS} x {=T}> %0, <{=SLS} x {=T}> undef, <{=SLS} x i32> zeroinitializer
ret <{=SLS} x {=T}> %1
generic_load(data: Ptr[T], SLS: Literal[int])
@llvm Function is implemented with inline LLVM IR ¶
%0 = bitcast T* %data to <{=SLS} x {=T}>*
%1 = load <{=SLS} x {=T}>, <{=SLS} x {=T}>* %0
ret <{=SLS} x {=T}> %1
bit_flip(self: Vec[u1, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i1> undef, i1 1, i32 0
%1 = shufflevector <{=N} x i1> %0, <{=N} x i1> undef, <{=N} x i32> zeroinitializer
%2 = xor <{=N} x i1> %self, %1
ret <{=N} x i1> %2
shift_half(self: Vec[u128, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i128> undef, i128 64, i32 0
%1 = shufflevector <{=N} x i128> %0, <{=N} x i128> undef, <{=N} x i32> zeroinitializer
%2 = lshr <{=N} x i128> %self, %1
ret <{=N} x i128> %2
add(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = add <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
add(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = add <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
fadd(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = fadd <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
fadd(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = fadd <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
sub(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = sub <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
sub(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = sub <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
fsub(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = fsub <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
fsub(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = fsub <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
mul(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = mul <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
fmul(self: Vec[T, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = fmul <{=N} x {=T}> %self, %other
ret <{=N} x {=T}> %0
mul(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = mul <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
fmul(self: Vec[T, N], other: T)
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = fmul <{=N} x {=T}> %self, %1
ret <{=N} x {=T}> %2
add_overflow(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare {<{=N} x i64>, <{=N} x i1>} @llvm.uadd.with.overflow.v{=N}i64(<{=N} x i64>, <{=N} x i64>)
%0 = call {<{=N} x i64>, <{=N} x i1>} @llvm.uadd.with.overflow.v{=N}i64(<{=N} x i64> %self, <{=N} x i64> %other)
ret {<{=N} x i64>, <{=N} x i1>} %0
add_overflow(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
declare {<{=N} x i64>, <{=N} x i1>} @llvm.uadd.with.overflow.v{=N}i64(<{=N} x i64>, <{=N} x i64>)
%0 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%1 = shufflevector <{=N} x i64> %0, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%2 = call {<{=N} x i64>, <{=N} x i1>} @llvm.uadd.with.overflow.v{=N}i64(<{=N} x i64> %self, <{=N} x i64> %1)
ret {<{=N} x i64>, <{=N} x i1>} %2
sub_overflow(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare {<{=N} x i64>, <{=N} x i1>} @llvm.usub.with.overflow.v{=N}i64(<{=N} x i64>, <{=N} x i64>)
%0 = call {<{=N} x i64>, <{=N} x i1>} @llvm.usub.with.overflow.v{=N}i64(<{=N} x i64> %self, <{=N} x i64> %other)
ret {<{=N} x i64>, <{=N} x i1>} %0
sub_overflow_commutative(self: Vec[u64, N], other: u64)
¶
sub_overflow(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
declare {<{=N} x i64>, <{=N} x i1>} @llvm.usub.with.overflow.v{=N}i64(<{=N} x i64>, <{=N} x i64>)
%0 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%1 = shufflevector <{=N} x i64> %0, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%2 = call {<{=N} x i64>, <{=N} x i1>} @llvm.usub.with.overflow.v{=N}i64(<{=N} x i64> %self, <{=N} x i64> %1)
ret {<{=N} x i64>, <{=N} x i1>} %2
zext_mul(self: Vec[u64, N], other: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = zext <{=N} x i64> %self to <{=N} x i128>
%1 = zext <{=N} x i64> %other to <{=N} x i128>
%2 = mul nuw <{=N} x i128> %0, %1
ret <{=N} x i128> %2
zext_mul(self: Vec[u64, N], other: u64)
@llvm Function is implemented with inline LLVM IR ¶
%0 = zext <{=N} x i64> %self to <{=N} x i128>
%1 = insertelement <{=N} x i64> undef, i64 %other, i32 0
%2 = shufflevector <{=N} x i64> %1, <{=N} x i64> undef, <{=N} x i32> zeroinitializer
%3 = zext <{=N} x i64> %2 to <{=N} x i128>
%4 = mul nuw <{=N} x i128> %0, %3
ret <{=N} x i128> %4
mulx(self: Vec[u64, N], other: Vec[u64, N], hi: Ptr[Vec[u64, N]])
@nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR ¶
%0 = zext <{=N} x i64> %self to <{=N} x i128>
%1 = zext <{=N} x i64> %other to <{=N} x i128>
%2 = mul nuw <{=N} x i128> %0, %1
%3 = lshr <{=N} x i128> %2, <i128 64, i128 64, i128 64, i128 64, i128 64, i128 64, i128 64, i128 64>
%4 = trunc <{=N} x i128> %3 to <{=N} x i64>
store <{=N} x i64> %4, <{=N} x i64>* %hi, align 8
%5 = trunc <{=N} x i128> %2 to <{=N} x i64>
ret <{=N} x i64> %5
mulhi(self: Vec[u64, N], other: Vec[u64, N])
¶
sqrt(self: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare <{=N} x double> @llvm.sqrt.v{=N}f64(<{=N} x double>)
%0 = call <{=N} x double> @llvm.sqrt.v{=N}f64(<{=N} x double> %self)
ret <{=N} x double> %0
log(self: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare <{=N} x double> @llvm.log.v{=N}f64(<{=N} x double>)
%0 = call <{=N} x double> @llvm.log.v{=N}f64(<{=N} x double> %self)
ret <{=N} x double> %0
cos(self: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare <{=N} x double> @llvm.cos.v{=N}f64(<{=N} x double>)
%0 = call <{=N} x double> @llvm.cos.v{=N}f64(<{=N} x double> %self)
ret <{=N} x double> %0
fabs(self: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
declare <{=N} x double> @llvm.fabs.v{=N}f64(<{=N} x double>)
%0 = call <{=N} x double> @llvm.fabs.v{=N}f64(<{=N} x double> %self)
ret <{=N} x double> %0
zext_double(self: Vec[u64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = zext <{=N} x i64> %self to <{=N} x i128>
ret <{=N} x i128> %0
trunc_half(self: Vec[u128, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = trunc <{=N} x i128> %self to <{=N} x i64>
ret <{=N} x i64> %0
shift_trunc_half(self: Vec[u128, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x i128> undef, i128 64, i32 0
%1 = shufflevector <{=N} x i128> %0, <{=N} x i128> undef, <{=N} x i32> zeroinitializer
%2 = lshr <{=N} x i128> %self, %1
%3 = trunc <{=N} x i128> %2 to <{=N} x i64>
ret <{=N} x i64> %3
to_u64(self: Vec[f64, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = fptoui <{=N} x double> %self to <{=N} x i64>
ret <{=N} x i64> %0
to_u64(self: Vec[u1, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = zext <{=N} x i1> %self to <{=N} x i64>
ret <{=N} x i64> %0
to_float(self: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = uitofp <{=N} x {=T}> %self to <{=N} x double>
ret <{=N} x double> %0
sub_if(self: Vec[T, N], other: Vec[T, N], mask: Vec[u1, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = sub <{=N} x {=T}> %self, %other
%1 = select <{=N} x i1> %mask, <{=N} x {=T}> %0, <{=N} x {=T}> %self
ret <{=N} x {=T}> %1
sub_if(self: Vec[T, N], other: T, mask: Vec[u1, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = insertelement <{=N} x {=T}> undef, {=T} %other, i32 0
%1 = shufflevector <{=N} x {=T}> %0, <{=N} x {=T}> undef, <{=N} x i32> zeroinitializer
%2 = sub <{=N} x {=T}> %self, %1
%3 = select <{=N} x i1> %mask, <{=N} x {=T}> %2, <{=N} x {=T}> %self
ret <{=N} x {=T}> %3
copy(self: Vec[T, N])
¶
mask(self: Vec[T, N], mask: Vec[u1, N], other: Vec[T, N])
@llvm Function is implemented with inline LLVM IR ¶
%0 = select <{=N} x i1> %mask, <{=N} x {=T}> %self, <{=N} x {=T}> %other
ret <{=N} x {=T}> %0
scatter(self: Vec[T, N])
¶
u8x16
= Vec[(u8, 16)]
¶
u8x32
= Vec[(u8, 32)]
¶
f32x8
= Vec[(f32, 8)]
¶
bitcast_scatter(ptr_in: Ptr[Vec[u64, N]], N: Literal[int])
@llvm Function is implemented with inline LLVM IR ¶
%0 = bitcast <{=N} x i64>* %ptr_in to i64*
ret i64* %0
bitcast_vectorize(ptr_in: Ptr[u64], N: Literal[int])
@llvm Function is implemented with inline LLVM IR ¶
%0 = bitcast i64* %ptr_in to <{=N} x i64>*
ret <{=N} x i64>* %0