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/] [20020226-1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* This tests the rotate patterns that some machines support.  */
2
 
3
#include <limits.h>
4
 
5
#ifndef CHAR_BIT
6
#define CHAR_BIT 8
7
#endif
8
 
9
#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
10
#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
11
 
12
#define CHAR_VALUE ((unsigned char)0x1234U)
13
#define SHORT_VALUE ((unsigned short)0x1234U)
14
#define INT_VALUE 0x1234U
15
#define LONG_VALUE 0x12345678LU
16
#define LL_VALUE 0x12345678abcdef0LLU
17
 
18
#define SHIFT1 4
19
#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
20
 
21
unsigned char uc = CHAR_VALUE;
22
unsigned short us = SHORT_VALUE;
23
unsigned int ui = INT_VALUE;
24
unsigned long ul = LONG_VALUE;
25
unsigned long long ull = LL_VALUE;
26
int shift1 = SHIFT1;
27
int shift2 = SHIFT2;
28
 
29
main ()
30
{
31
  if (ROR (uc, shift1) != ROR (CHAR_VALUE, SHIFT1))
32
    abort ();
33
 
34
  if (ROR (uc, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
35
    abort ();
36
 
37
  if (ROR (us, shift1) != ROR (SHORT_VALUE, SHIFT1))
38
    abort ();
39
 
40
  if (ROR (us, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
41
    abort ();
42
 
43
  if (ROR (ui, shift1) != ROR (INT_VALUE, SHIFT1))
44
    abort ();
45
 
46
  if (ROR (ui, SHIFT1) != ROR (INT_VALUE, SHIFT1))
47
    abort ();
48
 
49
  if (ROR (ul, shift1) != ROR (LONG_VALUE, SHIFT1))
50
    abort ();
51
 
52
  if (ROR (ul, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
53
    abort ();
54
 
55
  if (ROR (ull, shift1) != ROR (LL_VALUE, SHIFT1))
56
    abort ();
57
 
58
  if (ROR (ull, SHIFT1) != ROR (LL_VALUE, SHIFT1))
59
    abort ();
60
 
61
  if (ROR (ull, shift2) != ROR (LL_VALUE, SHIFT2))
62
    abort ();
63
 
64
  if (ROR (ull, SHIFT2) != ROR (LL_VALUE, SHIFT2))
65
    abort ();
66
 
67
  if (ROL (uc, shift1) != ROL (CHAR_VALUE, SHIFT1))
68
    abort ();
69
 
70
  if (ROL (uc, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
71
    abort ();
72
 
73
  if (ROL (us, shift1) != ROL (SHORT_VALUE, SHIFT1))
74
    abort ();
75
 
76
  if (ROL (us, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
77
    abort ();
78
 
79
  if (ROL (ui, shift1) != ROL (INT_VALUE, SHIFT1))
80
    abort ();
81
 
82
  if (ROL (ui, SHIFT1) != ROL (INT_VALUE, SHIFT1))
83
    abort ();
84
 
85
  if (ROL (ul, shift1) != ROL (LONG_VALUE, SHIFT1))
86
    abort ();
87
 
88
  if (ROL (ul, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
89
    abort ();
90
 
91
  if (ROL (ull, shift1) != ROL (LL_VALUE, SHIFT1))
92
    abort ();
93
 
94
  if (ROL (ull, SHIFT1) != ROL (LL_VALUE, SHIFT1))
95
    abort ();
96
 
97
  if (ROL (ull, shift2) != ROL (LL_VALUE, SHIFT2))
98
    abort ();
99
 
100
  if (ROL (ull, SHIFT2) != ROL (LL_VALUE, SHIFT2))
101
    abort ();
102
 
103
  exit (0);
104
}

powered by: WebSVN 2.1.0

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