1 ;; Constraint definitions for RS6000
2 ;; Copyright (C) 2006 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 2, 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 COPYING. If not, write to
18 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 ;; Boston, MA 02110-1301, USA.
21 ;; Register constraints
23 (define_register_constraint "f" "TARGET_HARD_FLOAT && TARGET_FPRS
24 ? FLOAT_REGS : NO_REGS"
27 (define_register_constraint "b" "BASE_REGS"
30 (define_register_constraint "h" "SPECIAL_REGS"
33 (define_register_constraint "q" "MQ_REGS"
36 (define_register_constraint "c" "CTR_REGS"
39 (define_register_constraint "l" "LINK_REGS"
42 (define_register_constraint "v" "ALTIVEC_REGS"
45 (define_register_constraint "x" "CR0_REGS"
48 (define_register_constraint "y" "CR_REGS"
51 (define_register_constraint "z" "XER_REGS"
54 ;; Integer constraints
56 (define_constraint "I"
57 "A signed 16-bit constant"
58 (and (match_code "const_int")
59 (match_test "(unsigned HOST_WIDE_INT) (ival + 0x8000) < 0x10000")))
61 (define_constraint "J"
62 "high-order 16 bits nonzero"
63 (and (match_code "const_int")
64 (match_test "(ival & (~ (unsigned HOST_WIDE_INT) 0xffff0000)) == 0")))
66 (define_constraint "K"
67 "low-order 16 bits nonzero"
68 (and (match_code "const_int")
69 (match_test "(ival & (~ (HOST_WIDE_INT) 0xffff)) == 0")))
71 (define_constraint "L"
72 "signed 16-bit constant shifted left 16 bits"
73 (and (match_code "const_int")
74 (match_test "((ival & 0xffff) == 0
75 && (ival >> 31 == -1 || ival >> 31 == 0))")))
77 (define_constraint "M"
78 "constant greater than 31"
79 (and (match_code "const_int")
80 (match_test "ival > 31")))
82 (define_constraint "N"
83 "positive constant that is an exact power of two"
84 (and (match_code "const_int")
85 (match_test "ival > 0 && exact_log2 (ival) >= 0")))
87 (define_constraint "O"
89 (and (match_code "const_int")
90 (match_test "ival == 0")))
92 (define_constraint "P"
93 "constant whose negation is signed 16-bit constant"
94 (and (match_code "const_int")
95 (match_test "(unsigned HOST_WIDE_INT) ((- ival) + 0x8000) < 0x10000")))
97 ;; Floating-point constraints
99 (define_constraint "G"
100 "Constant that can be copied into GPR with two insns for DF/DI
102 (and (match_code "const_double")
103 (match_test "num_insns_constant (op, mode)
104 == (mode == SFmode ? 1 : 2)")))
106 (define_constraint "H"
107 "DF/DI constant that takes three insns."
108 (and (match_code "const_double")
109 (match_test "num_insns_constant (op, mode) == 3")))
111 ;; Memory constraints
113 (define_memory_constraint "Q"
114 "Memory operand that is just an offset from a reg"
115 (and (match_code "mem")
116 (match_test "GET_CODE (XEXP (op, 0)) == REG")))
118 (define_memory_constraint "Y"
119 "Indexed or word-aligned displacement memory operand"
120 (match_operand 0 "word_offset_memref_operand"))
122 (define_memory_constraint "Z"
123 "Indexed or indirect memory operand"
124 (match_operand 0 "indexed_or_indirect_operand"))
126 ;; Address constraints
128 (define_address_constraint "a"
129 "Indexed or indirect address operand"
130 (match_operand 0 "indexed_or_indirect_address"))
132 (define_constraint "R"
134 (match_test "legitimate_constant_pool_address_p (op)"))
136 ;; General constraints
138 (define_constraint "S"
139 "Constant that can be placed into a 64-bit mask operand"
140 (match_operand 0 "mask64_operand"))
142 (define_constraint "T"
143 "Constant that can be placed into a 32-bit mask operand"
144 (match_operand 0 "mask_operand"))
146 (define_constraint "U"
147 "V.4 small data reference"
148 (and (match_test "DEFAULT_ABI == ABI_V4")
149 (match_operand 0 "small_data_operand")))
151 (define_constraint "t"
152 "AND masks that can be performed by two rldic{l,r} insns
153 (but excluding those that could match other constraints of anddi3)"
154 (and (and (and (match_operand 0 "mask64_2_operand")
155 (match_test "(fixed_regs[CR0_REGNO]
156 || !logical_operand (op, DImode))"))
157 (not (match_operand 0 "mask_operand")))
158 (not (match_operand 0 "mask64_operand"))))
160 (define_constraint "W"
161 "vector constant that does not require memory"
162 (match_operand 0 "easy_vector_constant"))