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/] [compile/] [920625-1.c] - Blame information for rev 868

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

Line No. Rev Author Line
1 149 jeremybenn
/* The problem on IA-64 is that if-conversion creates a sequence
2
 
3
         (p17) cmp.geu p6, p7 = r48, r15
4
         (p16) cmp.gtu p6, p7 = r48, r15
5
 
6
   where p16 and p17 are complemenary, but the assembler DV validation
7
   code doesn't recognize that p6 and p7 are complimentary, and so
8
   we end up warning for a later use
9
 
10
         (p6) addl r14 = 1, r0
11
         (p7) mov r14 = r0
12
 
13
   that appears to be a WAW violation. */
14
 
15
/* { dg-prune-output "Assembler messages" } */
16
/* { dg-prune-output "violate\[^\n\]*dependency" } */
17
/* { dg-prune-output "first path encountering" } */
18
/* { dg-prune-output "location of the conflicting" } */
19
 
20
typedef unsigned long int unsigned_word;
21
typedef signed long int signed_word;
22
typedef unsigned_word word;
23
 
24
typedef enum { ADD, ADD_CI, ADD_CO, ADD_CIO, SUB, SUB_CI, SUB_CO,
25
SUB_CIO, ADC_CI, ADC_CO, ADC_CIO, AND, IOR, XOR, ANDC, IORC, EQV,
26
NAND, NOR, AND_RC, IOR_RC, XOR_RC, ANDC_RC, IORC_RC, EQV_RC, NAND_RC,
27
NOR_RC, AND_CC, IOR_CC, XOR_CC, ANDC_CC, IORC_CC, EQV_CC, NAND_CC,
28
NOR_CC, LSHIFTR, ASHIFTR, SHIFTL, LSHIFTR_CO, ASHIFTR_CO, SHIFTL_CO,
29
ROTATEL, ROTATEL_CO, ROTATEXL_CIO, ASHIFTR_CON, EXTS1, EXTS2, EXTU1,
30
EXTU2, CLZ, CTZ, FF1, FF0, ABSVAL, NABSVAL, CMP, CPEQ, CPGE, CPGEU,
31
CPGT, CPGTU, CPLE, CPLEU, CPLT, CPLTU, CPNEQ, CMPPAR, DOZ, COPY,
32
EXCHANGE, COMCY, } opcode_t;
33
 
34
typedef struct
35
{
36
  opcode_t opcode:8;
37
  unsigned int s1:8;
38
  unsigned int s2:8;
39
  unsigned int d:8;
40
} insn_t;
41
 
42
enum prune_flags
43
{
44
  NO_PRUNE = 0,
45
  CY_0 = 1,
46
  CY_1 = 2,
47
  CY_JUST_SET = 4,
48
};
49
 
50
int flag_use_carry = 1;
51
 
52
inline
53
recurse(opcode_t opcode,
54
 int d,
55
 int s1,
56
 int s2,
57
 word v,
58
 int cost,
59
 insn_t *sequence,
60
 int n_insns,
61
 word *values,
62
 int n_values,
63
 const word goal_value,
64
 int allowed_cost,
65
 int cy,
66
 int prune_flags)
67
{
68
  insn_t insn;
69
 
70
  allowed_cost -= cost;
71
 
72
  if (allowed_cost > 0)
73
    {
74
      word old_d;
75
 
76
      old_d = values[d];
77
      values[d] = v;
78
 
79
      insn.opcode = opcode;
80
      insn.s1 = s1;
81
      insn.s2 = s2;
82
      insn.d = d;
83
      sequence[n_insns] = insn;
84
 
85
      synth(sequence, n_insns + 1, values, n_values,
86
     goal_value, allowed_cost, cy, prune_flags);
87
 
88
      values[d] = old_d;
89
    }
90
  else if (goal_value == v)
91
    {
92
      insn.opcode = opcode;
93
      insn.s1 = s1;
94
      insn.s2 = s2;
95
      insn.d = d;
96
      sequence[n_insns] = insn;
97
      test_sequence(sequence, n_insns + 1);
98
    }
99
}
100
 
101
synth(insn_t *sequence,
102
      int n_insns,
103
      word *values,
104
      int n_values,
105
      word goal_value,
106
      int allowed_cost,
107
      int ci,
108
      int prune_hint)
