rs6000: Make all divide instructions one type
[official-gcc.git] / gcc / config / rs6000 / constraints.md
blob9d6a3bbe7c87ef0ab9a2e2ba38b77cb17f361d02
1 ;; Constraint definitions for RS6000
2 ;; Copyright (C) 2006-2014 Free Software Foundation, Inc.
3 ;;
4 ;; This file is part of GCC.
5 ;;
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
9 ;; any later version.
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ;; Available constraint letters: "e", "k", "q", "u", "A", "B", "C", "D"
22 ;; Register constraints
24 (define_register_constraint "f" "rs6000_constraints[RS6000_CONSTRAINT_f]"
25   "@internal")
27 (define_register_constraint "d" "rs6000_constraints[RS6000_CONSTRAINT_d]"
28   "@internal")
30 (define_register_constraint "b" "BASE_REGS"
31   "@internal")
33 (define_register_constraint "h" "SPECIAL_REGS"
34   "@internal")
36 (define_register_constraint "c" "CTR_REGS"
37   "@internal")
39 (define_register_constraint "l" "LINK_REGS"
40   "@internal")
42 (define_register_constraint "v" "ALTIVEC_REGS"
43   "@internal")
45 (define_register_constraint "x" "CR0_REGS"
46   "@internal")
48 (define_register_constraint "y" "CR_REGS"
49   "@internal")
51 (define_register_constraint "z" "CA_REGS"
52   "@internal")
54 ;; Use w as a prefix to add VSX modes
55 ;; any VSX register
56 (define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
57   "Any VSX register if the -mvsx option was used or NO_REGS.")
59 ;; NOTE: For compatibility, "wc" is reserved to represent individual CR bits.
60 ;; It is currently used for that purpose in LLVM.
62 (define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]"
63   "VSX vector register to hold vector double data or NO_REGS.")
65 (define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]"
66   "VSX vector register to hold vector float data or NO_REGS.")
68 (define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]"
69   "If -mmfpgpr was used, a floating point register or NO_REGS.")
71 (define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]"
72   "Floating point register if the LFIWAX instruction is enabled or NO_REGS.")
74 (define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]"
75   "VSX register if direct move instructions are enabled, or NO_REGS.")
77 ;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use
78 ;; direct move directly, and movsf can't to move between the register sets.
79 ;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode
80 (define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).")
82 (define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]"
83   "General purpose register if 64-bit instructions are enabled or NO_REGS.")
85 (define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
86   "VSX vector register to hold scalar double values or NO_REGS.")
88 (define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
89   "VSX vector register to hold 128 bit integer or NO_REGS.")
91 (define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]"
92   "Altivec register to use for float/32-bit int loads/stores  or NO_REGS.")
94 (define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]"
95   "Altivec register to use for double loads/stores  or NO_REGS.")
97 (define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]"
98   "FP or VSX register to perform float operations under -mvsx or NO_REGS.")
100 (define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
101   "Floating point register if the STFIWX instruction is enabled or NO_REGS.")
103 (define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]"
104   "VSX vector register to hold scalar float values or NO_REGS.")
106 (define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]"
107   "Floating point register if the LFIWZX instruction is enabled or NO_REGS.")
109 (define_constraint "wD"
110   "Int constant that is the element number of the 64-bit scalar in a vector."
111   (and (match_code "const_int")
112        (match_test "TARGET_VSX && (ival == VECTOR_ELEMENT_SCALAR_64BIT)")))
114 ;; Lq/stq validates the address for load/store quad
115 (define_memory_constraint "wQ"
116   "Memory operand suitable for the load/store quad instructions"
117   (match_operand 0 "quad_memory_operand"))
119 ;; Altivec style load/store that ignores the bottom bits of the address
120 (define_memory_constraint "wZ"
121   "Indexed or indirect memory operand, ignoring the bottom 4 bits"
122   (match_operand 0 "altivec_indexed_or_indirect_operand"))
124 ;; Integer constraints
126 (define_constraint "I"
127   "A signed 16-bit constant"
128   (and (match_code "const_int")
129        (match_test "(unsigned HOST_WIDE_INT) (ival + 0x8000) < 0x10000")))
131 (define_constraint "J"
132   "high-order 16 bits nonzero"
133   (and (match_code "const_int")
134        (match_test "(ival & (~ (unsigned HOST_WIDE_INT) 0xffff0000)) == 0")))
136 (define_constraint "K"
137   "low-order 16 bits nonzero"
138   (and (match_code "const_int")
139        (match_test "(ival & (~ (HOST_WIDE_INT) 0xffff)) == 0")))
141 (define_constraint "L"
142   "signed 16-bit constant shifted left 16 bits"
143   (and (match_code "const_int")
144        (match_test "((ival & 0xffff) == 0
145                       && (ival >> 31 == -1 || ival >> 31 == 0))")))
147 (define_constraint "M"
148   "constant greater than 31"
149   (and (match_code "const_int")
150        (match_test "ival > 31")))
152 (define_constraint "N"
153   "positive constant that is an exact power of two"
154   (and (match_code "const_int")
155        (match_test "ival > 0 && exact_log2 (ival) >= 0")))
157 (define_constraint "O"
158   "constant zero"
159   (and (match_code "const_int")
160        (match_test "ival == 0")))
162 (define_constraint "P"
163   "constant whose negation is signed 16-bit constant"
164   (and (match_code "const_int")
165        (match_test "(unsigned HOST_WIDE_INT) ((- ival) + 0x8000) < 0x10000")))
167 ;; Floating-point constraints
169 (define_constraint "G"
170   "Constant that can be copied into GPR with two insns for DF/DI
171    and one for SF."
172   (and (match_code "const_double")
173        (match_test "num_insns_constant (op, mode)
174                     == (mode == SFmode ? 1 : 2)")))
176 (define_constraint "H"
177   "DF/DI constant that takes three insns."
178   (and (match_code "const_double")
179        (match_test "num_insns_constant (op, mode) == 3")))
181 ;; Memory constraints
183 (define_memory_constraint "es"
184   "A ``stable'' memory operand; that is, one which does not include any
185 automodification of the base register.  Unlike @samp{m}, this constraint
186 can be used in @code{asm} statements that might access the operand
187 several times, or that might not access it at all."
188   (and (match_code "mem")
189        (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")))
191 (define_memory_constraint "Q"
192   "Memory operand that is an offset from a register (it is usually better
193 to use @samp{m} or @samp{es} in @code{asm} statements)"
194   (and (match_code "mem")
195        (match_test "GET_CODE (XEXP (op, 0)) == REG")))
197 (define_memory_constraint "Y"
198   "memory operand for 8 byte and 16 byte gpr load/store"
199   (and (match_code "mem")
200        (match_operand 0 "mem_operand_gpr")))
202 (define_memory_constraint "Z"
203   "Memory operand that is an indexed or indirect from a register (it is
204 usually better to use @samp{m} or @samp{es} in @code{asm} statements)"
205   (match_operand 0 "indexed_or_indirect_operand"))
207 ;; Address constraints
209 (define_address_constraint "a"
210   "Indexed or indirect address operand"
211   (match_operand 0 "indexed_or_indirect_address"))
213 (define_constraint "R"
214   "AIX TOC entry"
215   (match_test "legitimate_constant_pool_address_p (op, QImode, false)"))
217 ;; General constraints
219 (define_constraint "S"
220   "Constant that can be placed into a 64-bit mask operand"
221   (match_operand 0 "mask64_operand"))
223 (define_constraint "T"
224   "Constant that can be placed into a 32-bit mask operand"
225   (match_operand 0 "mask_operand"))
227 (define_constraint "U"
228   "V.4 small data reference"
229   (and (match_test "DEFAULT_ABI == ABI_V4")
230        (match_operand 0 "small_data_operand")))
232 (define_constraint "t"
233   "AND masks that can be performed by two rldic{l,r} insns
234    (but excluding those that could match other constraints of anddi3)"
235   (and (and (and (match_operand 0 "mask64_2_operand")
236                  (match_test "(fixed_regs[CR0_REGNO]
237                               || !logical_operand (op, DImode))"))
238             (not (match_operand 0 "mask_operand")))
239        (not (match_operand 0 "mask64_operand"))))
241 (define_constraint "W"
242   "vector constant that does not require memory"
243   (match_operand 0 "easy_vector_constant"))
245 (define_constraint "j"
246   "Zero vector constant"
247   (match_test "op == const0_rtx || op == CONST0_RTX (GET_MODE (op))"))