From eddb00a704ed39ea781693cf8fcf7cc69a175b95 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 4 Oct 2012 03:07:37 +0000 Subject: [PATCH] Test file-scoped FP_CONTRACT pragma. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165196 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/fp-contract-pragma.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/CodeGen/fp-contract-pragma.cpp b/test/CodeGen/fp-contract-pragma.cpp index 9be9afc4c2..edb04d82ef 100644 --- a/test/CodeGen/fp-contract-pragma.cpp +++ b/test/CodeGen/fp-contract-pragma.cpp @@ -46,3 +46,20 @@ template class fp_contract_4 { template class fp_contract_4; // 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; +} + -- 2.40.0