OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [builtin-isinf_sign-1.c] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2008  Free Software Foundation.
2
 
3
   Verify that __builtin_isinf_sign folds correctly.
4
 
5
   Origin: Kaveh R. Ghazi,  May 17, 2008.  */
6
 
7
/* { dg-do link } */
8
 
9
/* All references to link_error should go away at compile-time.  */
10
extern void link_error(int);
11
 
12
void __attribute__ ((__noinline__))
13
foo (float f, double d, long double ld)
14
{
15
  /* Test the generic expansion of isinf_sign.  */
16
 
17
  if (__builtin_isinf_sign(f)
18
      != (__builtin_isinf(f) ? (__builtin_signbitf(f) ? -1 : 1) : 0))
19
    link_error (__LINE__);
20
  if (__builtin_isinf_sign(d)
21
      != (__builtin_isinf(d) ? (__builtin_signbit(d) ? -1 : 1) : 0))
22
    link_error (__LINE__);
23
  if (__builtin_isinf_sign(ld)
24
      != (__builtin_isinf(ld) ? (__builtin_signbitl(ld) ? -1 : 1) : 0))
25
    link_error (__LINE__);
26
 
27
  /* In boolean contexts, GCC will fold the inner conditional
28
     expression to 1.  So isinf_sign folds to plain isinf.  */
29
 
30
  if ((_Bool)__builtin_isinf_sign(f) != (__builtin_isinf(f) != 0))
31
    link_error (__LINE__);
32
  if ((_Bool)__builtin_isinf_sign(d) != (__builtin_isinf(d) != 0))
33
    link_error (__LINE__);
34
  if ((_Bool)__builtin_isinf_sign(ld) != (__builtin_isinf(ld) != 0))
35
    link_error (__LINE__);
36
 
37
  if ((__builtin_isinf_sign(f) != 0) != (__builtin_isinf(f) != 0))
38
    link_error (__LINE__);
39
  if ((__builtin_isinf_sign(d) != 0) != (__builtin_isinf(d) != 0))
40
    link_error (__LINE__);
41
  if ((__builtin_isinf_sign(ld) != 0) != (__builtin_isinf(ld) != 0))
42
    link_error (__LINE__);
43
 
44
  if ((__builtin_isinf_sign(f) ? 5 : 6) != (__builtin_isinf(f) ? 5 : 6))
45
    link_error (__LINE__);
46
  if ((__builtin_isinf_sign(d) ? 5 : 6) != (__builtin_isinf(d) ? 5 : 6))
47
    link_error (__LINE__);
48
  if ((__builtin_isinf_sign(ld) ? 5 : 6) != (__builtin_isinf(ld) ? 5 : 6))
49
    link_error (__LINE__);
50
}
51
 
52
int main (void)
53
{
54
  foo (1, 2, 3);
55
  return 0;
56
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.