ldc/tests/codegen/vector_abi_x86.d
Martin Kinkelin 7816e7730a
Win64: Use LLVM's vector calling convention for extern(D) (#2714)
I.e., pass and return vectors in registers. With the default C calling
convention (and the Win64 TargetABI not touching any vectors), vectors
are returned in XMM0, but inefficiently passed as ref to hidden copy
(automatically by LLVM).

Microsoft's vector calling convention, introduced opt-in with VS 2013,
additionally puts HFAs and HVAs (Homogeneous Float/Vector Aggregates)
into registers, see
https://blogs.msdn.microsoft.com/vcblog/2013/07/11/introducing-vector-calling-convention/.
2018-05-31 01:44:46 +02:00

19 lines
437 B
D

// Makes sure an optimized trivial function taking and returning a vector
// takes and returns it directly in XMM0, with no memory indirections.
// REQUIRES: host_X86
// RUN: %ldc -O -output-s -of=%t.s %s && FileCheck %s < %t.s
import core.simd;
// CHECK: _D14vector_abi_x863foo
int4 foo(int4 param)
{
// CHECK-NOT: mov
// CHECK: paddd
// CHECK-SAME: %xmm0
return param + 3;
// CHECK-NOT: mov
// CHECK: ret
}