109
{
110
  int s1, s2;
111
  word v, r1, r2;
112
  int co;
113
  int last_dest;
114
 
115
  if (n_insns > 0)
116
    last_dest = sequence[n_insns - 1].d;
117
  else
118
    last_dest = -1;
119
  if (ci >= 0 && flag_use_carry)
120
    {
121
      for (s1 = n_values - 1; s1 >= 0; s1--)
122
 {
123
   r1 = values[s1];
124
   for (s2 = s1 - 1; s2 >= 0; s2--)
125
     {
126
       r2 = values[s2];
127
 
128
       if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0)
129
  {
130
    if (last_dest >= 0 && s1 != last_dest && s2 != last_dest)
131
      continue;
132
  }
133
       do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0);
134
       recurse(ADD_CIO, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
135
       do { word __d = ( r1) + ( r2) + (( ci)); ( co) = ( ci); (v) = __d; } while (0);
136
       recurse(ADD_CI, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
137
 
138
       do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci) ? __d >= ( r1) : __d > ( r1); (v) = __d; } while (0);
139
       recurse(SUB_CIO, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
140
       do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( r2) : __d > ( r2); (v) = __d; } while (0);
141
       recurse(SUB_CIO, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
142
 
143
       do { word __d = ( r1) - ( r2) - (( ci)); ( co) = ( ci); (v) = __d; } while (0);
144
       recurse(SUB_CI, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
145
       do { word __d = ( r2) - ( r1) - (( ci)); ( co) = ( ci); (v) = __d; } while (0);
146
       recurse(SUB_CI, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
147
 
148
     }
149
 }
150
    }
151
  for (s1 = n_values - 1; s1 >= 0; s1--)
152
    {
153
      r1 = values[s1];
154
      for (s2 = s1 - 1; s2 >= 0; s2--)
155
 {
156
   r2 = values[s2];
157
 
158
   if (allowed_cost <= 1)
159
     {
160
       if (last_dest >= 0 && s1 != last_dest && s2 != last_dest)
161
  continue;
162
     }
163
 
164
   do { word __d = ( r1) + ( r2); ( co) = __d < ( r1); (v) = __d; } while (0);
165
   recurse(ADD_CO, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
166
 
167
   ((v) = ( r1) + ( r2), ( co) = ( ci));
168
   recurse(ADD, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
169
 
170
   do { word __d = ( r1) - ( r2); ( co) = __d > ( r1); (v) = __d; } while (0);
171
   recurse(SUB_CO, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
172
   do { word __d = ( r2) - ( r1); ( co) = __d > ( r2); (v) = __d; } while (0);
173
   recurse(SUB_CO, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
174
   ((v) = ( r1) - ( r2), ( co) = ( ci));
175
   recurse(SUB, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
176
   ((v) = ( r2) - ( r1), ( co) = ( ci));
177
   recurse(SUB, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
178
 
179
   ((v) = ( r1) & ( r2), ( co) = ( ci));
180
   recurse(AND, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
181
 
182
   ((v) = ( r1) | ( r2), ( co) = ( ci));
183
   recurse(IOR, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
184
 
185
   ((v) = ( r1) ^ ( r2), ( co) = ( ci));
186
   recurse(XOR, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
187
 
188
   ((v) = ( r1) & ~( r2), ( co) = ( ci));
189
   recurse(ANDC, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
190
   ((v) = ( r2) & ~( r1), ( co) = ( ci));
191
   recurse(ANDC, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
192
   ((v) = ( r1) | ~( r2), ( co) = ( ci));
193
   recurse(IORC, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
194
   ((v) = ( r2) | ~( r1), ( co) = ( ci));
195
   recurse(IORC, n_values,  s2,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
196
   ((v) = ( r1) ^ ~( r2), ( co) = ( ci));
197
   recurse(EQV, n_values,  s1,  s2, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
198
 
199
 }
200
    }
201
  if (ci >= 0 && flag_use_carry)
202
    {
203
      for (s1 = n_values - 1; s1 >= 0; s1--)
204
 {
205
   r1 = values[s1];
206
 
207
   if (allowed_cost <= 1 && (prune_hint & CY_JUST_SET) == 0)
208
     {
209
 
210
       if (last_dest >= 0 && s1 != last_dest)
211
  continue;
212
     }
213
 
214
   do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0);
215
   recurse(ADD_CIO, n_values,  s1,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
216
 
217
   do { word __d = ( r1) + ( r1) + (( ci)); ( co) = ( ci); (v) = __d; } while (0);
218
   recurse(ADD_CI, n_values,  s1,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
219
 
220
   do { word __d = ( r1) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0);
221
   recurse(ADD_CIO, n_values,  s1,  (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
222
 
223
   do { word __d = ( r1) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( r1) : __d < ( r1); (v) = __d; } while (0);
224
   recurse(ADD_CIO, n_values,  s1,  (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
225
   do { word __d = ( 0 ) - ( r1) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0);
226
   recurse(SUB_CIO, n_values,  (0x20 + 0) ,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
227
 
228
 }
229
    }
230
  for (s1 = n_values - 1; s1 >= 0; s1--)
231
    {
232
      r1 = values[s1];
233
 
234
      if (allowed_cost <= 1)
235
 {
236
   if (last_dest >= 0 && s1 != last_dest)
237
     continue;
238
 }
239
      do { word __d = ( r1) + ( r1); ( co) = __d < ( r1); (v) = __d; } while (0);
240
      recurse(ADD_CO, n_values,  s1,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
241
 
242
      ((v) = ( r1) & ( 1 ), ( co) = ( ci));
243
      recurse(AND, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
244
 
245
      ((v) = ( r1) ^ ( 1 ), ( co) = ( ci));
246
      recurse(XOR, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
247
 
248
      ((v) = ( -1 ) - ( r1), ( co) = ( ci));
249
      recurse(SUB, n_values,  (0x20 + -1) ,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
250
      do { word __d = ( r1) + ( 1 ); ( co) = __d < ( r1); (v) = __d; } while (0);
251
      recurse(ADD_CO, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
252
      ((v) = ( r1) + ( 1 ), ( co) = ( ci));
253
      recurse(ADD, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
254
      do { word __d = ( r1) + ( -1 ); ( co) = __d < ( r1); (v) = __d; } while (0);
255
      recurse(ADD_CO, n_values,  s1,  (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
256
      do { word __d = ( r1) - ( 1 ); ( co) = __d > ( r1); (v) = __d; } while (0);
257
      recurse(SUB_CO, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
258
      do { word __d = ( 0 ) - ( r1); ( co) = __d > ( 0 ); (v) = __d; } while (0);
259
      recurse(SUB_CO, n_values,  (0x20 + 0) ,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET);
260
      ((v) = ( 0 ) - ( r1), ( co) = ( ci));
261
      recurse(SUB, n_values,  (0x20 + 0) ,  s1, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
262
      ((v) = ((unsigned_word) ( r1) >> (( 1 ) & (32  - 1)) ), ( co) = ( ci));
263
      recurse(LSHIFTR, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
264
      ((v) = ((signed_word) ( r1) >> (( 1 ) & (32  - 1)) ), ( co) = ( ci));
265
      recurse(ASHIFTR, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
266
      ((v) = ((signed_word) ( r1) << (( 1 ) & (32  - 1)) ), ( co) = ( ci));
267
      recurse(SHIFTL, n_values,  s1,  (0x20 + 1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
268
      ((v) = ((unsigned_word) ( r1) >> (( 32 -1 ) & (32  - 1)) ), ( co) = ( ci));
269
      recurse(LSHIFTR, n_values,  s1,  (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
270
      ((v) = ((signed_word) ( r1) >> (( 32 -1 ) & (32  - 1)) ), ( co) = ( ci));
271
      recurse(ASHIFTR, n_values,  s1,  (0x20 + 32 -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
272
    }
273
  if (ci >= 0 && flag_use_carry
274
      && (allowed_cost <= 1 ? ((prune_hint & CY_JUST_SET) != 0) : 1))
275
    {
276
      do { word __d = ( 0 ) + ( 0 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0);
277
      recurse(ADD_CIO, n_values,  (0x20 + 0) ,  (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET | CY_0);
278
      do { word __d = ( 0 ) - ( 0 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0);
279
      recurse(SUB_CIO, n_values,  (0x20 + 0) ,  (0x20 + 0) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
280
      do { word __d = ( 0 ) - ( -1 ) - (( ci)); ( co) = ( ci) ? __d >= ( 0 ) : __d > ( 0 ); (v) = __d; } while (0);
281
      recurse(SUB_CIO, n_values,  (0x20 + 0) ,  (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  CY_JUST_SET | CY_1);
282
      do { word __d = ( 0 ) + ( -1 ) + (( ci)); ( co) = ( ci) ? __d <= ( 0 ) : __d < ( 0 ); (v) = __d; } while (0);
283
      recurse(ADD_CIO, n_values,  (0x20 + 0) ,  (0x20 + -1) , v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
284
 
285
    }
286
 
287
  if (allowed_cost > 1)
288
    {
289
      ((v) = ( 0x80000000 ), ( co) = ( ci));
290
      recurse(COPY, n_values,  (0x20 - 2) ,  0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
291
 
292
      ((v) = ( -1 ), ( co) = ( ci));
293
      recurse(COPY, n_values,  (0x20 + -1) ,  0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
294
 
295
      ((v) = ( 1 ), ( co) = ( ci));
296
      recurse(COPY, n_values,  (0x20 + 1) ,  0, v, 1, sequence, n_insns, values, n_values + 1, goal_value, allowed_cost, co,  prune_hint & ~CY_JUST_SET);
297
    }
298
}

powered by: WebSVN 2.1.0

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