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

Subversion Repositories scarts

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

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

Line No. Rev Author Line
1 12 jlechner
;; Predicate definitions for Motorola 68000.
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
;; Special case of a general operand that's used as a source
22
;; operand. Use this to permit reads from PC-relative memory when
23
;; -mpcrel is specified.
24
 
25
(define_predicate "general_src_operand"
26
  (match_code "const_int,const_double,const,symbol_ref,label_ref,subreg,reg,mem")
27
{
28
  if (TARGET_PCREL
29
      && GET_CODE (op) == MEM
30
      && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
31
          || GET_CODE (XEXP (op, 0)) == LABEL_REF
32
          || GET_CODE (XEXP (op, 0)) == CONST))
33
    return 1;
34
  return general_operand (op, mode);
35
})
36
 
37
;; Special case of a nonimmediate operand that's used as a source. Use
38
;; this to permit reads from PC-relative memory when -mpcrel is
39
;; specified.
40
 
41
(define_predicate "nonimmediate_src_operand"
42
  (match_code "subreg,reg,mem")
43
{
44
  if (TARGET_PCREL && GET_CODE (op) == MEM
45
      && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
46
          || GET_CODE (XEXP (op, 0)) == LABEL_REF
47
          || GET_CODE (XEXP (op, 0)) == CONST))
48
    return 1;
49
  return nonimmediate_operand (op, mode);
50
})
51
 
52
;; Special case of a memory operand that's used as a source. Use this
53
;; to permit reads from PC-relative memory when -mpcrel is specified.
54
 
55
(define_predicate "memory_src_operand"
56
  (match_code "subreg,mem")
57
{
58
  if (TARGET_PCREL && GET_CODE (op) == MEM
59
      && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
60
          || GET_CODE (XEXP (op, 0)) == LABEL_REF
61
          || GET_CODE (XEXP (op, 0)) == CONST))
62
    return 1;
63
  return memory_operand (op, mode);
64
})
65
 
66
;; Similar to general_operand, but exclude stack_pointer_rtx.
67
 
68
(define_predicate "not_sp_operand"
69
  (match_code "subreg,reg,mem")
70
{
71
  return op != stack_pointer_rtx && nonimmediate_operand (op, mode);
72
})
73
 
74
;; Predicate that accepts only a pc-relative address.  This is needed
75
;; because pc-relative addresses don't satisfy the predicate
76
;; "general_src_operand".
77
 
78
(define_predicate "pcrel_address"
79
  (match_code "symbol_ref,label_ref,const")
80
{
81
  return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF
82
          || GET_CODE (op) == CONST);
83
})
84
 
85
;; Accept integer operands in the range 0..0xffffffff.  We have to
86
;; check the range carefully since this predicate is used in DImode
87
;; contexts.  Also, we need some extra crud to make it work when
88
;; hosted on 64-bit machines.
89
 
90
(define_predicate "const_uint32_operand"
91
  (match_code "const_int,const_double")
92
{
93
  /* It doesn't make sense to ask this question with a mode that is
94
     not larger than 32 bits.  */
95
  if (GET_MODE_BITSIZE (mode) <= 32)
96
    abort ();
97
 
98
#if HOST_BITS_PER_WIDE_INT > 32
99
  /* All allowed constants will fit a CONST_INT.  */
100
  return (GET_CODE (op) == CONST_INT
101
          && (INTVAL (op) >= 0 && INTVAL (op) <= 0xffffffffL));
102
#else
103
  return (GET_CODE (op) == CONST_INT
104
          || (GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_HIGH (op) == 0));
105
#endif
106
})
107
 
108
;; Accept integer operands in the range -0x80000000..0x7fffffff.  We
109
;; have to check the range carefully since this predicate is used in
110
;; DImode contexts.
111
 
112
(define_predicate "const_sint32_operand"
113
  (match_code "const_int")
114
{
115
  /* It doesn't make sense to ask this question with a mode that is
116
     not larger than 32 bits.  */
117
  if (GET_MODE_BITSIZE (mode) <= 32)
118
    abort ();
119
 
120
  /* All allowed constants will fit a CONST_INT.  */
121
  return (GET_CODE (op) == CONST_INT
122
          && (INTVAL (op) >= (-0x7fffffff - 1) && INTVAL (op) <= 0x7fffffff));
123
})
124
 
125
;; Return true if X is a valid comparison operator for the dbcc
126
;; instruction.  Note it rejects floating point comparison
127
;; operators. (In the future we could use Fdbcc).  It also rejects
128
;; some comparisons when CC_NO_OVERFLOW is set.
129
 
130
(define_predicate "valid_dbcc_comparison_p"
131
  (match_code "eq,ne,gtu,ltu,geu,leu,gt,lt,ge,le")
132
{
133
  return valid_dbcc_comparison_p_2 (op, mode);
134
})
135
 
136
;; Check for sign_extend or zero_extend.  Used for bit-count operands.
137
 
138
(define_predicate "extend_operator"
139
  (match_code "sign_extend,zero_extend")
140
{
141
  if (mode != VOIDmode && GET_MODE (op) != mode)
142
    return 0;
143
  switch (GET_CODE (op))
144
    {
145
    case SIGN_EXTEND:
146
    case ZERO_EXTEND:
147
      return 1;
148
    default:
149
      return 0;
150
    }
151
})
152
 
153
;; Returns true if OP is either a symbol reference or a sum of a
154
;; symbol reference and a constant.
155
 
156
(define_predicate "symbolic_operand"
157
  (match_code "symbol_ref,label_ref,const")
158
{
159
  switch (GET_CODE (op))
160
    {
161
    case SYMBOL_REF:
162
    case LABEL_REF:
163
      return true;
164
 
165
    case CONST:
166
      op = XEXP (op, 0);
167
      return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
168
               || GET_CODE (XEXP (op, 0)) == LABEL_REF)
169
              && GET_CODE (XEXP (op, 1)) == CONST_INT);
170
 
171
#if 0 /* Deleted, with corresponding change in m68k.h,
172
         so as to fit the specs.  No CONST_DOUBLE is ever symbolic.  */
173
    case CONST_DOUBLE:
174
      return GET_MODE (op) == mode;
175
#endif
176
 
177
    default:
178
      return false;
179
    }
180
})
181
 
182
;; TODO: Add a comment here.
183
 
184
(define_predicate "post_inc_operand"
185
  (match_code "mem")
186
{
187
  return MEM_P (op) && GET_CODE (XEXP (op, 0)) == POST_INC;
188
})
189
 
190
;; TODO: Add a comment here.
191
 
192
(define_predicate "pre_dec_operand"
193
  (match_code "mem")
194
{
195
  return MEM_P (op) && GET_CODE (XEXP (op, 0)) == PRE_DEC;
196
})

powered by: WebSVN 2.1.0

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