Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / config / mmix / predicates.md
blobc74c561b57d163770aec424b52fd27ce48ffddab
1 ;; Operand and operator predicates for the GCC MMIX port.
2 ;; Copyright (C) 2005 Free Software Foundation, Inc.
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 ;; True if this is a foldable comparison operator
22 ;; - one where a the result of (compare:CC (reg) (const_int 0)) can be
23 ;; replaced by (reg).  */
25 (define_predicate "mmix_foldable_comparison_operator"
26   (match_code "ne, eq, ge, gt, le, lt, gtu, leu")
28   RTX_CODE code = GET_CODE (op);
30   if (mode == VOIDmode)
31     mode = GET_MODE (op);
33   /* This little bit is why the body of this predicate is kept as C.  */
34   if (mode == VOIDmode)
35     mode = GET_MODE (XEXP (op, 0));
37   return ((mode == CCmode || mode == DImode)
38           && (code == NE || code == EQ || code == GE || code == GT
39               || code == LE || code == LT))
40     /* FIXME: This may be a stupid trick.  What happens when GCC wants to
41        reverse the condition?  Can it do that by itself?  Maybe it can
42        even reverse the condition to fit a foldable one in the first
43        place?  */
44     || (mode == CC_UNSmode && (code == GTU || code == LEU));
47 ;; Like comparison_operator, but only true if this comparison operator is
48 ;; applied to a valid mode.  Needed to avoid jump.c generating invalid
49 ;; code with -ffast-math (gcc.dg/20001228-1.c).
51 (define_predicate "mmix_comparison_operator"
52   (match_operand 0 "comparison_operator")
54   RTX_CODE code = GET_CODE (op);
56   /* Comparison operators usually don't have a mode, but let's try and get
57      one anyway for the day that changes.  */
58   if (mode == VOIDmode)
59     mode = GET_MODE (op);
61   /* Get the mode from the first operand if we don't have one.
62      Also the reason why we do this in C.  */
63   if (mode == VOIDmode)
64     mode = GET_MODE (XEXP (op, 0));
66   /* FIXME: This needs to be kept in sync with the tables in
67      mmix_output_condition.  */
68   return
69     mode == VOIDmode
70     || (mode == CC_FUNmode
71         && (code == ORDERED || code == UNORDERED))
72     || (mode == CC_FPmode
73         && (code == GT || code == LT))
74     || (mode == CC_FPEQmode
75         && (code == NE || code == EQ))
76     || (mode == CC_UNSmode
77         && (code == GEU || code == GTU || code == LEU || code == LTU))
78     || (mode == CCmode
79         && (code == NE || code == EQ || code == GE || code == GT
80             || code == LE || code == LT))
81     || (mode == DImode
82         && (code == NE || code == EQ || code == GE || code == GT
83             || code == LE || code == LT || code == LEU || code == GTU));
86 ;; True if this is a register with a condition-code mode.
88 (define_predicate "mmix_reg_cc_operand"
89   (and (match_operand 0 "register_operand")
90        (ior (match_test "GET_MODE (op) == CCmode")
91             (ior (match_test "GET_MODE (op) == CC_UNSmode")
92                  (ior (match_test "GET_MODE (op) == CC_FPmode")
93                       (ior (match_test "GET_MODE (op) == CC_FPEQmode")
94                            (match_test "GET_MODE (op) == CC_FUNmode")))))))
96 ;; True if this is an address_operand or a symbolic operand.
98 (define_predicate "mmix_symbolic_or_address_operand"
99   (match_code "symbol_ref, label_ref, const, subreg, reg, plus")
101   switch (GET_CODE (op))
102     {
103     case SYMBOL_REF:
104     case LABEL_REF:
105       return 1;
106     case CONST:
107       /* The reason why this body still is C.  */
108       op = XEXP (op, 0);
109       if ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
110            || GET_CODE (XEXP (op, 0)) == LABEL_REF)
111           && (GET_CODE (XEXP (op, 1)) == CONST_INT
112               || (GET_CODE (XEXP (op, 1)) == CONST_DOUBLE
113                   && GET_MODE (XEXP (op, 1)) == VOIDmode)))
114         return 1;
115       /* Fall through.  */
116     default:
117       return address_operand (op, mode);
118     }
121 ;; True if this is a register or CONST_INT (or CONST_DOUBLE for DImode).
122 ;; We could narrow the value down with a couple of predicates, but that
123 ;; doesn't seem to be worth it at the moment.
125 (define_predicate "mmix_reg_or_constant_operand"
126   (ior (match_operand 0 "register_operand")
127        (ior (match_code "const_int")
128             (and (match_code "const_double")
129                  (match_test "GET_MODE (op) == VOIDmode")))))
131 ;; True if this is a register or 0 (int or float).
133 (define_predicate "mmix_reg_or_0_operand"
134   (ior
135    (match_operand 0 "register_operand")
136    (ior
137     (and (match_code "const_int")
138          (match_test "op == const0_rtx"))
139     (and
140      (match_code "const_double")
141      ;; FIXME: Is mode calculation necessary and correct?
142      (match_test
143       "op == CONST0_RTX (mode == VOIDmode ? GET_MODE (op) : mode)")))))
145 ;; True if this is a register or an int 0..255.
147 (define_predicate "mmix_reg_or_8bit_operand"
148   (ior
149    (match_operand 0 "register_operand")
150    (and (match_code "const_int")
151         (match_test "CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')"))))