mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 09:31:03 +03:00

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/.
19 lines
437 B
D
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
|
|
}
|