Skip to content

Commit eea0a28

Browse files
committed
[windows] Always pass libcall fp128 arguments indirectly
LLVM expects `__float128` to be both passed and returned in xmm registers on Windows. However, this disagrees with the Windowx x86-64 calling convention [1], which indicates values larger than 64 bits should be passed indirectly. Update LLVM's libcall calling convention to pass `fp128` directly. Returning in xmm0 is unchanged since this seems like a reasonable extrapolation of the ABI. With this change, the calling convention for `i128` and `f128` becomes the same. This corresponds to the frontend change in [2]. [1]: https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170 [2]: #115052
1 parent a804c44 commit eea0a28

File tree

5 files changed

+497
-172
lines changed

5 files changed

+497
-172
lines changed

llvm/lib/Target/X86/X86CallingConv.td

+2-1
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,9 @@ def CC_X86_Win64_C : CallingConv<[
639639
// 512 bit vectors are passed by pointer
640640
CCIfType<[v64i8, v32i16, v16i32, v32f16, v32bf16, v16f32, v8f64, v8i64], CCPassIndirect<i64>>,
641641

642-
// Long doubles are passed by pointer
642+
// Float types larger than 64-bits (long double and fp128) are passed by pointer
643643
CCIfType<[f80], CCPassIndirect<i64>>,
644+
CCIfType<[f128], CCPassIndirect<i64>>,
644645

645646
// If SSE was disabled, pass FP values smaller than 64-bits as integers in
646647
// GPRs or on the stack.

0 commit comments

Comments
 (0)