1 ;; Constraint definitions for m68k
2 ;; Copyright (C) 2007 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
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.
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.
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 (define_register_constraint "a" "ADDR_REGS"
23 (define_register_constraint "d" "DATA_REGS"
26 (define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
27 "Floating point register.")
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")))
34 (define_constraint "J"
35 "Signed 16-bit integer constant."
36 (and (match_code "const_int")
37 (match_test "ival >= -0x8000 && ival <= 0x7fff")))
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")))
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")))
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")))
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")))
59 (define_constraint "O"
60 "Integer constant 16, for rotate using swap."
61 (and (match_code "const_int")
62 (match_test "ival == 16")))
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")))
69 (define_constraint "R"
70 "Integer constant that mov3q can handle."
71 (and (match_code "const_int")
72 (match_test "valid_mov3q_const (ival)")))
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
78 (and (match_code "const_double")
79 (match_test "!(TARGET_68881 && standard_68881_constant_p (op))")))
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))")))
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)")))
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 "!flag_pic")))
99 (define_memory_constraint "Q"
100 "Means address register indirect addressing mode."
101 (and (match_code "mem")
102 (match_test "m68k_matches_q_p (op)")))
104 (define_constraint "U"
105 "Used for register offset addressing."
106 (and (match_code "mem")
107 (match_test "m68k_matches_u_p (op)")))
109 (define_constraint "W"
110 "Used for const_call_operands."
111 (match_operand 0 "const_call_operand"))
113 (define_constraint "Cs"
114 "symbol_ref or const."
115 (match_code "symbol_ref,const"))
117 (define_constraint "Ci"
119 (and (match_code "const_int")
120 (match_test "true")))
122 (define_constraint "C0"
124 (and (match_code "const_int")
125 (match_test "ival == 0")))
127 (define_constraint "Cj"
128 "Range of signed numbers that don't fit in 16 bits."
129 (and (match_code "const_int")
130 (match_test "ival < -0x8000 || ival > 0x7FFF")))
132 (define_constraint "Cu"
133 "16-bit offset for wrapped symbols"
134 (and (match_code "const")
135 (match_test "m68k_unwrap_symbol (op, false) != op")))
137 (define_constraint "CQ"
138 "Integers valid for mvq."
139 (and (match_code "const_int")
140 (match_test "m68k_const_method (ival) == MOVQ")))
142 (define_constraint "CW"
143 "Integers valid for a moveq followed by a swap."
144 (and (match_code "const_int")
145 (match_test "m68k_const_method (ival) == SWAP")))
147 (define_constraint "CZ"
148 "Integers valid for mvz."
149 (and (match_code "const_int")
150 (match_test "m68k_const_method (ival) == MVZ")))
152 (define_constraint "CS"
153 "Integers valid for mvs."
154 (and (match_code "const_int")
155 (match_test "m68k_const_method (ival) == MVS")))
157 (define_constraint "Ap"
159 (match_operand 0 "push_operand"))
161 (define_constraint "Ac"
162 "Non-register operands allowed in clr."
163 (and (match_operand 0 "movsi_const0_operand")
164 (match_test "!REG_P (op)")))