Skip to content

Commit 5bf901d

Browse files
authored
Merge pull request #42326 from WANGJIEKE/simd-vector-cxx-interop-test
[cxx-interop] Add "pass through" tests for simd vector types
2 parents 1a600f4 + 81731a1 commit 5bf901d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
3+
// RUN: %FileCheck %s < %t/functions.h
4+
5+
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h)
6+
7+
// CHECK: inline swift_double2 passThroughdouble2(swift_double2 x) noexcept SWIFT_WARN_UNUSED_RESULT {
8+
// CHECK-NEXT: return _impl::$s9Functions18passThroughdouble2y4simd7double2VAEF(x);
9+
// CHECK-NEXT: }
10+
11+
// CHECK: inline swift_float3 passThroughfloat3(swift_float3 x) noexcept SWIFT_WARN_UNUSED_RESULT {
12+
// CHECK-NEXT: return _impl::$s9Functions17passThroughfloat3y4simd6float3VAEF(x);
13+
// CHECK-NEXT: }
14+
15+
// CHECK: inline swift_float4 passThroughfloat4(swift_float4 x) noexcept SWIFT_WARN_UNUSED_RESULT {
16+
// CHECK-NEXT: return _impl::$s9Functions17passThroughfloat4y4simd6float4VAEF(x);
17+
// CHECK-NEXT: }
18+
19+
// CHECK: inline swift_int3 passThroughint3(swift_int3 x) noexcept SWIFT_WARN_UNUSED_RESULT {
20+
// CHECK-NEXT: return _impl::$s9Functions15passThroughint3y4simd4int3VAEF(x);
21+
// CHECK-NEXT: }
22+
23+
// CHECK: inline swift_uint4 passThroughuint4(swift_uint4 x) noexcept SWIFT_WARN_UNUSED_RESULT {
24+
// CHECK-NEXT: return _impl::$s9Functions16passThroughuint4y4simd5uint4VAEF(x);
25+
// CHECK-NEXT: }
26+
27+
import simd
28+
29+
public func passThroughfloat3(_ x: float3) -> float3 { return x }
30+
public func passThroughfloat4(_ x: float4) -> float4 { return x }
31+
public func passThroughdouble2(_ x: double2) -> double2 { return x }
32+
public func passThroughint3(_ x: int3) -> int3 { return x }
33+
public func passThroughuint4(_ x: uint4) -> uint4 { return x }

0 commit comments

Comments
 (0)