master
 1/**
 2 * This file has no copyright assigned and is placed in the Public Domain.
 3 * This file is part of the mingw-w64 runtime package.
 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 5 */
 6#include <internal.h>
 7
 8/* 7.6.2.3
 9   The feraiseexcept function raises the supported exceptions
10   represented by its argument The order in which these exceptions
11   are raised is unspecified, except as stated in F.7.6.
12   Whether the feraiseexcept function additionally raises
13   the inexact exception whenever it raises the overflow
14   or underflow exception is implementation-defined. */
15
16int feraiseexcept(int flags)
17{
18    fenv_t env;
19
20    flags &= FE_ALL_EXCEPT;
21    fegetenv(&env);
22    env._Fe_stat |= fenv_encode(flags, flags);
23    fesetenv(&env);
24#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
25    __asm__ volatile ("fwait\n\t");
26#endif
27    return 0;
28}