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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr31169.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 688 jeremybenn
extern void abort();
2
 
3
#define HOST_WIDE_INT long
4
#define HOST_BITS_PER_WIDE_INT (sizeof(long)*8)
5
 
6
struct tree_type
7
{
8
  unsigned int precision : 9;
9
};
10
 
11
int
12
sign_bit_p (struct tree_type *t, HOST_WIDE_INT val_hi, unsigned HOST_WIDE_INT val_lo)
13
{
14
  unsigned HOST_WIDE_INT mask_lo, lo;
15
  HOST_WIDE_INT mask_hi, hi;
16
  int width = t->precision;
17
 
18
  if (width > HOST_BITS_PER_WIDE_INT)
19
    {
20
      hi = (unsigned HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT - 1);
21
      lo = 0;
22
 
23
      mask_hi = ((unsigned HOST_WIDE_INT) -1
24
                 >> (2 * HOST_BITS_PER_WIDE_INT - width));
25
      mask_lo = -1;
26
    }
27
  else
28
    {
29
      hi = 0;
30
      lo = (unsigned HOST_WIDE_INT) 1 << (width - 1);
31
 
32
      mask_hi = 0;
33
      mask_lo = ((unsigned HOST_WIDE_INT) -1
34
                 >> (HOST_BITS_PER_WIDE_INT - width));
35
    }
36
 
37
  if ((val_hi & mask_hi) == hi
38
      && (val_lo & mask_lo) == lo)
39
    return 1;
40
 
41
  return 0;
42
}
43
 
44
int main()
45
{
46
  struct tree_type t;
47
  t.precision = 1;
48
  if (!sign_bit_p (&t, 0, -1))
49
    abort ();
50
  return 0;
51
}

powered by: WebSVN 2.1.0

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