OLD | NEW |
1 ;; Predicate definitions for ARM and Thumb | 1 ;; Predicate definitions for ARM and Thumb |
2 ;; Copyright (C) 2004, 2007, 2008, 2010 Free Software Foundation, Inc. | 2 ;; Copyright (C) 2004, 2007, 2008, 2010 Free Software Foundation, Inc. |
3 ;; Contributed by ARM Ltd. | 3 ;; Contributed by ARM Ltd. |
4 | 4 |
5 ;; This file is part of GCC. | 5 ;; This file is part of GCC. |
6 | 6 |
7 ;; GCC is free software; you can redistribute it and/or modify it | 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 | 8 ;; under the terms of the GNU General Public License as published |
9 ;; by the Free Software Foundation; either version 3, or (at your | 9 ;; by the Free Software Foundation; either version 3, or (at your |
10 ;; option) any later version. | 10 ;; option) any later version. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 ;; Something valid on the RHS of an ARM data-processing instruction | 123 ;; Something valid on the RHS of an ARM data-processing instruction |
124 (define_predicate "arm_rhs_operand" | 124 (define_predicate "arm_rhs_operand" |
125 (ior (match_operand 0 "s_register_operand") | 125 (ior (match_operand 0 "s_register_operand") |
126 (match_operand 0 "arm_immediate_operand"))) | 126 (match_operand 0 "arm_immediate_operand"))) |
127 | 127 |
128 (define_predicate "arm_rhsm_operand" | 128 (define_predicate "arm_rhsm_operand" |
129 (ior (match_operand 0 "arm_rhs_operand") | 129 (ior (match_operand 0 "arm_rhs_operand") |
130 (match_operand 0 "memory_operand"))) | 130 (match_operand 0 "memory_operand"))) |
131 | 131 |
| 132 ;; This doesn't have to do much because the constant is already checked |
| 133 ;; in the shift_operator predicate. |
132 (define_predicate "shift_amount_operand" | 134 (define_predicate "shift_amount_operand" |
133 (ior (and (match_test "TARGET_ARM") | 135 (ior (and (match_test "TARGET_ARM") |
134 (match_operand 0 "s_register_operand")) | 136 (match_operand 0 "s_register_operand")) |
135 (match_operand 0 "const_int_operand"))) | 137 (match_operand 0 "const_int_operand"))) |
136 | 138 |
137 (define_predicate "arm_add_operand" | 139 (define_predicate "arm_add_operand" |
138 (ior (match_operand 0 "arm_rhs_operand") | 140 (ior (match_operand 0 "arm_rhs_operand") |
139 (match_operand 0 "arm_neg_immediate_operand"))) | 141 (match_operand 0 "arm_neg_immediate_operand"))) |
140 | 142 |
141 (define_predicate "arm_addimm_operand" | 143 (define_predicate "arm_addimm_operand" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 (define_special_predicate "logical_binary_operator" | 213 (define_special_predicate "logical_binary_operator" |
212 (and (match_code "ior,xor,and") | 214 (and (match_code "ior,xor,and") |
213 (match_test "mode == GET_MODE (op)"))) | 215 (match_test "mode == GET_MODE (op)"))) |
214 | 216 |
215 ;; True for commutative operators | 217 ;; True for commutative operators |
216 (define_special_predicate "commutative_binary_operator" | 218 (define_special_predicate "commutative_binary_operator" |
217 (and (match_code "ior,xor,and,plus") | 219 (and (match_code "ior,xor,and,plus") |
218 (match_test "mode == GET_MODE (op)"))) | 220 (match_test "mode == GET_MODE (op)"))) |
219 | 221 |
220 ;; True for shift operators. | 222 ;; True for shift operators. |
| 223 ;; Notes: |
| 224 ;; * mult is only permitted with a constant shift amount |
| 225 ;; * patterns that permit register shift amounts only in ARM mode use |
| 226 ;; shift_amount_operand, patterns that always allow registers do not, |
| 227 ;; so we don't have to worry about that sort of thing here. |
221 (define_special_predicate "shift_operator" | 228 (define_special_predicate "shift_operator" |
222 (and (ior (ior (and (match_code "mult") | 229 (and (ior (ior (and (match_code "mult") |
223 (match_test "power_of_two_operand (XEXP (op, 1), mode)")) | 230 (match_test "power_of_two_operand (XEXP (op, 1), mode)")) |
224 (and (match_code "rotate") | 231 (and (match_code "rotate") |
225 (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT | 232 (match_test "GET_CODE (XEXP (op, 1)) == CONST_INT |
226 && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op
, 1))) < 32"))) | 233 && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op
, 1))) < 32"))) |
227 » (match_code "ashift,ashiftrt,lshiftrt,rotatert")) | 234 » (and (match_code "ashift,ashiftrt,lshiftrt,rotatert") |
| 235 » » (match_test "GET_CODE (XEXP (op, 1)) != CONST_INT |
| 236 » » » || ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op, 1))
) < 32"))) |
228 (match_test "mode == GET_MODE (op)"))) | 237 (match_test "mode == GET_MODE (op)"))) |
229 | 238 |
230 ;; True for MULT, to identify which variant of shift_operator is in use. | 239 ;; True for MULT, to identify which variant of shift_operator is in use. |
231 (define_special_predicate "mult_operator" | 240 (define_special_predicate "mult_operator" |
232 (match_code "mult")) | 241 (match_code "mult")) |
233 | 242 |
234 ;; True for operators that have 16-bit thumb variants. */ | 243 ;; True for operators that have 16-bit thumb variants. */ |
235 (define_special_predicate "thumb_16bit_operator" | 244 (define_special_predicate "thumb_16bit_operator" |
236 (match_code "plus,minus,and,ior,xor")) | 245 (match_code "plus,minus,and,ior,xor")) |
237 | 246 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 688 |
680 val = INTVAL (elt); | 689 val = INTVAL (elt); |
681 if (val != i) | 690 if (val != i) |
682 return false; | 691 return false; |
683 }· | 692 }· |
684 return true;· | 693 return true;· |
685 }) | 694 }) |
686 | 695 |
687 (define_special_predicate "add_operator" | 696 (define_special_predicate "add_operator" |
688 (match_code "plus")) | 697 (match_code "plus")) |
OLD | NEW |