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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [bfin/] [frmul.c] - Blame information for rev 841

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

Line No. Rev Author Line
1 149 jeremybenn
extern void abort (void);
2
extern void exit (int);
3
 
4
typedef int  __v2hi __attribute ((vector_size(4)));
5
typedef __v2hi fract2x16;
6
typedef short fract16;
7
 
8
#define GETVECT(HILO1,HILO2,IN1,IN2)                                    \
9
  __builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \
10
                          (HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2))
11
#define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4)                                    \
12
  __builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \
13
                          GETVECT (HL3, HL4, IN2, IN2))
14
 
15
#define FUNC(HL1, HL2, HL3, HL4) \
16
  fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\
17
  { \
18
    return DOTEST(a, b, HL1, HL2, HL3, HL4);\
19
  }
20
 
21
FUNC (0, 0, 0, 0)
22
FUNC (1, 0, 0, 0)
23
FUNC (0, 1, 0, 0)
24
FUNC (1, 1, 0, 0)
25
FUNC (0, 0, 1, 0)
26
FUNC (1, 0, 1, 0)
27
FUNC (0, 1, 1, 0)
28
FUNC (1, 1, 1, 0)
29
FUNC (0, 0, 0, 1)
30
FUNC (1, 0, 0, 1)
31
FUNC (0, 1, 0, 1)
32
FUNC (1, 1, 0, 1)
33
FUNC (0, 0, 1, 1)
34
FUNC (1, 0, 1, 1)
35
FUNC (0, 1, 1, 1)
36
FUNC (1, 1, 1, 1)
37
 
38
#define RES1 0x1400
39
#define RES2 0x1e00
40
#define RES3 0x1c00
41
#define RES4 0x2a00
42
 
43
 
44
int main ()
45
{
46
  fract2x16 a, b, c;
47
  fract16 t1, t2;
48
  a = __builtin_bfin_compose_2x16 (0x3000, 0x2000);
49
  b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
50
 
51
  c = foo0000 (a, b);
52
  t1 = __builtin_bfin_extract_lo (c);
53
  t2 = __builtin_bfin_extract_hi (c);
54
  if (t1 != RES1 || t2 != RES1)
55
    abort ();
56
 
57
  c = foo1000 (a, b);
58
  t1 = __builtin_bfin_extract_lo (c);
59
  t2 = __builtin_bfin_extract_hi (c);
60
  if (t1 != RES2 || t2 != RES1)
61
    abort ();
62
 
63
  c = foo0100 (a, b);
64
  t1 = __builtin_bfin_extract_lo (c);
65
  t2 = __builtin_bfin_extract_hi (c);
66
  if (t1 != RES1 || t2 != RES2)
67
    abort ();
68
 
69
  c = foo1100 (a, b);
70
  t1 = __builtin_bfin_extract_lo (c);
71
  t2 = __builtin_bfin_extract_hi (c);
72
  if (t1 != RES2 || t2 != RES2)
73
    abort ();
74
 
75
  c = foo0010 (a, b);
76
  t1 = __builtin_bfin_extract_lo (c);
77
  t2 = __builtin_bfin_extract_hi (c);
78
  if (t1 != RES3 || t2 != RES1)
79
    abort ();
80
 
81
  c = foo1010 (a, b);
82
  t1 = __builtin_bfin_extract_lo (c);
83
  t2 = __builtin_bfin_extract_hi (c);
84
  if (t1 != RES4 || t2 != RES1)
85
    abort ();
86
 
87
  c = foo0110 (a, b);
88
  t1 = __builtin_bfin_extract_lo (c);
89
  t2 = __builtin_bfin_extract_hi (c);
90
  if (t1 != RES3 || t2 != RES2)
91
    abort ();
92
 
93
  c = foo1110 (a, b);
94
  t1 = __builtin_bfin_extract_lo (c);
95
  t2 = __builtin_bfin_extract_hi (c);
96
  if (t1 != RES4 || t2 != RES2)
97
    abort ();
98
 
99
  c = foo0001 (a, b);
100
  t1 = __builtin_bfin_extract_lo (c);
101
  t2 = __builtin_bfin_extract_hi (c);
102
  if (t1 != RES1 || t2 != RES3)
103
    abort ();
104
 
105
  c = foo1001 (a, b);
106
  t1 = __builtin_bfin_extract_lo (c);
107
  t2 = __builtin_bfin_extract_hi (c);
108
  if (t1 != RES2 || t2 != RES3)
109
    abort ();
110
 
111
  c = foo0101 (a, b);
112
  t1 = __builtin_bfin_extract_lo (c);
113
  t2 = __builtin_bfin_extract_hi (c);
114
  if (t1 != RES1 || t2 != RES4)
115
    abort ();
116
 
117
  c = foo1101 (a, b);
118
  t1 = __builtin_bfin_extract_lo (c);
119
  t2 = __builtin_bfin_extract_hi (c);
120
  if (t1 != RES2 || t2 != RES4)
121
    abort ();
122
 
123
  c = foo0011 (a, b);
124
  t1 = __builtin_bfin_extract_lo (c);
125
  t2 = __builtin_bfin_extract_hi (c);
126
  if (t1 != RES3 || t2 != RES3)
127
    abort ();
128
 
129
  c = foo1011 (a, b);
130
  t1 = __builtin_bfin_extract_lo (c);
131
  t2 = __builtin_bfin_extract_hi (c);
132
  if (t1 != RES4 || t2 != RES3)
133
    abort ();
134
 
135
  c = foo0111 (a, b);
136
  t1 = __builtin_bfin_extract_lo (c);
137
  t2 = __builtin_bfin_extract_hi (c);
138
  if (t1 != RES3 || t2 != RES4)
139
    abort ();
140
 
141
  c = foo1111 (a, b);
142
  t1 = __builtin_bfin_extract_lo (c);
143
  t2 = __builtin_bfin_extract_hi (c);
144
  if (t1 != RES4 || t2 != RES4)
145
    abort ();
146
 
147
  exit (0);
148
}
149
 

powered by: WebSVN 2.1.0

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