OSDN Git Service

155395d28f723caefa1e9b55768bf007dc663c0d
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / constraints.md
1 ;; Constraint definitions for RS6000
2 ;; Copyright (C) 2006 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 2, or (at your option)
9 ;; any later version.
10 ;;
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
15 ;;
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING.  If not, write to
18 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 ;; Boston, MA 02110-1301, USA.
20
21 ;; Register constraints
22
23 (define_register_constraint "f" "TARGET_HARD_FLOAT && TARGET_FPRS
24                                  ? FLOAT_REGS : NO_REGS"
25   "@internal")
26
27 (define_register_constraint "b" "BASE_REGS"
28   "@internal")
29
30 (define_register_constraint "h" "SPECIAL_REGS"
31   "@internal")
32
33 (define_register_constraint "q" "MQ_REGS"
34   "@internal")
35
36 (define_register_constraint "c" "CTR_REGS"
37   "@internal")
38
39 (define_register_constraint "l" "LINK_REGS"
40   "@internal")
41
42 (define_register_constraint "v" "ALTIVEC_REGS"
43   "@internal")
44
45 (define_register_constraint "x" "CR0_REGS"
46   "@internal")
47
48 (define_register_constraint "y" "CR_REGS"
49   "@internal")
50
51 (define_register_constraint "z" "XER_REGS"
52   "@internal")
53
54 ;; Integer constraints
55
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")))
60
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")))
65
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")))
70
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))")))
76
77 (define_constraint "M"
78   "constant greater than 31"
79   (and (match_code "const_int")
80        (match_test "ival > 31")))
81
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")))
86
87 (define_constraint "O"
88   "constant zero"
89   (and (match_code "const_int")
90        (match_test "ival == 0")))
91
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")))
96
97 ;; Floating-point constraints
98
99 (define_constraint "G"
100   "Constant that can be copied into GPR with two insns for DF/DI
101    and one for SF."
102   (and (match_code "const_double")
103        (match_test "num_insns_constant (op, mode)
104                     == (mode == SFmode ? 1 : 2)")))
105
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")))
110
111 ;; Memory constraints
112
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")))
117
118 (define_memory_constraint "Y"
119   "Indexed or word-aligned displacement memory operand"
120   (match_operand 0 "word_offset_memref_operand"))
121
122 (define_memory_constraint "Z"
123   "Indexed or indirect memory operand"
124   (match_operand 0 "indexed_or_indirect_operand"))
125
126 ;; Address constraints
127
128 (define_address_constraint "a"
129   "Indexed or indirect address operand"
130   (match_operand 0 "indexed_or_indirect_address"))
131
132 (define_constraint "R"
133   "AIX TOC entry"
134   (match_test "legitimate_constant_pool_address_p (op)"))
135
136 ;; General constraints
137
138 (define_constraint "S"
139   "Constant that can be placed into a 64-bit mask operand"
140   (match_operand 0 "mask64_operand"))
141
142 (define_constraint "T"
143   "Constant that can be placed into a 32-bit mask operand"
144   (match_operand 0 "mask_operand"))
145
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")))
150
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"))))