ATLAS Offline Software
trapping_fp.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef CXXUTILS_TRAPPING_FP_H
14 #define CXXUTILS_TRAPPING_FP_H
15 
16 
17 // Tell the compiler to optimize the containing block assuming that
18 // FP may trap. This is sometimes needed with clang to avoid spurious FPEs
19 // resulting from auto-vectorization.
20 #if defined(__clang__) && defined(__x86_64__)
21 # define CXXUTILS_TRAPPING_FP _Pragma("float_control(except, on)") \
22  class CxxUtilsTrappingFPDummy
23 #else
24 # define CXXUTILS_TRAPPING_FP class CxxUtilsTrappingFPDummy
25 #endif
26 
27 
28 #endif // not CXXUTILS_TRAPPING_FP_H