annotate gcc/config/i386/predicates.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ;; Predicate definitions for IA-32 and x86-64.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 ;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 ;; This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ;; GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 ;; it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 ;; the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ;; any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ;; GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ;; GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ;; You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ;; along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ;; <http://www.gnu.org/licenses/>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
20 ;; Return true if OP is either a i387 or SSE fp register.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 (define_predicate "any_fp_register_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 (and (match_code "reg")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 (match_test "ANY_FP_REGNO_P (REGNO (op))")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
25 ;; Return true if OP is an i387 fp register.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 (define_predicate "fp_register_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 (and (match_code "reg")
111
kono
parents: 67
diff changeset
28 (match_test "STACK_REGNO_P (REGNO (op))")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
111
kono
parents: 67
diff changeset
30 ;; True if the operand is a GENERAL class register.
kono
parents: 67
diff changeset
31 (define_predicate "general_reg_operand"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 (and (match_code "reg")
111
kono
parents: 67
diff changeset
33 (match_test "GENERAL_REGNO_P (REGNO (op))")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
111
kono
parents: 67
diff changeset
35 ;; True if the operand is a nonimmediate operand with GENERAL class register.
kono
parents: 67
diff changeset
36 (define_predicate "nonimmediate_gr_operand"
kono
parents: 67
diff changeset
37 (if_then_else (match_code "reg")
kono
parents: 67
diff changeset
38 (match_test "GENERAL_REGNO_P (REGNO (op))")
kono
parents: 67
diff changeset
39 (match_operand 0 "nonimmediate_operand")))
kono
parents: 67
diff changeset
40
kono
parents: 67
diff changeset
41 ;; True if the operand is a general operand with GENERAL class register.
kono
parents: 67
diff changeset
42 (define_predicate "general_gr_operand"
kono
parents: 67
diff changeset
43 (if_then_else (match_code "reg")
kono
parents: 67
diff changeset
44 (match_test "GENERAL_REGNO_P (REGNO (op))")
kono
parents: 67
diff changeset
45 (match_operand 0 "general_operand")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 ;; True if the operand is an MMX register.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 (define_predicate "mmx_reg_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 (and (match_code "reg")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 (match_test "MMX_REGNO_P (REGNO (op))")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
52 ;; True if the operand is an SSE register.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
53 (define_predicate "sse_reg_operand"
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
54 (and (match_code "reg")
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
55 (match_test "SSE_REGNO_P (REGNO (op))")))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
56
111
kono
parents: 67
diff changeset
57 ;; True if the operand is an AVX-512 new register.
kono
parents: 67
diff changeset
58 (define_predicate "ext_sse_reg_operand"
kono
parents: 67
diff changeset
59 (and (match_code "reg")
kono
parents: 67
diff changeset
60 (match_test "EXT_REX_SSE_REGNO_P (REGNO (op))")))
kono
parents: 67
diff changeset
61
kono
parents: 67
diff changeset
62 ;; Return true if op is a QImode register.
kono
parents: 67
diff changeset
63 (define_predicate "any_QIreg_operand"
kono
parents: 67
diff changeset
64 (and (match_code "reg")
kono
parents: 67
diff changeset
65 (match_test "ANY_QI_REGNO_P (REGNO (op))")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66
111
kono
parents: 67
diff changeset
67 ;; Return true if op is one of QImode registers: %[abcd][hl].
kono
parents: 67
diff changeset
68 (define_predicate "QIreg_operand"
kono
parents: 67
diff changeset
69 (and (match_code "reg")
kono
parents: 67
diff changeset
70 (match_test "QI_REGNO_P (REGNO (op))")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
111
kono
parents: 67
diff changeset
72 ;; Return true if op is a QImode register operand other than %[abcd][hl].
kono
parents: 67
diff changeset
73 (define_predicate "ext_QIreg_operand"
kono
parents: 67
diff changeset
74 (and (match_test "TARGET_64BIT")
kono
parents: 67
diff changeset
75 (match_code "reg")
kono
parents: 67
diff changeset
76 (not (match_test "QI_REGNO_P (REGNO (op))"))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 ;; Return true if op is the AX register.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 (define_predicate "ax_reg_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 (and (match_code "reg")
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
81 (match_test "REGNO (op) == AX_REG")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 ;; Return true if op is the flags register.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 (define_predicate "flags_reg_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 (and (match_code "reg")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 (match_test "REGNO (op) == FLAGS_REG")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
111
kono
parents: 67
diff changeset
88 ;; Match a DI, SI or HImode register for a zero_extract.
kono
parents: 67
diff changeset
89 (define_special_predicate "ext_register_operand"
kono
parents: 67
diff changeset
90 (and (match_operand 0 "register_operand")
kono
parents: 67
diff changeset
91 (ior (and (match_test "TARGET_64BIT")
kono
parents: 67
diff changeset
92 (match_test "GET_MODE (op) == DImode"))
kono
parents: 67
diff changeset
93 (match_test "GET_MODE (op) == SImode")
kono
parents: 67
diff changeset
94 (match_test "GET_MODE (op) == HImode"))))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
95
111
kono
parents: 67
diff changeset
96 ;; Match register operands, but include memory operands for TARGET_SSE_MATH.
kono
parents: 67
diff changeset
97 (define_predicate "register_ssemem_operand"
kono
parents: 67
diff changeset
98 (if_then_else
kono
parents: 67
diff changeset
99 (match_test "SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH")
kono
parents: 67
diff changeset
100 (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
101 (match_operand 0 "register_operand")))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
102
111
kono
parents: 67
diff changeset
103 ;; Match nonimmediate operands, but exclude memory operands
kono
parents: 67
diff changeset
104 ;; for TARGET_SSE_MATH if TARGET_MIX_SSE_I387 is not enabled.
kono
parents: 67
diff changeset
105 (define_predicate "nonimm_ssenomem_operand"
kono
parents: 67
diff changeset
106 (if_then_else
kono
parents: 67
diff changeset
107 (and (match_test "SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH")
kono
parents: 67
diff changeset
108 (not (match_test "TARGET_MIX_SSE_I387")))
kono
parents: 67
diff changeset
109 (match_operand 0 "register_operand")
kono
parents: 67
diff changeset
110 (match_operand 0 "nonimmediate_operand")))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
111
111
kono
parents: 67
diff changeset
112 ;; The above predicate, suitable for x87 arithmetic operators.
kono
parents: 67
diff changeset
113 (define_predicate "x87nonimm_ssenomem_operand"
kono
parents: 67
diff changeset
114 (if_then_else
kono
parents: 67
diff changeset
115 (and (match_test "SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH")
kono
parents: 67
diff changeset
116 (not (match_test "TARGET_MIX_SSE_I387 && X87_ENABLE_ARITH (mode)")))
kono
parents: 67
diff changeset
117 (match_operand 0 "register_operand")
kono
parents: 67
diff changeset
118 (match_operand 0 "nonimmediate_operand")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119
111
kono
parents: 67
diff changeset
120 ;; Match register operands, include memory operand for TARGET_SSE4_1.
kono
parents: 67
diff changeset
121 (define_predicate "register_sse4nonimm_operand"
kono
parents: 67
diff changeset
122 (if_then_else (match_test "TARGET_SSE4_1")
kono
parents: 67
diff changeset
123 (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
124 (match_operand 0 "register_operand")))
kono
parents: 67
diff changeset
125
kono
parents: 67
diff changeset
126 ;; Return true if VALUE is symbol reference
kono
parents: 67
diff changeset
127 (define_predicate "symbol_operand"
kono
parents: 67
diff changeset
128 (match_code "symbol_ref"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
130 ;; Return true if VALUE can be stored in a sign extended immediate field.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 (define_predicate "x86_64_immediate_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 (match_code "const_int,symbol_ref,label_ref,const")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 if (!TARGET_64BIT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 return immediate_operand (op, mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 switch (GET_CODE (op))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 case CONST_INT:
111
kono
parents: 67
diff changeset
140 {
kono
parents: 67
diff changeset
141 HOST_WIDE_INT val = INTVAL (op);
kono
parents: 67
diff changeset
142 return trunc_int_for_mode (val, SImode) == val;
kono
parents: 67
diff changeset
143 }
kono
parents: 67
diff changeset
144 case SYMBOL_REF:
kono
parents: 67
diff changeset
145 /* TLS symbols are not constant. */
kono
parents: 67
diff changeset
146 if (SYMBOL_REF_TLS_MODEL (op))
kono
parents: 67
diff changeset
147 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
111
kono
parents: 67
diff changeset
149 /* Load the external function address via the GOT slot. */
kono
parents: 67
diff changeset
150 if (ix86_force_load_from_GOT_p (op))
kono
parents: 67
diff changeset
151 return false;
kono
parents: 67
diff changeset
152
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 /* For certain code models, the symbolic references are known to fit.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 in CM_SMALL_PIC model we know it fits if it is local to the shared
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 library. Don't count TLS SYMBOL_REFs here, since they should fit
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 only if inside of UNSPEC handled below. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 || (ix86_cmodel == CM_MEDIUM && !SYMBOL_REF_FAR_ADDR_P (op)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 case LABEL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 /* For certain code models, the code is near as well. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 || ix86_cmodel == CM_KERNEL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 case CONST:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 /* We also may accept the offsetted memory references in certain
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 special cases. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 if (GET_CODE (XEXP (op, 0)) == UNSPEC)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 switch (XINT (XEXP (op, 0), 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 case UNSPEC_GOTPCREL:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 case UNSPEC_DTPOFF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 case UNSPEC_GOTNTPOFF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 case UNSPEC_NTPOFF:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
175 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 if (GET_CODE (XEXP (op, 0)) == PLUS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 rtx op1 = XEXP (XEXP (op, 0), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 rtx op2 = XEXP (XEXP (op, 0), 1);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 if (ix86_cmodel == CM_LARGE)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
186 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 if (!CONST_INT_P (op2))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
188 return false;
111
kono
parents: 67
diff changeset
189
kono
parents: 67
diff changeset
190 HOST_WIDE_INT offset = INTVAL (op2);
kono
parents: 67
diff changeset
191 if (trunc_int_for_mode (offset, SImode) != offset)
kono
parents: 67
diff changeset
192 return false;
kono
parents: 67
diff changeset
193
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 switch (GET_CODE (op1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 case SYMBOL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 /* TLS symbols are not constant. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 if (SYMBOL_REF_TLS_MODEL (op1))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
199 return false;
111
kono
parents: 67
diff changeset
200
kono
parents: 67
diff changeset
201 /* Load the external function address via the GOT slot. */
kono
parents: 67
diff changeset
202 if (ix86_force_load_from_GOT_p (op1))
kono
parents: 67
diff changeset
203 return false;
kono
parents: 67
diff changeset
204
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 /* For CM_SMALL assume that latest object is 16MB before
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 end of 31bits boundary. We may also accept pretty
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 large negative constants knowing that all objects are
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 in the positive half of address space. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 if ((ix86_cmodel == CM_SMALL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 || (ix86_cmodel == CM_MEDIUM
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 && !SYMBOL_REF_FAR_ADDR_P (op1)))
111
kono
parents: 67
diff changeset
212 && offset < 16*1024*1024)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
213 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 /* For CM_KERNEL we know that all object resist in the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 negative half of 32bits address space. We may not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 accept negative offsets, since they may be just off
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 and we may accept pretty large positive ones. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 if (ix86_cmodel == CM_KERNEL
111
kono
parents: 67
diff changeset
219 && offset > 0)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
220 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 case LABEL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 /* These conditions are similar to SYMBOL_REF ones, just the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 constraints for code models differ. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM)
111
kono
parents: 67
diff changeset
227 && offset < 16*1024*1024)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
228 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 if (ix86_cmodel == CM_KERNEL
111
kono
parents: 67
diff changeset
230 && offset > 0)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
231 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 case UNSPEC:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 switch (XINT (op1, 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 case UNSPEC_DTPOFF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 case UNSPEC_NTPOFF:
111
kono
parents: 67
diff changeset
239 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
253 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
256 ;; Return true if VALUE can be stored in the zero extended immediate field.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 (define_predicate "x86_64_zext_immediate_operand"
111
kono
parents: 67
diff changeset
258 (match_code "const_int,symbol_ref,label_ref,const")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 switch (GET_CODE (op))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 case CONST_INT:
111
kono
parents: 67
diff changeset
263 return !(INTVAL (op) & ~(HOST_WIDE_INT) 0xffffffff);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 case SYMBOL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 /* TLS symbols are not constant. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 if (SYMBOL_REF_TLS_MODEL (op))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 return false;
111
kono
parents: 67
diff changeset
269
kono
parents: 67
diff changeset
270 /* Load the external function address via the GOT slot. */
kono
parents: 67
diff changeset
271 if (ix86_force_load_from_GOT_p (op))
kono
parents: 67
diff changeset
272 return false;
kono
parents: 67
diff changeset
273
kono
parents: 67
diff changeset
274 /* For certain code models, the symbolic references are known to fit. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 return (ix86_cmodel == CM_SMALL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 || (ix86_cmodel == CM_MEDIUM
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 && !SYMBOL_REF_FAR_ADDR_P (op)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 case LABEL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 /* For certain code models, the code is near as well. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 return ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 case CONST:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 /* We also may accept the offsetted memory references in certain
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 special cases. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 if (GET_CODE (XEXP (op, 0)) == PLUS)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 rtx op1 = XEXP (XEXP (op, 0), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 rtx op2 = XEXP (XEXP (op, 0), 1);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 if (ix86_cmodel == CM_LARGE)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
292 return false;
111
kono
parents: 67
diff changeset
293 if (!CONST_INT_P (op2))
kono
parents: 67
diff changeset
294 return false;
kono
parents: 67
diff changeset
295
kono
parents: 67
diff changeset
296 HOST_WIDE_INT offset = INTVAL (op2);
kono
parents: 67
diff changeset
297 if (trunc_int_for_mode (offset, SImode) != offset)
kono
parents: 67
diff changeset
298 return false;
kono
parents: 67
diff changeset
299
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 switch (GET_CODE (op1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 case SYMBOL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 /* TLS symbols are not constant. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 if (SYMBOL_REF_TLS_MODEL (op1))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
305 return false;
111
kono
parents: 67
diff changeset
306
kono
parents: 67
diff changeset
307 /* Load the external function address via the GOT slot. */
kono
parents: 67
diff changeset
308 if (ix86_force_load_from_GOT_p (op1))
kono
parents: 67
diff changeset
309 return false;
kono
parents: 67
diff changeset
310
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 /* For small code model we may accept pretty large positive
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 offsets, since one bit is available for free. Negative
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 offsets are limited by the size of NULL pointer area
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 specified by the ABI. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 if ((ix86_cmodel == CM_SMALL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 || (ix86_cmodel == CM_MEDIUM
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 && !SYMBOL_REF_FAR_ADDR_P (op1)))
111
kono
parents: 67
diff changeset
318 && offset > -0x10000)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
319 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 /* ??? For the kernel, we may accept adjustment of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 -0x10000000, since we know that it will just convert
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 negative address space to positive, but perhaps this
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 is not worthwhile. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 case LABEL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 /* These conditions are similar to SYMBOL_REF ones, just the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 constraints for code models differ. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM)
111
kono
parents: 67
diff changeset
330 && offset > -0x10000)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
331 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 default:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
335 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
343 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345
111
kono
parents: 67
diff changeset
346 ;; Return true if VALUE is a constant integer whose low and high words satisfy
kono
parents: 67
diff changeset
347 ;; x86_64_immediate_operand.
kono
parents: 67
diff changeset
348 (define_predicate "x86_64_hilo_int_operand"
kono
parents: 67
diff changeset
349 (match_code "const_int,const_wide_int")
kono
parents: 67
diff changeset
350 {
kono
parents: 67
diff changeset
351 switch (GET_CODE (op))
kono
parents: 67
diff changeset
352 {
kono
parents: 67
diff changeset
353 case CONST_INT:
kono
parents: 67
diff changeset
354 return x86_64_immediate_operand (op, mode);
kono
parents: 67
diff changeset
355
kono
parents: 67
diff changeset
356 case CONST_WIDE_INT:
kono
parents: 67
diff changeset
357 gcc_assert (CONST_WIDE_INT_NUNITS (op) == 2);
kono
parents: 67
diff changeset
358 return (x86_64_immediate_operand (GEN_INT (CONST_WIDE_INT_ELT (op, 0)),
kono
parents: 67
diff changeset
359 DImode)
kono
parents: 67
diff changeset
360 && x86_64_immediate_operand (GEN_INT (CONST_WIDE_INT_ELT (op,
kono
parents: 67
diff changeset
361 1)),
kono
parents: 67
diff changeset
362 DImode));
kono
parents: 67
diff changeset
363
kono
parents: 67
diff changeset
364 default:
kono
parents: 67
diff changeset
365 gcc_unreachable ();
kono
parents: 67
diff changeset
366 }
kono
parents: 67
diff changeset
367 })
kono
parents: 67
diff changeset
368
kono
parents: 67
diff changeset
369 ;; Return true if VALUE is a constant integer whose value is
kono
parents: 67
diff changeset
370 ;; x86_64_immediate_operand value zero extended from word mode to mode.
kono
parents: 67
diff changeset
371 (define_predicate "x86_64_dwzext_immediate_operand"
kono
parents: 67
diff changeset
372 (match_code "const_int,const_wide_int")
kono
parents: 67
diff changeset
373 {
kono
parents: 67
diff changeset
374 switch (GET_CODE (op))
kono
parents: 67
diff changeset
375 {
kono
parents: 67
diff changeset
376 case CONST_INT:
kono
parents: 67
diff changeset
377 if (!TARGET_64BIT)
kono
parents: 67
diff changeset
378 return UINTVAL (op) <= HOST_WIDE_INT_UC (0xffffffff);
kono
parents: 67
diff changeset
379 return UINTVAL (op) <= HOST_WIDE_INT_UC (0x7fffffff);
kono
parents: 67
diff changeset
380
kono
parents: 67
diff changeset
381 case CONST_WIDE_INT:
kono
parents: 67
diff changeset
382 if (!TARGET_64BIT)
kono
parents: 67
diff changeset
383 return false;
kono
parents: 67
diff changeset
384 return (CONST_WIDE_INT_NUNITS (op) == 2
kono
parents: 67
diff changeset
385 && CONST_WIDE_INT_ELT (op, 1) == 0
kono
parents: 67
diff changeset
386 && (trunc_int_for_mode (CONST_WIDE_INT_ELT (op, 0), SImode)
kono
parents: 67
diff changeset
387 == (HOST_WIDE_INT) CONST_WIDE_INT_ELT (op, 0)));
kono
parents: 67
diff changeset
388
kono
parents: 67
diff changeset
389 default:
kono
parents: 67
diff changeset
390 gcc_unreachable ();
kono
parents: 67
diff changeset
391 }
kono
parents: 67
diff changeset
392 })
kono
parents: 67
diff changeset
393
kono
parents: 67
diff changeset
394 ;; Return true if size of VALUE can be stored in a sign
kono
parents: 67
diff changeset
395 ;; extended immediate field.
kono
parents: 67
diff changeset
396 (define_predicate "x86_64_immediate_size_operand"
kono
parents: 67
diff changeset
397 (and (match_code "symbol_ref")
kono
parents: 67
diff changeset
398 (ior (not (match_test "TARGET_64BIT"))
kono
parents: 67
diff changeset
399 (match_test "ix86_cmodel == CM_SMALL")
kono
parents: 67
diff changeset
400 (match_test "ix86_cmodel == CM_KERNEL"))))
kono
parents: 67
diff changeset
401
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
402 ;; Return true if OP is general operand representable on x86_64.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 (define_predicate "x86_64_general_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 (ior (match_operand 0 "nonimmediate_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 (match_operand 0 "x86_64_immediate_operand"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 (match_operand 0 "general_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408
111
kono
parents: 67
diff changeset
409 ;; Return true if OP's both words are general operands representable
kono
parents: 67
diff changeset
410 ;; on x86_64.
kono
parents: 67
diff changeset
411 (define_predicate "x86_64_hilo_general_operand"
kono
parents: 67
diff changeset
412 (if_then_else (match_test "TARGET_64BIT")
kono
parents: 67
diff changeset
413 (ior (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
414 (match_operand 0 "x86_64_hilo_int_operand"))
kono
parents: 67
diff changeset
415 (match_operand 0 "general_operand")))
kono
parents: 67
diff changeset
416
kono
parents: 67
diff changeset
417 ;; Return true if OP is non-VOIDmode general operand representable
kono
parents: 67
diff changeset
418 ;; on x86_64. This predicate is used in sign-extending conversion
kono
parents: 67
diff changeset
419 ;; operations that require non-VOIDmode immediate operands.
kono
parents: 67
diff changeset
420 (define_predicate "x86_64_sext_operand"
kono
parents: 67
diff changeset
421 (and (match_test "GET_MODE (op) != VOIDmode")
kono
parents: 67
diff changeset
422 (match_operand 0 "x86_64_general_operand")))
kono
parents: 67
diff changeset
423
kono
parents: 67
diff changeset
424 ;; Return true if OP is non-VOIDmode general operand. This predicate
kono
parents: 67
diff changeset
425 ;; is used in sign-extending conversion operations that require
kono
parents: 67
diff changeset
426 ;; non-VOIDmode immediate operands.
kono
parents: 67
diff changeset
427 (define_predicate "sext_operand"
kono
parents: 67
diff changeset
428 (and (match_test "GET_MODE (op) != VOIDmode")
kono
parents: 67
diff changeset
429 (match_operand 0 "general_operand")))
kono
parents: 67
diff changeset
430
kono
parents: 67
diff changeset
431 ;; Return true if OP is representable on x86_64 as zero-extended operand.
kono
parents: 67
diff changeset
432 ;; This predicate is used in zero-extending conversion operations that
kono
parents: 67
diff changeset
433 ;; require non-VOIDmode immediate operands.
kono
parents: 67
diff changeset
434 (define_predicate "x86_64_zext_operand"
kono
parents: 67
diff changeset
435 (if_then_else (match_test "TARGET_64BIT")
kono
parents: 67
diff changeset
436 (ior (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
437 (and (match_operand 0 "x86_64_zext_immediate_operand")
kono
parents: 67
diff changeset
438 (match_test "GET_MODE (op) != VOIDmode")))
kono
parents: 67
diff changeset
439 (match_operand 0 "nonimmediate_operand")))
kono
parents: 67
diff changeset
440
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
441 ;; Return true if OP is general operand representable on x86_64
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 ;; as either sign extended or zero extended constant.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 (define_predicate "x86_64_szext_general_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 (ior (match_operand 0 "nonimmediate_operand")
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
446 (match_operand 0 "x86_64_immediate_operand")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
447 (match_operand 0 "x86_64_zext_immediate_operand"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 (match_operand 0 "general_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
450 ;; Return true if OP is nonmemory operand representable on x86_64.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 (define_predicate "x86_64_nonmemory_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 (ior (match_operand 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 (match_operand 0 "x86_64_immediate_operand"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 (match_operand 0 "nonmemory_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
457 ;; Return true if OP is nonmemory operand representable on x86_64.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 (define_predicate "x86_64_szext_nonmemory_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 (ior (match_operand 0 "register_operand")
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
461 (match_operand 0 "x86_64_immediate_operand")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
462 (match_operand 0 "x86_64_zext_immediate_operand"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 (match_operand 0 "nonmemory_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 ;; Return true when operand is PIC expression that can be computed by lea
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 ;; operation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 (define_predicate "pic_32bit_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 (match_code "const,symbol_ref,label_ref")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 if (!flag_pic)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
471 return false;
111
kono
parents: 67
diff changeset
472
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 /* Rule out relocations that translate into 64bit constants. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 if (TARGET_64BIT && GET_CODE (op) == CONST)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 op = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 if (GET_CODE (op) == PLUS && CONST_INT_P (XEXP (op, 1)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 op = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 if (GET_CODE (op) == UNSPEC
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 && (XINT (op, 1) == UNSPEC_GOTOFF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 || XINT (op, 1) == UNSPEC_GOT))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
482 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 }
111
kono
parents: 67
diff changeset
484
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 return symbolic_operand (op, mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
488 ;; Return true if OP is nonmemory operand acceptable by movabs patterns.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 (define_predicate "x86_64_movabs_operand"
111
kono
parents: 67
diff changeset
490 (and (match_operand 0 "nonmemory_operand")
kono
parents: 67
diff changeset
491 (not (match_operand 0 "pic_32bit_operand"))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
493 ;; Return true if OP is either a symbol reference or a sum of a symbol
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 ;; reference and a constant.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 (define_predicate "symbolic_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 (match_code "symbol_ref,label_ref,const")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 switch (GET_CODE (op))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 case SYMBOL_REF:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 case LABEL_REF:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
502 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 case CONST:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 op = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 if (GET_CODE (op) == SYMBOL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 || GET_CODE (op) == LABEL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 || (GET_CODE (op) == UNSPEC
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 && (XINT (op, 1) == UNSPEC_GOT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 || XINT (op, 1) == UNSPEC_GOTOFF
111
kono
parents: 67
diff changeset
511 || XINT (op, 1) == UNSPEC_PCREL
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 || XINT (op, 1) == UNSPEC_GOTPCREL)))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
513 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514 if (GET_CODE (op) != PLUS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 || !CONST_INT_P (XEXP (op, 1)))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
516 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 op = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 if (GET_CODE (op) == SYMBOL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 || GET_CODE (op) == LABEL_REF)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
521 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 /* Only @GOTOFF gets offsets. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 if (GET_CODE (op) != UNSPEC
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 || XINT (op, 1) != UNSPEC_GOTOFF)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
525 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 op = XVECEXP (op, 0, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 if (GET_CODE (op) == SYMBOL_REF
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 || GET_CODE (op) == LABEL_REF)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
530 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
531 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 default:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 gcc_unreachable ();
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 ;; Return true if OP is a symbolic operand that resolves locally.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 (define_predicate "local_symbolic_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 (match_code "const,label_ref,symbol_ref")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542 if (GET_CODE (op) == CONST
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 && GET_CODE (XEXP (op, 0)) == PLUS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 && CONST_INT_P (XEXP (XEXP (op, 0), 1)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 op = XEXP (XEXP (op, 0), 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 if (GET_CODE (op) == LABEL_REF)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
548 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 if (GET_CODE (op) != SYMBOL_REF)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
551 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
553 if (SYMBOL_REF_TLS_MODEL (op))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
554 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555
111
kono
parents: 67
diff changeset
556 /* Dll-imported symbols are always external. */
kono
parents: 67
diff changeset
557 if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
kono
parents: 67
diff changeset
558 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 if (SYMBOL_REF_LOCAL_P (op))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
560 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 /* There is, however, a not insubstantial body of code in the rest of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 the compiler that assumes it can just stick the results of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 ASM_GENERATE_INTERNAL_LABEL in a symbol_ref and have done. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 /* ??? This is a hack. Should update the body of the compiler to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 always create a DECL an invoke targetm.encode_section_info. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 if (strncmp (XSTR (op, 0), internal_label_prefix,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 internal_label_prefix_len) == 0)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
569 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
571 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574 ;; Test for a legitimate @GOTOFF operand.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 ;; VxWorks does not impose a fixed gap between segments; the run-time
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 ;; gap can be different from the object-file gap. We therefore can't
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 ;; use @GOTOFF unless we are absolutely sure that the symbol is in the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 ;; same segment as the GOT. Unfortunately, the flexibility of linker
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 ;; scripts means that we can't be sure of that in general, so assume
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 ;; that @GOTOFF is never valid on VxWorks.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 (define_predicate "gotoff_operand"
111
kono
parents: 67
diff changeset
583 (and (not (match_test "TARGET_VXWORKS_RTP"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 (match_operand 0 "local_symbolic_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 ;; Test for various thread-local symbols.
111
kono
parents: 67
diff changeset
587 (define_special_predicate "tls_symbolic_operand"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588 (and (match_code "symbol_ref")
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
589 (match_test "SYMBOL_REF_TLS_MODEL (op)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590
111
kono
parents: 67
diff changeset
591 (define_special_predicate "tls_modbase_operand"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 (and (match_code "symbol_ref")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 (match_test "op == ix86_tls_module_base ()")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594
111
kono
parents: 67
diff changeset
595 (define_predicate "tls_address_pattern"
kono
parents: 67
diff changeset
596 (and (match_code "set,parallel,unspec,unspec_volatile")
kono
parents: 67
diff changeset
597 (match_test "ix86_tls_address_pattern_p (op)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 ;; Test for a pc-relative call operand
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 (define_predicate "constant_call_address_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 (match_code "symbol_ref")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
603 if (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
604 || flag_force_indirect_call)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 return false;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 return true;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
611 ;; P6 processors will jump to the address after the decrement when %esp
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
612 ;; is used as a call operand, so they will execute return address as a code.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
613 ;; See Pentium Pro errata 70, Pentium 2 errata A33 and Pentium 3 errata E17.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
614
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
615 (define_predicate "call_register_no_elim_operand"
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
616 (match_operand 0 "register_operand")
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
617 {
111
kono
parents: 67
diff changeset
618 if (SUBREG_P (op))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
619 op = SUBREG_REG (op);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
620
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
621 if (!TARGET_64BIT && op == stack_pointer_rtx)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
622 return false;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
623
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
624 return register_no_elim_operand (op, mode);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
625 })
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
626
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 ;; True for any non-virtual or eliminable register. Used in places where
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 ;; instantiation of such a register may cause the pattern to not be recognized.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 (define_predicate "register_no_elim_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 (match_operand 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 {
111
kono
parents: 67
diff changeset
632 if (SUBREG_P (op))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 op = SUBREG_REG (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 return !(op == arg_pointer_rtx
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 || op == frame_pointer_rtx
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636 || IN_RANGE (REGNO (op),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 FIRST_PSEUDO_REGISTER, LAST_VIRTUAL_REGISTER));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
639
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 ;; Similarly, but include the stack pointer. This is used to prevent esp
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 ;; from being used as an index reg.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 (define_predicate "index_register_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
643 (match_operand 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 {
111
kono
parents: 67
diff changeset
645 if (SUBREG_P (op))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 op = SUBREG_REG (op);
111
kono
parents: 67
diff changeset
647 if (reload_completed)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
648 return REG_OK_FOR_INDEX_STRICT_P (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 return REG_OK_FOR_INDEX_NONSTRICT_P (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
652
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
653 ;; Return false if this is any eliminable register. Otherwise general_operand.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
654 (define_predicate "general_no_elim_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 (if_then_else (match_code "reg,subreg")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 (match_operand 0 "register_no_elim_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 (match_operand 0 "general_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 ;; Return false if this is any eliminable register. Otherwise
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 ;; register_operand or a constant.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 (define_predicate "nonmemory_no_elim_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 (ior (match_operand 0 "register_no_elim_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 (match_operand 0 "immediate_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664
111
kono
parents: 67
diff changeset
665 ;; Test for a valid operand for indirect branch.
kono
parents: 67
diff changeset
666 (define_predicate "indirect_branch_operand"
kono
parents: 67
diff changeset
667 (ior (match_operand 0 "register_operand")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
668 (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
669 (not (match_test "TARGET_X32"))
111
kono
parents: 67
diff changeset
670 (match_operand 0 "memory_operand"))))
kono
parents: 67
diff changeset
671
kono
parents: 67
diff changeset
672 ;; Return true if OP is a memory operands that can be used in sibcalls.
kono
parents: 67
diff changeset
673 ;; Since sibcall never returns, we can only use call-clobbered register
kono
parents: 67
diff changeset
674 ;; as GOT base. Allow GOT slot here only with pseudo register as GOT
kono
parents: 67
diff changeset
675 ;; base. Properly handle sibcall over GOT slot with *sibcall_GOT_32
kono
parents: 67
diff changeset
676 ;; and *sibcall_value_GOT_32 patterns.
kono
parents: 67
diff changeset
677 (define_predicate "sibcall_memory_operand"
kono
parents: 67
diff changeset
678 (match_operand 0 "memory_operand")
kono
parents: 67
diff changeset
679 {
kono
parents: 67
diff changeset
680 op = XEXP (op, 0);
kono
parents: 67
diff changeset
681 if (CONSTANT_P (op))
kono
parents: 67
diff changeset
682 return true;
kono
parents: 67
diff changeset
683 if (GET_CODE (op) == PLUS && REG_P (XEXP (op, 0)))
kono
parents: 67
diff changeset
684 {
kono
parents: 67
diff changeset
685 int regno = REGNO (XEXP (op, 0));
kono
parents: 67
diff changeset
686 if (!HARD_REGISTER_NUM_P (regno) || call_used_regs[regno])
kono
parents: 67
diff changeset
687 {
kono
parents: 67
diff changeset
688 op = XEXP (op, 1);
kono
parents: 67
diff changeset
689 if (GOT32_symbol_operand (op, VOIDmode))
kono
parents: 67
diff changeset
690 return true;
kono
parents: 67
diff changeset
691 }
kono
parents: 67
diff changeset
692 }
kono
parents: 67
diff changeset
693 return false;
kono
parents: 67
diff changeset
694 })
kono
parents: 67
diff changeset
695
kono
parents: 67
diff changeset
696 ;; Return true if OP is a GOT memory operand.
kono
parents: 67
diff changeset
697 (define_predicate "GOT_memory_operand"
kono
parents: 67
diff changeset
698 (match_operand 0 "memory_operand")
kono
parents: 67
diff changeset
699 {
kono
parents: 67
diff changeset
700 op = XEXP (op, 0);
kono
parents: 67
diff changeset
701 return (GET_CODE (op) == CONST
kono
parents: 67
diff changeset
702 && GET_CODE (XEXP (op, 0)) == UNSPEC
kono
parents: 67
diff changeset
703 && XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL);
kono
parents: 67
diff changeset
704 })
kono
parents: 67
diff changeset
705
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
706 ;; Test for a valid operand for a call instruction.
111
kono
parents: 67
diff changeset
707 ;; Allow constant call address operands in Pmode only.
kono
parents: 67
diff changeset
708 (define_special_predicate "call_insn_operand"
kono
parents: 67
diff changeset
709 (ior (match_test "constant_call_address_operand
kono
parents: 67
diff changeset
710 (op, mode == VOIDmode ? mode : Pmode)")
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
711 (match_operand 0 "call_register_no_elim_operand")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
712 (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
713 (ior (and (not (match_test "TARGET_X32"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
714 (match_operand 0 "memory_operand"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
715 (and (match_test "TARGET_X32 && Pmode == DImode")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
716 (match_operand 0 "GOT_memory_operand"))))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
717
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
718 ;; Similarly, but for tail calls, in which we cannot allow memory references.
111
kono
parents: 67
diff changeset
719 (define_special_predicate "sibcall_insn_operand"
kono
parents: 67
diff changeset
720 (ior (match_test "constant_call_address_operand
kono
parents: 67
diff changeset
721 (op, mode == VOIDmode ? mode : Pmode)")
kono
parents: 67
diff changeset
722 (match_operand 0 "register_no_elim_operand")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
723 (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
724 (ior (and (not (match_test "TARGET_X32"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
725 (match_operand 0 "sibcall_memory_operand"))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
726 (and (match_test "TARGET_X32 && Pmode == DImode")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
727 (match_operand 0 "GOT_memory_operand"))))))
111
kono
parents: 67
diff changeset
728
kono
parents: 67
diff changeset
729 ;; Return true if OP is a 32-bit GOT symbol operand.
kono
parents: 67
diff changeset
730 (define_predicate "GOT32_symbol_operand"
kono
parents: 67
diff changeset
731 (match_test "GET_CODE (op) == CONST
kono
parents: 67
diff changeset
732 && GET_CODE (XEXP (op, 0)) == UNSPEC
kono
parents: 67
diff changeset
733 && XINT (XEXP (op, 0), 1) == UNSPEC_GOT"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
734
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 ;; Match exactly zero.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 (define_predicate "const0_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 (match_code "const_int,const_double,const_vector")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 if (mode == VOIDmode)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
740 mode = GET_MODE (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 return op == CONST0_RTX (mode);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743
111
kono
parents: 67
diff changeset
744 ;; Match one or a vector with all elements equal to one.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 (define_predicate "const1_operand"
111
kono
parents: 67
diff changeset
746 (match_code "const_int,const_double,const_vector")
kono
parents: 67
diff changeset
747 {
kono
parents: 67
diff changeset
748 if (mode == VOIDmode)
kono
parents: 67
diff changeset
749 mode = GET_MODE (op);
kono
parents: 67
diff changeset
750 return op == CONST1_RTX (mode);
kono
parents: 67
diff changeset
751 })
kono
parents: 67
diff changeset
752
kono
parents: 67
diff changeset
753 ;; Match exactly -1.
kono
parents: 67
diff changeset
754 (define_predicate "constm1_operand"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 (and (match_code "const_int")
111
kono
parents: 67
diff changeset
756 (match_test "op == constm1_rtx")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 ;; Match exactly eight.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 (define_predicate "const8_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 (match_test "INTVAL (op) == 8")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
762
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
763 ;; Match exactly 128.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
764 (define_predicate "const128_operand"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
765 (and (match_code "const_int")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
766 (match_test "INTVAL (op) == 128")))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
767
111
kono
parents: 67
diff changeset
768 ;; Match exactly 0x0FFFFFFFF in anddi as a zero-extension operation
kono
parents: 67
diff changeset
769 (define_predicate "const_32bit_mask"
kono
parents: 67
diff changeset
770 (and (match_code "const_int")
kono
parents: 67
diff changeset
771 (match_test "trunc_int_for_mode (INTVAL (op), DImode)
kono
parents: 67
diff changeset
772 == (HOST_WIDE_INT) 0xffffffff")))
kono
parents: 67
diff changeset
773
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 ;; Match 2, 4, or 8. Used for leal multiplicands.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
775 (define_predicate "const248_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
776 (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
777 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
778 HOST_WIDE_INT i = INTVAL (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
779 return i == 2 || i == 4 || i == 8;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
781
111
kono
parents: 67
diff changeset
782 ;; Match 1, 2, or 3. Used for lea shift amounts.
kono
parents: 67
diff changeset
783 (define_predicate "const123_operand"
kono
parents: 67
diff changeset
784 (match_code "const_int")
kono
parents: 67
diff changeset
785 {
kono
parents: 67
diff changeset
786 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
787 return i == 1 || i == 2 || i == 3;
kono
parents: 67
diff changeset
788 })
kono
parents: 67
diff changeset
789
kono
parents: 67
diff changeset
790 ;; Match 2, 3, 6, or 7
kono
parents: 67
diff changeset
791 (define_predicate "const2367_operand"
kono
parents: 67
diff changeset
792 (match_code "const_int")
kono
parents: 67
diff changeset
793 {
kono
parents: 67
diff changeset
794 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
795 return i == 2 || i == 3 || i == 6 || i == 7;
kono
parents: 67
diff changeset
796 })
kono
parents: 67
diff changeset
797
kono
parents: 67
diff changeset
798 ;; Match 1, 2, 4, or 8
kono
parents: 67
diff changeset
799 (define_predicate "const1248_operand"
kono
parents: 67
diff changeset
800 (match_code "const_int")
kono
parents: 67
diff changeset
801 {
kono
parents: 67
diff changeset
802 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
803 return i == 1 || i == 2 || i == 4 || i == 8;
kono
parents: 67
diff changeset
804 })
kono
parents: 67
diff changeset
805
kono
parents: 67
diff changeset
806 ;; Match 3, 5, or 9. Used for leal multiplicands.
kono
parents: 67
diff changeset
807 (define_predicate "const359_operand"
kono
parents: 67
diff changeset
808 (match_code "const_int")
kono
parents: 67
diff changeset
809 {
kono
parents: 67
diff changeset
810 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
811 return i == 3 || i == 5 || i == 9;
kono
parents: 67
diff changeset
812 })
kono
parents: 67
diff changeset
813
kono
parents: 67
diff changeset
814 ;; Match 4 or 8 to 11. Used for embeded rounding.
kono
parents: 67
diff changeset
815 (define_predicate "const_4_or_8_to_11_operand"
kono
parents: 67
diff changeset
816 (match_code "const_int")
kono
parents: 67
diff changeset
817 {
kono
parents: 67
diff changeset
818 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
819 return i == 4 || (i >= 8 && i <= 11);
kono
parents: 67
diff changeset
820 })
kono
parents: 67
diff changeset
821
kono
parents: 67
diff changeset
822 ;; Match 4 or 8. Used for SAE.
kono
parents: 67
diff changeset
823 (define_predicate "const48_operand"
kono
parents: 67
diff changeset
824 (match_code "const_int")
kono
parents: 67
diff changeset
825 {
kono
parents: 67
diff changeset
826 HOST_WIDE_INT i = INTVAL (op);
kono
parents: 67
diff changeset
827 return i == 4 || i == 8;
kono
parents: 67
diff changeset
828 })
kono
parents: 67
diff changeset
829
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
830 ;; Match 0 or 1.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
831 (define_predicate "const_0_to_1_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
832 (and (match_code "const_int")
111
kono
parents: 67
diff changeset
833 (ior (match_test "op == const0_rtx")
kono
parents: 67
diff changeset
834 (match_test "op == const1_rtx"))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
835
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
836 ;; Match 0 to 3.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 (define_predicate "const_0_to_3_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
838 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 (match_test "IN_RANGE (INTVAL (op), 0, 3)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840
111
kono
parents: 67
diff changeset
841 ;; Match 0 to 4.
kono
parents: 67
diff changeset
842 (define_predicate "const_0_to_4_operand"
kono
parents: 67
diff changeset
843 (and (match_code "const_int")
kono
parents: 67
diff changeset
844 (match_test "IN_RANGE (INTVAL (op), 0, 4)")))
kono
parents: 67
diff changeset
845
kono
parents: 67
diff changeset
846 ;; Match 0 to 5.
kono
parents: 67
diff changeset
847 (define_predicate "const_0_to_5_operand"
kono
parents: 67
diff changeset
848 (and (match_code "const_int")
kono
parents: 67
diff changeset
849 (match_test "IN_RANGE (INTVAL (op), 0, 5)")))
kono
parents: 67
diff changeset
850
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 ;; Match 0 to 7.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 (define_predicate "const_0_to_7_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
854 (match_test "IN_RANGE (INTVAL (op), 0, 7)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
855
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
856 ;; Match 0 to 15.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
857 (define_predicate "const_0_to_15_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
858 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
859 (match_test "IN_RANGE (INTVAL (op), 0, 15)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
860
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
861 ;; Match 0 to 31.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 (define_predicate "const_0_to_31_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
863 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
864 (match_test "IN_RANGE (INTVAL (op), 0, 31)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
865
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
866 ;; Match 0 to 63.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
867 (define_predicate "const_0_to_63_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
868 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 (match_test "IN_RANGE (INTVAL (op), 0, 63)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
870
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 ;; Match 0 to 255.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
872 (define_predicate "const_0_to_255_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
873 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
874 (match_test "IN_RANGE (INTVAL (op), 0, 255)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
875
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
876 ;; Match (0 to 255) * 8
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
877 (define_predicate "const_0_to_255_mul_8_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
878 (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
879 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
880 unsigned HOST_WIDE_INT val = INTVAL (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
881 return val <= 255*8 && val % 8 == 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
882 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
883
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
884 ;; Return true if OP is CONST_INT >= 1 and <= 31 (a valid operand
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
885 ;; for shift & compare patterns, as shifting by 0 does not change flags).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
886 (define_predicate "const_1_to_31_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
887 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
888 (match_test "IN_RANGE (INTVAL (op), 1, 31)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
889
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
890 ;; Return true if OP is CONST_INT >= 1 and <= 63 (a valid operand
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 ;; for 64bit shift & compare patterns, as shifting by 0 does not change flags).
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
892 (define_predicate "const_1_to_63_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
893 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
894 (match_test "IN_RANGE (INTVAL (op), 1, 63)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
895
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
896 ;; Match 2 or 3.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
897 (define_predicate "const_2_to_3_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
898 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
899 (match_test "IN_RANGE (INTVAL (op), 2, 3)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
900
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
901 ;; Match 4 to 5.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
902 (define_predicate "const_4_to_5_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
903 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
904 (match_test "IN_RANGE (INTVAL (op), 4, 5)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
905
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
906 ;; Match 4 to 7.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
907 (define_predicate "const_4_to_7_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
908 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
909 (match_test "IN_RANGE (INTVAL (op), 4, 7)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
910
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
911 ;; Match 6 to 7.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
912 (define_predicate "const_6_to_7_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
913 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
914 (match_test "IN_RANGE (INTVAL (op), 6, 7)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
915
111
kono
parents: 67
diff changeset
916 ;; Match 8 to 9.
kono
parents: 67
diff changeset
917 (define_predicate "const_8_to_9_operand"
kono
parents: 67
diff changeset
918 (and (match_code "const_int")
kono
parents: 67
diff changeset
919 (match_test "IN_RANGE (INTVAL (op), 8, 9)")))
kono
parents: 67
diff changeset
920
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
921 ;; Match 8 to 11.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
922 (define_predicate "const_8_to_11_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
923 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
924 (match_test "IN_RANGE (INTVAL (op), 8, 11)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
925
111
kono
parents: 67
diff changeset
926 ;; Match 8 to 15.
kono
parents: 67
diff changeset
927 (define_predicate "const_8_to_15_operand"
kono
parents: 67
diff changeset
928 (and (match_code "const_int")
kono
parents: 67
diff changeset
929 (match_test "IN_RANGE (INTVAL (op), 8, 15)")))
kono
parents: 67
diff changeset
930
kono
parents: 67
diff changeset
931 ;; Match 10 to 11.
kono
parents: 67
diff changeset
932 (define_predicate "const_10_to_11_operand"
kono
parents: 67
diff changeset
933 (and (match_code "const_int")
kono
parents: 67
diff changeset
934 (match_test "IN_RANGE (INTVAL (op), 10, 11)")))
kono
parents: 67
diff changeset
935
kono
parents: 67
diff changeset
936 ;; Match 12 to 13.
kono
parents: 67
diff changeset
937 (define_predicate "const_12_to_13_operand"
kono
parents: 67
diff changeset
938 (and (match_code "const_int")
kono
parents: 67
diff changeset
939 (match_test "IN_RANGE (INTVAL (op), 12, 13)")))
kono
parents: 67
diff changeset
940
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
941 ;; Match 12 to 15.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
942 (define_predicate "const_12_to_15_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
943 (and (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
944 (match_test "IN_RANGE (INTVAL (op), 12, 15)")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
945
111
kono
parents: 67
diff changeset
946 ;; Match 14 to 15.
kono
parents: 67
diff changeset
947 (define_predicate "const_14_to_15_operand"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
948 (and (match_code "const_int")
111
kono
parents: 67
diff changeset
949 (match_test "IN_RANGE (INTVAL (op), 14, 15)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
950
111
kono
parents: 67
diff changeset
951 ;; Match 16 to 19.
kono
parents: 67
diff changeset
952 (define_predicate "const_16_to_19_operand"
kono
parents: 67
diff changeset
953 (and (match_code "const_int")
kono
parents: 67
diff changeset
954 (match_test "IN_RANGE (INTVAL (op), 16, 19)")))
kono
parents: 67
diff changeset
955
kono
parents: 67
diff changeset
956 ;; Match 16 to 31.
kono
parents: 67
diff changeset
957 (define_predicate "const_16_to_31_operand"
kono
parents: 67
diff changeset
958 (and (match_code "const_int")
kono
parents: 67
diff changeset
959 (match_test "IN_RANGE (INTVAL (op), 16, 31)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
960
111
kono
parents: 67
diff changeset
961 ;; Match 20 to 23.
kono
parents: 67
diff changeset
962 (define_predicate "const_20_to_23_operand"
kono
parents: 67
diff changeset
963 (and (match_code "const_int")
kono
parents: 67
diff changeset
964 (match_test "IN_RANGE (INTVAL (op), 20, 23)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
965
111
kono
parents: 67
diff changeset
966 ;; Match 24 to 27.
kono
parents: 67
diff changeset
967 (define_predicate "const_24_to_27_operand"
kono
parents: 67
diff changeset
968 (and (match_code "const_int")
kono
parents: 67
diff changeset
969 (match_test "IN_RANGE (INTVAL (op), 24, 27)")))
kono
parents: 67
diff changeset
970
kono
parents: 67
diff changeset
971 ;; Match 28 to 31.
kono
parents: 67
diff changeset
972 (define_predicate "const_28_to_31_operand"
kono
parents: 67
diff changeset
973 (and (match_code "const_int")
kono
parents: 67
diff changeset
974 (match_test "IN_RANGE (INTVAL (op), 28, 31)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
975
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
976 ;; True if this is a constant appropriate for an increment or decrement.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
977 (define_predicate "incdec_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
978 (match_code "const_int")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
979 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
980 /* On Pentium4, the inc and dec operations causes extra dependency on flag
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
981 registers, since carry flag is not set. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
982 if (!TARGET_USE_INCDEC && !optimize_insn_for_size_p ())
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
983 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
984 return op == const1_rtx || op == constm1_rtx;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
985 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
986
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
987 ;; True for registers, or 1 or -1. Used to optimize double-word shifts.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
988 (define_predicate "reg_or_pm1_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
989 (ior (match_operand 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
990 (and (match_code "const_int")
111
kono
parents: 67
diff changeset
991 (ior (match_test "op == const1_rtx")
kono
parents: 67
diff changeset
992 (match_test "op == constm1_rtx")))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
993
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
994 ;; True if OP is acceptable as operand of DImode shift expander.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
995 (define_predicate "shiftdi_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
996 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
997 (match_operand 0 "nonimmediate_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
998 (match_operand 0 "register_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
999
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1000 (define_predicate "ashldi_input_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1001 (if_then_else (match_test "TARGET_64BIT")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1002 (match_operand 0 "nonimmediate_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003 (match_operand 0 "reg_or_pm1_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1004
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1005 ;; Return true if OP is a vector load from the constant pool with just
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1006 ;; the first element nonzero.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1007 (define_predicate "zero_extended_scalar_load_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1008 (match_code "mem")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1009 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1010 unsigned n_elts;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1011 op = avoid_constant_pool_reference (op);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1012
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1013 if (GET_CODE (op) != CONST_VECTOR)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1014 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1015
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1016 n_elts = CONST_VECTOR_NUNITS (op);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1017
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1018 for (n_elts--; n_elts > 0; n_elts--)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1019 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1020 rtx elt = CONST_VECTOR_ELT (op, n_elts);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1021 if (elt != CONST0_RTX (GET_MODE_INNER (GET_MODE (op))))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1022 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1023 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1024 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1025 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1026
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1027 /* Return true if operand is a vector constant that is all ones. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1028 (define_predicate "vector_all_ones_operand"
111
kono
parents: 67
diff changeset
1029 (and (match_code "const_vector")
kono
parents: 67
diff changeset
1030 (match_test "INTEGRAL_MODE_P (GET_MODE (op))")
kono
parents: 67
diff changeset
1031 (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1032
111
kono
parents: 67
diff changeset
1033 ; Return true when OP is operand acceptable for vector memory operand.
kono
parents: 67
diff changeset
1034 ; Only AVX can have misaligned memory operand.
kono
parents: 67
diff changeset
1035 (define_predicate "vector_memory_operand"
kono
parents: 67
diff changeset
1036 (and (match_operand 0 "memory_operand")
kono
parents: 67
diff changeset
1037 (ior (match_test "TARGET_AVX")
kono
parents: 67
diff changeset
1038 (match_test "MEM_ALIGN (op) >= GET_MODE_ALIGNMENT (mode)"))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1039
111
kono
parents: 67
diff changeset
1040 ; Return true when OP is register_operand or vector_memory_operand.
kono
parents: 67
diff changeset
1041 (define_predicate "vector_operand"
kono
parents: 67
diff changeset
1042 (ior (match_operand 0 "register_operand")
kono
parents: 67
diff changeset
1043 (match_operand 0 "vector_memory_operand")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1044
111
kono
parents: 67
diff changeset
1045 ;; Return true when OP is either nonimmediate operand, or any
kono
parents: 67
diff changeset
1046 ;; CONST_VECTOR.
kono
parents: 67
diff changeset
1047 (define_predicate "nonimmediate_or_const_vector_operand"
kono
parents: 67
diff changeset
1048 (ior (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
1049 (match_code "const_vector")))
kono
parents: 67
diff changeset
1050
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1051 ;; Return true when OP is nonimmediate or standard SSE constant.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1052 (define_predicate "nonimmediate_or_sse_const_operand"
111
kono
parents: 67
diff changeset
1053 (ior (match_operand 0 "nonimmediate_operand")
kono
parents: 67
diff changeset
1054 (match_test "standard_sse_constant_p (op, mode)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1055
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1056 ;; Return true if OP is a register or a zero.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1057 (define_predicate "reg_or_0_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1058 (ior (match_operand 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1059 (match_operand 0 "const0_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1060
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1061 ; Return true when OP is a nonimmediate or zero.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1062 (define_predicate "nonimm_or_0_operand"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1063 (ior (match_operand 0 "nonimmediate_operand")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1064 (match_operand 0 "const0_operand")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1065
111
kono
parents: 67
diff changeset
1066 (define_predicate "norex_memory_operand"
kono
parents: 67
diff changeset
1067 (and (match_operand 0 "memory_operand")
kono
parents: 67
diff changeset
1068 (not (match_test "x86_extended_reg_mentioned_p (op)"))))
kono
parents: 67
diff changeset
1069
kono
parents: 67
diff changeset
1070 ;; Return true for RTX codes that force SImode address.
kono
parents: 67
diff changeset
1071 (define_predicate "SImode_address_operand"
kono
parents: 67
diff changeset
1072 (match_code "subreg,zero_extend,and"))
kono
parents: 67
diff changeset
1073
kono
parents: 67
diff changeset
1074 ;; Return true if op is a valid address for LEA, and does not contain
kono
parents: 67
diff changeset
1075 ;; a segment override. Defined as a special predicate to allow
kono
parents: 67
diff changeset
1076 ;; mode-less const_int operands pass to address_operand.
kono
parents: 67
diff changeset
1077 (define_special_predicate "address_no_seg_operand"
kono
parents: 67
diff changeset
1078 (match_test "address_operand (op, VOIDmode)")
kono
parents: 67
diff changeset
1079 {
kono
parents: 67
diff changeset
1080 struct ix86_address parts;
kono
parents: 67
diff changeset
1081 int ok;
kono
parents: 67
diff changeset
1082
kono
parents: 67
diff changeset
1083 if (!CONST_INT_P (op)
kono
parents: 67
diff changeset
1084 && mode != VOIDmode
kono
parents: 67
diff changeset
1085 && GET_MODE (op) != mode)
kono
parents: 67
diff changeset
1086 return false;
kono
parents: 67
diff changeset
1087
kono
parents: 67
diff changeset
1088 ok = ix86_decompose_address (op, &parts);
kono
parents: 67
diff changeset
1089 gcc_assert (ok);
kono
parents: 67
diff changeset
1090 return parts.seg == ADDR_SPACE_GENERIC;
kono
parents: 67
diff changeset
1091 })
kono
parents: 67
diff changeset
1092
kono
parents: 67
diff changeset
1093 ;; Return true if op if a valid base register, displacement or
kono
parents: 67
diff changeset
1094 ;; sum of base register and displacement for VSIB addressing.
kono
parents: 67
diff changeset
1095 (define_predicate "vsib_address_operand"
kono
parents: 67
diff changeset
1096 (match_test "address_operand (op, VOIDmode)")
kono
parents: 67
diff changeset
1097 {
kono
parents: 67
diff changeset
1098 struct ix86_address parts;
kono
parents: 67
diff changeset
1099 int ok;
kono
parents: 67
diff changeset
1100 rtx disp;
kono
parents: 67
diff changeset
1101
kono
parents: 67
diff changeset
1102 ok = ix86_decompose_address (op, &parts);
kono
parents: 67
diff changeset
1103 gcc_assert (ok);
kono
parents: 67
diff changeset
1104 if (parts.index || parts.seg != ADDR_SPACE_GENERIC)
kono
parents: 67
diff changeset
1105 return false;
kono
parents: 67
diff changeset
1106
kono
parents: 67
diff changeset
1107 /* VSIB addressing doesn't support (%rip). */
kono
parents: 67
diff changeset
1108 if (parts.disp)
kono
parents: 67
diff changeset
1109 {
kono
parents: 67
diff changeset
1110 disp = parts.disp;
kono
parents: 67
diff changeset
1111 if (GET_CODE (disp) == CONST)
kono
parents: 67
diff changeset
1112 {
kono
parents: 67
diff changeset
1113 disp = XEXP (disp, 0);
kono
parents: 67
diff changeset
1114 if (GET_CODE (disp) == PLUS)
kono
parents: 67
diff changeset
1115 disp = XEXP (disp, 0);
kono
parents: 67
diff changeset
1116 if (GET_CODE (disp) == UNSPEC)
kono
parents: 67
diff changeset
1117 switch (XINT (disp, 1))
kono
parents: 67
diff changeset
1118 {
kono
parents: 67
diff changeset
1119 case UNSPEC_GOTPCREL:
kono
parents: 67
diff changeset
1120 case UNSPEC_PCREL:
kono
parents: 67
diff changeset
1121 case UNSPEC_GOTNTPOFF:
kono
parents: 67
diff changeset
1122 return false;
kono
parents: 67
diff changeset
1123 }
kono
parents: 67
diff changeset
1124 }
kono
parents: 67
diff changeset
1125 if (TARGET_64BIT
kono
parents: 67
diff changeset
1126 && flag_pic
kono
parents: 67
diff changeset
1127 && (GET_CODE (disp) == SYMBOL_REF
kono
parents: 67
diff changeset
1128 || GET_CODE (disp) == LABEL_REF))
kono
parents: 67
diff changeset
1129 return false;
kono
parents: 67
diff changeset
1130 }
kono
parents: 67
diff changeset
1131
kono
parents: 67
diff changeset
1132 return true;
kono
parents: 67
diff changeset
1133 })
kono
parents: 67
diff changeset
1134
kono
parents: 67
diff changeset
1135 (define_predicate "vsib_mem_operator"
kono
parents: 67
diff changeset
1136 (match_code "mem"))
kono
parents: 67
diff changeset
1137
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1138 ;; Return true if the rtx is known to be at least 32 bits aligned.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1139 (define_predicate "aligned_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1140 (match_operand 0 "general_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1141 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1142 struct ix86_address parts;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1143 int ok;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1144
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1145 /* Registers and immediate operands are always "aligned". */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1146 if (!MEM_P (op))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1147 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1148
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1149 /* All patterns using aligned_operand on memory operands ends up
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1150 in promoting memory operand to 64bit and thus causing memory mismatch. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1151 if (TARGET_MEMORY_MISMATCH_STALL && !optimize_insn_for_size_p ())
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1152 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1153
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1154 /* Don't even try to do any aligned optimizations with volatiles. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1155 if (MEM_VOLATILE_P (op))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1156 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1157
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1158 if (MEM_ALIGN (op) >= 32)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1159 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1160
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1161 op = XEXP (op, 0);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1162
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1163 /* Pushes and pops are only valid on the stack pointer. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1164 if (GET_CODE (op) == PRE_DEC
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1165 || GET_CODE (op) == POST_INC)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1166 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1167
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1168 /* Decode the address. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1169 ok = ix86_decompose_address (op, &parts);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1170 gcc_assert (ok);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1171
111
kono
parents: 67
diff changeset
1172 if (parts.base && SUBREG_P (parts.base))
kono
parents: 67
diff changeset
1173 parts.base = SUBREG_REG (parts.base);
kono
parents: 67
diff changeset
1174 if (parts.index && SUBREG_P (parts.index))
kono
parents: 67
diff changeset
1175 parts.index = SUBREG_REG (parts.index);
kono
parents: 67
diff changeset
1176
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1177 /* Look for some component that isn't known to be aligned. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1178 if (parts.index)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1179 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1180 if (REGNO_POINTER_ALIGN (REGNO (parts.index)) * parts.scale < 32)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1181 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1182 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1183 if (parts.base)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1184 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1185 if (REGNO_POINTER_ALIGN (REGNO (parts.base)) < 32)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1186 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1187 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1188 if (parts.disp)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1189 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1190 if (!CONST_INT_P (parts.disp)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1191 || (INTVAL (parts.disp) & 3))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1192 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1193 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1194
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1195 /* Didn't find one -- this must be an aligned address. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1196 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1197 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1198
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1199 ;; Return true if OP is memory operand with a displacement.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1200 (define_predicate "memory_displacement_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1201 (match_operand 0 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1202 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1203 struct ix86_address parts;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1204 int ok;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1205
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1206 ok = ix86_decompose_address (XEXP (op, 0), &parts);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1207 gcc_assert (ok);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1208 return parts.disp != NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1209 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1210
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1211 ;; Return true if OP is memory operand with a displacement only.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1212 (define_predicate "memory_displacement_only_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1213 (match_operand 0 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1214 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1215 struct ix86_address parts;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1216 int ok;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1217
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1218 if (TARGET_64BIT)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1219 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1220
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1221 ok = ix86_decompose_address (XEXP (op, 0), &parts);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1222 gcc_assert (ok);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1223
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1224 if (parts.base || parts.index)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1225 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1226
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1227 return parts.disp != NULL_RTX;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1228 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1229
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1230 ;; Return true if OP is memory operand that cannot be represented
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1231 ;; by the modRM array.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1232 (define_predicate "long_memory_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1233 (and (match_operand 0 "memory_operand")
111
kono
parents: 67
diff changeset
1234 (match_test "memory_address_length (op, false)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1235
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1236 ;; Return true if OP is a comparison operator that can be issued by fcmov.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1237 (define_predicate "fcmov_comparison_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1238 (match_operand 0 "comparison_operator")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1239 {
111
kono
parents: 67
diff changeset
1240 machine_mode inmode = GET_MODE (XEXP (op, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1241 enum rtx_code code = GET_CODE (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1242
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1243 if (inmode == CCFPmode)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1244 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1245 if (!ix86_trivial_fp_comparison_operator (op, mode))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1246 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1247 code = ix86_fp_compare_code_to_integer (code);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1248 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1249 /* i387 supports just limited amount of conditional codes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1250 switch (code)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1251 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1252 case LTU: case GTU: case LEU: case GEU:
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1253 if (inmode == CCmode || inmode == CCFPmode || inmode == CCCmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1254 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1255 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1256 case ORDERED: case UNORDERED:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1257 case EQ: case NE:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1258 return true;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1259 default:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1260 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1261 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1262 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1263
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1264 ;; Return true if OP is a comparison that can be used in the CMPSS/CMPPS insns.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1265 ;; The first set are supported directly; the second set can't be done with
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1266 ;; full IEEE support, i.e. NaNs.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1267
111
kono
parents: 67
diff changeset
1268 (define_predicate "sse_comparison_operator"
kono
parents: 67
diff changeset
1269 (ior (match_code "eq,ne,lt,le,unordered,unge,ungt,ordered")
kono
parents: 67
diff changeset
1270 (and (match_test "TARGET_AVX")
kono
parents: 67
diff changeset
1271 (match_code "ge,gt,uneq,unle,unlt,ltgt"))))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1272
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1273 (define_predicate "ix86_comparison_int_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1274 (match_code "ne,eq,ge,gt,le,lt"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1275
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1276 (define_predicate "ix86_comparison_uns_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1277 (match_code "ne,eq,geu,gtu,leu,ltu"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1278
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1279 (define_predicate "bt_comparison_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1280 (match_code "ne,eq"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1281
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1282 ;; Return true if OP is a valid comparison operator in valid mode.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1283 (define_predicate "ix86_comparison_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1284 (match_operand 0 "comparison_operator")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1285 {
111
kono
parents: 67
diff changeset
1286 machine_mode inmode = GET_MODE (XEXP (op, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1287 enum rtx_code code = GET_CODE (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1288
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1289 if (inmode == CCFPmode)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1290 return ix86_trivial_fp_comparison_operator (op, mode);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1291
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1292 switch (code)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1293 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1294 case EQ: case NE:
111
kono
parents: 67
diff changeset
1295 if (inmode == CCGZmode)
kono
parents: 67
diff changeset
1296 return false;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1297 return true;
111
kono
parents: 67
diff changeset
1298 case GE: case LT:
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1299 if (inmode == CCmode || inmode == CCGCmode
111
kono
parents: 67
diff changeset
1300 || inmode == CCGOCmode || inmode == CCNOmode || inmode == CCGZmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1301 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1302 return false;
111
kono
parents: 67
diff changeset
1303 case GEU: case LTU:
kono
parents: 67
diff changeset
1304 if (inmode == CCGZmode)
kono
parents: 67
diff changeset
1305 return true;
kono
parents: 67
diff changeset
1306 /* FALLTHRU */
kono
parents: 67
diff changeset
1307 case GTU: case LEU:
kono
parents: 67
diff changeset
1308 if (inmode == CCmode || inmode == CCCmode || inmode == CCGZmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1309 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1310 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1311 case ORDERED: case UNORDERED:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1312 if (inmode == CCmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1313 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1314 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1315 case GT: case LE:
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1316 if (inmode == CCmode || inmode == CCGCmode || inmode == CCNOmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1317 return true;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1318 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1319 default:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1320 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1321 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1322 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1323
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1324 ;; Return true if OP is a valid comparison operator
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1325 ;; testing carry flag to be set.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1326 (define_predicate "ix86_carry_flag_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1327 (match_code "ltu,lt,unlt,gtu,gt,ungt,le,unle,ge,unge,ltgt,uneq")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 {
111
kono
parents: 67
diff changeset
1329 machine_mode inmode = GET_MODE (XEXP (op, 0));
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1330 enum rtx_code code = GET_CODE (op);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1331
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1332 if (inmode == CCFPmode)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1333 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1334 if (!ix86_trivial_fp_comparison_operator (op, mode))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1335 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1336 code = ix86_fp_compare_code_to_integer (code);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1337 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1338 else if (inmode == CCCmode)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1339 return code == LTU || code == GTU;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1340 else if (inmode != CCmode)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1341 return false;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1342
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1343 return code == LTU;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1344 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1345
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1346 ;; Return true if this comparison only requires testing one flag bit.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1347 (define_predicate "ix86_trivial_fp_comparison_operator"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1348 (match_code "gt,ge,unlt,unle,uneq,ltgt,ordered,unordered"))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1349
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1350 ;; Return true if we know how to do this comparison. Others require
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1351 ;; testing more than one flag bit, and we let the generic middle-end
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1352 ;; code do that.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1353 (define_predicate "ix86_fp_comparison_operator"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1354 (if_then_else (match_test "ix86_fp_comparison_strategy (GET_CODE (op))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1355 == IX86_FPCMP_ARITH")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1356 (match_operand 0 "comparison_operator")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1357 (match_operand 0 "ix86_trivial_fp_comparison_operator")))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1358
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1359 ;; Nearly general operand, but accept any const_double, since we wish
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1360 ;; to be able to drop them into memory rather than have them get pulled
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1361 ;; into registers.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1362 (define_predicate "cmp_fp_expander_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1363 (ior (match_code "const_double")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1364 (match_operand 0 "general_operand")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1365
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1366 ;; Return true if this is a valid binary floating-point operation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1367 (define_predicate "binary_fp_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1368 (match_code "plus,minus,mult,div"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1369
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1370 ;; Return true if this is a multiply operation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1371 (define_predicate "mult_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1372 (match_code "mult"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1373
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1374 ;; Return true if this is a division operation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1375 (define_predicate "div_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1376 (match_code "div"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1377
111
kono
parents: 67
diff changeset
1378 ;; Return true if this is a plus, minus, and, ior or xor operation.
kono
parents: 67
diff changeset
1379 (define_predicate "plusminuslogic_operator"
kono
parents: 67
diff changeset
1380 (match_code "plus,minus,and,ior,xor"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1381
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1382 ;; Return true for ARITHMETIC_P.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1383 (define_predicate "arith_or_logical_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1384 (match_code "plus,mult,and,ior,xor,smin,smax,umin,umax,compare,minus,div,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1385 mod,udiv,umod,ashift,rotate,ashiftrt,lshiftrt,rotatert"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1386
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1387 ;; Return true for COMMUTATIVE_P.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1388 (define_predicate "commutative_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1389 (match_code "plus,mult,and,ior,xor,smin,smax,umin,umax"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1390
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1391 ;; Return true if OP is a binary operator that can be promoted to wider mode.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1392 (define_predicate "promotable_binary_operator"
111
kono
parents: 67
diff changeset
1393 (ior (match_code "plus,minus,and,ior,xor,ashift")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1394 (and (match_code "mult")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1395 (match_test "TARGET_TUNE_PROMOTE_HIMODE_IMUL"))))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1396
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1397 (define_predicate "compare_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1398 (match_code "compare"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1399
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1400 (define_predicate "absneg_operator"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1401 (match_code "abs,neg"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1402
111
kono
parents: 67
diff changeset
1403 ;; Return true if OP is a memory operand, aligned to
kono
parents: 67
diff changeset
1404 ;; less than its natural alignment.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1405 (define_predicate "misaligned_operand"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1406 (and (match_code "mem")
111
kono
parents: 67
diff changeset
1407 (match_test "MEM_ALIGN (op) < GET_MODE_BITSIZE (mode)")))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1408
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1409 ;; Return true if OP is a vzeroall operation, known to be a PARALLEL.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1410 (define_predicate "vzeroall_operation"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1411 (match_code "parallel")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1412 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1413 unsigned i, nregs = TARGET_64BIT ? 16 : 8;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1414
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1415 if ((unsigned) XVECLEN (op, 0) != 1 + nregs)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1416 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1417
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1418 for (i = 0; i < nregs; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1419 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1420 rtx elt = XVECEXP (op, 0, i+1);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1421
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1422 if (GET_CODE (elt) != SET
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1423 || GET_CODE (SET_DEST (elt)) != REG
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1424 || GET_MODE (SET_DEST (elt)) != V8SImode
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1425 || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1426 || SET_SRC (elt) != CONST0_RTX (V8SImode))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1427 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1428 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1429 return true;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1430 })
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1431
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1432 ;; return true if OP is a vzeroall pattern.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1433 (define_predicate "vzeroall_pattern"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1434 (and (match_code "parallel")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1435 (match_code "unspec_volatile" "a")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1436 (match_test "XINT (XVECEXP (op, 0, 0), 1) == UNSPECV_VZEROALL")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1437
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1438 ;; return true if OP is a vzeroupper pattern.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1439 (define_predicate "vzeroupper_pattern"
111
kono
parents: 67
diff changeset
1440 (and (match_code "unspec_volatile")
kono
parents: 67
diff changeset
1441 (match_test "XINT (op, 1) == UNSPECV_VZEROUPPER")))
kono
parents: 67
diff changeset
1442
kono
parents: 67
diff changeset
1443 ;; Return true if OP is an addsub vec_merge operation
kono
parents: 67
diff changeset
1444 (define_predicate "addsub_vm_operator"
kono
parents: 67
diff changeset
1445 (match_code "vec_merge")
kono
parents: 67
diff changeset
1446 {
kono
parents: 67
diff changeset
1447 rtx op0, op1;
kono
parents: 67
diff changeset
1448 int swapped;
kono
parents: 67
diff changeset
1449 HOST_WIDE_INT mask;
kono
parents: 67
diff changeset
1450 int nunits, elt;
kono
parents: 67
diff changeset
1451
kono
parents: 67
diff changeset
1452 op0 = XEXP (op, 0);
kono
parents: 67
diff changeset
1453 op1 = XEXP (op, 1);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1454
111
kono
parents: 67
diff changeset
1455 /* Sanity check. */
kono
parents: 67
diff changeset
1456 if (GET_CODE (op0) == MINUS && GET_CODE (op1) == PLUS)
kono
parents: 67
diff changeset
1457 swapped = 0;
kono
parents: 67
diff changeset
1458 else if (GET_CODE (op0) == PLUS && GET_CODE (op1) == MINUS)
kono
parents: 67
diff changeset
1459 swapped = 1;
kono
parents: 67
diff changeset
1460 else
kono
parents: 67
diff changeset
1461 gcc_unreachable ();
kono
parents: 67
diff changeset
1462
kono
parents: 67
diff changeset
1463 mask = INTVAL (XEXP (op, 2));
kono
parents: 67
diff changeset
1464 nunits = GET_MODE_NUNITS (mode);
kono
parents: 67
diff changeset
1465
kono
parents: 67
diff changeset
1466 for (elt = 0; elt < nunits; elt++)
kono
parents: 67
diff changeset
1467 {
kono
parents: 67
diff changeset
1468 /* bit clear: take from op0, set: take from op1 */
kono
parents: 67
diff changeset
1469 int bit = !(mask & (HOST_WIDE_INT_1U << elt));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1470
111
kono
parents: 67
diff changeset
1471 if (bit != ((elt & 1) ^ swapped))
kono
parents: 67
diff changeset
1472 return false;
kono
parents: 67
diff changeset
1473 }
kono
parents: 67
diff changeset
1474
kono
parents: 67
diff changeset
1475 return true;
kono
parents: 67
diff changeset
1476 })
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1477
111
kono
parents: 67
diff changeset
1478 ;; Return true if OP is an addsub vec_select/vec_concat operation
kono
parents: 67
diff changeset
1479 (define_predicate "addsub_vs_operator"
kono
parents: 67
diff changeset
1480 (and (match_code "vec_select")
kono
parents: 67
diff changeset
1481 (match_code "vec_concat" "0"))
kono
parents: 67
diff changeset
1482 {
kono
parents: 67
diff changeset
1483 rtx op0, op1;
kono
parents: 67
diff changeset
1484 bool swapped;
kono
parents: 67
diff changeset
1485 int nunits, elt;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1486
111
kono
parents: 67
diff changeset
1487 op0 = XEXP (XEXP (op, 0), 0);
kono
parents: 67
diff changeset
1488 op1 = XEXP (XEXP (op, 0), 1);
kono
parents: 67
diff changeset
1489
kono
parents: 67
diff changeset
1490 /* Sanity check. */
kono
parents: 67
diff changeset
1491 if (GET_CODE (op0) == MINUS && GET_CODE (op1) == PLUS)
kono
parents: 67
diff changeset
1492 swapped = false;
kono
parents: 67
diff changeset
1493 else if (GET_CODE (op0) == PLUS && GET_CODE (op1) == MINUS)
kono
parents: 67
diff changeset
1494 swapped = true;
kono
parents: 67
diff changeset
1495 else
kono
parents: 67
diff changeset
1496 gcc_unreachable ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1497
111
kono
parents: 67
diff changeset
1498 nunits = GET_MODE_NUNITS (mode);
kono
parents: 67
diff changeset
1499 if (XVECLEN (XEXP (op, 1), 0) != nunits)
kono
parents: 67
diff changeset
1500 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1501
111
kono
parents: 67
diff changeset
1502 /* We already checked that permutation is suitable for addsub,
kono
parents: 67
diff changeset
1503 so only look at the first element of the parallel. */
kono
parents: 67
diff changeset
1504 elt = INTVAL (XVECEXP (XEXP (op, 1), 0, 0));
kono
parents: 67
diff changeset
1505
kono
parents: 67
diff changeset
1506 return elt == (swapped ? nunits : 0);
kono
parents: 67
diff changeset
1507 })
kono
parents: 67
diff changeset
1508
kono
parents: 67
diff changeset
1509 ;; Return true if OP is a parallel for an addsub vec_select.
kono
parents: 67
diff changeset
1510 (define_predicate "addsub_vs_parallel"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1511 (and (match_code "parallel")
111
kono
parents: 67
diff changeset
1512 (match_code "const_int" "a"))
kono
parents: 67
diff changeset
1513 {
kono
parents: 67
diff changeset
1514 int nelt = XVECLEN (op, 0);
kono
parents: 67
diff changeset
1515 int elt, i;
kono
parents: 67
diff changeset
1516
kono
parents: 67
diff changeset
1517 if (nelt < 2)
kono
parents: 67
diff changeset
1518 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1519
111
kono
parents: 67
diff changeset
1520 /* Check that the permutation is suitable for addsub.
kono
parents: 67
diff changeset
1521 For example, { 0 9 2 11 4 13 6 15 } or { 8 1 10 3 12 5 14 7 }. */
kono
parents: 67
diff changeset
1522 elt = INTVAL (XVECEXP (op, 0, 0));
kono
parents: 67
diff changeset
1523 if (elt == 0)
kono
parents: 67
diff changeset
1524 {
kono
parents: 67
diff changeset
1525 for (i = 1; i < nelt; ++i)
kono
parents: 67
diff changeset
1526 if (INTVAL (XVECEXP (op, 0, i)) != (i + (i & 1) * nelt))
kono
parents: 67
diff changeset
1527 return false;
kono
parents: 67
diff changeset
1528 }
kono
parents: 67
diff changeset
1529 else if (elt == nelt)
kono
parents: 67
diff changeset
1530 {
kono
parents: 67
diff changeset
1531 for (i = 1; i < nelt; ++i)
kono
parents: 67
diff changeset
1532 if (INTVAL (XVECEXP (op, 0, i)) != (elt + i - (i & 1) * nelt))
kono
parents: 67
diff changeset
1533 return false;
kono
parents: 67
diff changeset
1534 }
kono
parents: 67
diff changeset
1535 else
kono
parents: 67
diff changeset
1536 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1537
111
kono
parents: 67
diff changeset
1538 return true;
kono
parents: 67
diff changeset
1539 })
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1540
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1541 ;; Return true if OP is a parallel for a vbroadcast permute.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1542 (define_predicate "avx_vbroadcast_operand"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1543 (and (match_code "parallel")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1544 (match_code "const_int" "a"))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1545 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1546 rtx elt = XVECEXP (op, 0, 0);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1547 int i, nelt = XVECLEN (op, 0);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1548
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1549 /* Don't bother checking there are the right number of operands,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1550 merely that they're all identical. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1551 for (i = 1; i < nelt; ++i)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1552 if (XVECEXP (op, 0, i) != elt)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1553 return false;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1554 return true;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
1555 })
111
kono
parents: 67
diff changeset
1556
kono
parents: 67
diff changeset
1557 ;; Return true if OP is a parallel for a palignr permute.
kono
parents: 67
diff changeset
1558 (define_predicate "palignr_operand"
kono
parents: 67
diff changeset
1559 (and (match_code "parallel")
kono
parents: 67
diff changeset
1560 (match_code "const_int" "a"))
kono
parents: 67
diff changeset
1561 {
kono
parents: 67
diff changeset
1562 int elt = INTVAL (XVECEXP (op, 0, 0));
kono
parents: 67
diff changeset
1563 int i, nelt = XVECLEN (op, 0);
kono
parents: 67
diff changeset
1564
kono
parents: 67
diff changeset
1565 /* Check that an order in the permutation is suitable for palignr.
kono
parents: 67
diff changeset
1566 For example, {5 6 7 0 1 2 3 4} is "palignr 5, xmm, xmm". */
kono
parents: 67
diff changeset
1567 for (i = 1; i < nelt; ++i)
kono
parents: 67
diff changeset
1568 if (INTVAL (XVECEXP (op, 0, i)) != ((elt + i) % nelt))
kono
parents: 67
diff changeset
1569 return false;
kono
parents: 67
diff changeset
1570 return true;
kono
parents: 67
diff changeset
1571 })
kono
parents: 67
diff changeset
1572
kono
parents: 67
diff changeset
1573 ;; Return true if OP is a proper third operand to vpblendw256.
kono
parents: 67
diff changeset
1574 (define_predicate "avx2_pblendw_operand"
kono
parents: 67
diff changeset
1575 (match_code "const_int")
kono
parents: 67
diff changeset
1576 {
kono
parents: 67
diff changeset
1577 HOST_WIDE_INT val = INTVAL (op);
kono
parents: 67
diff changeset
1578 HOST_WIDE_INT low = val & 0xff;
kono
parents: 67
diff changeset
1579 return val == ((low << 8) | low);
kono
parents: 67
diff changeset
1580 })
kono
parents: 67
diff changeset
1581
kono
parents: 67
diff changeset
1582 ;; Return true if OP is vector_operand or CONST_VECTOR.
kono
parents: 67
diff changeset
1583 (define_predicate "general_vector_operand"
kono
parents: 67
diff changeset
1584 (ior (match_operand 0 "vector_operand")
kono
parents: 67
diff changeset
1585 (match_code "const_vector")))
kono
parents: 67
diff changeset
1586
kono
parents: 67
diff changeset
1587 ;; Return true if OP is either -1 constant or stored in register.
kono
parents: 67
diff changeset
1588 (define_predicate "register_or_constm1_operand"
kono
parents: 67
diff changeset
1589 (ior (match_operand 0 "register_operand")
kono
parents: 67
diff changeset
1590 (and (match_code "const_int")
kono
parents: 67
diff changeset
1591 (match_test "op == constm1_rtx"))))
kono
parents: 67
diff changeset
1592
kono
parents: 67
diff changeset
1593 ;; Return true if the vector ends with between 12 and 18 register saves using
kono
parents: 67
diff changeset
1594 ;; RAX as the base address.
kono
parents: 67
diff changeset
1595 (define_predicate "save_multiple"
kono
parents: 67
diff changeset
1596 (match_code "parallel")
kono
parents: 67
diff changeset
1597 {
kono
parents: 67
diff changeset
1598 const unsigned len = XVECLEN (op, 0);
kono
parents: 67
diff changeset
1599 unsigned i;
kono
parents: 67
diff changeset
1600
kono
parents: 67
diff changeset
1601 /* Starting from end of vector, count register saves. */
kono
parents: 67
diff changeset
1602 for (i = 0; i < len; ++i)
kono
parents: 67
diff changeset
1603 {
kono
parents: 67
diff changeset
1604 rtx src, dest, addr;
kono
parents: 67
diff changeset
1605 rtx e = XVECEXP (op, 0, len - 1 - i);
kono
parents: 67
diff changeset
1606
kono
parents: 67
diff changeset
1607 if (GET_CODE (e) != SET)
kono
parents: 67
diff changeset
1608 break;
kono
parents: 67
diff changeset
1609
kono
parents: 67
diff changeset
1610 src = SET_SRC (e);
kono
parents: 67
diff changeset
1611 dest = SET_DEST (e);
kono
parents: 67
diff changeset
1612
kono
parents: 67
diff changeset
1613 if (!REG_P (src) || !MEM_P (dest))
kono
parents: 67
diff changeset
1614 break;
kono
parents: 67
diff changeset
1615
kono
parents: 67
diff changeset
1616 addr = XEXP (dest, 0);
kono
parents: 67
diff changeset
1617
kono
parents: 67
diff changeset
1618 /* Good if dest address is in RAX. */
kono
parents: 67
diff changeset
1619 if (REG_P (addr) && REGNO (addr) == AX_REG)
kono
parents: 67
diff changeset
1620 continue;
kono
parents: 67
diff changeset
1621
kono
parents: 67
diff changeset
1622 /* Good if dest address is offset of RAX. */
kono
parents: 67
diff changeset
1623 if (GET_CODE (addr) == PLUS
kono
parents: 67
diff changeset
1624 && REG_P (XEXP (addr, 0))
kono
parents: 67
diff changeset
1625 && REGNO (XEXP (addr, 0)) == AX_REG)
kono
parents: 67
diff changeset
1626 continue;
kono
parents: 67
diff changeset
1627
kono
parents: 67
diff changeset
1628 break;
kono
parents: 67
diff changeset
1629 }
kono
parents: 67
diff changeset
1630 return (i >= 12 && i <= 18);
kono
parents: 67
diff changeset
1631 })
kono
parents: 67
diff changeset
1632
kono
parents: 67
diff changeset
1633
kono
parents: 67
diff changeset
1634 ;; Return true if the vector ends with between 12 and 18 register loads using
kono
parents: 67
diff changeset
1635 ;; RSI as the base address.
kono
parents: 67
diff changeset
1636 (define_predicate "restore_multiple"
kono
parents: 67
diff changeset
1637 (match_code "parallel")
kono
parents: 67
diff changeset
1638 {
kono
parents: 67
diff changeset
1639 const unsigned len = XVECLEN (op, 0);
kono
parents: 67
diff changeset
1640 unsigned i;
kono
parents: 67
diff changeset
1641
kono
parents: 67
diff changeset
1642 /* Starting from end of vector, count register restores. */
kono
parents: 67
diff changeset
1643 for (i = 0; i < len; ++i)
kono
parents: 67
diff changeset
1644 {
kono
parents: 67
diff changeset
1645 rtx src, dest, addr;
kono
parents: 67
diff changeset
1646 rtx e = XVECEXP (op, 0, len - 1 - i);
kono
parents: 67
diff changeset
1647
kono
parents: 67
diff changeset
1648 if (GET_CODE (e) != SET)
kono
parents: 67
diff changeset
1649 break;
kono
parents: 67
diff changeset
1650
kono
parents: 67
diff changeset
1651 src = SET_SRC (e);
kono
parents: 67
diff changeset
1652 dest = SET_DEST (e);
kono
parents: 67
diff changeset
1653
kono
parents: 67
diff changeset
1654 if (!MEM_P (src) || !REG_P (dest))
kono
parents: 67
diff changeset
1655 break;
kono
parents: 67
diff changeset
1656
kono
parents: 67
diff changeset
1657 addr = XEXP (src, 0);
kono
parents: 67
diff changeset
1658
kono
parents: 67
diff changeset
1659 /* Good if src address is in RSI. */
kono
parents: 67
diff changeset
1660 if (REG_P (addr) && REGNO (addr) == SI_REG)
kono
parents: 67
diff changeset
1661 continue;
kono
parents: 67
diff changeset
1662
kono
parents: 67
diff changeset
1663 /* Good if src address is offset of RSI. */
kono
parents: 67
diff changeset
1664 if (GET_CODE (addr) == PLUS
kono
parents: 67
diff changeset
1665 && REG_P (XEXP (addr, 0))
kono
parents: 67
diff changeset
1666 && REGNO (XEXP (addr, 0)) == SI_REG)
kono
parents: 67
diff changeset
1667 continue;
kono
parents: 67
diff changeset
1668
kono
parents: 67
diff changeset
1669 break;
kono
parents: 67
diff changeset
1670 }
kono
parents: 67
diff changeset
1671 return (i >= 12 && i <= 18);
kono
parents: 67
diff changeset
1672 })