1 ;; Predicate definitions for XSTORMY16.
2 ;; Copyright (C) 2005 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
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)
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.
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.
21 ;; Return 1 if OP is a shift operator.
23 (define_predicate "shift_operator"
24 (match_code "ashift,ashiftrt,lshiftrt")
26 enum rtx_code code = GET_CODE (op);
28 return (code == ASHIFT
33 ;; Return 1 if this is an EQ or NE operator.
35 (define_predicate "equality_operator"
38 return ((mode == VOIDmode || GET_MODE (op) == mode)
39 && (GET_CODE (op) == EQ || GET_CODE (op) == NE));
42 ;; Return 1 if this is a comparison operator but not an EQ or NE
45 (define_predicate "inequality_operator"
46 (match_code "ge,gt,le,lt,geu,gtu,leu,ltu")
48 return comparison_operator (op, mode) && ! equality_operator (op, mode);
51 ;; Return 1 if this is a LT, GE, LTU, or GEU operator.
53 (define_predicate "xstormy16_ineqsi_operator"
54 (match_code "lt,ge,ltu,geu")
56 enum rtx_code code = GET_CODE (op);
58 return ((mode == VOIDmode || GET_MODE (op) == mode)
59 && (code == LT || code == GE || code == LTU || code == GEU));
62 ;; Predicate for MEMs that can use special 8-bit addressing.
64 (define_predicate "xstormy16_below100_operand"
67 if (GET_MODE (op) != mode)
69 if (GET_CODE (op) == MEM)
71 else if (GET_CODE (op) == SUBREG
72 && GET_CODE (XEXP (op, 0)) == MEM
73 && !MEM_VOLATILE_P (XEXP (op, 0)))
74 op = XEXP (XEXP (op, 0), 0);
77 if (GET_CODE (op) == CONST_INT)
79 HOST_WIDE_INT i = INTVAL (op);
80 return (i >= 0x7f00 && i < 0x7fff);
82 return xstormy16_below100_symbol (op, HImode);
85 ;; TODO: Add a comment here.
87 (define_predicate "xstormy16_below100_or_register"
88 (match_code "mem,reg,subreg")
90 return (xstormy16_below100_operand (op, mode)
91 || register_operand (op, mode));
94 ;; TODO: Add a comment here.
96 (define_predicate "xstormy16_splittable_below100_or_register"
97 (match_code "mem,reg,subreg")
99 if (GET_CODE (op) == MEM && MEM_VOLATILE_P (op))
101 return (xstormy16_below100_operand (op, mode)
102 || register_operand (op, mode));
105 ;; Predicate for constants with exactly one bit not set.
107 (define_predicate "xstormy16_onebit_clr_operand"
108 (match_code "const_int")
111 if (GET_CODE (op) != CONST_INT)
118 return exact_log2 (i) != -1;
121 ;; Predicate for constants with exactly one bit set.
123 (define_predicate "xstormy16_onebit_set_operand"
124 (match_code "const_int")
127 if (GET_CODE (op) != CONST_INT)
134 return exact_log2 (i) != -1;
137 ;; TODO: Add a comment here.
139 (define_predicate "nonimmediate_nonstack_operand"
140 (match_code "reg,mem,subreg")
142 /* 'Q' is for pushes, 'R' for pops. */
143 return (nonimmediate_operand (op, mode)
144 && ! xstormy16_extra_constraint_p (op, 'Q')
145 && ! xstormy16_extra_constraint_p (op, 'R'));