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

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

Line No. Rev Author Line
1 149 jeremybenn
typedef unsigned long long ull;
2
volatile int gvol[32];
3
ull gull;
4
 
5
#define MULTI(X) \
6
        X( 1), X( 2), X( 3), X( 4), X( 5), X( 6), X( 7), X( 8), X( 9), X(10), \
7
        X(11), X(12), X(13), X(14), X(15), X(16), X(17), X(18), X(19), X(20), \
8
        X(21), X(22), X(23), X(24), X(25), X(26), X(27), X(28), X(29), X(30)
9
 
10
#define DECLARE(INDEX) x##INDEX
11
#define COPYIN(INDEX) x##INDEX = gvol[INDEX]
12
#define COPYOUT(INDEX) gvol[INDEX] = x##INDEX
13
 
14
#define BUILD_TEST(NAME, N)             \
15
  ull __attribute__((noinline))         \
16
  NAME (int n, ull x)                   \
17
  {                                     \
18
    while (n--)                         \
19
      {                                 \
20
        int MULTI (DECLARE);            \
21
        MULTI (COPYIN);                 \
22
        MULTI (COPYOUT);                \
23
        x += N;                         \
24
      }                                 \
25
    return x;                           \
26
  }
27
 
28
#define RUN_TEST(NAME, N)               \
29
  if (NAME (3, ~0ULL) != N * 3 - 1)     \
30
    abort ();                           \
31
  if (NAME (3, 0xffffffffULL)           \
32
      != N * 3 + 0xffffffffULL)         \
33
    abort ();
34
 
35
#define DO_TESTS(DO_TEST)       \
36
  DO_TEST (t1, -2048)           \
37
  DO_TEST (t2, -513)            \
38
  DO_TEST (t3, -512)            \
39
  DO_TEST (t4, -511)            \
40
  DO_TEST (t5, -1)              \
41
  DO_TEST (t6, 1)               \
42
  DO_TEST (t7, 511)             \
43
  DO_TEST (t8, 512)             \
44
  DO_TEST (t9, 513)             \
45
  DO_TEST (t10, gull)           \
46
  DO_TEST (t11, -gull)
47
 
48
DO_TESTS (BUILD_TEST)
49
 
50
ull neg (ull x) { return -x; }
51
 
52
int
53
main ()
54
{
55
  gull = 100;
56
  DO_TESTS (RUN_TEST)
57
  if (neg (gull) != -100ULL)
58
    abort ();
59
  exit (0);
60
}

powered by: WebSVN 2.1.0

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