1 ;; Constraint definitions for m68k
2 ;; Copyright (C) 2007-2013 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 "!TARGET_PCREL")
98 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
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)")))
105 (define_constraint "U"
106 "Used for register offset addressing."
107 (and (match_code "mem")
108 (match_test "m68k_matches_u_p (op)")))
110 (define_constraint "W"
111 "Used for const_call_operands."
112 (match_operand 0 "const_call_operand"))
114 (define_constraint "Cs"
115 "symbol_ref or const."
116 (match_code "symbol_ref,const"))
118 (define_constraint "Ci"
120 (and (match_code "const_int")
121 (match_test "true")))
123 (define_constraint "C0"
125 (and (match_code "const_int")
126 (match_test "ival == 0")))
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")))
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")))
138 (define_constraint "CQ"
139 "Integers valid for mvq."
140 (and (match_code "const_int")
141 (match_test "m68k_const_method (ival) == MOVQ")))
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")))
148 (define_constraint "CZ"
149 "Integers valid for mvz."
150 (and (match_code "const_int")
151 (match_test "m68k_const_method (ival) == MVZ")))
153 (define_constraint "CS"
154 "Integers valid for mvs."
155 (and (match_code "const_int")
156 (match_test "m68k_const_method (ival) == MVS")))
158 (define_constraint "Ap"
160 (match_operand 0 "push_operand"))
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)")))