Daily bump.
[official-gcc.git] / gcc / config / gcn / constraints.md
blobc0fb5a84b452f531f59dc12cbb0ff39fabe55b8f
1 ;; Constraint definitions for GCN.
2 ;; Copyright (C) 2016-2021 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.
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.
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/>.
20 (define_constraint "I"
21   "Inline integer constant"
22   (and (match_code "const_int")
23        (match_test "ival >= -16 && ival <= 64")))
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")))
30 (define_constraint "Kf"
31   "Immeditate constant -1"
32   (and (match_code "const_int")
33        (match_test "ival == -1")))
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")))
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)")))
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)")))
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)")))
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)")))
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)")))
65 (define_constraint "DB"
66   "Immediate 64-bit parameter, low and high part match 'B'"
67   (match_code "const_int,const_double,const_vector"))
69 (define_constraint "U"
70   "unspecified value"
71   (match_code "unspec"))
73 (define_constraint "Y"
74   "Symbol or label for relative calls"
75   (match_code "symbol_ref,label_ref"))
77 (define_register_constraint "v" "VGPR_REGS"
78   "VGPR registers")
80 (define_register_constraint "Sg" "SGPR_REGS"
81   "SGPR registers")
83 (define_register_constraint "SD" "SGPR_DST_REGS"
84   "registers useable as a destination of scalar operation")
86 (define_register_constraint "SS" "SGPR_SRC_REGS"
87   "registers useable as a source of scalar operation")
89 (define_register_constraint "Sm" "SGPR_MEM_SRC_REGS"
90   "registers useable as a source of scalar memory operation")
92 (define_register_constraint "Sv" "SGPR_VOP_SRC_REGS"
93   "registers useable as a source of VOP3A instruction")
95 (define_register_constraint "ca" "ALL_CONDITIONAL_REGS"
96   "SCC VCCZ or EXECZ")
98 (define_register_constraint "cs" "SCC_CONDITIONAL_REG"
99   "SCC")
101 (define_register_constraint "cV" "VCC_CONDITIONAL_REG"
102   "VCC")
104 (define_register_constraint "e" "EXEC_MASK_REG"
105   "EXEC")
107 (define_special_memory_constraint "RB"
108   "Buffer memory address to scratch memory."
109   (and (match_code "mem")
110        (match_test "AS_SCRATCH_P (MEM_ADDR_SPACE (op))")))
112 (define_special_memory_constraint "RF"
113   "Buffer memory address to flat memory."
114   (and (match_code "mem")
115        (match_test "AS_FLAT_P (MEM_ADDR_SPACE (op))
116                     && gcn_flat_address_p (XEXP (op, 0), mode)")))
118 (define_special_memory_constraint "RS"
119   "Buffer memory address to scalar flat memory."
120   (and (match_code "mem")
121        (match_test "AS_SCALAR_FLAT_P (MEM_ADDR_SPACE (op))
122                     && gcn_scalar_flat_mem_p (op)")))
124 (define_special_memory_constraint "RL"
125   "Buffer memory address to LDS memory."
126   (and (match_code "mem")
127        (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))")))
129 (define_special_memory_constraint "RG"
130   "Buffer memory address to GDS memory."
131   (and (match_code "mem")
132        (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")))
134 (define_special_memory_constraint "RD"
135   "Buffer memory address to GDS or LDS memory."
136   (and (match_code "mem")
137        (ior (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")
138             (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))"))))
140 (define_special_memory_constraint "RM"
141   "Memory address to global (main) memory."
142   (and (match_code "mem")
143        (match_test "AS_GLOBAL_P (MEM_ADDR_SPACE (op))
144                     && gcn_global_address_p (XEXP (op, 0))")))