mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 23:38:59 -04:00

This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples, Itanium otherwise. It's no longer possible to do weird combinations. To be able to run a test with a specific ABI without constraining it to a specific triple, new substitutions are added to lit: %itanium_abi_triple and %ms_abi_triple can be used to get the current target triple adjusted to the desired ABI. For example, if the test suite is running with the i686-pc-win32 target, %itanium_abi_triple will expand to i686-pc-mingw32. Differential Revision: http://llvm-reviews.chandlerc.com/D2545 llvm-svn: 199250
65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
// RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// Is FP_CONTRACT is honored in a simple case?
|
|
float fp_contract_1(float a, float b, float c) {
|
|
// CHECK: _Z13fp_contract_1fff
|
|
// CHECK: tail call float @llvm.fmuladd
|
|
#pragma STDC FP_CONTRACT ON
|
|
return a * b + c;
|
|
}
|
|
|
|
// Is FP_CONTRACT state cleared on exiting compound statements?
|
|
float fp_contract_2(float a, float b, float c) {
|
|
// CHECK: _Z13fp_contract_2fff
|
|
// CHECK: %[[M:.+]] = fmul float %a, %b
|
|
// CHECK-NEXT: fadd float %[[M]], %c
|
|
{
|
|
#pragma STDC FP_CONTRACT ON
|
|
}
|
|
return a * b + c;
|
|
}
|
|
|
|
// Does FP_CONTRACT survive template instatiation?
|
|
class Foo {};
|
|
Foo operator+(Foo, Foo);
|
|
|
|
template <typename T>
|
|
T template_muladd(T a, T b, T c) {
|
|
#pragma STDC FP_CONTRACT ON
|
|
return a * b + c;
|
|
}
|
|
|
|
float fp_contract_3(float a, float b, float c) {
|
|
// CHECK: _Z13fp_contract_3fff
|
|
// CHECK: tail call float @llvm.fmuladd
|
|
return template_muladd<float>(a, b, c);
|
|
}
|
|
|
|
template<typename T> class fp_contract_4 {
|
|
float method(float a, float b, float c) {
|
|
#pragma STDC FP_CONTRACT ON
|
|
return a * b + c;
|
|
}
|
|
};
|
|
|
|
template class fp_contract_4<int>;
|
|
// CHECK: _ZN13fp_contract_4IiE6methodEfff
|
|
// CHECK: tail call float @llvm.fmuladd
|
|
|
|
// Check file-scoped FP_CONTRACT
|
|
#pragma STDC FP_CONTRACT ON
|
|
float fp_contract_5(float a, float b, float c) {
|
|
// CHECK: _Z13fp_contract_5fff
|
|
// CHECK: tail call float @llvm.fmuladd
|
|
return a * b + c;
|
|
}
|
|
|
|
#pragma STDC FP_CONTRACT OFF
|
|
float fp_contract_6(float a, float b, float c) {
|
|
// CHECK: _Z13fp_contract_6fff
|
|
// CHECK: %[[M:.+]] = fmul float %a, %b
|
|
// CHECK-NEXT: fadd float %[[M]], %c
|
|
return a * b + c;
|
|
}
|
|
|