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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [spu/] [ea/] [cast2.c] - Blame information for rev 762

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

Line No. Rev Author Line
1 691 jeremybenn
/* Copyright (C) 2009 Free Software Foundation, Inc.
2
 
3
   This file is free software; you can redistribute it and/or modify it under
4
   the terms of the GNU General Public License as published by the Free
5
   Software Foundation; either version 3 of the License, or (at your option)
6
   any later version.
7
 
8
   This file is distributed in the hope that it will be useful, but WITHOUT
9
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11
   for more details.
12
 
13
   You should have received a copy of the GNU General Public License
14
   along with this file; see the file COPYING3.  If not see
15
   <http://www.gnu.org/licenses/>.  */
16
 
17
/* { dg-do run } */
18
 
19
extern void abort (void);
20
 
21
int array[128];
22
 
23
__ea int *ea;
24
int *lm;
25
 
26
void verify_ea (void) __attribute__ ((noinline));
27
void
28
verify_ea (void)
29
{
30
  if (ea != (__ea int *)lm)
31
    abort ();
32
}
33
 
34
void verify_lm (void) __attribute__ ((noinline));
35
void
36
verify_lm (void)
37
{
38
  if ((int *)ea != lm)
39
    abort ();
40
}
41
 
42
void verify_diff (int x) __attribute__ ((noinline));
43
void
44
verify_diff (int x)
45
{
46
  if (ea - lm != x)
47
    abort ();
48
}
49
 
50
int
51
main (int argc, char **argv)
52
{
53
  ea = 0;
54
  lm = 0;
55
  verify_ea ();
56
  verify_lm ();
57
  verify_diff (0);
58
 
59
  ea = &array[64];
60
  lm = &array[64];
61
  verify_ea ();
62
  verify_lm ();
63
  verify_diff (0);
64
 
65
  ea = &array[0];
66
  lm = &array[64];
67
  verify_diff (-64);
68
 
69
  ea = &array[64];
70
  lm = &array[0];
71
  verify_diff (64);
72
 
73
  return 0;
74
}

powered by: WebSVN 2.1.0

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