Fix i386 Win64 ABI compliance for __int128 return values.
i386 backend now correctly handles __int128 return values on Windows x64 according to the MS ABI.
GCC’s i386 backend has been corrected to comply with the Windows x64 ABI regarding the return of __int128 types. Previously, the compiler incorrectly returned 128-bit integer types in SSE registers (%xmm0), deviating from the ABI’s requirement to use indirect memory returns for such types. This patch ensures that __int128 values are treated as indirect returns, with the caller providing a memory slot passed as the first argument and a pointer returned in RAX.
In Details
The i386 Windows x64 target behavior for __int128 return values has been fixed to adhere to the MS x64 ABI. The function_value_ms_64 and ix86_return_in_memory functions were updated to prevent 16-byte integral types from being classified as SSE returns. Instead, they are now correctly handled as indirect memory returns, aligning the compiler's code generation with the platform's calling convention for large integer types.
- i386
- Refers to the x86 instruction set architecture, typically 32-bit, but in this context denotes the target architecture for GCC's code generation, including its 64-bit extension (x86-64).
- Win64
- Microsoft's 64-bit version of the Windows operating system and its associated ABI (Application Binary Interface).
- MS x64 ABI
- The Application Binary Interface specification used by Microsoft's compilers for the 64-bit x86 architecture. It defines how functions are called, how arguments are passed, and how return values are handled.
- __int128
- A GCC extension data type representing a 128-bit integer. It is not part of the standard C++ language but is supported by GCC for handling large integer arithmetic.
- SSE registers
- Streaming SIMD Extensions registers (e.g., %xmm0) used for Single Instruction, Multiple Data (SIMD) operations and, on x86-64, also for floating-point and 128-bit integer return values according to specific ABIs.