mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
It turns out that on some targets we generate a call to initialize a SIMD vector from a Builtin.Vec, even though everything is transparent, so the checks for the return using a specific value were too fragile. rdar://153260158
34 lines
1.3 KiB
Swift
34 lines
1.3 KiB
Swift
//===--- SIMDMaskInitializers.swift.gyb -------------------*- swift -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2025 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %gyb %s -o %t/SIMDMaskInitializers.swift
|
|
// RUN: %target-swift-frontend -primary-file %t/SIMDMaskInitializers.swift -emit-ir | %FileCheck %t/SIMDMaskInitializers.swift --check-prefix=CHECK --check-prefix=CHECK-%target-cpu
|
|
|
|
import Swift
|
|
|
|
%for bits in [8,16,32,64]:
|
|
% for totalBits in [64,128]:
|
|
% n = totalBits // bits
|
|
% if n != 1:
|
|
% neonSuffix = str(n) + {8:'b',16:'h',32:'s',64:'d'}[bits]
|
|
func repeating${n}_mask${bits}(_ scalar: Bool) -> SIMDMask<SIMD${n}<Int${bits}>> {
|
|
SIMDMask(repeating: scalar)
|
|
}
|
|
// CHECK: repeating${n}_mask${bits}{{.*}} {
|
|
// CHECK: entry:
|
|
// CHECK: [[TMP:%[0-9]+]] = insertelement <${n} x i${bits}> {{.*}}, i${bits} %{{.*}}, i32 0
|
|
// CHECK-NEXT: [[REP:%[0-9]+]] = shufflevector <${n} x i${bits}> [[TMP]], <${n} x i${bits}> {{.*}}, <${n} x i32> zeroinitializer
|
|
|
|
% end
|
|
% end
|
|
%end
|