1 ;; Constraint definitions for RS6000
2 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
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)
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 ;; Register constraints
22 (define_register_constraint "f" "TARGET_HARD_FLOAT && TARGET_FPRS
23 ? FLOAT_REGS : NO_REGS"
26 (define_register_constraint "d" "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
27 ? FLOAT_REGS : NO_REGS"
30 (define_register_constraint "b" "BASE_REGS"
33 (define_register_constraint "h" "SPECIAL_REGS"
36 (define_register_constraint "q" "MQ_REGS"
39 (define_register_constraint "c" "CTR_REGS"
42 (define_register_constraint "l" "LINK_REGS"
45 (define_register_constraint "v" "ALTIVEC_REGS"
48 (define_register_constraint "x" "CR0_REGS"
51 (define_register_constraint "y" "CR_REGS"
54 (define_register_constraint "z" "XER_REGS"
57 ;; Integer constraints
59 (define_constraint "I"
60 "A signed 16-bit constant"
61 (and (match_code "const_int")
62 (match_test "(unsigned HOST_WIDE_INT) (ival + 0x8000) < 0x10000")))
64 (define_constraint "J"
65 "high-order 16 bits nonzero"
66 (and (match_code "const_int")
67 (match_test "(ival & (~ (unsigned HOST_WIDE_INT) 0xffff0000)) == 0")))
69 (define_constraint "K"
70 "low-order 16 bits nonzero"
71 (and (match_code "const_int")
72 (match_test "(ival & (~ (HOST_WIDE_INT) 0xffff)) == 0")))
74 (define_constraint "L"
75 "signed 16-bit constant shifted left 16 bits"
76 (and (match_code "const_int")
77 (match_test "((ival & 0xffff) == 0
78 && (ival >> 31 == -1 || ival >> 31 == 0))")))
80 (define_constraint "M"
81 "constant greater than 31"
82 (and (match_code "const_int")
83 (match_test "ival > 31")))
85 (define_constraint "N"
86 "positive constant that is an exact power of two"
87 (and (match_code "const_int")
88 (match_test "ival > 0 && exact_log2 (ival) >= 0")))
90 (define_constraint "O"
92 (and (match_code "const_int")
93 (match_test "ival == 0")))
95 (define_constraint "P"
96 "constant whose negation is signed 16-bit constant"
97 (and (match_code "const_int")
98 (match_test "(unsigned HOST_WIDE_INT) ((- ival) + 0x8000) < 0x10000")))
100 ;; Floating-point constraints
102 (define_constraint "G"
103 "Constant that can be copied into GPR with two insns for DF/DI
105 (and (match_code "const_double")
106 (match_test "num_insns_constant (op, mode)
107 == (mode == SFmode ? 1 : 2)")))
109 (define_constraint "H"
110 "DF/DI constant that takes three insns."
111 (and (match_code "const_double")
112 (match_test "num_insns_constant (op, mode) == 3")))
114 ;; Memory constraints
116 (define_memory_constraint "Q"
117 "Memory operand that is just an offset from a reg"
118 (and (match_code "mem")
119 (match_test "GET_CODE (XEXP (op, 0)) == REG")))
121 (define_memory_constraint "Y"
122 "Indexed or word-aligned displacement memory operand"
123 (match_operand 0 "word_offset_memref_operand"))
125 (define_memory_constraint "Z"
126 "Indexed or indirect memory operand"
127 (match_operand 0 "indexed_or_indirect_operand"))
129 ;; Address constraints
131 (define_address_constraint "a"
132 "Indexed or indirect address operand"
133 (match_operand 0 "indexed_or_indirect_address"))
135 (define_constraint "R"
137 (match_test "legitimate_constant_pool_address_p (op)"))
139 ;; General constraints
141 (define_constraint "S"
142 "Constant that can be placed into a 64-bit mask operand"
143 (match_operand 0 "mask64_operand"))
145 (define_constraint "T"
146 "Constant that can be placed into a 32-bit mask operand"
147 (match_operand 0 "mask_operand"))
149 (define_constraint "U"
150 "V.4 small data reference"
151 (and (match_test "DEFAULT_ABI == ABI_V4")
152 (match_operand 0 "small_data_operand")))
154 (define_constraint "t"
155 "AND masks that can be performed by two rldic{l,r} insns
156 (but excluding those that could match other constraints of anddi3)"
157 (and (and (and (match_operand 0 "mask64_2_operand")
158 (match_test "(fixed_regs[CR0_REGNO]
159 || !logical_operand (op, DImode))"))
160 (not (match_operand 0 "mask_operand")))
161 (not (match_operand 0 "mask64_operand"))))
163 (define_constraint "W"
164 "vector constant that does not require memory"
165 (match_operand 0 "easy_vector_constant"))