ldc/tests/codegen/inlining_stdlib.d
Martin Kinkelin 0b255da8d7 Re-enable cross-module-inlining for pragma(inline, true)
At -O0 already, resolving #2552.
2019-03-06 23:05:52 +01:00

34 lines
1 KiB
D

// Test inlining of some standard library functions
// RUN: %ldc %s -c -output-ll -release -O0 -of=%t.O0.ll && FileCheck %s --check-prefix OPT0 < %t.O0.ll
// RUN: %ldc %s -c -output-ll -release -O3 -enable-cross-module-inlining -of=%t.O3.ll && FileCheck %s --check-prefix OPT3 < %t.O3.ll
extern (C): // simplify mangling for easier matching
// OPT0-LABEL: define{{.*}} @foo(
// OPT3-LABEL: define{{.*}} @foo(
int foo(size_t i)
{
// core.bitop.bsf() is force-inlined
import core.bitop;
// OPT0: call {{.*}} @llvm.cttz
// OPT3: call {{.*}} @llvm.cttz
return bsf(i);
// OPT0: ret
// OPT3: ret
}
// OPT0-LABEL: define{{.*}} @ggg(
// OPT3-LABEL: define{{.*}} @ggg(
double ggg(double r)
{
// std.math.nextDown() is inlined when optimizing
import std.math;
// OPT0: call {{.*}} @{{.*}}D3std4math8nextDown
// OPT3: call {{.*}} @{{.*}}D3std4math6nextUp
return nextDown(r);
// OPT0: ret
// OPT3: ret
}
// OPT0: declare {{.*}}D3std4math8nextDown
// OPT3: declare {{.*}}D3std4math6nextUp