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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [shiftopt-1.c] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2002  Free Software Foundation
2
 
3
   Check that constant folding of shift operations is working.
4
 
5
   Roger Sayle, 10th October 2002.  */
6
 
7
extern void abort (void);
8
extern void link_error (void);
9
 
10
void
11
utest (unsigned int x)
12
{
13
  if (x >> 0 != x)
14
    link_error ();
15
 
16
  if (x << 0 != x)
17
    link_error ();
18
 
19
  if (0 << x != 0)
20
    link_error ();
21
 
22
  if (0 >> x != 0)
23
    link_error ();
24
 
25
  if (-1 >> x != -1)
26
    link_error ();
27
 
28
  if (~0 >> x != ~0)
29
    link_error ();
30
}
31
 
32
void
33
stest (int x)
34
{
35
  if (x >> 0 != x)
36
    link_error ();
37
 
38
  if (x << 0 != x)
39
    link_error ();
40
 
41
  if (0 << x != 0)
42
    link_error ();
43
 
44
  if (0 >> x != 0)
45
    link_error ();
46
 
47
  if (-1 >> x != -1)
48
    link_error ();
49
 
50
  if (~0 >> x != ~0)
51
    link_error ();
52
}
53
 
54
int
55
main ()
56
{
57
  utest(9);
58
  utest(0);
59
 
60
  stest(9);
61
  stest(0);
62
 
63
  return 0;
64
}
65
 
66
#ifndef __OPTIMIZE__
67
void
68
link_error ()
69
{
70
  abort ();
71
}
72
#endif
73
 

powered by: WebSVN 2.1.0

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