]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/msp430/constraints.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / msp430 / constraints.md
CommitLineData
f6a83b4a 1;; Machine Description for TI MSP43* processors
7adcbafe 2;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
f6a83b4a
DD
3;; Contributed by Red Hat.
4
5;; This file is part of GCC.
6
7;; GCC is free software; you can redistribute it and/or modify
8;; it 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,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public 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(define_register_constraint "R12" "R12_REGS"
22 "Register R12.")
23
24(define_register_constraint "R13" "R13_REGS"
25 "Register R13.")
26
27(define_constraint "K"
703e049a 28 "Integer constant 1-19."
f6a83b4a 29 (and (match_code "const_int")
703e049a 30 (match_test "IN_RANGE (ival, 1, 19)")))
f6a83b4a
DD
31
32(define_constraint "L"
33 "Integer constant -1^20..1^19."
34 (and (match_code "const_int")
3ea7f8e5 35 (match_test "IN_RANGE (ival, HOST_WIDE_INT_M1U << 20, 1 << 19)")))
f6a83b4a 36
703e049a 37;; Valid shift amount for RRUM, RRAM, RLAM, RRCM.
f6a83b4a
DD
38(define_constraint "M"
39 "Integer constant 1-4."
40 (and (match_code "const_int")
41 (match_test "IN_RANGE (ival, 1, 4)")))
42
3f02735b
DD
43(define_constraint "N"
44 "Integer constant 0-255."
45 (and (match_code "const_int")
46 (match_test "IN_RANGE (ival, 0, 255)")))
47
48(define_constraint "O"
49 "Integer constant 256-65535."
50 (and (match_code "const_int")
51 (match_test "IN_RANGE (ival, 256, 65535)")))
52
703e049a
JL
53(define_constraint "P"
54 "Integer constant 1-16."
55 (and (match_code "const_int")
56 (match_test "IN_RANGE (ival, 1, 16)")))
57
f6a83b4a
DD
58;; We do not allow arbitrary constants, eg symbols or labels,
59;; because their address may be above the 16-bit address limit
60;; supported by the offset used in the MOVA instruction.
61(define_constraint "Ya"
62 "Memory reference, any type, but restricted range of constants"
63 (and (match_code "mem")
64 (ior (match_code "reg" "0")
65 (and (match_code "plus" "0")
66 (match_code "reg" "00")
67 (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")))
68 (match_test "CONSTANT_P (XEXP (op, 0))")
28987d8b 69 (match_code "post_inc" "0")
f6a83b4a
DD
70 )))
71
72(define_constraint "Yl"
73 "Memory reference, labels only."
74 (and (match_code "mem")
75 (match_code "label_ref" "0")))
76
77
5cbc4e2a 78;; These are memory references that are safe to use without the X suffix,
8682b1a5
JL
79;; because we know/assume they need not index across the 64K boundary.
80;; Note that for a PSImode memory operand, we always need to use the X suffix,
81;; regardless of what this constraint decides.
f6a83b4a 82(define_constraint "Ys"
8682b1a5 83 "Memory reference, indexed or indirect register addressing modes."
f6a83b4a
DD
84 (and (match_code "mem")
85 (ior
86 (and (match_code "plus" "0")
87 (and (match_code "reg" "00")
88 (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))"))
3ea7f8e5 89 (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), HOST_WIDE_INT_M1U << 15, (1 << 15)-1)"))))
f6a83b4a 90 (match_code "reg" "0")
d8e4dc54 91 (match_code "post_inc" "0")
f6a83b4a 92 )))
fb28dac0
DD
93
94(define_constraint "Yc"
d4f283a1 95 "Memory reference, for CALL - we can't use SP."
fb28dac0
DD
96 (and (match_code "mem")
97 (match_code "mem" "0")
98 (not (ior
99 (and (match_code "plus" "00")
100 (and (match_code "reg" "000")
101 (match_test ("REGNO (XEXP (XEXP (op, 0), 0)) != SP_REGNO"))))
102 (and (match_code "reg" "0")
103 (match_test ("REGNO (XEXP (XEXP (op, 0), 0)) != SP_REGNO")))
104 ))))
105
8682b1a5
JL
106(define_constraint "Yx"
107 "Memory reference, in lower memory below address 0x10000."
108 (and (match_code "mem")
109 (match_test "msp430_op_not_in_high_mem (op)")))