Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/builtin-feclearexcept-feraiseexcept-1.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target fenv_exceptions } */
3 /* { dg-options "-lm -fno-builtin" } */
4
5 /* This testcase ensures that the builtins expand with the matching arguments
6 or otherwise fallback gracefully to a function call, and don't ICE during
7 compilation.
8 "-fno-builtin" option is used to enable calls to libc implementation of the
9 gcc builtins tested when not using __builtin_ prefix. */
10
11 #include <fenv.h>
12
13 int
14 main ()
15 {
16 int rsi = 0;
17 long rsl = 0;
18 short rss = 0;
19 char rsc = 0;
20
21 unsigned int rui = 0;
22 unsigned long rul = 0;
23 unsigned short rus = 0;
24 unsigned char ruc = 0;
25
26 int e = FE_DIVBYZERO;
27
28 __builtin_feclearexcept(e); // CALL
29 __builtin_feclearexcept(FE_ALL_EXCEPT); // CALL
30 __builtin_feclearexcept(FE_INVALID); // CALL
31 __builtin_feclearexcept(FE_INVALID | FE_INEXACT); // CALL
32
33 __builtin_feclearexcept(FE_INEXACT | FE_DIVBYZERO |
34 FE_UNDERFLOW | FE_OVERFLOW); // EXPAND
35 __builtin_feclearexcept(FE_INEXACT | FE_OVERFLOW); // EXPAND
36 __builtin_feclearexcept(FE_INEXACT); // EXPAND
37 __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
38 __builtin_feclearexcept(FE_UNDERFLOW); // EXPAND
39 __builtin_feclearexcept(FE_OVERFLOW); // EXPAND
40 __builtin_feclearexcept(0); // EXPAND
41
42 rsi = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
43 rsl = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
44 rss = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
45 rsc = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
46 rui = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
47 rul = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
48 rus = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
49 ruc = __builtin_feclearexcept(FE_DIVBYZERO); // EXPAND
50
51
52 __builtin_feraiseexcept(e); // CALL
53 __builtin_feraiseexcept(FE_ALL_EXCEPT); // CALL
54 __builtin_feraiseexcept(FE_INVALID); // CALL
55 __builtin_feraiseexcept(FE_INVALID | FE_INEXACT); // CALL
56
57 __builtin_feraiseexcept(FE_INEXACT | FE_DIVBYZERO |
58 FE_UNDERFLOW | FE_OVERFLOW); // EXPAND
59 __builtin_feraiseexcept(FE_INEXACT | FE_OVERFLOW); // EXPAND
60 __builtin_feraiseexcept(FE_INEXACT); // EXPAND
61 __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
62 __builtin_feraiseexcept(FE_UNDERFLOW); // EXPAND
63 __builtin_feraiseexcept(FE_OVERFLOW); // EXPAND
64 __builtin_feraiseexcept(0); // EXPAND
65
66 rsi = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
67 rsl = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
68 rss = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
69 rsc = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
70 rui = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
71 rul = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
72 rus = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
73 ruc = __builtin_feraiseexcept(FE_DIVBYZERO); // EXPAND
74
75 return 0;
76 }