]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/xtensa/constraints.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / xtensa / constraints.md
CommitLineData
887af464 1;; Constraint definitions for Xtensa.
83ffe9cd 2;; Copyright (C) 2006-2023 Free Software Foundation, Inc.
887af464
BW
3;;
4;; This file is part of GCC.
5;;
6;; GCC is free software; you can redistribute it and/or modify
7;; it under the terms of the GNU General Public License as published by
2f83c7d6 8;; the Free Software Foundation; either version 3, or (at your option)
887af464
BW
9;; any later version.
10;;
11;; GCC is distributed in the hope that it will be useful,
12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;; GNU General Public License for more details.
15;;
16;; You should have received a copy of the GNU General Public License
2f83c7d6
NC
17;; along with GCC; see the file COPYING3. If not see
18;; <http://www.gnu.org/licenses/>.
887af464
BW
19
20;; Register constraints.
21
590e2636 22(define_register_constraint "a" "TARGET_WINDOWED_ABI ? GR_REGS : AR_REGS"
887af464
BW
23 "General-purpose AR registers @code{a0}-@code{a15},
24 except @code{a1} (@code{sp}).")
25
26(define_register_constraint "b" "TARGET_BOOLEANS ? BR_REGS : NO_REGS"
27 "Boolean registers @code{b0}-@code{b15}; only available if the Xtensa
28 Boolean Option is configured.")
29
8731aa98
TJJS
30(define_register_constraint "c" "TARGET_WINDOWED_ABI ? NO_REGS : ISC_REGS"
31 "@internal
32 General-purpose AR registers for indirect sibling calls, @code{a2}-
33 @code{a8}.")
34
887af464
BW
35(define_register_constraint "d" "TARGET_DENSITY ? AR_REGS: NO_REGS"
36 "@internal
37 All AR registers, including sp, but only if the Xtensa Code Density
38 Option is configured.")
39
40(define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
41 "Floating-point registers @code{f0}-@code{f15}; only available if the
42 Xtensa Floating-Pointer Coprocessor is configured.")
43
590e2636 44(define_register_constraint "q" "TARGET_WINDOWED_ABI ? SP_REG : NO_REGS"
887af464
BW
45 "@internal
46 The stack pointer (register @code{a1}).")
47
48(define_register_constraint "A" "TARGET_MAC16 ? ACC_REG : NO_REGS"
49 "The low 32 bits of the accumulator from the Xtensa MAC16 Option.")
50
51(define_register_constraint "B" "TARGET_SEXT ? GR_REGS : NO_REGS"
52 "@internal
53 General-purpose AR registers, but only if the Xtensa Sign Extend
54 Option is configured.")
55
56(define_register_constraint "C" "TARGET_MUL16 ? GR_REGS: NO_REGS"
57 "@internal
58 General-purpose AR registers, but only if the Xtensa 16-Bit Integer
59 Multiply Option is configured.")
60
590e2636 61(define_register_constraint "D" "TARGET_DENSITY ? (TARGET_WINDOWED_ABI ? GR_REGS : AR_REGS) : NO_REGS"
887af464
BW
62 "@internal
63 General-purpose AR registers, but only if the Xtensa Code Density
64 Option is configured.")
65
66(define_register_constraint "W" "TARGET_CONST16 ? GR_REGS: NO_REGS"
67 "@internal
68 General-purpose AR registers, but only if the Xtensa Const16
69 Option is configured.")
70
71;; Integer constant constraints.
72
73(define_constraint "I"
74 "A signed 12-bit integer constant for use with MOVI instructions."
75 (and (match_code "const_int")
76 (match_test "xtensa_simm12b (ival)")))
77
78(define_constraint "J"
79 "A signed 8-bit integer constant for use with ADDI instructions."
80 (and (match_code "const_int")
81 (match_test "xtensa_simm8 (ival)")))
82
83(define_constraint "K"
84 "A constant integer that can be an immediate operand of an Xtensa
85 conditional branch instruction that performs a signed comparison or
86 a comparison against zero."
87 (and (match_code "const_int")
88 (match_test "xtensa_b4const_or_zero (ival)")))
89
90(define_constraint "L"
91 "A constant integer that can be an immediate operand of an Xtensa
92 conditional branch instruction that performs an unsigned comparison."
93 (and (match_code "const_int")
94 (match_test "xtensa_b4constu (ival)")))
95
96(define_constraint "M"
97 "An integer constant in the range @minus{}32-95 for use with MOVI.N
98 instructions."
99 (and (match_code "const_int")
9b251fe2 100 (match_test "IN_RANGE (ival, -32, 95)")))
887af464
BW
101
102(define_constraint "N"
103 "An unsigned 8-bit integer constant shifted left by 8 bits for use
104 with ADDMI instructions."
105 (and (match_code "const_int")
106 (match_test "xtensa_simm8x256 (ival)")))
107
108(define_constraint "O"
109 "An integer constant that can be used in ADDI.N instructions."
110 (and (match_code "const_int")
9b251fe2 111 (match_test "ival == -1 || IN_RANGE (ival, 1, 15)")))
887af464
BW
112
113(define_constraint "P"
114 "An integer constant that can be used as a mask value in an EXTUI
115 instruction."
116 (and (match_code "const_int")
117 (match_test "xtensa_mask_immediate (ival)")))
118
a024f514
MF
119(define_constraint "Y"
120 "A constant that can be used in relaxed MOVI instructions."
479b6f44
TJJS
121 (ior (and (match_code "const_int,const_double,const,symbol_ref,label_ref")
122 (match_test "TARGET_AUTO_LITPOOLS"))
123 (and (match_code "const_int")
4f3f0296 124 (match_test "! xtensa_split1_finished_p ()"))))
a024f514 125
887af464
BW
126;; Memory constraints. Do not use define_memory_constraint here. Doing so
127;; causes reload to force some constants into the constant pool, but since
128;; the Xtensa constant pool can only be accessed with L32R instructions, it
129;; is always better to just copy a constant into a register. Instead, use
130;; regular constraints but add a check to allow pseudos during reload.
131
132(define_constraint "R"
133 "Memory that can be accessed with a 4-bit unsigned offset from a register."
134 (ior (and (match_code "mem")
135 (match_test "smalloffset_mem_p (op)"))
136 (and (match_code "reg")
137 (match_test "reload_in_progress
138 && REGNO (op) >= FIRST_PSEUDO_REGISTER"))))
139
140(define_constraint "T"
141 "Memory in a literal pool (addressable with an L32R instruction)."
142 (and (match_code "mem")
143 (match_test "!TARGET_CONST16 && constantpool_mem_p (op)")))
144
145(define_constraint "U"
146 "Memory that is not in a literal pool."
147 (ior (and (match_code "mem")
148 (match_test "! constantpool_mem_p (op)"))
149 (and (match_code "reg")
150 (match_test "reload_in_progress
151 && REGNO (op) >= FIRST_PSEUDO_REGISTER"))))