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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vshift-5.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O3" } */
3
 
4
extern void abort (void);
5
long long a[16];
6
 
7
__attribute__((noinline, noclone)) void
8
f1 (void)
9
{
10
  long long a0, a1, a2, a3;
11
  a0 = a[0];
12
  a1 = a[1];
13
  a2 = a[2];
14
  a3 = a[3];
15
  a0 = a0 << 2;
16
  a1 = a1 << 3;
17
  a2 = a2 << 4;
18
  a3 = a3 << 5;
19
  a[0] = a0;
20
  a[1] = a1;
21
  a[2] = a2;
22
  a[3] = a3;
23
}
24
 
25
__attribute__((noinline, noclone)) void
26
f2 (void)
27
{
28
  long long a0, a1, a2, a3;
29
  a0 = a[0];
30
  a1 = a[1];
31
  a2 = a[2];
32
  a3 = a[3];
33
  a0 = a0 << 2;
34
  a1 = a1 << 2;
35
  a2 = a2 << 2;
36
  a3 = a3 << 2;
37
  a[0] = a0;
38
  a[1] = a1;
39
  a[2] = a2;
40
  a[3] = a3;
41
}
42
 
43
__attribute__((noinline, noclone)) void
44
f3 (int x)
45
{
46
  long long a0, a1, a2, a3;
47
  a0 = a[0];
48
  a1 = a[1];
49
  a2 = a[2];
50
  a3 = a[3];
51
  a0 = a0 << x;
52
  a1 = a1 << x;
53
  a2 = a2 << x;
54
  a3 = a3 << x;
55
  a[0] = a0;
56
  a[1] = a1;
57
  a[2] = a2;
58
  a[3] = a3;
59
}
60
 
61
int
62
main ()
63
{
64
  a[0] = 4LL;
65
  a[1] = 3LL;
66
  a[2] = 2LL;
67
  a[3] = 1LL;
68
  f1 ();
69
  if (a[0] != (4LL << 2) || a[1] != (3LL << 3)
70
      || a[2] != (2LL << 4) || a[3] != (1LL << 5))
71
    abort ();
72
  f2 ();
73
  if (a[0] != (4LL << 4) || a[1] != (3LL << 5)
74
      || a[2] != (2LL << 6) || a[3] != (1LL << 7))
75
    abort ();
76
  f3 (3);
77
  if (a[0] != (4LL << 7) || a[1] != (3LL << 8)
78
      || a[2] != (2LL << 9) || a[3] != (1LL << 10))
79
    abort ();
80
  return 0;
81
}

powered by: WebSVN 2.1.0

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