]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/gcn/constraints.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / gcn / constraints.md
1 ;; Constraint definitions for GCN.
2 ;; Copyright (C) 2016-2024 Free Software Foundation, Inc.
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
8 ;; the Free Software Foundation; either version 3, or (at your option)
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
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
19
20 (define_constraint "I"
21 "Inline integer constant"
22 (and (match_code "const_int")
23 (match_test "ival >= -16 && ival <= 64")))
24
25 (define_constraint "J"
26 "Signed integer 16-bit inline constant"
27 (and (match_code "const_int")
28 (match_test "((unsigned HOST_WIDE_INT) ival + 0x8000) < 0x10000")))
29
30 (define_constraint "Kf"
31 "Immeditate constant -1"
32 (and (match_code "const_int")
33 (match_test "ival == -1")))
34
35 (define_constraint "L"
36 "Unsigned integer 15-bit constant"
37 (and (match_code "const_int")
38 (match_test "((unsigned HOST_WIDE_INT) ival) < 0x8000")))
39
40 (define_constraint "A"
41 "Inline immediate parameter"
42 (and (match_code "const_int,const_double,const_vector")
43 (match_test "gcn_inline_constant_p (op)")))
44
45 (define_constraint "B"
46 "Immediate 32-bit parameter"
47 (and (match_code "const_int,const_double,const_vector")
48 (match_test "gcn_constant_p (op)")))
49
50 (define_constraint "C"
51 "Immediate 32-bit parameter zero-extended to 64-bits"
52 (and (match_code "const_int,const_double,const_vector")
53 (match_test "gcn_constant64_p (op)")))
54
55 (define_constraint "DA"
56 "Immediate 64-bit parameter, low and high part match 'A'"
57 (and (match_code "const_int,const_double,const_vector")
58 (match_test "gcn_inline_constant64_p (op, 0)")))
59
60 (define_constraint "Db"
61 "Immediate 64-bit parameter, low part matches 'B', high part matches 'A'"
62 (and (match_code "const_int,const_double,const_vector")
63 (match_test "gcn_inline_constant64_p (op, 1)")))
64
65 (define_constraint "DB"
66 "Immediate 64-bit parameter, low and high part match 'B'"
67 (match_code "const_int,const_double,const_vector"))
68
69 (define_constraint "U"
70 "unspecified value"
71 (match_code "unspec"))
72
73 (define_constraint "Y"
74 "Symbol or label for relative calls"
75 (match_code "symbol_ref,label_ref"))
76
77 (define_register_constraint "v" "VGPR_REGS"
78 "VGPR registers")
79
80 (define_register_constraint "a" "TARGET_CDNA1_PLUS ? AVGPR_REGS : NO_REGS"
81 "Accumulator VGPR registers")
82
83 (define_register_constraint "Sg" "SGPR_REGS"
84 "SGPR registers")
85
86 (define_register_constraint "SD" "SGPR_DST_REGS"
87 "registers useable as a destination of scalar operation")
88
89 (define_register_constraint "SS" "SGPR_SRC_REGS"
90 "registers useable as a source of scalar operation")
91
92 (define_register_constraint "Sm" "SGPR_MEM_SRC_REGS"
93 "registers useable as a source of scalar memory operation")
94
95 (define_register_constraint "Sv" "SGPR_VOP_SRC_REGS"
96 "registers useable as a source of VOP3A instruction")
97
98 (define_register_constraint "ca" "ALL_CONDITIONAL_REGS"
99 "SCC VCCZ or EXECZ")
100
101 (define_register_constraint "cs" "SCC_CONDITIONAL_REG"
102 "SCC")
103
104 (define_register_constraint "cV" "VCC_CONDITIONAL_REG"
105 "VCC")
106
107 (define_register_constraint "e" "EXEC_MASK_REG"
108 "EXEC")
109
110 (define_special_memory_constraint "RB"
111 "Buffer memory address to scratch memory."
112 (and (match_code "mem")
113 (match_test "AS_SCRATCH_P (MEM_ADDR_SPACE (op))")))
114
115 (define_special_memory_constraint "RF"
116 "Buffer memory address to flat memory."
117 (and (match_code "mem")
118 (match_test "AS_FLAT_P (MEM_ADDR_SPACE (op))
119 && gcn_flat_address_p (XEXP (op, 0), mode)")))
120
121 (define_special_memory_constraint "RS"
122 "Buffer memory address to scalar flat memory."
123 (and (match_code "mem")
124 (match_test "AS_SCALAR_FLAT_P (MEM_ADDR_SPACE (op))
125 && gcn_scalar_flat_mem_p (op)")))
126
127 (define_special_memory_constraint "RL"
128 "Buffer memory address to LDS memory."
129 (and (match_code "mem")
130 (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))")))
131
132 (define_special_memory_constraint "RG"
133 "Buffer memory address to GDS memory."
134 (and (match_code "mem")
135 (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")))
136
137 (define_special_memory_constraint "RD"
138 "Buffer memory address to GDS or LDS memory."
139 (and (match_code "mem")
140 (ior (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")
141 (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))"))))
142
143 (define_special_memory_constraint "RM"
144 "Memory address to global (main) memory."
145 (and (match_code "mem")
146 (match_test "AS_GLOBAL_P (MEM_ADDR_SPACE (op))
147 && gcn_global_address_p (XEXP (op, 0))")))