Mercurial > hg > CbC > CbC_gcc
annotate gcc/config/xtensa/predicates.md @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
rev | line source |
---|---|
0 | 1 ;; Predicate definitions for Xtensa. |
131 | 2 ;; Copyright (C) 2005-2018 Free Software Foundation, Inc. |
0 | 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 3, or (at your option) | |
9 ;; any later version. | |
10 ;; | |
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. | |
15 ;; | |
16 ;; You should have received a copy of the GNU General Public License | |
17 ;; along with GCC; see the file COPYING3. If not see | |
18 ;; <http://www.gnu.org/licenses/>. | |
19 | |
20 (define_predicate "add_operand" | |
21 (ior (and (match_code "const_int") | |
22 (match_test "xtensa_simm8 (INTVAL (op)) | |
23 || xtensa_simm8x256 (INTVAL (op))")) | |
24 (match_operand 0 "register_operand"))) | |
25 | |
26 (define_predicate "addsubx_operand" | |
27 (and (match_code "const_int") | |
28 (match_test "INTVAL (op) == 2 | |
29 || INTVAL (op) == 4 | |
30 || INTVAL (op) == 8"))) | |
31 | |
32 (define_predicate "arith_operand" | |
33 (ior (and (match_code "const_int") | |
34 (match_test "xtensa_simm8 (INTVAL (op))")) | |
35 (match_operand 0 "register_operand"))) | |
36 | |
37 ;; Non-immediate operand excluding the constant pool. | |
38 (define_predicate "nonimmed_operand" | |
39 (ior (and (match_operand 0 "memory_operand") | |
40 (match_test "!constantpool_mem_p (op)")) | |
41 (match_operand 0 "register_operand"))) | |
42 | |
43 ;; Memory operand excluding the constant pool. | |
44 (define_predicate "mem_operand" | |
45 (and (match_operand 0 "memory_operand") | |
46 (match_test "!constantpool_mem_p (op)"))) | |
47 | |
48 ;; Memory operand in the constant pool. | |
49 (define_predicate "constantpool_operand" | |
50 (match_test "constantpool_mem_p (op)")) | |
51 | |
52 (define_predicate "mask_operand" | |
53 (ior (and (match_code "const_int") | |
54 (match_test "xtensa_mask_immediate (INTVAL (op))")) | |
55 (match_operand 0 "register_operand"))) | |
56 | |
57 (define_predicate "extui_fldsz_operand" | |
58 (and (match_code "const_int") | |
59 (match_test "xtensa_mask_immediate ((1 << INTVAL (op)) - 1)"))) | |
60 | |
61 (define_predicate "sext_operand" | |
62 (if_then_else (match_test "TARGET_SEXT") | |
63 (match_operand 0 "nonimmed_operand") | |
64 (match_operand 0 "mem_operand"))) | |
65 | |
66 (define_predicate "sext_fldsz_operand" | |
67 (and (match_code "const_int") | |
68 (match_test "INTVAL (op) >= 8 && INTVAL (op) <= 23"))) | |
69 | |
70 (define_predicate "lsbitnum_operand" | |
71 (and (match_code "const_int") | |
72 (match_test "BITS_BIG_ENDIAN | |
73 ? (INTVAL (op) == BITS_PER_WORD - 1) | |
74 : (INTVAL (op) == 0)"))) | |
75 | |
76 (define_predicate "branch_operand" | |
77 (ior (and (match_code "const_int") | |
78 (match_test "xtensa_b4const_or_zero (INTVAL (op))")) | |
79 (match_operand 0 "register_operand"))) | |
80 | |
81 (define_predicate "ubranch_operand" | |
82 (ior (and (match_code "const_int") | |
83 (match_test "xtensa_b4constu (INTVAL (op))")) | |
84 (match_operand 0 "register_operand"))) | |
85 | |
86 (define_predicate "call_insn_operand" | |
87 (match_code "const_int,const,symbol_ref,reg") | |
88 { | |
89 if ((GET_CODE (op) == REG) | |
90 && (op != arg_pointer_rtx) | |
91 && ((REGNO (op) < FRAME_POINTER_REGNUM) | |
92 || (REGNO (op) > LAST_VIRTUAL_REGISTER))) | |
93 return true; | |
94 | |
95 if (CONSTANT_ADDRESS_P (op)) | |
96 { | |
97 /* Direct calls only allowed to static functions with PIC. */ | |
98 if (flag_pic) | |
99 { | |
111 | 100 tree callee; |
101 const char * callee_sec, * caller_sec; | |
0 | 102 |
103 if (GET_CODE (op) != SYMBOL_REF | |
104 || !SYMBOL_REF_LOCAL_P (op) || SYMBOL_REF_EXTERNAL_P (op)) | |
105 return false; | |
106 | |
107 /* Don't attempt a direct call if the callee is known to be in | |
108 a different section, since there's a good chance it will be | |
109 out of range. */ | |
110 | |
111 if (flag_function_sections | |
112 || DECL_ONE_ONLY (current_function_decl)) | |
113 return false; | |
114 caller_sec = DECL_SECTION_NAME (current_function_decl); | |
115 callee = SYMBOL_REF_DECL (op); | |
116 if (callee) | |
117 { | |
118 if (DECL_ONE_ONLY (callee)) | |
119 return false; | |
120 callee_sec = DECL_SECTION_NAME (callee); | |
111 | 121 if (((caller_sec == NULL) ^ (callee_sec == NULL)) |
122 || (caller_sec != NULL | |
123 && caller_sec != callee_sec)) | |
0 | 124 return false; |
125 } | |
111 | 126 else if (caller_sec) |
0 | 127 return false; |
128 } | |
129 return true; | |
130 } | |
131 | |
132 return false; | |
133 }) | |
134 | |
135 (define_predicate "move_operand" | |
136 (ior | |
137 (ior (match_operand 0 "register_operand") | |
138 (and (match_operand 0 "memory_operand") | |
139 (match_test "!constantpool_mem_p (op) | |
140 || GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0"))) | |
141 (ior (and (match_code "const_int") | |
142 (match_test "GET_MODE_CLASS (mode) == MODE_INT | |
143 && xtensa_simm12b (INTVAL (op))")) | |
144 (and (match_code "const_int,const_double,const,symbol_ref,label_ref") | |
111 | 145 (match_test "(TARGET_CONST16 || TARGET_AUTO_LITPOOLS) |
146 && CONSTANT_P (op) | |
0 | 147 && GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0"))))) |
148 | |
149 ;; Accept the floating point constant 1 in the appropriate mode. | |
150 (define_predicate "const_float_1_operand" | |
151 (match_code "const_double") | |
152 { | |
111 | 153 return real_equal (CONST_DOUBLE_REAL_VALUE (op), &dconst1); |
0 | 154 }) |
155 | |
156 (define_predicate "fpmem_offset_operand" | |
157 (and (match_code "const_int") | |
158 (match_test "xtensa_mem_offset (INTVAL (op), SFmode)"))) | |
159 | |
160 (define_predicate "branch_operator" | |
161 (match_code "eq,ne,lt,ge")) | |
162 | |
163 (define_predicate "ubranch_operator" | |
164 (match_code "ltu,geu")) | |
165 | |
166 (define_predicate "boolean_operator" | |
167 (match_code "eq,ne")) | |
168 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
169 (define_predicate "xtensa_cstoresi_operator" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
170 (match_code "eq,ne,gt,ge,lt,le")) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
171 |
0 | 172 (define_predicate "tls_symbol_operand" |
173 (and (match_code "symbol_ref") | |
174 (match_test "SYMBOL_REF_TLS_MODEL (op) != 0"))) |