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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [config/] [pa/] [predicates.md] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
;; Predicate definitions for HP PA-RISC.
2
;; Copyright (C) 2005 Free Software Foundation, Inc.
3
;;
4
;; This file is part of GCC.
5
;;
6
;; GCC is free software; you can redistribute it and/or modify
7
;; it under the terms of the GNU General Public License as published by
8
;; the Free Software Foundation; either version 2, or (at your option)
9
;; any later version.
10
;;
11
;; GCC is distributed in the hope that it will be useful,
12
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;; GNU General Public License for more details.
15
;;
16
;; You should have received a copy of the GNU General Public License
17
;; along with GCC; see the file COPYING.  If not, write to
18
;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19
;; Boston, MA 02110-1301, USA.
20
 
21
;; Return nonzero only if OP is a register of mode MODE, or
22
;; CONST0_RTX.
23
 
24
(define_predicate "reg_or_0_operand"
25
  (match_code "subreg,reg,const_int,const_double")
26
{
27
  return (op == CONST0_RTX (mode) || register_operand (op, mode));
28
})
29
 
30
;; Return nonzero if OP is suitable for use in a call to a named
31
;; function.
32
;;
33
;; For 2.5 try to eliminate either call_operand_address or
34
;; function_label_operand, they perform very similar functions.
35
 
36
(define_predicate "call_operand_address"
37
  (match_code "label_ref,symbol_ref,const_int,const_double,const,high")
38
{
39
  return (GET_MODE (op) == word_mode
40
          && CONSTANT_P (op) && ! TARGET_PORTABLE_RUNTIME);
41
})
42
 
43
;; Return 1 iff OP is an indexed memory operand.
44
 
45
(define_predicate "indexed_memory_operand"
46
  (match_code "subreg,mem")
47
{
48
  if (GET_MODE (op) != mode)
49
    return 0;
50
 
51
  /* Before reload, a (SUBREG (MEM...)) forces reloading into a register.  */
52
  if (reload_completed && GET_CODE (op) == SUBREG)
53
    op = SUBREG_REG (op);
54
 
55
  if (GET_CODE (op) != MEM || symbolic_memory_operand (op, mode))
56
    return 0;
57
 
58
  op = XEXP (op, 0);
59
 
60
  return (memory_address_p (mode, op) && IS_INDEX_ADDR_P (op));
61
})
62
 
63
;; TODO: Add a comment.
64
 
65
(define_predicate "symbolic_operand"
66
  (match_code "symbol_ref,label_ref,const")
67
{
68
  switch (GET_CODE (op))
69
    {
70
    case SYMBOL_REF:
71
      return !SYMBOL_REF_TLS_MODEL (op);
72
    case LABEL_REF:
73
      return 1;
74
    case CONST:
75
      op = XEXP (op, 0);
76
      return (((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
77
                && !SYMBOL_REF_TLS_MODEL (XEXP (op, 0)))
78
               || GET_CODE (XEXP (op, 0)) == LABEL_REF)
79
              && GET_CODE (XEXP (op, 1)) == CONST_INT);
80
    default:
81
      return 0;
82
    }
83
})
84
 
85
;; Return truth value of statement that OP is a symbolic memory
86
;; operand of mode MODE.
87
 
88
(define_predicate "symbolic_memory_operand"
89
  (match_code "subreg,mem")
90
{
91
  if (GET_CODE (op) == SUBREG)
92
    op = SUBREG_REG (op);
93
  if (GET_CODE (op) != MEM)
94
    return 0;
95
  op = XEXP (op, 0);
96
  return ((GET_CODE (op) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (op))
97
         || GET_CODE (op) == CONST || GET_CODE (op) == HIGH
98
         || GET_CODE (op) == LABEL_REF);
99
})
100
 
