ldc/tests/codegen/hashed_mangling.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

49 lines
1.6 KiB
D

// Test hashing of symbols above hash threshold
// RUN: %ldc -hash-threshold=90 -g -c -output-ll -of=%t90.ll %s && FileCheck %s --check-prefix HASH90 < %t90.ll
// RUN: %ldc -hash-threshold=90 -run %s
// Don't use Phobos functions in this test, because the test hashthreshold is too low for an unhashed libphobos.
module one.two.three;
// HASH90-DAG: define{{.*}} @externCfunctions_are_not_hashed_externCfunctions_are_not_hashed_externCfunctions_are_not_hashed
extern (C) int externCfunctions_are_not_hashed_externCfunctions_are_not_hashed_externCfunctions_are_not_hashed()
{
return 95;
}
auto s(T)(T t)
{
// HASH90-DAG: define{{.*}} @{{(\"\\01_?)?}}_D3one3two5three__T1sTiZQfFNaNbNiNfiZSQBkQBjQBi__TQBfTiZQBlFiZ__T6ResultTiZQk
// HASH90-DAG: define{{.*}} @{{(\"\\01_?)?}}_D3one3two5three3L1633_182fab6f09ff014d9f4a578edf9609981sZ
// HASH90-DAG: define{{.*}} @{{(\"\\01_?)?}}_D3one3two5three3L2333_9b5306e5c42722cd2cb93ae6beb422346Result3fooZ
struct Result(T)
{
void foo(){}
}
return Result!int();
}
auto klass(T)(T t)
{
class Result(T)
{
// HASH90-DAG: define{{.*}} @{{(\"\\01_?)?}}_D3one3two5three__T5klassTiZQjFiZ__T6ResultTiZQk3fooMFZv
// HASH90-DAG: define{{.*}} @{{(\"\\01_?)?}}_D3one3two5three3L3433_de737f3d65ae58efa925cffda52cd8da6Result3fooZ
void foo(){}
}
return new Result!int();
}
void main()
{
assert(
externCfunctions_are_not_hashed_externCfunctions_are_not_hashed_externCfunctions_are_not_hashed() == 95);
auto x = 1.s.s.s.s;
x.foo;
auto y = 1.klass.klass.klass.klass;
y.foo;
}