Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / config / stormy16 / predicates.md
blob9cfbb01b875e57485babf6b5f93c244f8e5f3835
1 ;; Predicate definitions for XSTORMY16.
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.
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
29           || code == ASHIFTRT
30           || code == LSHIFTRT);
33 ;; Return 1 if this is an EQ or NE operator.
35 (define_predicate "equality_operator"
36   (match_code "eq,ne")
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
43 ;; operator.
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);
57   
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"
65   (match_code "mem")
67   if (GET_MODE (op) != mode)
68     return 0;
69   if (GET_CODE (op) == MEM)
70     op = XEXP (op, 0);
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);
75   else
76     return 0;
77   if (GET_CODE (op) == CONST_INT)
78     {
79       HOST_WIDE_INT i = INTVAL (op);
80       return (i >= 0x7f00 && i < 0x7fff);
81     }
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))
100     return 0;
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")
110   HOST_WIDE_INT i;
111   if (GET_CODE (op) != CONST_INT)
112     return 0;
113   i = ~ INTVAL (op);
114   if (mode == QImode)
115     i &= 0xff;
116   if (mode == HImode)
117     i &= 0xffff;
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")
126   HOST_WIDE_INT i;
127   if (GET_CODE (op) != CONST_INT)
128     return 0;
129   i = INTVAL (op);
130   if (mode == QImode)
131     i &= 0xff;
132   if (mode == HImode)
133     i &= 0xffff;
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'));