diff --git a/cranelift/codegen/src/isa/x64/abi.rs b/cranelift/codegen/src/isa/x64/abi.rs index 7f657bc16ba3..baaa373bcbb8 100644 --- a/cranelift/codegen/src/isa/x64/abi.rs +++ b/cranelift/codegen/src/isa/x64/abi.rs @@ -211,10 +211,10 @@ impl ABIMachineSpec for X64ABIMachineSpec { ); } - // Windows fastcall dictates that `__m128i` parameters to a function - // are passed indirectly as pointers, so handle that as a special - // case before the loop below. - if param.value_type.is_vector() + // Windows fastcall dictates that `__m128i` and `f128` parameters to + // a function are passed indirectly as pointers, so handle that as a + // special case before the loop below. + if (param.value_type.is_vector() || param.value_type.is_float()) && param.value_type.bits() >= 128 && args_or_rets == ArgsOrRets::Args && is_fastcall @@ -504,9 +504,9 @@ impl ABIMachineSpec for X64ABIMachineSpec { } fn gen_load_base_offset(into_reg: Writable, base: Reg, offset: i32, ty: Type) -> Self::I { - // Only ever used for I64s and vectors; if that changes, see if the - // ExtKind below needs to be changed. - assert!(ty == I64 || ty.is_vector()); + // Only ever used for I64s, F128s and vectors; if that changes, see if + // the ExtKind below needs to be changed. + assert!(ty == I64 || ty.is_vector() || ty == F128); let mem = Amode::imm_reg(offset, base); Inst::load(ty, mem, into_reg, ExtKind::None) } diff --git a/cranelift/filetests/filetests/isa/x64/call-conv.clif b/cranelift/filetests/filetests/isa/x64/call-conv.clif index 6b9deb3a5be1..aa001793ac2c 100644 --- a/cranelift/filetests/filetests/isa/x64/call-conv.clif +++ b/cranelift/filetests/filetests/isa/x64/call-conv.clif @@ -658,7 +658,7 @@ block0(v0: f128, v1: f128): ; pushq %rbp ; movq %rsp, %rbp ; block0: -; movdqa %xmm1, %xmm0 +; movdqu 0(%rdx), %xmm0 ; movq %rbp, %rsp ; popq %rbp ; ret @@ -668,7 +668,8 @@ block0(v0: f128, v1: f128): ; pushq %rbp ; movq %rsp, %rbp ; block1: ; offset 0x4 -; movdqa %xmm1, %xmm0 +; movdqu (%rdx), %xmm0 ; movq %rbp, %rsp ; popq %rbp ; retq +