Skip to content

[cxx-interop] Support SIMD types in reverse interop #83586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Xazax-hun
Copy link
Contributor

@Xazax-hun Xazax-hun commented Aug 7, 2025

This supports both built-in vector types and the SIMDX Swift types
that are used through type aliases like float3. These SIMD types are
passed via compatibility structs (with their valued memcpy-d into the
ABI compatible struct) as they have special ABI rules. E.g., a float3 is
not passed as float3, but as float4 on the ABI level.

Previously, we did not expose simd types from Swift to C++ (unless the
SIMD types were impoted from clang).

rdar://153218744

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Aug 7, 2025
@Xazax-hun Xazax-hun force-pushed the reverse-interop-better-simd branch from 59ebd61 to 5b0a382 Compare August 8, 2025 10:46
@Xazax-hun Xazax-hun changed the title [cxx-interop] Better support SIMD types [cxx-interop] Support SIMD types in reverse interop Aug 8, 2025
@Xazax-hun Xazax-hun marked this pull request as ready for review August 8, 2025 10:47
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

This supports both built-in vector types and the SIMDX<T> Swift types
that are used through type aliases like float3. These SIMD types are
passed via compatibility structs (with their valued memcpy-d into the
ABI compatible struct) as they have special ABI rules. E.g., a float3 is
not passed as float3, but as float4 on the ABI level.

Previously, we did not expose simd types from Swift to C++ (unless the
SIMD types were impoted from clang).

rdar://153218744
@Xazax-hun Xazax-hun force-pushed the reverse-interop-better-simd branch from 5b0a382 to 39d90cc Compare August 8, 2025 14:53
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants