Skip to content

Commit 41e87be

Browse files
authored
Update F128 argument ABI for windows_fastcall to match LLVM 21 (#10678)
1 parent ce3c1a7 commit 41e87be

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

cranelift/codegen/src/isa/x64/abi.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ impl ABIMachineSpec for X64ABIMachineSpec {
211211
);
212212
}
213213

214-
// Windows fastcall dictates that `__m128i` parameters to a function
215-
// are passed indirectly as pointers, so handle that as a special
216-
// case before the loop below.
217-
if param.value_type.is_vector()
214+
// Windows fastcall dictates that `__m128i` and `f128` parameters to
215+
// a function are passed indirectly as pointers, so handle that as a
216+
// special case before the loop below.
217+
if (param.value_type.is_vector() || param.value_type.is_float())
218218
&& param.value_type.bits() >= 128
219219
&& args_or_rets == ArgsOrRets::Args
220220
&& is_fastcall
@@ -504,9 +504,9 @@ impl ABIMachineSpec for X64ABIMachineSpec {
504504
}
505505

506506
fn gen_load_base_offset(into_reg: Writable<Reg>, base: Reg, offset: i32, ty: Type) -> Self::I {
507-
// Only ever used for I64s and vectors; if that changes, see if the
508-
// ExtKind below needs to be changed.
509-
assert!(ty == I64 || ty.is_vector());
507+
// Only ever used for I64s, F128s and vectors; if that changes, see if
508+
// the ExtKind below needs to be changed.
509+
assert!(ty == I64 || ty.is_vector() || ty == F128);
510510
let mem = Amode::imm_reg(offset, base);
511511
Inst::load(ty, mem, into_reg, ExtKind::None)
512512
}

cranelift/filetests/filetests/isa/x64/call-conv.clif

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ block0(v0: f128, v1: f128):
658658
; pushq %rbp
659659
; movq %rsp, %rbp
660660
; block0:
661-
; movdqa %xmm1, %xmm0
661+
; movdqu 0(%rdx), %xmm0
662662
; movq %rbp, %rsp
663663
; popq %rbp
664664
; ret
@@ -668,7 +668,8 @@ block0(v0: f128, v1: f128):
668668
; pushq %rbp
669669
; movq %rsp, %rbp
670670
; block1: ; offset 0x4
671-
; movdqa %xmm1, %xmm0
671+
; movdqu (%rdx), %xmm0
672672
; movq %rbp, %rsp
673673
; popq %rbp
674674
; retq
675+

0 commit comments

Comments
 (0)