xref: /llvm-project/clang/test/CodeGen/fp-floatcontrol-class.cpp (revision f5360d4bb3376347479d86547d21b95d80be786d)
1 // RUN: %clang_cc1 -ffp-contract=on -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -ffp-contract=on -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -ffp-contract=on -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
4 // Verify that float_control does not pertain to initializer expressions
5 
6 float y();
7 float z();
8 #pragma float_control(except, on)
9 class ON {
10   float w = 2 + y() * z();
11   // CHECK-LABEL: define {{.*}} void @_ZN2ONC2Ev{{.*}}
12   //CHECK: call contract float {{.*}}llvm.fmuladd
13 };
14 ON on;
15 #pragma float_control(except, off)
16 class OFF {
17   float w = 2 + y() * z();
18   // CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}}
19   //CHECK: call contract float {{.*}}llvm.fmuladd
20 };
21 OFF off;
22