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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [bfin/] [predicates.md] - Blame information for rev 203

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

Line No. Rev Author Line
1 38 julius
;; Predicate definitions for the Blackfin.
2
;; Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
3
;; Contributed by Analog Devices.
4
;;
5
;; This file is part of GCC.
6
;;
7
;; GCC is free software; you can redistribute it and/or modify
8
;; it under the terms of the GNU General Public License as published by
9
;; the Free Software Foundation; either version 3, or (at your option)
10
;; any later version.
11
;;
12
;; GCC is distributed in the hope that it will be useful,
13
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
;; GNU General Public License for more details.
16
;;
17
;; You should have received a copy of the GNU General Public License
18
;; along with GCC; see the file COPYING3.  If not see
19
;; .
20
 
21
;; Return nonzero iff OP is one of the integer constants 1 or 2.
22
(define_predicate "pos_scale_operand"
23
  (and (match_code "const_int")
24
       (match_test "INTVAL (op) == 1 || INTVAL (op) == 2")))
25
 
26
;; Return nonzero iff OP is one of the integer constants 2 or 4.
27
(define_predicate "scale_by_operand"
28
  (and (match_code "const_int")
29
       (match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
30
 
31
;; Return nonzero if OP is a constant that consists of two parts; lower
32
;; bits all zero and upper bits all ones.  In this case, we can perform
33
;; an AND operation with a sequence of two shifts.  Don't return nonzero
34
;; if the constant would be cheap to load.
35
(define_predicate "highbits_operand"
36
  (and (match_code "const_int")
37
       (match_test "log2constp (-INTVAL (op)) && !CONST_7BIT_IMM_P (INTVAL (op))")))
38
 
39
;; Return nonzero if OP is suitable as a right-hand side operand for an
40
;; andsi3 operation.
41
(define_predicate "rhs_andsi3_operand"
42
  (ior (match_operand 0 "register_operand")
43
       (and (match_code "const_int")
44
            (match_test "log2constp (~INTVAL (op)) || INTVAL (op) == 255 || INTVAL (op) == 65535"))))
45
 
46
;; Return nonzero if OP is a register or a constant with exactly one bit
47
;; set.
48
(define_predicate "regorlog2_operand"
49
  (ior (match_operand 0 "register_operand")
50
       (and (match_code "const_int")
51
            (match_test "log2constp (INTVAL (op))"))))
52
 
53
;; Return nonzero if OP is a register or an integer constant.
54
(define_predicate "reg_or_const_int_operand"
55
  (ior (match_operand 0 "register_operand")
56
       (match_code "const_int")))
57
 
58
(define_predicate "const01_operand"
59
  (and (match_code "const_int")
60
       (match_test "op == const0_rtx || op == const1_rtx")))
61
 
62
(define_predicate "vec_shift_operand"
63
  (ior (and (match_code "const_int")
64
            (match_test "INTVAL (op) >= -16 && INTVAL (op) < 15"))
65
       (match_operand 0 "register_operand")))
66
 
67
;; Like register_operand, but make sure that hard regs have a valid mode.
68
(define_predicate "valid_reg_operand"
69
  (match_operand 0 "register_operand")
70
{
71
  if (GET_CODE (op) == SUBREG)
72
    op = SUBREG_REG (op);
73
  if (REGNO (op) < FIRST_PSEUDO_REGISTER)
74
    return HARD_REGNO_MODE_OK (REGNO (op), mode);
75
  return 1;
76
})
77
 
78
;; Return nonzero if OP is a LC register.
79
(define_predicate "lc_register_operand"
80
  (and (match_code "reg")
81
       (match_test "REGNO (op) == REG_LC0 || REGNO (op) == REG_LC1")))
82
 
83
;; Return nonzero if OP is a LT register.
84
(define_predicate "lt_register_operand"
85
  (and (match_code "reg")
86
       (match_test "REGNO (op) == REG_LT0 || REGNO (op) == REG_LT1")))
87
 
88
;; Return nonzero if OP is a LB register.
89
(define_predicate "lb_register_operand"
90
  (and (match_code "reg")
91
       (match_test "REGNO (op) == REG_LB0 || REGNO (op) == REG_LB1")))
92
 
93
;; Return nonzero if OP is a register or a 7 bit signed constant.
94
(define_predicate "reg_or_7bit_operand"
95
  (ior (match_operand 0 "register_operand")
96
       (and (match_code "const_int")
97
            (match_test "CONST_7BIT_IMM_P (INTVAL (op))"))))
98
 
99
;; Return nonzero if OP is a register other than DREG and PREG.
100
(define_predicate "nondp_register_operand"
101
  (match_operand 0 "register_operand")
102
{
103
  unsigned int regno;
104
  if (GET_CODE (op) == SUBREG)
105
    op = SUBREG_REG (op);
106
 
107
  regno = REGNO (op);
108
  return (regno >= FIRST_PSEUDO_REGISTER || !DP_REGNO_P (regno));
109
})
110
 
111
;; Return nonzero if OP is a register other than DREG and PREG, or MEM.
112
(define_predicate "nondp_reg_or_memory_operand"
113
  (ior (match_operand 0 "nondp_register_operand")
114
       (match_operand 0 "memory_operand")))
115
 
116
;; Return nonzero if OP is a register or, when negated, a 7 bit signed
117
;; constant.
118
(define_predicate "reg_or_neg7bit_operand"
119
  (ior (match_operand 0 "register_operand")
120
       (and (match_code "const_int")
121
            (match_test "CONST_7BIT_IMM_P (-INTVAL (op))"))))
122
 
123
;; Used for secondary reloads, this function returns 1 if OP is of the
124
;; form (plus (fp) (const_int)).
125
(define_predicate "fp_plus_const_operand"
126
  (match_code "plus")
127
{
128
  rtx op1, op2;
129
 
130
  op1 = XEXP (op, 0);
131
  op2 = XEXP (op, 1);
132
  return (REG_P (op1)
133
          && (REGNO (op1) == FRAME_POINTER_REGNUM
134
              || REGNO (op1) == STACK_POINTER_REGNUM)
135
          && GET_CODE (op2) == CONST_INT);
136
})
137
 
138
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
139
;; possibly with an offset.
140
(define_predicate "symbolic_operand"
141
  (ior (match_code "symbol_ref,label_ref")
142
       (and (match_code "const")
143
            (match_test "GET_CODE (XEXP (op,0)) == PLUS
144
                         && (GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
145
                             || GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
146
                         && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT"))))
147
 
148
;; Returns 1 if OP is a plain constant or matched by symbolic_operand.
149
(define_predicate "symbolic_or_const_operand"
150
  (ior (match_code "const_int,const_double")
151
       (match_operand 0 "symbolic_operand")))
152
 
153
;; Returns 1 if OP is a SYMBOL_REF.
154
(define_predicate "symbol_ref_operand"
155
  (match_code "symbol_ref"))
156
 
157
;; True for any non-virtual or eliminable register.  Used in places where
158
;; instantiation of such a register may cause the pattern to not be recognized.
159
(define_predicate "register_no_elim_operand"
160
  (match_operand 0 "register_operand")
161
{
162
  if (GET_CODE (op) == SUBREG)
163
    op = SUBREG_REG (op);
164
  return !(op == arg_pointer_rtx
165
           || op == frame_pointer_rtx
166
           || (REGNO (op) >= FIRST_PSEUDO_REGISTER
167
               && REGNO (op) <= LAST_VIRTUAL_REGISTER));
168
})
169
 
170
;; Test for an operator valid in a conditional branch
171
(define_predicate "bfin_cbranch_operator"
172
  (match_code "eq,ne"))

powered by: WebSVN 2.1.0

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