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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [config/] [stormy16/] [predicates.md] - Blame information for rev 859

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

Line No. Rev Author Line
1 282 jeremybenn
;; Predicate definitions for XSTORMY16.
2
;; Copyright (C) 2005, 2007, 2008 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 3, 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 COPYING3.  If not see
18
;; .
19
 
20
;; Return 1 if OP is a shift operator.
21
 
22
(define_predicate "shift_operator"
23
  (match_code "ashift,ashiftrt,lshiftrt")
24
{
25
  enum rtx_code code = GET_CODE (op);
26
 
27
  return (code == ASHIFT
28
          || code == ASHIFTRT
29
          || code == LSHIFTRT);
30
})
31
 
32
;; Return 1 if this is an EQ or NE operator.
33
 
34
(define_predicate "equality_operator"
35
  (match_code "eq,ne")
36
{
37
  return ((mode == VOIDmode || GET_MODE (op) == mode)
38
          && (GET_CODE (op) == EQ || GET_CODE (op) == NE));
39
})
40
 
41
;; Return 1 if this is a comparison operator but not an EQ or NE
42
;; operator.
43
 
44
(define_predicate "inequality_operator"
45
  (match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
46
{
47
  return comparison_operator (op, mode) && ! equality_operator (op, mode);
48
})
49
 
50
;; Return 1 if this is a LT, GE, LTU, or GEU operator.
51
 
52
(define_predicate "xstormy16_ineqsi_operator"
53
  (match_code "lt,ge,ltu,geu")
54
{
55
  enum rtx_code code = GET_CODE (op);
56
 
57
  return ((mode == VOIDmode || GET_MODE (op) == mode)
58
          && (code == LT || code == GE || code == LTU || code == GEU));
59
})
60
 
61
;; Predicate for MEMs that can use special 8-bit addressing.
62
 
63
(define_predicate "xstormy16_below100_operand"
64
  (match_code "mem")
65
{
66
  if (GET_MODE (op) != mode)
67
    return 0;
68
  if (GET_CODE (op) == MEM)
69
    op = XEXP (op, 0);
70
  else if (GET_CODE (op) == SUBREG
71
           && GET_CODE (XEXP (op, 0)) == MEM
72
           && !MEM_VOLATILE_P (XEXP (op, 0)))
73
    op = XEXP (XEXP (op, 0), 0);
74
  else
75
    return 0;
76
  if (GET_CODE (op) == CONST_INT)
77
    {
78
      HOST_WIDE_INT i = INTVAL (op);
79
      return (i >= 0x7f00 && i < 0x7fff);
80
    }
81
  return xstormy16_below100_symbol (op, HImode);
82
})
83
 
84
;; TODO: Add a comment here.
85
 
86
(define_predicate "xstormy16_below100_or_register"
87
  (match_code "mem,reg,subreg")
88
{
89
  return (xstormy16_below100_operand (op, mode)
90
          || register_operand (op, mode));
91
})
92
 
93
;; TODO: Add a comment here.
94
 
95
(define_predicate "xstormy16_splittable_below100_or_register"
96
  (match_code "mem,reg,subreg")
97
{
98
  if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
99
    return 0;
100
  return (xstormy16_below100_operand (op, mode)
101
          || register_operand (op, mode));
102
})
103
 
104
;; Predicate for constants with exactly one bit not set.
105
 
106
(define_predicate "xstormy16_onebit_clr_operand"
107
  (match_code "const_int")
108
{
109
  HOST_WIDE_INT i;
110
  if (GET_CODE (op) != CONST_INT)
111
    return 0;
112
  i = ~ INTVAL (op);
113
  if (mode == QImode)
114
    i &= 0xff;
115
  if (mode == HImode)
116
    i &= 0xffff;
117
  return exact_log2 (i) != -1;
118
})
119
 
120
;; Predicate for constants with exactly one bit set.
121
 
122
(define_predicate "xstormy16_onebit_set_operand"
123
  (match_code "const_int")
124
{
125
  HOST_WIDE_INT i;
126
  if (GET_CODE (op) != CONST_INT)
127
    return 0;
128
  i = INTVAL (op);
129
  if (mode == QImode)
130
    i &= 0xff;
131
  if (mode == HImode)
132
    i &= 0xffff;
133
  return exact_log2 (i) != -1;
134
})
135
 
136
;; TODO: Add a comment here.
137
 
138
(define_predicate "nonimmediate_nonstack_operand"
139
  (match_code "reg,mem,subreg")
140
{
141
  /* 'Q' is for pushes, 'R' for pops.  */
142
  return (nonimmediate_operand (op, mode)
143
          && ! xstormy16_extra_constraint_p (op, 'Q')
144
          && ! xstormy16_extra_constraint_p (op, 'R'));
145
})
146
 
147
(define_predicate "xstormy16_carry_plus_operand"
148
  (match_code "plus")
149
{
150
  return (GET_CODE (XEXP (op, 1)) == CONST_INT
151
          && (INTVAL (XEXP (op, 1)) < -4 || INTVAL (XEXP (op, 1)) > 4));
152
})
153
 
154
(define_predicate "xs_hi_general_operand"
155
  (match_code "const_int,reg,subreg,mem,symbol_ref,label_ref,const")
156
{
157
  if ((GET_CODE (op) == CONST_INT)
158
       && ((INTVAL (op) >= 32768) || (INTVAL (op) < -32768)))
159
    {
160
      error ("constant halfword load operand out of range");
161
      return false;
162
    }
163
 
164
  return general_operand (op, mode);
165
})
166
 
167
(define_predicate "xs_hi_nonmemory_operand"
168
  (match_code "const_int,reg,subreg,const")
169
{
170
  if ((GET_CODE (op) == CONST_INT)
171
       && ((INTVAL (op) >= 32768) || (INTVAL (op) < -32768)))
172
    {
173
      error ("constant arithmetic operand out of range");
174
      return false;
175
    }
176
 
177
  return nonmemory_operand (op, mode);
178
})

powered by: WebSVN 2.1.0

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