File: pr94439.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (55 lines) | stat: -rw-r--r-- 1,611 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-additional-options "-flive-patching=inline-clone -funroll-loops -fno-tree-forwprop -fno-expensive-optimizations -mstack-arg-probe -fcompare-debug" } */
/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */

extern void exit (int);
extern void abort (void);

#define COMPARE_BODY(A, B, TYPE, COPYSIGN)				\
  do {									\
    TYPE s1 = COPYSIGN ((TYPE) 1.0, A);					\
    TYPE s2 = COPYSIGN ((TYPE) 1.0, B);					\
    if (s1 != s2)							\
      abort ();								\
    if ((__builtin_isnan (A) != 0) != (__builtin_isnan (B) != 0))	\
      abort ();								\
    if ((A != B) != (__builtin_isnan (A) != 0))				\
      abort ();								\
  } while (0)

void
comparel (long double a, long double b)
{
  COMPARE_BODY (a, b, long double, __builtin_copysignl);
}

void
comparecl (_Complex long double a, long double r, long double i)
{
  comparel (__real__ a, r);
  comparel (__imag__ a, i);
}

#define VERIFY(A, B, TYPE, COMPARE)			\
  do {							\
    TYPE a = A;						\
    TYPE b = B;						\
    _Complex TYPE cr = __builtin_complex (a, b);	\
    static _Complex TYPE cs = __builtin_complex (A, B);	\
    COMPARE (cr, A, B);					\
    COMPARE (cs, A, B);					\
  } while (0)

#define ALL_CHECKS(PZ, NZ, NAN, INF, TYPE, COMPARE)	\
  do {							\
    VERIFY (NAN, NZ, TYPE, COMPARE);			\
    VERIFY (INF, NZ, TYPE, COMPARE);			\
    VERIFY (INF, NAN, TYPE, COMPARE);			\
    VERIFY (INF, INF, TYPE, COMPARE);			\
  } while (0)

void
check_long_double (void)
{
  ALL_CHECKS (0.0l, -0.0l, __builtin_nanl(""), __builtin_infl(), long double, comparecl);
}