OSDN Git Service

Disallow negative constant address for x32
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / constraints.md
1 ;; Constraint definitions for m68k
2 ;; Copyright (C) 2007 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 it
7 ;; under the terms of the GNU General Public License as published
8 ;; by the Free Software Foundation; either version 3, or (at your
9 ;; option) any later version.
10
11 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
12 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14 ;; 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 COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
19
20 (define_register_constraint "a" "ADDR_REGS"
21   "Address register.")
22
23 (define_register_constraint "d" "DATA_REGS"
24   "Data register.")
25
26 (define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
27   "Floating point register.")
28
29 (define_constraint "I"
30   "Integer constant in the range 1 @dots 8, for immediate shift counts and addq."
31   (and (match_code "const_int")
32        (match_test "ival > 0 && ival <= 8")))
33
34 (define_constraint "J"
35   "Signed 16-bit integer constant."
36   (and (match_code "const_int")
37        (match_test "ival >= -0x8000 && ival <= 0x7fff")))
38
39 (define_constraint "K"
40   "Integer constant that moveq can't handle."
41   (and (match_code "const_int")
42        (match_test "ival < -0x80 || ival >= 0x80")))
43
44 (define_constraint "L"
45   "Integer constant in the range -8 @dots -1, for subq."
46   (and (match_code "const_int")
47        (match_test "ival < 0 && ival >= -8")))
48
49 (define_constraint "M"
50   "Integer constant that moveq+notb can't handle."
51   (and (match_code "const_int")
52        (match_test "ival < -0x100 || ival >= 0x100")))
53
54 (define_constraint "N"
55   "Integer constant in the range 24 @dots 31, for rotatert:SI 8 to 1 expressed as rotate."
56   (and (match_code "const_int")
57        (match_test "ival >= 24 && ival <= 31")))
58
59 (define_constraint "O"
60   "Integer constant 16, for rotate using swap."
61   (and (match_code "const_int")
62        (match_test "ival == 16")))
63
64 (define_constraint "P"
65   "Integer constant in the range 8 @dots 15, for rotatert:HI 8 to 1 expressed as rotate."
66   (and (match_code "const_int")
67        (match_test "ival >= 8 && ival <= 15")))
68
69 (define_constraint "R"
70   "Integer constant that mov3q can handle."
71   (and (match_code "const_int")
72        (match_test "valid_mov3q_const (ival)")))
73
74 (define_constraint "G"
75   "Defines all of the floating constants that are *NOT* 68881
76    constants.  This is so 68881 constants get reloaded and the fpmovecr
77    is used."
78   (and (match_code "const_double")
79        (match_test "!(TARGET_68881 && standard_68881_constant_p (op))")))
80
81 (define_constraint "H"
82   "Defines a real zero constant."
83   (and (match_code "const_double")
84        (match_test "op == CONST0_RTX (GET_MODE (op))")))
85
86 (define_constraint "S"
87   "Used for operands that satisfy 'm' when -mpcrel is in effect."
88   (and (match_code "mem")
89        (match_test "TARGET_PCREL
90                     && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
91                         || GET_CODE (XEXP (op, 0)) == LABEL_REF
92                         || GET_CODE (XEXP (op, 0)) == CONST)")))
93
94 (define_constraint "T"
95   "Used for operands that satisfy 's' when -mpcrel is not in effect."
96   (and (match_code "symbol_ref,label_ref,const")
97        (match_test "!TARGET_PCREL")
98        (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
99
100 (define_memory_constraint "Q"
101   "Means address register indirect addressing mode."
102   (and (match_code "mem")
103        (match_test "m68k_matches_q_p (op)")))
104
105 (define_constraint "U"
106   "Used for register offset addressing."
107   (and (match_code "mem")
108        (match_test "m68k_matches_u_p (op)")))
109
110 (define_constraint "W"
111   "Used for const_call_operands."
112   (match_operand 0 "const_call_operand"))
113
114 (define_constraint "Cs"
115   "symbol_ref or const."
116   (match_code "symbol_ref,const"))
117
118 (define_constraint "Ci"
119   "const_int."
120   (and (match_code "const_int")
121        (match_test "true")))
122
123 (define_constraint "C0"
124   "const_int 0."
125   (and (match_code "const_int")
126        (match_test "ival == 0")))
127
128 (define_constraint "Cj"
129   "Range of signed numbers that don't fit in 16 bits."
130   (and (match_code "const_int")
131        (match_test "ival < -0x8000 || ival > 0x7FFF")))
132
133 (define_constraint "Cu"
134   "16-bit offset for wrapped symbols"
135   (and (match_code "const")
136        (match_test "m68k_unwrap_symbol (op, false) != op")))
137
138 (define_constraint "CQ"
139   "Integers valid for mvq."
140   (and (match_code "const_int")
141        (match_test "m68k_const_method (ival) == MOVQ")))
142
143 (define_constraint "CW"
144   "Integers valid for a moveq followed by a swap."
145   (and (match_code "const_int")
146        (match_test "m68k_const_method (ival) == SWAP")))
147
148 (define_constraint "CZ"
149   "Integers valid for mvz."
150   (and (match_code "const_int")
151        (match_test "m68k_const_method (ival) == MVZ")))
152
153 (define_constraint "CS"
154   "Integers valid for mvs."
155   (and (match_code "const_int")
156        (match_test "m68k_const_method (ival) == MVS")))
157
158 (define_constraint "Ap"
159   "push_operand."
160   (match_operand 0 "push_operand"))
161
162 (define_constraint "Ac"
163   "Non-register operands allowed in clr."
164   (and (match_operand 0 "movsi_const0_operand")
165        (match_test "!REG_P (op)")))