3 * Copyright (c) 2018-2019 Collabora LTD
5 * Author: Gert Wollny <gert.wollny@collabora.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * on the rights to use, copy, modify, merge, publish, distribute, sub
11 * license, and/or sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef r600_sfn_alu_defines_h
28 #define r600_sfn_alu_defines_h
35 /* ALU op2 instructions 17:7 top three bits alwayss zero. */
63 op1_flt64_to_flt32
= 28,
64 op1_flt32_to_flt64
= 29,
65 op2_pred_setgt_uint
= 30,
66 op2_pred_setge_uint
= 31,
71 op1_pred_set_inv
= 36,
72 op2_pred_set_pop
= 37,
73 op0_pred_set_clr
= 38,
74 op1_pred_set_restore
= 39,
75 op2_pred_sete_push
= 40,
76 op2_pred_setgt_push
= 41,
77 op2_pred_setge_push
= 42,
78 op2_pred_setne_push
= 43,
100 op2_killge_uint
= 65,
102 op2_pred_setgt_int
= 67,
103 op2_pred_setge_int
= 68,
104 op2_pred_setne_int
= 69,
109 op2_pred_sete_push_int
= 74,
110 op2_pred_setgt_push_int
= 75,
111 op2_pred_setge_push_int
= 76,
112 op2_pred_setne_push_int
= 77,
113 op2_pred_setlt_push_int
= 78,
114 op2_pred_setle_push_int
= 79,
119 op0_group_barrier
= 84,
120 op0_group_seq_begin
= 85,
121 op0_group_seq_end
= 86,
123 op1_set_cf_idx0
= 88,
124 op1_set_cf_idx1
= 89,
125 op2_set_lds_size
= 90,
127 op1_log_clamped
= 130,
129 op1_recip_clamped
= 132,
131 op1_recip_ieee
= 134,
132 op1_recipsqrt_clamped
= 135,
133 op1_recipsqrt_ff
= 136,
134 op1_recipsqrt_ieee1
= 137,
140 op2_mullo_uint
= 145,
141 op2_mulhi_uint
= 146,
143 op1_recip_uint
= 148,
145 op1_recip_clamped_64
= 150,
146 op1_recipsqrt_64
= 151,
147 op1_recipsqrt_clamped_64
= 152,
149 op1_flt_to_uint
= 154,
150 op1_int_to_flt
= 155,
151 op1_uint_to_flt
= 156,
153 op1_flt32_to_flt16
= 162,
154 op1_flt16_to_flt32
= 163,
155 op1_ubyte0_flt
= 164,
156 op1_ubyte1_flt
= 165,
157 op1_ubyte2_flt
= 166,
158 op1_ubyte3_flt
= 167,
163 op1_flt_to_uint4
= 174,
165 op1_flt_to_int_rpi
= 176,
166 op1_flt_to_int_floor
= 177,
167 op2_mulhi_uint24
= 178,
168 op1_mbcnt_32hi_int
= 179,
169 op1_offset_to_flt
= 180,
170 op2_mul_uint24
= 181,
171 op1_bcnt_accum_prev_int
= 182,
172 op1_mbcnt_32lo_accum_prev_int
= 183,
186 op2_pred_setgt_64
= 199,
187 op2_pred_sete_64
= 198,
188 op2_pred_setge_64
= 201,
192 op1v_flt64_to_flt32
= 205,
193 op1v_flt32_to_flt64
= 206,
194 op2_sad_accum_prev_uint
= 207,
197 op2_mul_ieee_prev
= 210,
199 op2_muladd_prev
= 212,
200 op2_muladd_ieee_prev
= 213,
205 op0_store_flags
= 218,
206 op1_load_store_flags
= 219,
210 op1_interp_load_p0
= 224,
211 op1_interp_load_p10
= 125,
212 op1_interp_load_p20
= 126,
213 // op 3 all left shift 6
214 op3_bfe_uint
= 4<< 6,
218 op3_cndne_64
= 9<< 6,
220 op3_lerp_uint
= 11<< 6,
221 op3_bit_align_int
= 12<< 6,
222 op3_byte_align_int
= 13<< 6,
223 op3_sad_accum_uint
= 14<< 6,
224 op3_sad_accum_hi_uint
= 15<< 6,
225 op3_muladd_uint24
= 16<< 6,
226 op3_lds_idx_op
= 17<< 6,
228 op3_muladd_m2
= 21<< 6,
229 op3_muladd_m4
= 22<< 6,
230 op3_muladd_d2
= 23<< 6,
231 op3_muladd_ieee
= 24<< 6,
235 op3_cnde_int
= 28<< 6,
236 op3_cndgt_int
= 29<< 6,
237 op3_cndge_int
= 30<< 6,
243 using AluOpFlags
=std::bitset
<32>;
246 static constexpr int x
= 1;
247 static constexpr int y
= 2;
248 static constexpr int z
= 4;
249 static constexpr int w
= 8;
250 static constexpr int v
= 15;
251 static constexpr int t
= 16;
252 static constexpr int a
= 31;
254 AluOp(int ns
, int f
, int um
, const char *n
):
255 nsrc(ns
), is_float(f
), unit_mask(um
), name(n
)
259 bool can_channel(int flags
) const {
260 return flags
& unit_mask
;
269 extern const std::map
<EAluOp
, AluOp
> alu_ops
;
271 enum AluInlineConstants
{
272 ALU_SRC_LDS_OQ_A
= 219,
273 ALU_SRC_LDS_OQ_B
= 220,
274 ALU_SRC_LDS_OQ_A_POP
= 221,
275 ALU_SRC_LDS_OQ_B_POP
= 222,
276 ALU_SRC_LDS_DIRECT_A
= 223,
277 ALU_SRC_LDS_DIRECT_B
= 224,
278 ALU_SRC_TIME_HI
= 227,
279 ALU_SRC_TIME_LO
= 228,
280 ALU_SRC_MASK_HI
= 229,
281 ALU_SRC_MASK_LO
= 230,
282 ALU_SRC_HW_WAVE_ID
= 231,
283 ALU_SRC_SIMD_ID
= 232,
285 ALU_SRC_HW_THREADGRP_ID
= 234,
286 ALU_SRC_WAVE_ID_IN_GRP
= 235,
287 ALU_SRC_NUM_THREADGRP_WAVES
= 236,
288 ALU_SRC_HW_ALU_ODD
= 237,
289 ALU_SRC_LOOP_IDX
= 238,
290 ALU_SRC_PARAM_BASE_ADDR
= 240,
291 ALU_SRC_NEW_PRIM_MASK
= 241,
292 ALU_SRC_PRIM_MASK_HI
= 242,
293 ALU_SRC_PRIM_MASK_LO
= 243,
294 ALU_SRC_1_DBL_L
= 244,
295 ALU_SRC_1_DBL_M
= 245,
296 ALU_SRC_0_5_DBL_L
= 246,
297 ALU_SRC_0_5_DBL_M
= 247,
301 ALU_SRC_M_1_INT
= 251,
303 ALU_SRC_LITERAL
= 253,
306 ALU_SRC_PARAM_BASE
= 0x1C0,
310 struct AluInlineConstantDescr
{
315 extern const std::map
<AluInlineConstants
, AluInlineConstantDescr
> alu_src_const
;
332 DS_OP_WRITE_REL
= 14,
334 DS_OP_CMP_STORE
= 16,
335 DS_OP_CMP_STORE_SPF
= 17,
336 DS_OP_BYTE_WRITE
= 18,
337 DS_OP_SHORT_WRITE
= 19,
343 DS_OP_MIN_INT_RET
= 37,
344 DS_OP_MAX_INT_RET
= 38,
345 DS_OP_MIN_UINT_RET
= 39,
346 DS_OP_MAX_UINT_RET
= 40,
350 DS_OP_MSKOR_RET
= 44,
352 DS_OP_XCHG_REL_RET
= 46,
353 DS_OP_XCHG2_RET
= 47,
354 DS_OP_CMP_XCHG_RET
= 48,
355 DS_OP_CMP_XCHG_SPF_RET
= 49,
357 DS_OP_READ_REL_RET
= 51,
358 DS_OP_READ2_RET
= 52,
359 DS_OP_READWRITE_RET
= 53,
360 DS_OP_BYTE_READ_RET
= 54,
361 DS_OP_UBYTE_READ_RET
= 55,
362 DS_OP_SHORT_READ_RET
= 56,
363 DS_OP_USHORT_READ_RET
= 57,
364 DS_OP_ATOMIC_ORDERED_ALLOC_RET
= 63,
373 extern const std::map
<ESDOp
, LDSOp
> lds_ops
;
377 #endif // ALU_DEFINES_H