Skip to content

Commit 09cd45d

Browse files
committed
Remove a small helper function that took a Builtin.VecNxInt1 type.
It saved some boilerplate, but if it doesn't get inline (as in debug builds), Swift doesn't know how to legalize the type at the call boundary, and we crash.
1 parent 5afe404 commit 09cd45d

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

stdlib/public/core/SIMDConcreteOperations.swift.gyb

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ vectorscalarCounts = storagescalarCounts + [3]
2525
% storageN = 4 if n == 3 else n
2626
% s = "s" if int.is_signed else "u"
2727
% Builtin = "Vec" + str(storageN) + "xInt" + str(int.bits)
28+
% MaskExt = "Builtin.sext_Vec" + str(storageN) + "xInt1_" + Builtin
2829
% if int.is_signed:
2930
extension SIMDMask where Storage == ${Vector} {
3031
@_alwaysEmitIntoClient
31-
internal init(_ _builtin: Builtin.Vec${storageN}xInt1) {
32-
_storage = ${Vector}(Builtin.sext_Vec${storageN}xInt1_${Builtin}(_builtin))
32+
internal init(_ _builtin: Builtin.${Builtin}) {
33+
_storage = ${Vector}(_builtin)
3334
}
3435

3536
@_alwaysEmitIntoClient
@@ -216,49 +217,49 @@ extension SIMD${n} where Scalar == ${Scalar} {
216217
/// A vector mask with the result of a pointwise equality comparison.
217218
@_alwaysEmitIntoClient
218219
public static func .==(a: Self, b: Self) -> SIMDMask<MaskStorage> {
219-
SIMDMask<MaskStorage>(
220+
SIMDMask<MaskStorage>(${MaskExt}(
220221
Builtin.cmp_eq_${Builtin}(a._storage._value, b._storage._value)
221-
)
222+
))
222223
}
223224

224225
/// A vector mask with the result of a pointwise inequality comparison.
225226
@_alwaysEmitIntoClient
226227
public static func .!=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
227-
SIMDMask<MaskStorage>(
228+
SIMDMask<MaskStorage>(${MaskExt}(
228229
Builtin.cmp_ne_${Builtin}(a._storage._value, b._storage._value)
229-
)
230+
))
230231
}
231232

232233
/// A vector mask with the result of a pointwise less-than comparison.
233234
@_alwaysEmitIntoClient
234235
public static func .<(a: Self, b: Self) -> SIMDMask<MaskStorage> {
235-
SIMDMask<MaskStorage>(
236+
SIMDMask<MaskStorage>(${MaskExt}(
236237
Builtin.cmp_${s}lt_${Builtin}(a._storage._value, b._storage._value)
237-
)
238+
))
238239
}
239240

240241
/// A vector mask with the result of a pointwise less-than-or-equal-to comparison.
241242
@_alwaysEmitIntoClient
242243
public static func .<=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
243-
SIMDMask<MaskStorage>(
244+
SIMDMask<MaskStorage>(${MaskExt}(
244245
Builtin.cmp_${s}le_${Builtin}(a._storage._value, b._storage._value)
245-
)
246+
))
246247
}
247248

248249
/// A vector mask with the result of a pointwise greater-than comparison.
249250
@_alwaysEmitIntoClient
250251
public static func .>(a: Self, b: Self) -> SIMDMask<MaskStorage> {
251-
SIMDMask<MaskStorage>(
252+
SIMDMask<MaskStorage>(${MaskExt}(
252253
Builtin.cmp_${s}gt_${Builtin}(a._storage._value, b._storage._value)
253-
)
254+
))
254255
}
255256

256257
/// A vector mask with the result of a pointwise greater-than-or-equal-to comparison.
257258
@_alwaysEmitIntoClient
258259
public static func .>=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
259-
SIMDMask<MaskStorage>(
260+
SIMDMask<MaskStorage>(${MaskExt}(
260261
Builtin.cmp_${s}ge_${Builtin}(a._storage._value, b._storage._value)
261-
)
262+
))
262263
}
263264

264265
/// The wrapping sum of two vectors.
@@ -303,6 +304,8 @@ extension SIMD${n} where Scalar == ${Scalar} {
303304
% Vector = "SIMD" + str(n) + "<" + Scalar + ">"
304305
% storageN = 4 if n == 3 else n
305306
% Builtin = "Vec" + str(storageN) + "xFPIEEE" + str(bits)
307+
% VecPre = "Vec" + str(storageN) + "x"
308+
% MaskExt = "Builtin.sext_" + VecPre + "Int1_" + VecPre + "Int" + str(bits)
306309
% if bits == 16:
307310
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
308311
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
@@ -316,49 +319,49 @@ extension SIMD${n} where Scalar == ${Scalar} {
316319
/// A vector mask with the result of a pointwise equality comparison.
317320
@_alwaysEmitIntoClient
318321
public static func .==(a: Self, b: Self) -> SIMDMask<MaskStorage> {
319-
SIMDMask<MaskStorage>(
322+
SIMDMask<MaskStorage>(${MaskExt}(
320323
Builtin.fcmp_oeq_${Builtin}(a._storage._value, b._storage._value)
321-
)
324+
))
322325
}
323326

324327
/// A vector mask with the result of a pointwise inequality comparison.
325328
@_alwaysEmitIntoClient
326329
public static func .!=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
327-
SIMDMask<MaskStorage>(
330+
SIMDMask<MaskStorage>(${MaskExt}(
328331
Builtin.fcmp_une_${Builtin}(a._storage._value, b._storage._value)
329-
)
332+
))
330333
}
331334

332335
/// A vector mask with the result of a pointwise less-than comparison.
333336
@_alwaysEmitIntoClient
334337
public static func .<(a: Self, b: Self) -> SIMDMask<MaskStorage> {
335-
SIMDMask<MaskStorage>(
338+
SIMDMask<MaskStorage>(${MaskExt}(
336339
Builtin.fcmp_olt_${Builtin}(a._storage._value, b._storage._value)
337-
)
340+
))
338341
}
339342

340343
/// A vector mask with the result of a pointwise less-than-or-equal-to comparison.
341344
@_alwaysEmitIntoClient
342345
public static func .<=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
343-
SIMDMask<MaskStorage>(
346+
SIMDMask<MaskStorage>(${MaskExt}(
344347
Builtin.fcmp_ole_${Builtin}(a._storage._value, b._storage._value)
345-
)
348+
))
346349
}
347350

348351
/// A vector mask with the result of a pointwise greater-than comparison.
349352
@_alwaysEmitIntoClient
350353
public static func .>(a: Self, b: Self) -> SIMDMask<MaskStorage> {
351-
SIMDMask<MaskStorage>(
354+
SIMDMask<MaskStorage>(${MaskExt}(
352355
Builtin.fcmp_ogt_${Builtin}(a._storage._value, b._storage._value)
353-
)
356+
))
354357
}
355358

356359
/// A vector mask with the result of a pointwise greater-than-or-equal-to comparison.
357360
@_alwaysEmitIntoClient
358361
public static func .>=(a: Self, b: Self) -> SIMDMask<MaskStorage> {
359-
SIMDMask<MaskStorage>(
362+
SIMDMask<MaskStorage>(${MaskExt}(
360363
Builtin.fcmp_oge_${Builtin}(a._storage._value, b._storage._value)
361-
)
364+
))
362365
}
363366
}
364367
% if bits == 16:

0 commit comments

Comments
 (0)