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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [mips/] [mips16-attributes.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* Verify that mips16 and nomips16 attributes work, checking all combinations
2
   of calling a nomips16/mips16/default function from a nomips16/mips16/default
3
   function.  */
4
/* { dg-do run } */
5
/* { dg-options "(-mips16)" } */
6
 
7
#include <stdlib.h>
8
 
9
#define ATTR1 __attribute__ ((nomips16))
10
#define ATTR2 __attribute__ ((mips16))
11
#define ATTR3
12
 
13
double ATTR1
14
f1 (int i, float f, double d)
15
{
16
  return i + f + d;
17
}
18
 
19
double ATTR2
20
f2 (int i, float f, double d)
21
{
22
  return i + f + d;
23
}
24
 
25
double ATTR3
26
f3 (int i, float f, double d)
27
{
28
  return i + f + d;
29
}
30
 
31
void ATTR1
32
g1 (int i, float f, double d)
33
{
34
  double r = i + f + d;
35
 
36
  if (f1 (i, f, d) != r)
37
    abort ();
38
  if (f2 (i+1, f+1, d+1) != r + 3)
39
    abort ();
40
  if (f3 (i+2, f+2, d+2) != r + 6)
41
    abort ();
42
}
43
 
44
void ATTR2
45
g2 (int i, float f, double d)
46
{
47
  double r = i + f + d;
48
 
49
  if (f1 (i, f, d) != r)
50
    abort ();
51
  if (f2 (i+1, f+1, d+1) != r + 3)
52
    abort ();
53
  if (f3 (i+2, f+2, d+2) != r + 6)
54
    abort ();
55
}
56
 
57
void ATTR3
58
g3 (int i, float f, double d)
59
{
60
  double r = i + f + d;
61
 
62
  if (f1 (i, f, d) != r)
63
    abort ();
64
  if (f2 (i+1, f+1, d+1) != r + 3)
65
    abort ();
66
  if (f3 (i+2, f+2, d+2) != r + 6)
67
    abort ();
68
}
69
 
70
int ATTR3
71
main (void)
72
{
73
  int i = 1;
74
  float f = -2.0;
75
  double d = 3.0;
76
 
77
  g1 (i, f, d);
78
  g2 (i, f, d);
79
  g3 (i, f, d);
80
 
81
  exit (0);
82
}
83
 

powered by: WebSVN 2.1.0

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