Skip to content

Commit 81e8e0c

Browse files
committed
more operators.
1 parent 4e85956 commit 81e8e0c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

stdlib/public/core/SIMDConcreteOperations.swift.gyb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,24 @@ extension SIMD${n} where Scalar == ${Scalar} {
126126
Builtin.cmp_${s}ge_${Builtin}(a._storage._value, b._storage._value)
127127
)
128128
}
129+
130+
/// The wrapping sum of two vectors.
131+
@_alwaysEmitIntoClient
132+
public static func &+(a: Self, b: Self) -> Self{
133+
Self(Builtin.add_${Builtin}(a._storage._value, b._storage._value))
134+
}
135+
136+
/// The wrapping difference of two vectors.
137+
@_alwaysEmitIntoClient
138+
public static func &-(a: Self, b: Self) -> Self{
139+
Self(Builtin.sub_${Builtin}(a._storage._value, b._storage._value))
140+
}
141+
142+
/// The pointwise wrapping product of two vectors.
143+
@_alwaysEmitIntoClient
144+
public static func &*(a: Self, b: Self) -> Self{
145+
Self(Builtin.mul_${Builtin}(a._storage._value, b._storage._value))
146+
}
129147
}
130148

131149
% end
@@ -193,6 +211,30 @@ extension SIMD${n} where Scalar == ${Scalar} {
193211
Builtin.fcmp_oge_${Builtin}(a._storage._value, b._storage._value)
194212
)
195213
}
214+
215+
/// The sum of two vectors.
216+
@_alwaysEmitIntoClient
217+
public static func +(a: Self, b: Self) -> Self{
218+
Self(Builtin.fadd_${Builtin}(a._storage._value, b._storage._value))
219+
}
220+
221+
/// The difference of two vectors.
222+
@_alwaysEmitIntoClient
223+
public static func -(a: Self, b: Self) -> Self{
224+
Self(Builtin.fsub_${Builtin}(a._storage._value, b._storage._value))
225+
}
226+
227+
/// The pointwise product of two vectors.
228+
@_alwaysEmitIntoClient
229+
public static func *(a: Self, b: Self) -> Self{
230+
Self(Builtin.fmul_${Builtin}(a._storage._value, b._storage._value))
231+
}
232+
233+
/// The pointwise quotient of two vectors.
234+
@_alwaysEmitIntoClient
235+
public static func /(a: Self, b: Self) -> Self{
236+
Self(Builtin.fdiv_${Builtin}(a._storage._value, b._storage._value))
237+
}
196238
}
197239
% if bits == 16:
198240
#endif

0 commit comments

Comments
 (0)