OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [avr/] [torture/] [pr41885.c] - Blame information for rev 314

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 314 jeremybenn
/* { dg-options "-w -std=c99" } */
2
/* { dg-do run } */
3
 
4
#include <limits.h>
5
#include <stdint.h>
6
#include <stdlib.h>
7
 
8
 
9
uint16_t rotl_16a (uint16_t x)
10
{
11
    return (x << 8) | (x >> 8);
12
}
13
uint16_t rotl_16b (short dummy, uint16_t x)
14
{
15
    return (x << 8) | (x >> 8);
16
}
17
 
18
uint32_t rotl_32a (uint32_t x)
19
{
20
    return (x << 8) | (x >> 24);
21
}
22
uint32_t rotl_32b (short dummy, uint32_t x)
23
{
24
    return (x << 8) | (x >> 24);
25
}
26
uint32_t rotl_32c (short dummy, uint32_t x)
27
{
28
    return (x << 16) | (x >> 16);
29
}
30
uint32_t rotl_32d (short dummy, uint32_t x)
31
{
32
    return (x << 24) | (x >> 8);
33
}
34
uint32_t rotl_32e (long dummy, uint32_t x)
35
{
36
    return (x << 24) | (x >> 8);
37
}
38
 
39
uint64_t rotl_64 (uint64_t x)
40
{
41
    return (x << 56) | (x >> 8);
42
}
43
 
44
uint64_t rotl_64a (short dummy, uint64_t x)
45
{
46
    return (x << 56) | (x >> 8);
47
}
48
uint64_t rotl_64b (short dummy, uint64_t x)
49
{
50
    return (x << 48) | (x >> 16);
51
}
52
uint64_t rotl_64c (short dummy, uint64_t x)
53
{
54
    return (x << 40) | (x >> 24);
55
}
56
uint64_t rotl_64d (short dummy, uint64_t x)
57
{
58
    return (x << 32) | (x >> 32);
59
}
60
uint64_t rotl_64e (short dummy, uint64_t x)
61
{
62
    return (x << 24) | (x >> 40);
63
}
64
uint64_t rotl_64f (short dummy, uint64_t x)
65
{
66
    return (x << 16) | (x >> 48);
67
}
68
uint64_t rotl_64g (short dummy, uint64_t x)
69
{
70
    return (x << 8) | (x >> 56);
71
}
72
uint64_t rotl_64h (long dummy, uint64_t x)
73
{
74
    return (x << 16) | (x >> 48);
75
}
76
 
77
 
78
 
79
 
80
int main (void)
81
{
82
  if (rotl_16a(0x1234) != 0x3412)
83
    abort();
84
  if (rotl_16b(0xAA55,0x1234) != 0x3412)
85
    abort();
86
 
87
uint32_t num32 = 0x12345678;
88
 
89
  if (rotl_32a(num32) != 0x34567812)
90
    abort();
91
  if (rotl_32b(0xAA55,num32) != 0x34567812)
92
    abort();
93
  if (rotl_32c(0xAA55,num32) != 0x56781234)
94
    abort();
95
  if (rotl_32d(0xAA55,num32) != 0x78123456)
96
    abort();
97
  if (rotl_32e(0x1122AA55,num32) != 0x78123456)
98
    abort();
99
 
100
uint64_t num = 0x123456789ABCDEF0ULL;
101
 
102
 if (rotl_64(num) != 0xF0123456789ABCDEULL)
103
    abort();
104
 if (rotl_64a(0xAA55,num) != 0xF0123456789ABCDEULL)
105
    abort();
106
 if (rotl_64b(0xAA55,num) != 0xDEF0123456789ABCULL)
107
    abort();
108
 if (rotl_64c(0xAA55,num) != 0xBCDEF0123456789AULL)
109
    abort();
110
 if (rotl_64d(0xAA55,num) != 0x9ABCDEF012345678ULL)
111
    abort();
112
 if (rotl_64e(0xAA55,num) != 0x789ABCDEF0123456ULL)
113
    abort();
114
 if (rotl_64f(0xAA55,num) != 0x56789ABCDEF01234ULL)
115
    abort();
116
 if (rotl_64g(0xAA55,num) != 0x3456789ABCDEF012ULL)
117
    abort();
118
 if (rotl_64h(0x1122AA55,num) != 0x56789ABCDEF01234ULL)
119
    abort();
120
 
121
  exit (0);
122
}
123
 

powered by: WebSVN 2.1.0

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