aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/gcn/constraints.md
blob: dd6615b0fd7b0bc7a60002b94230cb7fe3680af4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
;; Constraint definitions for GCN.
;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_constraint "I"
  "Inline integer constant"
  (and (match_code "const_int")
       (match_test "ival >= -16 && ival <= 64")))

(define_constraint "J"
  "Signed integer 16-bit inline constant"
  (and (match_code "const_int")
       (match_test "((unsigned HOST_WIDE_INT) ival + 0x8000) < 0x10000")))

(define_constraint "Kf"
  "Immeditate constant -1"
  (and (match_code "const_int")
       (match_test "ival == -1")))

(define_constraint "L"
  "Unsigned integer 15-bit constant"
  (and (match_code "const_int")
       (match_test "((unsigned HOST_WIDE_INT) ival) < 0x8000")))

(define_constraint "A"
  "Inline immediate parameter"
  (and (match_code "const_int,const_double,const_vector")
       (match_test "gcn_inline_constant_p (op)")))

(define_constraint "B"
  "Immediate 32-bit parameter"
  (and (match_code "const_int,const_double,const_vector")
	(match_test "gcn_constant_p (op)")))

(define_constraint "C"
  "Immediate 32-bit parameter zero-extended to 64-bits"
  (and (match_code "const_int,const_double,const_vector")
	(match_test "gcn_constant64_p (op)")))

(define_constraint "DA"
  "Immediate 64-bit parameter, low and high part match 'A'"
  (and (match_code "const_int,const_double,const_vector")
       (match_test "gcn_inline_constant64_p (op, 0)")))

(define_constraint "Db"
  "Immediate 64-bit parameter, low part matches 'B', high part matches 'A'"
  (and (match_code "const_int,const_double,const_vector")
       (match_test "gcn_inline_constant64_p (op, 1)")))

(define_constraint "DB"
  "Immediate 64-bit parameter, low and high part match 'B'"
  (match_code "const_int,const_double,const_vector"))

(define_constraint "U"
  "unspecified value"
  (match_code "unspec"))

(define_constraint "Y"
  "Symbol or label for relative calls"
  (match_code "symbol_ref,label_ref"))

(define_register_constraint "v" "VGPR_REGS"
  "VGPR registers")

(define_register_constraint "Sg" "SGPR_REGS"
  "SGPR registers")

(define_register_constraint "SD" "SGPR_DST_REGS"
  "registers useable as a destination of scalar operation")

(define_register_constraint "SS" "SGPR_SRC_REGS"
  "registers useable as a source of scalar operation")

(define_register_constraint "Sm" "SGPR_MEM_SRC_REGS"
  "registers useable as a source of scalar memory operation")

(define_register_constraint "Sv" "SGPR_VOP_SRC_REGS"
  "registers useable as a source of VOP3A instruction")

(define_register_constraint "ca" "ALL_CONDITIONAL_REGS"
  "SCC VCCZ or EXECZ")

(define_register_constraint "cs" "SCC_CONDITIONAL_REG"
  "SCC")

(define_register_constraint "cV" "VCC_CONDITIONAL_REG"
  "VCC")

(define_register_constraint "e" "EXEC_MASK_REG"
  "EXEC")

(define_special_memory_constraint "RB"
  "Buffer memory address to scratch memory."
  (and (match_code "mem")
       (match_test "AS_SCRATCH_P (MEM_ADDR_SPACE (op))")))

(define_special_memory_constraint "RF"
  "Buffer memory address to flat memory."
  (and (match_code "mem")
       (match_test "AS_FLAT_P (MEM_ADDR_SPACE (op))
		    && gcn_flat_address_p (XEXP (op, 0), mode)")))

(define_special_memory_constraint "RS"
  "Buffer memory address to scalar flat memory."
  (and (match_code "mem")
       (match_test "AS_SCALAR_FLAT_P (MEM_ADDR_SPACE (op))
		    && gcn_scalar_flat_mem_p (op)")))

(define_special_memory_constraint "RL"
  "Buffer memory address to LDS memory."
  (and (match_code "mem")
       (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))")))

(define_special_memory_constraint "RG"
  "Buffer memory address to GDS memory."
  (and (match_code "mem")
       (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")))

(define_special_memory_constraint "RD"
  "Buffer memory address to GDS or LDS memory."
  (and (match_code "mem")
       (ior (match_test "AS_GDS_P (MEM_ADDR_SPACE (op))")
	    (match_test "AS_LDS_P (MEM_ADDR_SPACE (op))"))))

(define_special_memory_constraint "RM"
  "Memory address to global (main) memory."
  (and (match_code "mem")
       (match_test "AS_GLOBAL_P (MEM_ADDR_SPACE (op))
		    && gcn_global_address_p (XEXP (op, 0))")))