101
;; Return true if OP is a symbolic operand for the TLS Global Dynamic model.
102
(define_predicate "tgd_symbolic_operand"
103
  (and (match_code "symbol_ref")
104
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_GLOBAL_DYNAMIC")))
105
 
106
;; Return true if OP is a symbolic operand for the TLS Local Dynamic model.
107
(define_predicate "tld_symbolic_operand"
108
  (and (match_code "symbol_ref")
109
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC")))
110
 
111
;; Return true if OP is a symbolic operand for the TLS Initial Exec model.
112
(define_predicate "tie_symbolic_operand"
113
  (and (match_code "symbol_ref")
114
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC")))
115
 
116
;; Return true if OP is a symbolic operand for the TLS Local Exec model.
117
(define_predicate "tle_symbolic_operand"
118
  (and (match_code "symbol_ref")
119
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC")))
120
 
121
 
122
;; Return 1 if the operand is a register operand or a non-symbolic
123
;; memory operand after reload.  This predicate is used for branch
124
;; patterns that internally handle register reloading.  We need to
125
;; accept non-symbolic memory operands after reload to ensure that the
126
;; pattern is still valid if reload didn't find a hard register for
127
;; the operand.
128
 
129
(define_predicate "reg_before_reload_operand"
130
  (match_code "reg,mem")
131
{
132
  /* Don't accept a SUBREG since it will need a reload.  */
133
  if (GET_CODE (op) == SUBREG)
134
    return 0;
135
 
136
  if (register_operand (op, mode))
137
    return 1;
138
 
139
  if (reload_completed
140
      && memory_operand (op, mode)
141
      && !symbolic_memory_operand (op, mode))
142
    return 1;
143
 
144
  return 0;
145
})
146
 
147
;; Return 1 if the operand is either a register, zero, or a memory
148
;; operand that is not symbolic.
149
 
150
(define_predicate "reg_or_0_or_nonsymb_mem_operand"
151
  (match_code "subreg,reg,mem,const_int,const_double")
152
{
153
  if (register_operand (op, mode))
154
    return 1;
155
 
156
  if (op == CONST0_RTX (mode))
157
    return 1;
158
 
159
  if (GET_CODE (op) == SUBREG)
160
    op = SUBREG_REG (op);
161
 
162
  if (GET_CODE (op) != MEM)
163
    return 0;
164
 
165
  /* Until problems with management of the REG_POINTER flag are resolved,
166
     we need to delay creating move insns with unscaled indexed addresses
167
     until CSE is not expected.  */
168
  if (!TARGET_NO_SPACE_REGS
169
      && !cse_not_expected
170
      && GET_CODE (XEXP (op, 0)) == PLUS
171
      && REG_P (XEXP (XEXP (op, 0), 0))
172
      && REG_P (XEXP (XEXP (op, 0), 1)))
173
    return 0;
174
 
175
  return (!symbolic_memory_operand (op, mode)
176
          && memory_address_p (mode, XEXP (op, 0)));
177
})
178
 
179
;; Accept anything that can be used as a destination operand for a
180
;; move instruction.  We don't accept indexed memory operands since
181
;; they are supported only for floating point stores.
182
 
183
(define_predicate "move_dest_operand"
184
  (match_code "subreg,reg,mem")
185
{
186
  if (register_operand (op, mode))
187
    return 1;
188
 
189
  if (GET_MODE (op) != mode)
190
    return 0;
191
 
192
  if (GET_CODE (op) == SUBREG)
193
    op = SUBREG_REG (op);
194
 
195
  if (GET_CODE (op) != MEM || symbolic_memory_operand (op, mode))
196
    return 0;
197
 
198
  op = XEXP (op, 0);
199
 
200
  return (memory_address_p (mode, op)
201
          && !IS_INDEX_ADDR_P (op)
202
          && !IS_LO_SUM_DLT_ADDR_P (op));
203
})
204
 
205
;; Accept anything that can be used as a source operand for a move
206
;; instruction.
207
 
208
(define_predicate "move_src_operand"
209
  (match_code "subreg,reg,const_int,mem")
210
{
211
  if (register_operand (op, mode))
212
    return 1;
213
 
214
  if (GET_CODE (op) == CONST_INT)
215
    return cint_ok_for_move (INTVAL (op));
216
 
217
  if (GET_MODE (op) != mode)
218
    return 0;
219
 
220
  if (GET_CODE (op) == SUBREG)
221
    op = SUBREG_REG (op);
222
 
223
  if (GET_CODE (op) != MEM)
224
    return 0;
225
 
226
  /* Until problems with management of the REG_POINTER flag are resolved,
227
     we need to delay creating move insns with unscaled indexed addresses
228
     until CSE is not expected.  */
229
  if (!TARGET_NO_SPACE_REGS
230
      && !cse_not_expected
231
      && GET_CODE (XEXP (op, 0)) == PLUS
232
      && REG_P (XEXP (XEXP (op, 0), 0))
233
      && REG_P (XEXP (XEXP (op, 0), 1)))
234
    return 0;
235
 
236
  return memory_address_p (mode, XEXP (op, 0));
237
})
238
 
239
;; Accept anything that can be used as the source operand for a
240
;; prefetch instruction with a cache-control completer.
241
 
242
(define_predicate "prefetch_cc_operand"
243
  (match_code "mem")
244
{
245
  if (GET_CODE (op) != MEM)
246
    return 0;
247
 
248
  op = XEXP (op, 0);
249
 
250
  /* We must reject virtual registers as we don't allow REG+D.  */
251
  if (op == virtual_incoming_args_rtx
252
      || op == virtual_stack_vars_rtx
253
      || op == virtual_stack_dynamic_rtx
254
      || op == virtual_outgoing_args_rtx
255
      || op == virtual_cfa_rtx)
256
    return 0;
257
 
258
  if (!REG_P (op) && !IS_INDEX_ADDR_P (op))
259
    return 0;
260
 
261
  /* Until problems with management of the REG_POINTER flag are resolved,
262
     we need to delay creating prefetch insns with unscaled indexed addresses
263
     until CSE is not expected.  */
264
  if (!TARGET_NO_SPACE_REGS
265
      && !cse_not_expected
266
      && GET_CODE (op) == PLUS
267
      && REG_P (XEXP (op, 0)))
268
    return 0;
269
 
270
  return memory_address_p (mode, op);
271
})
272
 
273
;; Accept anything that can be used as the source operand for a
274
;; prefetch instruction with no cache-control completer.
275
 
276
(define_predicate "prefetch_nocc_operand"
277
  (match_code "mem")
278
{
279
  if (GET_CODE (op) != MEM)
280
    return 0;
281
 
282
  op = XEXP (op, 0);
283
 
284
  /* Until problems with management of the REG_POINTER flag are resolved,
285
     we need to delay creating prefetch insns with unscaled indexed addresses
286
     until CSE is not expected.  */
287
  if (!TARGET_NO_SPACE_REGS
288
      && !cse_not_expected
289
      && GET_CODE (op) == PLUS
290
      && REG_P (XEXP (op, 0))
291
      && REG_P (XEXP (op, 1)))
292
    return 0;
293
 
294
  return memory_address_p (mode, op);
295
})
296
 
297
;; Accept REG and any CONST_INT that can be moved in one instruction
298
;; into a general register.
299
 
300
(define_predicate "reg_or_cint_move_operand"
301
  (match_code "subreg,reg,const_int")
302
{
303
  if (register_operand (op, mode))
304
    return 1;
305
 
306
  return (GET_CODE (op) == CONST_INT && cint_ok_for_move (INTVAL (op)));
307
})
308
 
309
;; TODO: Add a comment here.
310
 
311
(define_predicate "pic_label_operand"
312
  (match_code "label_ref,const")
313
{
314
  if (!flag_pic)
315
    return 0;
316
 
317
  switch (GET_CODE (op))
318
    {
319
    case LABEL_REF:
320
      return 1;
321
    case CONST:
322
      op = XEXP (op, 0);
323
      return (GET_CODE (XEXP (op, 0)) == LABEL_REF
324
              && GET_CODE (XEXP (op, 1)) == CONST_INT);
325
    default:
326
      return 0;
327
    }
328
})
329
 
330
;; TODO: Add a comment here.
331
 
332
(define_predicate "fp_reg_operand"
333
  (match_code "reg")
334
{
335
  return reg_renumber && FP_REG_P (op);
336
})
337
 
338
;; Return truth value of whether OP can be used as an operand in a
339
;; three operand arithmetic insn that accepts registers of mode MODE
340
;; or 14-bit signed integers.
341
 
342
(define_predicate "arith_operand"
343
  (match_code "subreg,reg,const_int")
344
{
345
  return (register_operand (op, mode)
346
          || (GET_CODE (op) == CONST_INT && INT_14_BITS (op)));
347
})
348
 
349
;; Return truth value of whether OP can be used as an operand in a
350
;; three operand arithmetic insn that accepts registers of mode MODE
351
;; or 11-bit signed integers.
352
 
353
(define_predicate "arith11_operand"
354
  (match_code "subreg,reg,const_int")
355
{
356
  return (register_operand (op, mode)
357
          || (GET_CODE (op) == CONST_INT && INT_11_BITS (op)));
358
})
359
 
360
;; A constant integer suitable for use in a PRE_MODIFY memory
361
;; reference.
362
 
363
(define_predicate "pre_cint_operand"
364
  (match_code "const_int")
365
{
366
  return (GET_CODE (op) == CONST_INT
367
          && INTVAL (op) >= -0x2000 && INTVAL (op) < 0x10);
368
})
369
 
370
;; A constant integer suitable for use in a POST_MODIFY memory
371
;; reference.
372
 
373
(define_predicate "post_cint_operand"
374
  (match_code "const_int")
375
{
376
  return (GET_CODE (op) == CONST_INT
377
          && INTVAL (op) < 0x2000 && INTVAL (op) >= -0x10);
378
})
379
 
380
;; TODO: Add a comment here.
381
 
382
(define_predicate "arith_double_operand"
383
  (match_code "subreg,reg,const_double")
384
{
385
  return (register_operand (op, mode)
386
          || (GET_CODE (op) == CONST_DOUBLE
387
              && GET_MODE (op) == mode
388
              && VAL_14_BITS_P (CONST_DOUBLE_LOW (op))
389
              && ((CONST_DOUBLE_HIGH (op) >= 0)
390
                  == ((CONST_DOUBLE_LOW (op) & 0x1000) == 0))));
391
})
392
 
393
;; Return truth value of whether OP is an integer which fits the range
394
;; constraining immediate operands in three-address insns, or is an
395
;; integer register.
396
 
397
(define_predicate "ireg_or_int5_operand"
398
  (match_code "const_int,reg")
399
{
400
  return ((GET_CODE (op) == CONST_INT && INT_5_BITS (op))
401
          || (GET_CODE (op) == REG && REGNO (op) > 0 && REGNO (op) < 32));
402
})
403
 
404
;; Return truth value of whether OP is an integer which fits the range
405
;; constraining immediate operands in three-address insns.
406
 
407
(define_predicate "int5_operand"
408
  (match_code "const_int")
409
{
410
  return (GET_CODE (op) == CONST_INT && INT_5_BITS (op));
411
})
412
 
413
;; Return truth value of whether OP is an integer which fits the range
414
;; constraining immediate operands in three-address insns.
415
 
416
(define_predicate "uint5_operand"
417
  (match_code "const_int")
418
{
419
  return (GET_CODE (op) == CONST_INT && INT_U5_BITS (op));
420
})
421
 
422
;; Return truth value of whether OP is an integer which fits the range
423
;; constraining immediate operands in three-address insns.
424
 
425
(define_predicate "int11_operand"
426
  (match_code "const_int")
427
{
428
  return (GET_CODE (op) == CONST_INT && INT_11_BITS (op));
429
})
430
 
431
;; Return truth value of whether OP is an integer which fits the range
432
;; constraining immediate operands in three-address insns.
433
 
434
(define_predicate "uint32_operand"
435
  (match_code "const_int,const_double")
436
{
437
#if HOST_BITS_PER_WIDE_INT > 32
438
  /* All allowed constants will fit a CONST_INT.  */
439
  return (GET_CODE (op) == CONST_INT
440
          && (INTVAL (op) >= 0 && INTVAL (op) < (HOST_WIDE_INT) 1 << 32));
441
#else
442
  return (GET_CODE (op) == CONST_INT
443
          || (GET_CODE (op) == CONST_DOUBLE
444
              && CONST_DOUBLE_HIGH (op) == 0));
445
#endif
446
})
447
 
448
;; Return truth value of whether OP is an integer which fits the range
449
;; constraining immediate operands in three-address insns.
450
 
451
(define_predicate "arith5_operand"
452
  (match_code "subreg,reg,const_int")
453
{
454
  return register_operand (op, mode) || int5_operand (op, mode);
455
})
456
 
457
;; True iff depi or extru can be used to compute (reg & OP).
458
 
459
(define_predicate "and_operand"
460
  (match_code "subreg,reg,const_int")
461
{
462
  return (register_operand (op, mode)
463
          || (GET_CODE (op) == CONST_INT && and_mask_p (INTVAL (op))));
464
})
465
 
466
;; True iff depi can be used to compute (reg | OP).
467
 
468
(define_predicate "ior_operand"
469
  (match_code "const_int")
470
{
471
  return (GET_CODE (op) == CONST_INT && ior_mask_p (INTVAL (op)));
472
})
473
 
474
;; True iff OP is a CONST_INT of the forms 0...0xxxx or
475
;; 0...01...1xxxx. Such values can be the left hand side x in (x <<
476
;; r), using the zvdepi instruction.
477
 
478
(define_predicate "lhs_lshift_cint_operand"
479
  (match_code "const_int")
480
{
481
  unsigned HOST_WIDE_INT x;
482
  if (GET_CODE (op) != CONST_INT)
483
    return 0;
484
  x = INTVAL (op) >> 4;
485
  return (x & (x + 1)) == 0;
486
})
487
 
488
;; TODO: Add a comment here.
489
 
490
(define_predicate "lhs_lshift_operand"
491
  (match_code "subreg,reg,const_int")
492
{
493
  return register_operand (op, mode) || lhs_lshift_cint_operand (op, mode);
494
})
495
 
496
;; TODO: Add a comment here.
497
 
498
(define_predicate "arith32_operand"
499
  (match_code "subreg,reg,const_int")
500
{
501
  return register_operand (op, mode) || GET_CODE (op) == CONST_INT;
502
})
503
 
504
;; TODO: Add a comment here.
505
 
506
(define_predicate "pc_or_label_operand"
507
  (match_code "pc,label_ref")
508
{
509
  return (GET_CODE (op) == PC || GET_CODE (op) == LABEL_REF);
510
})
511
 
512
;; TODO: Add a comment here.
513
 
514
(define_predicate "plus_xor_ior_operator"
515
  (match_code "plus,xor,ior")
516
{
517
  return (GET_CODE (op) == PLUS || GET_CODE (op) == XOR
518
          || GET_CODE (op) == IOR);
519
})
520
 
521
;; Return 1 if OP is a CONST_INT with the value 2, 4, or 8.  These are
522
;; the valid constant for shadd instructions.
523
 
524
(define_predicate "shadd_operand"
525
  (match_code "const_int")
526
{
527
  return (GET_CODE (op) == CONST_INT && shadd_constant_p (INTVAL (op)));
528
})
529
 
530
;; TODO: Add a comment here.
531
 
532
(define_predicate "div_operand"
533
  (match_code "reg,const_int")
534
{
535
  return (mode == SImode
536
          && ((GET_CODE (op) == REG && REGNO (op) == 25)
537
              || (GET_CODE (op) == CONST_INT && INTVAL (op) > 0
538
                  && INTVAL (op) < 16 && magic_milli[INTVAL (op)])));
539
})
540
 
541
;; Return nonzero if OP is an integer register, else return zero.
542
 
543
(define_predicate "ireg_operand"
544
  (match_code "reg")
545
{
546
  return (GET_CODE (op) == REG && REGNO (op) > 0 && REGNO (op) < 32);
547
})
548
 
549
;; Return 1 if this is a comparison operator.  This allows the use of
550
;; MATCH_OPERATOR to recognize all the branch insns.
551
 
552
(define_predicate "cmpib_comparison_operator"
553
  (match_code "eq,ne,lt,le,leu,gt,gtu,ge")
554
{
555
  return ((mode == VOIDmode || GET_MODE (op) == mode)
556
          && (GET_CODE (op) == EQ
557
              || GET_CODE (op) == NE
558
              || GET_CODE (op) == GT
559
              || GET_CODE (op) == GTU
560
              || GET_CODE (op) == GE
561
              || GET_CODE (op) == LT
562
              || GET_CODE (op) == LE
563
              || GET_CODE (op) == LEU));
564
})
565
 
566
;; Return 1 if OP is an operator suitable for use in a movb
567
;; instruction.
568
 
569
(define_predicate "movb_comparison_operator"
570
  (match_code "eq,ne,lt,ge")
571
{
572
  return (GET_CODE (op) == EQ || GET_CODE (op) == NE
573
          || GET_CODE (op) == LT || GET_CODE (op) == GE);
574
})

powered by: WebSVN 2.1.0

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