summaryrefslogtreecommitdiff
path: root/gcc/config/m68k/constraints.md
blob: 96ad9e94c7df5fe6741a80d6be7e833846587c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
;; Constraint definitions for m68k
;; Copyright (C) 2007-2020 Free Software Foundation, Inc.

;; This file is part of GCC.

;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.

;; GCC is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_register_constraint "a" "ADDR_REGS"
  "Address register.")

(define_register_constraint "d" "DATA_REGS"
  "Data register.")

(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
  "Floating point register.")

(define_constraint "I"
  "Integer constant in the range 1 @dots 8, for immediate shift counts and addq."
  (and (match_code "const_int")
       (match_test "ival > 0 && ival <= 8")))

(define_constraint "J"
  "Signed 16-bit integer constant."
  (and (match_code "const_int")
       (match_test "ival >= -0x8000 && ival <= 0x7fff")))

(define_constraint "K"
  "Integer constant that moveq can't handle."
  (and (match_code "const_int")
       (match_test "ival < -0x80 || ival >= 0x80")))

(define_constraint "L"
  "Integer constant in the range -8 @dots -1, for subq."
  (and (match_code "const_int")
       (match_test "ival < 0 && ival >= -8")))

(define_constraint "M"
  "Integer constant that moveq+notb can't handle."
  (and (match_code "const_int")
       (match_test "ival < -0x100 || ival >= 0x100")))

(define_constraint "N"
  "Integer constant in the range 24 @dots 31, for rotatert:SI 8 to 1 expressed as rotate."
  (and (match_code "const_int")
       (match_test "ival >= 24 && ival <= 31")))

(define_constraint "O"
  "Integer constant 16, for rotate using swap."
  (and (match_code "const_int")
       (match_test "ival == 16")))

(define_constraint "P"
  "Integer constant in the range 8 @dots 15, for rotatert:HI 8 to 1 expressed as rotate."
  (and (match_code "const_int")
       (match_test "ival >= 8 && ival <= 15")))

(define_constraint "R"
  "Integer constant that mov3q can handle."
  (and (match_code "const_int")
       (match_test "valid_mov3q_const (ival)")))

(define_constraint "G"
  "Defines all of the floating constants that are *NOT* 68881
   constants.  This is so 68881 constants get reloaded and the fpmovecr
   is used."
  (and (match_code "const_double")
       (match_test "!(TARGET_68881 && standard_68881_constant_p (op))")))

(define_constraint "H"
  "Defines a real zero constant."
  (and (match_code "const_double")
       (match_test "op == CONST0_RTX (GET_MODE (op))")))

(define_constraint "S"
  "Used for operands that satisfy 'm' when -mpcrel is in effect."
  (and (match_code "mem")
       (match_test "TARGET_PCREL
		    && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
			|| GET_CODE (XEXP (op, 0)) == LABEL_REF
			|| GET_CODE (XEXP (op, 0)) == CONST)")))

(define_constraint "T"
  "Used for operands that satisfy 's' when -mpcrel is not in effect."
  (and (match_code "symbol_ref,label_ref,const")
       (match_test "!TARGET_PCREL")
       (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))

(define_memory_constraint "Q"
  "Means address register indirect addressing mode."
  (and (match_code "mem")
       (match_test "m68k_matches_q_p (op)")))

(define_constraint "U"
  "Used for register offset addressing."
  (and (match_code "mem")
       (match_test "m68k_matches_u_p (op)")))

(define_constraint "W"
  "Used for const_call_operands."
  (match_operand 0 "const_call_operand"))

(define_constraint "Cs"
  "symbol_ref or const."
  (match_code "symbol_ref,const"))

(define_constraint "Ci"
  "const_int."
  (and (match_code "const_int")
       (match_test "true")))

(define_constraint "C0"
  "const_int 0."
  (and (match_code "const_int")
       (match_test "ival == 0")))

(define_constraint "Cj"
  "Range of signed numbers that don't fit in 16 bits."
  (and (match_code "const_int")
       (match_test "ival < -0x8000 || ival > 0x7FFF")))

(define_constraint "Cu"
  "16-bit offset for wrapped symbols"
  (and (match_code "const")
       (match_test "m68k_unwrap_symbol (op, false) != op")))

(define_constraint "CQ"
  "Integers valid for mvq."
  (and (match_code "const_int")
       (match_test "m68k_const_method (ival) == MOVQ")))

(define_constraint "CW"
  "Integers valid for a moveq followed by a swap."
  (and (match_code "const_int")
       (match_test "m68k_const_method (ival) == SWAP")))

(define_constraint "CZ"
  "Integers valid for mvz."
  (and (match_code "const_int")
       (match_test "m68k_const_method (ival) == MVZ")))

(define_constraint "CS"
  "Integers valid for mvs."
  (and (match_code "const_int")
       (match_test "m68k_const_method (ival) == MVS")))

(define_constraint "Ap"
  "push_operand."
  (match_operand 0 "push_operand"))

(define_constraint "Ac"
  "Non-register operands allowed in clr."
  (and (match_operand 0 "movsi_const0_operand")
       (match_test "!REG_P (op)")))