1 |
709 |
jeremybenn |
;; Toshiba Media Processor Machine predicates
|
2 |
|
|
;; Copyright (C) 2009 Free Software Foundation, Inc.
|
3 |
|
|
;; Contributed by Red Hat Inc.
|
4 |
|
|
|
5 |
|
|
;; This file is part of GCC.
|
6 |
|
|
;;
|
7 |
|
|
;; GCC is free software; you can redistribute it and/or modify it
|
8 |
|
|
;; under the terms of the GNU General Public License as published by
|
9 |
|
|
;; the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
;; any later version.
|
11 |
|
|
;;
|
12 |
|
|
;; GCC is distributed in the hope that it will be useful, but WITHOUT
|
13 |
|
|
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
14 |
|
|
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
15 |
|
|
;; License for more details.
|
16 |
|
|
;;
|
17 |
|
|
;; You should have received a copy of the GNU General Public License
|
18 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
19 |
|
|
;; . */
|
20 |
|
|
|
21 |
|
|
;; (define_predicate "cgen_h_uint_7a1_immediate"
|
22 |
|
|
;; (match_code "const_int"))
|
23 |
|
|
;; (define_predicate "cgen_h_uint_6a2_immediate"
|
24 |
|
|
;; (match_code "const_int"))
|
25 |
|
|
;; (define_predicate "cgen_h_uint_22a4_immediate"
|
26 |
|
|
;; (match_code "const_int"))
|
27 |
|
|
;; (define_predicate "cgen_h_sint_2a1_immediate"
|
28 |
|
|
;; (match_code "const_int"))
|
29 |
|
|
;; (define_predicate "cgen_h_uint_24a1_immediate"
|
30 |
|
|
;; (match_code "const_int"))
|
31 |
|
|
;; (define_predicate "cgen_h_sint_6a1_immediate"
|
32 |
|
|
;; (match_code "const_int"))
|
33 |
|
|
;; (define_predicate "cgen_h_uint_5a4_immediate"
|
34 |
|
|
;; (match_code "const_int"))
|
35 |
|
|
;; (define_predicate "cgen_h_uint_2a1_immediate"
|
36 |
|
|
;; (match_code "const_int"))
|
37 |
|
|
;; (define_predicate "cgen_h_uint_16a1_immediate"
|
38 |
|
|
;; (match_code "const_int"))
|
39 |
|
|
;; (define_predicate "cgen_h_uint_3a1_immediate"
|
40 |
|
|
;; (match_code "const_int"))
|
41 |
|
|
;; (define_predicate "cgen_h_uint_5a1_immediate"
|
42 |
|
|
;; (match_code "const_int"))
|
43 |
|
|
;; (define_predicate "cgen_h_sint_16a1_immediate"
|
44 |
|
|
;; (match_code "const_int"))
|
45 |
|
|
;; (define_predicate "cgen_h_sint_5a8_immediate"
|
46 |
|
|
;; (match_code "const_int"))
|
47 |
|
|
;; (define_predicate "cgen_h_uint_4a1_immediate"
|
48 |
|
|
;; (match_code "const_int"))
|
49 |
|
|
|
50 |
|
|
(define_predicate "cgen_h_sint_7a2_immediate"
|
51 |
|
|
(match_code "const_int")
|
52 |
|
|
{ int i = INTVAL (op);
|
53 |
|
|
return ((i & 1) == 0 && i >= -128 && i < 128);
|
54 |
|
|
})
|
55 |
|
|
|
56 |
|
|
(define_predicate "cgen_h_sint_6a4_immediate"
|
57 |
|
|
(match_code "const_int")
|
58 |
|
|
{ int i = INTVAL (op);
|
59 |
|
|
return ((i & 3) == 0 && i >= -256 && i < 256);
|
60 |
|
|
})
|
61 |
|
|
|
62 |
|
|
;; This is used below, to simplify things.
|
63 |
|
|
(define_predicate "mep_subreg_operand"
|
64 |
|
|
(ior
|
65 |
|
|
(and (and (and (match_code "subreg")
|
66 |
|
|
(match_code "reg" "0"))
|
67 |
|
|
(match_test "REGNO (SUBREG_REG (op)) >= FIRST_PSEUDO_REGISTER"))
|
68 |
|
|
(match_test "!(reload_completed || reload_in_progress)"))
|
69 |
|
|
(and (match_code "reg")
|
70 |
|
|
(match_test "REGNO (op) >= FIRST_PSEUDO_REGISTER"))))
|
71 |
|
|
|
72 |
|
|
(define_predicate "symbolic_operand"
|
73 |
|
|
(match_code "const,symbol_ref,label_ref"))
|
74 |
|
|
|
75 |
|
|
(define_predicate "mep_farsym_operand"
|
76 |
|
|
(and (match_code "const,symbol_ref")
|
77 |
|
|
(match_test "mep_section_tag (op) == 'f'")))
|
78 |
|
|
|
79 |
|
|
(define_predicate "mep_nearsym_operand"
|
80 |
|
|
(and (match_code "const,symbol_ref,label_ref")
|
81 |
|
|
(match_test "mep_section_tag (op) != 'f'")))
|
82 |
|
|
|
83 |
|
|
(define_predicate "mep_movdest_operand"
|
84 |
|
|
(and (match_test "mep_section_tag (op) != 'f'")
|
85 |
|
|
(match_operand 0 "nonimmediate_operand")))
|
86 |
|
|
|
87 |
|
|
(define_predicate "mep_r0_15_operand"
|
88 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
89 |
|
|
(and (match_code "reg")
|
90 |
|
|
(match_test "GR_REGNO_P (REGNO (op))"))))
|
91 |
|
|
|
92 |
|
|
(define_predicate "mep_r0_operand"
|
93 |
|
|
(and (match_code "reg")
|
94 |
|
|
(ior (match_test "REGNO (op) == 0")
|
95 |
|
|
(match_test "!(reload_completed || reload_in_progress)
|
96 |
|
|
&& REGNO (op) >= FIRST_PSEUDO_REGISTER"))))
|
97 |
|
|
|
98 |
|
|
(define_predicate "mep_hi_operand"
|
99 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
100 |
|
|
(and (match_code "reg")
|
101 |
|
|
(match_test "REGNO (op) == HI_REGNO"))))
|
102 |
|
|
|
103 |
|
|
(define_predicate "mep_lo_operand"
|
104 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
105 |
|
|
(and (match_code "reg")
|
106 |
|
|
(match_test "REGNO (op) == LO_REGNO"))))
|
107 |
|
|
|
108 |
|
|
(define_predicate "mep_tp_operand"
|
109 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
110 |
|
|
(and (match_code "reg")
|
111 |
|
|
(match_test "REGNO (op) == TP_REGNO"))))
|
112 |
|
|
|
113 |
|
|
(define_predicate "mep_gp_operand"
|
114 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
115 |
|
|
(and (match_code "reg")
|
116 |
|
|
(match_test "REGNO (op) == GP_REGNO"))))
|
117 |
|
|
|
118 |
|
|
(define_predicate "mep_sp_operand"
|
119 |
|
|
(match_test "op == stack_pointer_rtx"))
|
120 |
|
|
|
121 |
|
|
(define_predicate "mep_tprel_operand"
|
122 |
|
|
(ior (match_operand 0 "mep_subreg_operand")
|
123 |
|
|
(and (match_code "reg")
|
124 |
|
|
(match_test "REGNO (op) < 8"))))
|
125 |
|
|
|
126 |
|
|
(define_predicate "mep_call_address_operand"
|
127 |
|
|
(and (match_test "mep_section_tag (op) != 'f'")
|
128 |
|
|
(and (ior (not (match_code "symbol_ref"))
|
129 |
|
|
(match_test "mep_section_tag (DECL_RTL (cfun->decl)) != 'f'
|
130 |
|
|
&& !mep_lookup_pragma_call (XSTR (op, 0))"))
|
131 |
|
|
(match_code "symbol_ref,reg"))))
|
132 |
|
|
|
133 |
|
|
(define_predicate "mep_Y_operand"
|
134 |
|
|
(and (match_code "mem")
|
135 |
|
|
(match_code "reg" "0")))
|
136 |
|
|
|
137 |
|
|
(define_predicate "mep_imm4_operand"
|
138 |
|
|
(and (match_code "const_int")
|
139 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15")))
|
140 |
|
|
|
141 |
|
|
(define_predicate "mep_reg_or_imm4_operand"
|
142 |
|
|
(ior (match_code "reg")
|
143 |
|
|
(and (match_code "const_int")
|
144 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15"))))
|
145 |
|
|
|
146 |
|
|
(define_predicate "mep_imm7a4_operand"
|
147 |
|
|
(and (match_code "const_int")
|
148 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) < 128 && INTVAL (op) % 4 == 0")))
|
149 |
|
|
|
150 |
|
|
(define_predicate "mep_slad_operand"
|
151 |
|
|
(and (match_code "const_int")
|
152 |
|
|
(match_test "INTVAL (op) == 2 || INTVAL (op) == 4")))
|
153 |
|
|
|
154 |
|
|
(define_predicate "mep_add_operand"
|
155 |
|
|
(ior (and (match_code "const")
|
156 |
|
|
(and (match_operand 0 "symbolic_operand")
|
157 |
|
|
(and (match_test "mep_section_tag(op) == 'b' || mep_section_tag(op) == 't'")
|
158 |
|
|
(ior (match_code "unspec" "0")
|
159 |
|
|
(and (match_code "plus" "0")
|
160 |
|
|
(match_code "unspec" "00"))))))
|
161 |
|
|
(match_code "const_int,reg")))
|
162 |
|
|
|
163 |
|
|
;; Return true if OP is an integer in the range 0..7 inclusive.
|
164 |
|
|
;; On the MeP-h1, shifts by such constants execute in a single stage
|
165 |
|
|
;; and shifts by larger values execute in two.
|
166 |
|
|
(define_predicate "mep_single_shift_operand"
|
167 |
|
|
(and (match_code "const_int")
|
168 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7")))
|
169 |
|
|
|
170 |
|
|
;; Return true if OP is an operation that can be performed using bsetm,
|
171 |
|
|
;; bclrm or bnotm. The possibilities are:
|
172 |
|
|
|
173 |
|
|
;; bsetm: (ior X Y), Y has one bit set
|
174 |
|
|
;; bclrm: (and X Y), Y has one bit clear
|
175 |
|
|
;; bnotm: (xor X Y), Y has one bit set.
|
176 |
|
|
(define_predicate "mep_bit_operator"
|
177 |
|
|
(and (match_code "and,ior,xor")
|
178 |
|
|
(match_test "mep_bit_position_p (XEXP (op, 1), GET_CODE (op) != AND)")))
|
179 |
|
|
|
180 |
|
|
(define_predicate "mep_reload_operand"
|
181 |
|
|
(ior (and (match_code "reg")
|
182 |
|
|
(match_test "!ANY_CONTROL_REGNO_P (REGNO (op))"))
|
183 |
|
|
(and (match_code "mem,symbol_ref")
|
184 |
|
|
(match_test "mep_section_tag (op) != 'f'"))))
|