1;; Toshiba Media Processor Machine constraints
2;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
3;; Contributed by Red Hat Inc.
4;;
5;; This file is part of GCC.
6;;
7;; GCC is free software; you can redistribute it and/or modify it
8;; under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 3, or (at your option)
10;; any later version.
11;;
12;; GCC is distributed in the hope that it will be useful, but WITHOUT
13;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15;; License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with GCC; see the file COPYING3.  If not see
19;; <http://www.gnu.org/licenses/>.  */
20
21
22
23(define_register_constraint "a" "SP_REGS"
24  "The $sp register.")
25
26(define_register_constraint "b" "TP_REGS"
27  "The $tp register.")
28
29(define_register_constraint "c" "CONTROL_REGS"
30  "Any control register.")
31
32(define_register_constraint "d" "HILO_REGS"
33  "Either the $hi or the $lo register.")
34
35(define_register_constraint "em" "LOADABLE_CR_REGS"
36  "Coprocessor registers that can be directly loaded ($c0-$c15).")
37
38(define_register_constraint "ex" "mep_have_copro_copro_moves_p ? CR_REGS : NO_REGS"
39  "Coprocessor registers that can be moved to each other.")
40
41(define_register_constraint "er" "mep_have_core_copro_moves_p ? CR_REGS : NO_REGS"
42  "Coprocessor registers that can be moved to core registers.")
43
44(define_register_constraint "h" "HI_REGS"
45  "The $hi register.")
46
47(define_register_constraint "j" "RPC_REGS"
48  "The $rpc register.")
49
50(define_register_constraint "l" "LO_REGS"
51  "The $lo register.")
52
53(define_register_constraint "t" "TPREL_REGS"
54  "Registers which can be used in $tp-relative addressing.")
55
56(define_register_constraint "v" "GP_REGS"
57  "The $gp register.")
58
59(define_register_constraint "x" "CR_REGS"
60  "The coprocessor registers.")
61
62(define_register_constraint "y" "CCR_REGS"
63  "The coprocessor control registers.")
64
65(define_register_constraint "z" "R0_REGS"
66  "The $0 register.")
67
68(define_register_constraint "A" "USER0_REGS"
69  "User-defined register set A.")
70
71(define_register_constraint "B" "USER1_REGS"
72  "User-defined register set B.")
73
74(define_register_constraint "C" "USER2_REGS"
75  "User-defined register set C.")
76
77(define_register_constraint "D" "USER3_REGS"
78  "User-defined register set D.")
79
80
81
82(define_constraint "I"
83  "Offsets for $gp-rel addressing."
84  (and (match_code "const_int")
85       (match_test "ival >= -32768 && ival < 32768")))
86
87(define_constraint "J"
88  "Constants that can be used directly with boolean insns."
89  (and (match_code "const_int")
90       (match_test "ival >= 0 && ival < 65536")))
91
92(define_constraint "K"
93  "Constants that can be moved directly to registers."
94  (and (match_code "const_int")
95       (match_test "ival >= 0 && ival < 0x01000000")))
96
97(define_constraint "L"
98  "Small constants that can be added to registers."
99  (and (match_code "const_int")
100       (match_test "ival >= -32 && ival < 32")))
101
102(define_constraint "M"
103  "Long shift counts."
104  (and (match_code "const_int")
105       (match_test "ival >= 0 && ival < 32")))
106
107(define_constraint "N"
108  "Small constants that can be compared to registers."
109  (and (match_code "const_int")
110       (match_test "ival >= 0 && ival < 16")))
111
112(define_constraint "O"
113  "Constants that can be loaded into the top half of registers."
114  (and (match_code "const_int")
115       (match_test "!(ival & 0xffff) && ival >= -2147483647-1 && ival <= 2147483647")))
116
117(define_constraint "S"
118  "Signed 8-bit immediates."
119  (and (match_code "const_int")
120       (match_test "ival >= -128 && ival < 127")))
121
122
123
124;; This must only be used with mep_call_address_operand() as the predicate.
125(define_constraint "R"
126  "@internal
127Near symbols that can be used as addresses for CALL."
128  (not (match_code "reg")))
129
130(define_constraint "T"
131  "Symbols encoded for $tp-rel or $gp-rel addressing."
132  (ior (ior
133	(and (match_code "unspec")
134	     (match_code "symbol_ref" "a"))
135	(and (match_code "const")
136	     (and (match_code "unspec" "0")
137		  (match_code "symbol_ref" "0a"))))
138       (and (match_code "const")
139	    (and (match_code "plus" "0")
140		 (and (match_code "unspec" "00")
141		      (match_code "symbol_ref" "00a"))))))
142
143(define_constraint "U"
144  "Non-constant addresses for loading/saving coprocessor registers."
145  (and (match_code "mem")
146       (match_test "! CONSTANT_P (XEXP (op, 0))")))
147
148(define_constraint "W"
149  "The top half of a symbol's value."
150  (and (match_code "high")
151       (match_code "symbol_ref" "0")))
152
153(define_constraint "Y"
154  "A register indirect address without offset."
155  (and (match_code "mem")
156       (match_code "reg" "0")))
157
158(define_constraint "Z"
159  "Symbolic references to the control bus."
160  (and (and (match_code "mem")
161	    (match_code "symbol_ref" "0"))
162       (match_test "mep_section_tag (op) == 'c'")))
163