libstdc++: Resolve integer type mismatches in stdx::simd [PR122981]
Fixes integer type mismatches in stdx::simd for ARM targets, improving type safety and compatibility.
This patch resolves integer type mismatches in stdx::simd that affected ARM targets, particularly arm-none-eabi. Due to int32_t being defined as long, generic int vectors passed as int32x2_t were causing compilation errors. The fix uses intN_t aliases consistently and ensures correct bitcasting in NEON popcount implementation, enhancing type safety and avoiding unnecessary reinterpretations.
In Details
The stdx::simd experimental header exhibits type mismatches on ARM targets where int32_t is a long alias. Generic vector types were being incorrectly handled when converted to ARM vector types. This commit adjusts __int_for_sizeof to return standard intN_t types and modifies the NEON popcount implementation to cast to the correct intN_t types, rather than relying on potentially mismatched aliases like int or long.
- stdx::simd
- An experimental C++ header in libstdc++ providing support for SIMD (Single Instruction, Multiple Data) operations, allowing for parallel computation on vector data types.
- ARM NEON
- ARM's Advanced SIMD extension, a set of instructions and data types designed for high-performance media and signal processing.
- bitcasting
- Reinterpreting the bits of one data type as another data type without changing the underlying bit pattern. This is common in low-level programming and SIMD operations.