1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2014 Intel Corporation 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci * IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci/** 25bf215546Sopenharmony_ci * @file brw_inst.h 26bf215546Sopenharmony_ci * 27bf215546Sopenharmony_ci * A representation of i965 EU assembly instructions, with helper methods to 28bf215546Sopenharmony_ci * get and set various fields. This is the actual hardware format. 29bf215546Sopenharmony_ci */ 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#ifndef BRW_INST_H 32bf215546Sopenharmony_ci#define BRW_INST_H 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#include <assert.h> 35bf215546Sopenharmony_ci#include <stdint.h> 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci#include "brw_eu_defines.h" 38bf215546Sopenharmony_ci#include "brw_isa_info.h" 39bf215546Sopenharmony_ci#include "brw_reg_type.h" 40bf215546Sopenharmony_ci#include "dev/intel_device_info.h" 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_ci#ifdef __cplusplus 43bf215546Sopenharmony_ciextern "C" { 44bf215546Sopenharmony_ci#endif 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ci/* brw_context.h has a forward declaration of brw_inst, so name the struct. */ 47bf215546Sopenharmony_citypedef struct brw_inst { 48bf215546Sopenharmony_ci uint64_t data[2]; 49bf215546Sopenharmony_ci} brw_inst; 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_cistatic inline uint64_t brw_inst_bits(const brw_inst *inst, 52bf215546Sopenharmony_ci unsigned high, unsigned low); 53bf215546Sopenharmony_cistatic inline void brw_inst_set_bits(brw_inst *inst, 54bf215546Sopenharmony_ci unsigned high, unsigned low, 55bf215546Sopenharmony_ci uint64_t value); 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci#define FC(name, hi4, lo4, hi12, lo12, assertions) \ 58bf215546Sopenharmony_cistatic inline void \ 59bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, \ 60bf215546Sopenharmony_ci brw_inst *inst, uint64_t v) \ 61bf215546Sopenharmony_ci{ \ 62bf215546Sopenharmony_ci assert(assertions); \ 63bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 64bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi12, lo12, v); \ 65bf215546Sopenharmony_ci else \ 66bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi4, lo4, v); \ 67bf215546Sopenharmony_ci} \ 68bf215546Sopenharmony_cistatic inline uint64_t \ 69bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, \ 70bf215546Sopenharmony_ci const brw_inst *inst) \ 71bf215546Sopenharmony_ci{ \ 72bf215546Sopenharmony_ci assert(assertions); \ 73bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 74bf215546Sopenharmony_ci return brw_inst_bits(inst, hi12, lo12); \ 75bf215546Sopenharmony_ci else \ 76bf215546Sopenharmony_ci return brw_inst_bits(inst, hi4, lo4); \ 77bf215546Sopenharmony_ci} 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_ci/* A simple macro for fields which stay in the same place on all generations, 80bf215546Sopenharmony_ci * except for Gfx12! 81bf215546Sopenharmony_ci */ 82bf215546Sopenharmony_ci#define F(name, hi4, lo4, hi12, lo12) FC(name, hi4, lo4, hi12, lo12, true) 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_ci#define BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 85bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12, lo12) \ 86bf215546Sopenharmony_ci unsigned high, low; \ 87bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 88bf215546Sopenharmony_ci high = hi12; low = lo12; \ 89bf215546Sopenharmony_ci } else if (devinfo->ver >= 8) { \ 90bf215546Sopenharmony_ci high = hi8; low = lo8; \ 91bf215546Sopenharmony_ci } else if (devinfo->ver >= 7) { \ 92bf215546Sopenharmony_ci high = hi7; low = lo7; \ 93bf215546Sopenharmony_ci } else if (devinfo->ver >= 6) { \ 94bf215546Sopenharmony_ci high = hi6; low = lo6; \ 95bf215546Sopenharmony_ci } else if (devinfo->ver >= 5) { \ 96bf215546Sopenharmony_ci high = hi5; low = lo5; \ 97bf215546Sopenharmony_ci } else if (devinfo->verx10 >= 45) { \ 98bf215546Sopenharmony_ci high = hi45; low = lo45; \ 99bf215546Sopenharmony_ci } else { \ 100bf215546Sopenharmony_ci high = hi4; low = lo4; \ 101bf215546Sopenharmony_ci } \ 102bf215546Sopenharmony_ci assert(((int) high) != -1 && ((int) low) != -1); 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci/* A general macro for cases where the field has moved to several different 105bf215546Sopenharmony_ci * bit locations across generations. GCC appears to combine cases where the 106bf215546Sopenharmony_ci * bits are identical, removing some of the inefficiency. 107bf215546Sopenharmony_ci */ 108bf215546Sopenharmony_ci#define FF(name, hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 109bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12, lo12) \ 110bf215546Sopenharmony_cistatic inline void \ 111bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, \ 112bf215546Sopenharmony_ci brw_inst *inst, uint64_t value) \ 113bf215546Sopenharmony_ci{ \ 114bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 115bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12, lo12) \ 116bf215546Sopenharmony_ci brw_inst_set_bits(inst, high, low, value); \ 117bf215546Sopenharmony_ci} \ 118bf215546Sopenharmony_cistatic inline uint64_t \ 119bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, const brw_inst *inst)\ 120bf215546Sopenharmony_ci{ \ 121bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 122bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12, lo12) \ 123bf215546Sopenharmony_ci return brw_inst_bits(inst, high, low); \ 124bf215546Sopenharmony_ci} 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ci/* A macro for fields which moved as of Gfx8+. */ 127bf215546Sopenharmony_ci#define F8(name, gfx4_high, gfx4_low, gfx8_high, gfx8_low, \ 128bf215546Sopenharmony_ci gfx12_high, gfx12_low) \ 129bf215546Sopenharmony_ciFF(name, \ 130bf215546Sopenharmony_ci /* 4: */ gfx4_high, gfx4_low, \ 131bf215546Sopenharmony_ci /* 4.5: */ gfx4_high, gfx4_low, \ 132bf215546Sopenharmony_ci /* 5: */ gfx4_high, gfx4_low, \ 133bf215546Sopenharmony_ci /* 6: */ gfx4_high, gfx4_low, \ 134bf215546Sopenharmony_ci /* 7: */ gfx4_high, gfx4_low, \ 135bf215546Sopenharmony_ci /* 8: */ gfx8_high, gfx8_low, \ 136bf215546Sopenharmony_ci /* 12: */ gfx12_high, gfx12_low); 137bf215546Sopenharmony_ci 138bf215546Sopenharmony_ci/* Macro for fields that gained extra discontiguous MSBs in Gfx12 (specified 139bf215546Sopenharmony_ci * by hi12ex-lo12ex). 140bf215546Sopenharmony_ci */ 141bf215546Sopenharmony_ci#define FFDC(name, hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 142bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12ex, lo12ex, hi12, lo12, assertions) \ 143bf215546Sopenharmony_cistatic inline void \ 144bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, \ 145bf215546Sopenharmony_ci brw_inst *inst, uint64_t value) \ 146bf215546Sopenharmony_ci{ \ 147bf215546Sopenharmony_ci assert(assertions); \ 148bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 149bf215546Sopenharmony_ci const unsigned k = hi12 - lo12 + 1; \ 150bf215546Sopenharmony_ci if (hi12ex != -1 && lo12ex != -1) \ 151bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi12ex, lo12ex, value >> k); \ 152bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi12, lo12, value & ((1ull << k) - 1)); \ 153bf215546Sopenharmony_ci } else { \ 154bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 155bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, -1, -1); \ 156bf215546Sopenharmony_ci brw_inst_set_bits(inst, high, low, value); \ 157bf215546Sopenharmony_ci } \ 158bf215546Sopenharmony_ci} \ 159bf215546Sopenharmony_cistatic inline uint64_t \ 160bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, const brw_inst *inst)\ 161bf215546Sopenharmony_ci{ \ 162bf215546Sopenharmony_ci assert(assertions); \ 163bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 164bf215546Sopenharmony_ci const unsigned k = hi12 - lo12 + 1; \ 165bf215546Sopenharmony_ci return (hi12ex == -1 || lo12ex == -1 ? 0 : \ 166bf215546Sopenharmony_ci brw_inst_bits(inst, hi12ex, lo12ex) << k) | \ 167bf215546Sopenharmony_ci brw_inst_bits(inst, hi12, lo12); \ 168bf215546Sopenharmony_ci } else { \ 169bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 170bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, -1, -1); \ 171bf215546Sopenharmony_ci return brw_inst_bits(inst, high, low); \ 172bf215546Sopenharmony_ci } \ 173bf215546Sopenharmony_ci} 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci#define FD(name, hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 176bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12ex, lo12ex, hi12, lo12) \ 177bf215546Sopenharmony_ci FFDC(name, hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, \ 178bf215546Sopenharmony_ci hi7, lo7, hi8, lo8, hi12ex, lo12ex, hi12, lo12, true) 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ci/* Macro for fields that didn't move across generations until Gfx12, and then 181bf215546Sopenharmony_ci * gained extra discontiguous bits. 182bf215546Sopenharmony_ci */ 183bf215546Sopenharmony_ci#define FDC(name, hi4, lo4, hi12ex, lo12ex, hi12, lo12, assertions) \ 184bf215546Sopenharmony_ci FFDC(name, hi4, lo4, hi4, lo4, hi4, lo4, hi4, lo4, \ 185bf215546Sopenharmony_ci hi4, lo4, hi4, lo4, hi12ex, lo12ex, hi12, lo12, assertions) 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_ci 188bf215546Sopenharmony_ci/* Macro for the 2-bit register file field, which on Gfx12+ is stored as the 189bf215546Sopenharmony_ci * variable length combination of an IsImm (hi12) bit and an additional file 190bf215546Sopenharmony_ci * (lo12) bit. 191bf215546Sopenharmony_ci */ 192bf215546Sopenharmony_ci#define FI(name, hi4, lo4, hi8, lo8, hi12, lo12) \ 193bf215546Sopenharmony_cistatic inline void \ 194bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, \ 195bf215546Sopenharmony_ci brw_inst *inst, uint64_t value) \ 196bf215546Sopenharmony_ci{ \ 197bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 198bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi12, hi12, value >> 1); \ 199bf215546Sopenharmony_ci if ((value >> 1) == 0) \ 200bf215546Sopenharmony_ci brw_inst_set_bits(inst, lo12, lo12, value & 1); \ 201bf215546Sopenharmony_ci } else { \ 202bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi4, lo4, hi4, lo4, hi4, lo4, \ 203bf215546Sopenharmony_ci hi4, lo4, hi8, lo8, -1, -1); \ 204bf215546Sopenharmony_ci brw_inst_set_bits(inst, high, low, value); \ 205bf215546Sopenharmony_ci } \ 206bf215546Sopenharmony_ci} \ 207bf215546Sopenharmony_cistatic inline uint64_t \ 208bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, const brw_inst *inst)\ 209bf215546Sopenharmony_ci{ \ 210bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 211bf215546Sopenharmony_ci return (brw_inst_bits(inst, hi12, hi12) << 1) | \ 212bf215546Sopenharmony_ci (brw_inst_bits(inst, hi12, hi12) == 0 ? \ 213bf215546Sopenharmony_ci brw_inst_bits(inst, lo12, lo12) : 1); \ 214bf215546Sopenharmony_ci } else { \ 215bf215546Sopenharmony_ci BOUNDS(hi4, lo4, hi4, lo4, hi4, lo4, hi4, lo4, \ 216bf215546Sopenharmony_ci hi4, lo4, hi8, lo8, -1, -1); \ 217bf215546Sopenharmony_ci return brw_inst_bits(inst, high, low); \ 218bf215546Sopenharmony_ci } \ 219bf215546Sopenharmony_ci} 220bf215546Sopenharmony_ci 221bf215546Sopenharmony_ci/* Macro for fields that become a constant in Gfx12+ not actually represented 222bf215546Sopenharmony_ci * in the instruction. 223bf215546Sopenharmony_ci */ 224bf215546Sopenharmony_ci#define FK(name, hi4, lo4, const12) \ 225bf215546Sopenharmony_cistatic inline void \ 226bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, \ 227bf215546Sopenharmony_ci brw_inst *inst, uint64_t v) \ 228bf215546Sopenharmony_ci{ \ 229bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 230bf215546Sopenharmony_ci assert(v == (const12)); \ 231bf215546Sopenharmony_ci else \ 232bf215546Sopenharmony_ci brw_inst_set_bits(inst, hi4, lo4, v); \ 233bf215546Sopenharmony_ci} \ 234bf215546Sopenharmony_cistatic inline uint64_t \ 235bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, \ 236bf215546Sopenharmony_ci const brw_inst *inst) \ 237bf215546Sopenharmony_ci{ \ 238bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 239bf215546Sopenharmony_ci return (const12); \ 240bf215546Sopenharmony_ci else \ 241bf215546Sopenharmony_ci return brw_inst_bits(inst, hi4, lo4); \ 242bf215546Sopenharmony_ci} 243bf215546Sopenharmony_ci 244bf215546Sopenharmony_ciF(src1_vstride, /* 4+ */ 120, 117, /* 12+ */ 119, 116) 245bf215546Sopenharmony_ciF(src1_width, /* 4+ */ 116, 114, /* 12+ */ 115, 113) 246bf215546Sopenharmony_ciF(src1_da16_swiz_w, /* 4+ */ 115, 114, /* 12+ */ -1, -1) 247bf215546Sopenharmony_ciF(src1_da16_swiz_z, /* 4+ */ 113, 112, /* 12+ */ -1, -1) 248bf215546Sopenharmony_ciF(src1_hstride, /* 4+ */ 113, 112, /* 12+ */ 97, 96) 249bf215546Sopenharmony_ciF(src1_address_mode, /* 4+ */ 111, 111, /* 12+ */ 112, 112) 250bf215546Sopenharmony_ci/** Src1.SrcMod @{ */ 251bf215546Sopenharmony_ciF(src1_negate, /* 4+ */ 110, 110, /* 12+ */ 121, 121) 252bf215546Sopenharmony_ciF(src1_abs, /* 4+ */ 109, 109, /* 12+ */ 120, 120) 253bf215546Sopenharmony_ci/** @} */ 254bf215546Sopenharmony_ciF8(src1_ia_subreg_nr, /* 4+ */ 108, 106, /* 8+ */ 108, 105, /* 12+ */ 111, 108) 255bf215546Sopenharmony_ciF(src1_da_reg_nr, /* 4+ */ 108, 101, /* 12+ */ 111, 104) 256bf215546Sopenharmony_ciF(src1_da16_subreg_nr, /* 4+ */ 100, 100, /* 12+ */ -1, -1) 257bf215546Sopenharmony_ciF(src1_da1_subreg_nr, /* 4+ */ 100, 96, /* 12+ */ 103, 99) 258bf215546Sopenharmony_ciF(src1_da16_swiz_y, /* 4+ */ 99, 98, /* 12+ */ -1, -1) 259bf215546Sopenharmony_ciF(src1_da16_swiz_x, /* 4+ */ 97, 96, /* 12+ */ -1, -1) 260bf215546Sopenharmony_ciF8(src1_reg_hw_type, /* 4+ */ 46, 44, /* 8+ */ 94, 91, /* 12+ */ 91, 88) 261bf215546Sopenharmony_ciFI(src1_reg_file, /* 4+ */ 43, 42, /* 8+ */ 90, 89, /* 12+ */ 47, 98) 262bf215546Sopenharmony_ciF(src1_is_imm, /* 4+ */ -1, -1, /* 12+ */ 47, 47) 263bf215546Sopenharmony_ciF(src0_vstride, /* 4+ */ 88, 85, /* 12+ */ 87, 84) 264bf215546Sopenharmony_ciF(src0_width, /* 4+ */ 84, 82, /* 12+ */ 83, 81) 265bf215546Sopenharmony_ciF(src0_da16_swiz_w, /* 4+ */ 83, 82, /* 12+ */ -1, -1) 266bf215546Sopenharmony_ciF(src0_da16_swiz_z, /* 4+ */ 81, 80, /* 12+ */ -1, -1) 267bf215546Sopenharmony_ciF(src0_hstride, /* 4+ */ 81, 80, /* 12+ */ 65, 64) 268bf215546Sopenharmony_ciF(src0_address_mode, /* 4+ */ 79, 79, /* 12+ */ 80, 80) 269bf215546Sopenharmony_ci/** Src0.SrcMod @{ */ 270bf215546Sopenharmony_ciF(src0_negate, /* 4+ */ 78, 78, /* 12+ */ 45, 45) 271bf215546Sopenharmony_ciF(src0_abs, /* 4+ */ 77, 77, /* 12+ */ 44, 44) 272bf215546Sopenharmony_ci/** @} */ 273bf215546Sopenharmony_ciF8(src0_ia_subreg_nr, /* 4+ */ 76, 74, /* 8+ */ 76, 73, /* 12+ */ 79, 76) 274bf215546Sopenharmony_ciF(src0_da_reg_nr, /* 4+ */ 76, 69, /* 12+ */ 79, 72) 275bf215546Sopenharmony_ciF(src0_da16_subreg_nr, /* 4+ */ 68, 68, /* 12+ */ -1, -1) 276bf215546Sopenharmony_ciF(src0_da1_subreg_nr, /* 4+ */ 68, 64, /* 12+ */ 71, 67) 277bf215546Sopenharmony_ciF(src0_da16_swiz_y, /* 4+ */ 67, 66, /* 12+ */ -1, -1) 278bf215546Sopenharmony_ciF(src0_da16_swiz_x, /* 4+ */ 65, 64, /* 12+ */ -1, -1) 279bf215546Sopenharmony_ciF(dst_address_mode, /* 4+ */ 63, 63, /* 12+ */ 35, 35) 280bf215546Sopenharmony_ciF(dst_hstride, /* 4+ */ 62, 61, /* 12+ */ 49, 48) 281bf215546Sopenharmony_ciF8(dst_ia_subreg_nr, /* 4+ */ 60, 58, /* 8+ */ 60, 57, /* 12+ */ 63, 60) 282bf215546Sopenharmony_ciF(dst_da_reg_nr, /* 4+ */ 60, 53, /* 12+ */ 63, 56) 283bf215546Sopenharmony_ciF(dst_da16_subreg_nr, /* 4+ */ 52, 52, /* 12+ */ -1, -1) 284bf215546Sopenharmony_ciF(dst_da1_subreg_nr, /* 4+ */ 52, 48, /* 12+ */ 55, 51) 285bf215546Sopenharmony_ciF(da16_writemask, /* 4+ */ 51, 48, /* 12+ */ -1, -1) /* Dst.ChanEn */ 286bf215546Sopenharmony_ciF8(src0_reg_hw_type, /* 4+ */ 41, 39, /* 8+ */ 46, 43, /* 12+ */ 43, 40) 287bf215546Sopenharmony_ciFI(src0_reg_file, /* 4+ */ 38, 37, /* 8+ */ 42, 41, /* 12+ */ 46, 66) 288bf215546Sopenharmony_ciF(src0_is_imm, /* 4+ */ -1, -1, /* 12+ */ 46, 46) 289bf215546Sopenharmony_ciF8(dst_reg_hw_type, /* 4+ */ 36, 34, /* 8+ */ 40, 37, /* 12+ */ 39, 36) 290bf215546Sopenharmony_ciF8(dst_reg_file, /* 4+ */ 33, 32, /* 8+ */ 36, 35, /* 12+ */ 50, 50) 291bf215546Sopenharmony_ciF8(mask_control, /* 4+ */ 9, 9, /* 8+ */ 34, 34, /* 12+ */ 31, 31) 292bf215546Sopenharmony_ciFF(flag_reg_nr, 293bf215546Sopenharmony_ci /* 4-6: doesn't exist */ -1, -1, -1, -1, -1, -1, -1, -1, 294bf215546Sopenharmony_ci /* 7: */ 90, 90, 295bf215546Sopenharmony_ci /* 8: */ 33, 33, 296bf215546Sopenharmony_ci /* 12: */ 23, 23) 297bf215546Sopenharmony_ciF8(flag_subreg_nr, /* 4+ */ 89, 89, /* 8+ */ 32, 32, /* 12+ */ 22, 22) 298bf215546Sopenharmony_ciF(saturate, /* 4+ */ 31, 31, /* 12+ */ 34, 34) 299bf215546Sopenharmony_ciF(debug_control, /* 4+ */ 30, 30, /* 12+ */ 30, 30) 300bf215546Sopenharmony_ciF(cmpt_control, /* 4+ */ 29, 29, /* 12+ */ 29, 29) 301bf215546Sopenharmony_ciFC(branch_control, /* 4+ */ 28, 28, /* 12+ */ 33, 33, devinfo->ver >= 8) 302bf215546Sopenharmony_ciFC(acc_wr_control, /* 4+ */ 28, 28, /* 12+ */ 33, 33, devinfo->ver >= 6) 303bf215546Sopenharmony_ciFC(mask_control_ex, /* 4+ */ 28, 28, /* 12+ */ -1, -1, devinfo->verx10 == 45 || 304bf215546Sopenharmony_ci devinfo->ver == 5) 305bf215546Sopenharmony_ciF(cond_modifier, /* 4+ */ 27, 24, /* 12+ */ 95, 92) 306bf215546Sopenharmony_ciFC(math_function, /* 4+ */ 27, 24, /* 12+ */ 95, 92, devinfo->ver >= 6) 307bf215546Sopenharmony_ciF(exec_size, /* 4+ */ 23, 21, /* 12+ */ 18, 16) 308bf215546Sopenharmony_ciF(pred_inv, /* 4+ */ 20, 20, /* 12+ */ 28, 28) 309bf215546Sopenharmony_ciF(pred_control, /* 4+ */ 19, 16, /* 12+ */ 27, 24) 310bf215546Sopenharmony_ciF(thread_control, /* 4+ */ 15, 14, /* 12+ */ -1, -1) 311bf215546Sopenharmony_ciF(atomic_control, /* 4+ */ -1, -1, /* 12+ */ 32, 32) 312bf215546Sopenharmony_ciF(qtr_control, /* 4+ */ 13, 12, /* 12+ */ 21, 20) 313bf215546Sopenharmony_ciFF(nib_control, 314bf215546Sopenharmony_ci /* 4-6: doesn't exist */ -1, -1, -1, -1, -1, -1, -1, -1, 315bf215546Sopenharmony_ci /* 7: */ 47, 47, 316bf215546Sopenharmony_ci /* 8: */ 11, 11, 317bf215546Sopenharmony_ci /* 12: */ 19, 19) 318bf215546Sopenharmony_ciF8(no_dd_check, /* 4+ */ 11, 11, /* 8+ */ 10, 10, /* 12+ */ -1, -1) 319bf215546Sopenharmony_ciF8(no_dd_clear, /* 4+ */ 10, 10, /* 8+ */ 9, 9, /* 12+ */ -1, -1) 320bf215546Sopenharmony_ciF(swsb, /* 4+ */ -1, -1, /* 12+ */ 15, 8) 321bf215546Sopenharmony_ciFK(access_mode, /* 4+ */ 8, 8, /* 12+ */ BRW_ALIGN_1) 322bf215546Sopenharmony_ci/* Bit 7 is Reserved (for future Opcode expansion) */ 323bf215546Sopenharmony_ciF(hw_opcode, /* 4+ */ 6, 0, /* 12+ */ 6, 0) 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci/** 326bf215546Sopenharmony_ci * Three-source instructions: 327bf215546Sopenharmony_ci * @{ 328bf215546Sopenharmony_ci */ 329bf215546Sopenharmony_ciF(3src_src2_reg_nr, /* 4+ */ 125, 118, /* 12+ */ 127, 120) /* same in align1 */ 330bf215546Sopenharmony_ciF(3src_a16_src2_subreg_nr, /* 4+ */ 117, 115, /* 12+ */ -1, -1) /* Extra discontiguous bit on CHV? */ 331bf215546Sopenharmony_ciF(3src_a16_src2_swizzle, /* 4+ */ 114, 107, /* 12+ */ -1, -1) 332bf215546Sopenharmony_ciF(3src_a16_src2_rep_ctrl, /* 4+ */ 106, 106, /* 12+ */ -1, -1) 333bf215546Sopenharmony_ciF(3src_src1_reg_nr, /* 4+ */ 104, 97, /* 12+ */ 111, 104) /* same in align1 */ 334bf215546Sopenharmony_ciF(3src_a16_src1_subreg_nr, /* 4+ */ 96, 94, /* 12+ */ -1, -1) /* Extra discontiguous bit on CHV? */ 335bf215546Sopenharmony_ciF(3src_a16_src1_swizzle, /* 4+ */ 93, 86, /* 12+ */ -1, -1) 336bf215546Sopenharmony_ciF(3src_a16_src1_rep_ctrl, /* 4+ */ 85, 85, /* 12+ */ -1, -1) 337bf215546Sopenharmony_ciF(3src_src0_reg_nr, /* 4+ */ 83, 76, /* 12+ */ 79, 72) /* same in align1 */ 338bf215546Sopenharmony_ciF(3src_a16_src0_subreg_nr, /* 4+ */ 75, 73, /* 12+ */ -1, -1) /* Extra discontiguous bit on CHV? */ 339bf215546Sopenharmony_ciF(3src_a16_src0_swizzle, /* 4+ */ 72, 65, /* 12+ */ -1, -1) 340bf215546Sopenharmony_ciF(3src_a16_src0_rep_ctrl, /* 4+ */ 64, 64, /* 12+ */ -1, -1) 341bf215546Sopenharmony_ciF(3src_dst_reg_nr, /* 4+ */ 63, 56, /* 12+ */ 63, 56) /* same in align1 */ 342bf215546Sopenharmony_ciF(3src_a16_dst_subreg_nr, /* 4+ */ 55, 53, /* 12+ */ -1, -1) 343bf215546Sopenharmony_ciF(3src_a16_dst_writemask, /* 4+ */ 52, 49, /* 12+ */ -1, -1) 344bf215546Sopenharmony_ciF8(3src_a16_nib_ctrl, /* 4+ */ 47, 47, /* 8+ */ 11, 11, /* 12+ */ -1, -1) /* only exists on IVB+ */ 345bf215546Sopenharmony_ciF8(3src_a16_dst_hw_type, /* 4+ */ 45, 44, /* 8+ */ 48, 46, /* 12+ */ -1, -1) /* only exists on IVB+ */ 346bf215546Sopenharmony_ciF8(3src_a16_src_hw_type, /* 4+ */ 43, 42, /* 8+ */ 45, 43, /* 12+ */ -1, -1) 347bf215546Sopenharmony_ciF8(3src_src2_negate, /* 4+ */ 41, 41, /* 8+ */ 42, 42, /* 12+ */ 85, 85) 348bf215546Sopenharmony_ciF8(3src_src2_abs, /* 4+ */ 40, 40, /* 8+ */ 41, 41, /* 12+ */ 84, 84) 349bf215546Sopenharmony_ciF8(3src_src1_negate, /* 4+ */ 39, 39, /* 8+ */ 40, 40, /* 12+ */ 87, 87) 350bf215546Sopenharmony_ciF8(3src_src1_abs, /* 4+ */ 38, 38, /* 8+ */ 39, 39, /* 12+ */ 86, 86) 351bf215546Sopenharmony_ciF8(3src_src0_negate, /* 4+ */ 37, 37, /* 8+ */ 38, 38, /* 12+ */ 45, 45) 352bf215546Sopenharmony_ciF8(3src_src0_abs, /* 4+ */ 36, 36, /* 8+ */ 37, 37, /* 12+ */ 44, 44) 353bf215546Sopenharmony_ciF8(3src_a16_src1_type, /* 4+ */ -1, -1, /* 8+ */ 36, 36, /* 12+ */ -1, -1) 354bf215546Sopenharmony_ciF8(3src_a16_src2_type, /* 4+ */ -1, -1, /* 8+ */ 35, 35, /* 12+ */ -1, -1) 355bf215546Sopenharmony_ciF8(3src_a16_flag_reg_nr, /* 4+ */ 34, 34, /* 8+ */ 33, 33, /* 12+ */ -1, -1) 356bf215546Sopenharmony_ciF8(3src_a16_flag_subreg_nr, /* 4+ */ 33, 33, /* 8+ */ 32, 32, /* 12+ */ -1, -1) 357bf215546Sopenharmony_ciFF(3src_a16_dst_reg_file, 358bf215546Sopenharmony_ci /* 4-5: doesn't exist - no 3-source instructions */ -1, -1, -1, -1, -1, -1, 359bf215546Sopenharmony_ci /* 6: */ 32, 32, 360bf215546Sopenharmony_ci /* 7-8: doesn't exist - no MRFs */ -1, -1, -1, -1, 361bf215546Sopenharmony_ci /* 12: */ -1, -1) 362bf215546Sopenharmony_ciF(3src_saturate, /* 4+ */ 31, 31, /* 12+ */ 34, 34) 363bf215546Sopenharmony_ciF(3src_debug_control, /* 4+ */ 30, 30, /* 12+ */ 30, 30) 364bf215546Sopenharmony_ciF(3src_cmpt_control, /* 4+ */ 29, 29, /* 12+ */ 29, 29) 365bf215546Sopenharmony_ciF(3src_acc_wr_control, /* 4+ */ 28, 28, /* 12+ */ 33, 33) 366bf215546Sopenharmony_ciF(3src_cond_modifier, /* 4+ */ 27, 24, /* 12+ */ 95, 92) 367bf215546Sopenharmony_ciF(3src_exec_size, /* 4+ */ 23, 21, /* 12+ */ 18, 16) 368bf215546Sopenharmony_ciF(3src_pred_inv, /* 4+ */ 20, 20, /* 12+ */ 28, 28) 369bf215546Sopenharmony_ciF(3src_pred_control, /* 4+ */ 19, 16, /* 12+ */ 27, 24) 370bf215546Sopenharmony_ciF(3src_thread_control, /* 4+ */ 15, 14, /* 12+ */ -1, -1) 371bf215546Sopenharmony_ciF(3src_atomic_control, /* 4+ */ -1, -1, /* 12+ */ 32, 32) 372bf215546Sopenharmony_ciF(3src_qtr_control, /* 4+ */ 13, 12, /* 12+ */ 21, 20) 373bf215546Sopenharmony_ciF8(3src_no_dd_check, /* 4+ */ 11, 11, /* 8+ */ 10, 10, /* 12+ */ -1, -1) 374bf215546Sopenharmony_ciF8(3src_no_dd_clear, /* 4+ */ 10, 10, /* 8+ */ 9, 9, /* 12+ */ -1, -1) 375bf215546Sopenharmony_ciF8(3src_mask_control, /* 4+ */ 9, 9, /* 8+ */ 34, 34, /* 12+ */ 31, 31) 376bf215546Sopenharmony_ciFK(3src_access_mode, /* 4+ */ 8, 8, /* 12+ */ BRW_ALIGN_1) 377bf215546Sopenharmony_ciF(3src_swsb, /* 4+ */ -1, -1, /* 12+ */ 15, 8) 378bf215546Sopenharmony_ci/* Bit 7 is Reserved (for future Opcode expansion) */ 379bf215546Sopenharmony_ciF(3src_hw_opcode, /* 4+ */ 6, 0, /* 12+ */ 6, 0) 380bf215546Sopenharmony_ci/** @} */ 381bf215546Sopenharmony_ci 382bf215546Sopenharmony_ci#define REG_TYPE(reg) \ 383bf215546Sopenharmony_cistatic inline void \ 384bf215546Sopenharmony_cibrw_inst_set_3src_a16_##reg##_type(const struct intel_device_info *devinfo, \ 385bf215546Sopenharmony_ci brw_inst *inst, enum brw_reg_type type) \ 386bf215546Sopenharmony_ci{ \ 387bf215546Sopenharmony_ci unsigned hw_type = brw_reg_type_to_a16_hw_3src_type(devinfo, type); \ 388bf215546Sopenharmony_ci brw_inst_set_3src_a16_##reg##_hw_type(devinfo, inst, hw_type); \ 389bf215546Sopenharmony_ci} \ 390bf215546Sopenharmony_ci \ 391bf215546Sopenharmony_cistatic inline enum brw_reg_type \ 392bf215546Sopenharmony_cibrw_inst_3src_a16_##reg##_type(const struct intel_device_info *devinfo, \ 393bf215546Sopenharmony_ci const brw_inst *inst) \ 394bf215546Sopenharmony_ci{ \ 395bf215546Sopenharmony_ci unsigned hw_type = brw_inst_3src_a16_##reg##_hw_type(devinfo, inst); \ 396bf215546Sopenharmony_ci return brw_a16_hw_3src_type_to_reg_type(devinfo, hw_type); \ 397bf215546Sopenharmony_ci} 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ciREG_TYPE(dst) 400bf215546Sopenharmony_ciREG_TYPE(src) 401bf215546Sopenharmony_ci#undef REG_TYPE 402bf215546Sopenharmony_ci 403bf215546Sopenharmony_ci/** 404bf215546Sopenharmony_ci * Three-source align1 instructions: 405bf215546Sopenharmony_ci * @{ 406bf215546Sopenharmony_ci */ 407bf215546Sopenharmony_ci/* Reserved 127:126 */ 408bf215546Sopenharmony_ci/* src2_reg_nr same in align16 */ 409bf215546Sopenharmony_ciFC(3src_a1_src2_subreg_nr, /* 4+ */ 117, 113, /* 12+ */ 119, 115, devinfo->ver >= 10) 410bf215546Sopenharmony_ciFC(3src_a1_src2_hstride, /* 4+ */ 112, 111, /* 12+ */ 113, 112, devinfo->ver >= 10) 411bf215546Sopenharmony_ci/* Reserved 110:109. src2 vstride is an implied parameter */ 412bf215546Sopenharmony_ciFC(3src_a1_src2_hw_type, /* 4+ */ 108, 106, /* 12+ */ 82, 80, devinfo->ver >= 10) 413bf215546Sopenharmony_ci/* Reserved 105 */ 414bf215546Sopenharmony_ci/* src1_reg_nr same in align16 */ 415bf215546Sopenharmony_ciFC(3src_a1_src1_subreg_nr, /* 4+ */ 96, 92, /* 12+ */ 103, 99, devinfo->ver >= 10) 416bf215546Sopenharmony_ciFC(3src_a1_src1_hstride, /* 4+ */ 91, 90, /* 12+ */ 97, 96, devinfo->ver >= 10) 417bf215546Sopenharmony_ciFDC(3src_a1_src1_vstride, /* 4+ */ 89, 88, /* 12+ */ 91, 91, 83, 83, devinfo->ver >= 10) 418bf215546Sopenharmony_ciFC(3src_a1_src1_hw_type, /* 4+ */ 87, 85, /* 12+ */ 90, 88, devinfo->ver >= 10) 419bf215546Sopenharmony_ci/* Reserved 84 */ 420bf215546Sopenharmony_ci/* src0_reg_nr same in align16 */ 421bf215546Sopenharmony_ciFC(3src_a1_src0_subreg_nr, /* 4+ */ 75, 71, /* 12+ */ 71, 67, devinfo->ver >= 10) 422bf215546Sopenharmony_ciFC(3src_a1_src0_hstride, /* 4+ */ 70, 69, /* 12+ */ 65, 64, devinfo->ver >= 10) 423bf215546Sopenharmony_ciFDC(3src_a1_src0_vstride, /* 4+ */ 68, 67, /* 12+ */ 43, 43, 35, 35, devinfo->ver >= 10) 424bf215546Sopenharmony_ciFC(3src_a1_src0_hw_type, /* 4+ */ 66, 64, /* 12+ */ 42, 40, devinfo->ver >= 10) 425bf215546Sopenharmony_ci/* dst_reg_nr same in align16 */ 426bf215546Sopenharmony_ciFC(3src_a1_dst_subreg_nr, /* 4+ */ 55, 54, /* 12+ */ 55, 54, devinfo->ver >= 10) 427bf215546Sopenharmony_ciFC(3src_a1_special_acc, /* 4+ */ 55, 52, /* 12+ */ 54, 51, devinfo->ver >= 10) /* aliases dst_subreg_nr */ 428bf215546Sopenharmony_ci/* Reserved 51:50 */ 429bf215546Sopenharmony_ciFC(3src_a1_dst_hstride, /* 4+ */ 49, 49, /* 12+ */ 48, 48, devinfo->ver >= 10) 430bf215546Sopenharmony_ciFC(3src_a1_dst_hw_type, /* 4+ */ 48, 46, /* 12+ */ 38, 36, devinfo->ver >= 10) 431bf215546Sopenharmony_ciFI(3src_a1_src2_reg_file, /* 4+ */ -1, -1, /* 8+ */ 45, 45, /* 12+ */ 47, 114) 432bf215546Sopenharmony_ciFC(3src_a1_src1_reg_file, /* 4+ */ 44, 44, /* 12+ */ 98, 98, devinfo->ver >= 10) 433bf215546Sopenharmony_ciFI(3src_a1_src0_reg_file, /* 4+ */ -1, -1, /* 8+ */ 43, 43, /* 12+ */ 46, 66) 434bf215546Sopenharmony_ci 435bf215546Sopenharmony_ciF(3src_a1_src2_is_imm, /* 4+ */ -1, -1, /* 12+ */ 47, 47) 436bf215546Sopenharmony_ciF(3src_a1_src0_is_imm, /* 4+ */ -1, -1, /* 12+ */ 46, 46) 437bf215546Sopenharmony_ci 438bf215546Sopenharmony_ci/* Source Modifier fields same in align16 */ 439bf215546Sopenharmony_ciFC(3src_a1_dst_reg_file, /* 4+ */ 36, 36, /* 12+ */ 50, 50, devinfo->ver >= 10) 440bf215546Sopenharmony_ciFC(3src_a1_exec_type, /* 4+ */ 35, 35, /* 12+ */ 39, 39, devinfo->ver >= 10) 441bf215546Sopenharmony_ci/* Fields below this same in align16 */ 442bf215546Sopenharmony_ci/** @} */ 443bf215546Sopenharmony_ci 444bf215546Sopenharmony_ci#define REG_TYPE(reg) \ 445bf215546Sopenharmony_cistatic inline void \ 446bf215546Sopenharmony_cibrw_inst_set_3src_a1_##reg##_type(const struct intel_device_info *devinfo, \ 447bf215546Sopenharmony_ci brw_inst *inst, enum brw_reg_type type) \ 448bf215546Sopenharmony_ci{ \ 449bf215546Sopenharmony_ci UNUSED enum gfx10_align1_3src_exec_type exec_type = \ 450bf215546Sopenharmony_ci (enum gfx10_align1_3src_exec_type) brw_inst_3src_a1_exec_type(devinfo, \ 451bf215546Sopenharmony_ci inst); \ 452bf215546Sopenharmony_ci if (brw_reg_type_is_floating_point(type)) { \ 453bf215546Sopenharmony_ci assert(exec_type == BRW_ALIGN1_3SRC_EXEC_TYPE_FLOAT); \ 454bf215546Sopenharmony_ci } else { \ 455bf215546Sopenharmony_ci assert(exec_type == BRW_ALIGN1_3SRC_EXEC_TYPE_INT); \ 456bf215546Sopenharmony_ci } \ 457bf215546Sopenharmony_ci unsigned hw_type = brw_reg_type_to_a1_hw_3src_type(devinfo, type); \ 458bf215546Sopenharmony_ci brw_inst_set_3src_a1_##reg##_hw_type(devinfo, inst, hw_type); \ 459bf215546Sopenharmony_ci} \ 460bf215546Sopenharmony_ci \ 461bf215546Sopenharmony_cistatic inline enum brw_reg_type \ 462bf215546Sopenharmony_cibrw_inst_3src_a1_##reg##_type(const struct intel_device_info *devinfo, \ 463bf215546Sopenharmony_ci const brw_inst *inst) \ 464bf215546Sopenharmony_ci{ \ 465bf215546Sopenharmony_ci enum gfx10_align1_3src_exec_type exec_type = \ 466bf215546Sopenharmony_ci (enum gfx10_align1_3src_exec_type) brw_inst_3src_a1_exec_type(devinfo, \ 467bf215546Sopenharmony_ci inst); \ 468bf215546Sopenharmony_ci unsigned hw_type = brw_inst_3src_a1_##reg##_hw_type(devinfo, inst); \ 469bf215546Sopenharmony_ci return brw_a1_hw_3src_type_to_reg_type(devinfo, hw_type, exec_type); \ 470bf215546Sopenharmony_ci} 471bf215546Sopenharmony_ci 472bf215546Sopenharmony_ciREG_TYPE(dst) 473bf215546Sopenharmony_ciREG_TYPE(src0) 474bf215546Sopenharmony_ciREG_TYPE(src1) 475bf215546Sopenharmony_ciREG_TYPE(src2) 476bf215546Sopenharmony_ci#undef REG_TYPE 477bf215546Sopenharmony_ci 478bf215546Sopenharmony_ci/** 479bf215546Sopenharmony_ci * Three-source align1 instruction immediates: 480bf215546Sopenharmony_ci * @{ 481bf215546Sopenharmony_ci */ 482bf215546Sopenharmony_cistatic inline uint16_t 483bf215546Sopenharmony_cibrw_inst_3src_a1_src0_imm(ASSERTED const struct intel_device_info *devinfo, 484bf215546Sopenharmony_ci const brw_inst *insn) 485bf215546Sopenharmony_ci{ 486bf215546Sopenharmony_ci assert(devinfo->ver >= 10); 487bf215546Sopenharmony_ci if (devinfo->ver >= 12) 488bf215546Sopenharmony_ci return brw_inst_bits(insn, 79, 64); 489bf215546Sopenharmony_ci else 490bf215546Sopenharmony_ci return brw_inst_bits(insn, 82, 67); 491bf215546Sopenharmony_ci} 492bf215546Sopenharmony_ci 493bf215546Sopenharmony_cistatic inline uint16_t 494bf215546Sopenharmony_cibrw_inst_3src_a1_src2_imm(ASSERTED const struct intel_device_info *devinfo, 495bf215546Sopenharmony_ci const brw_inst *insn) 496bf215546Sopenharmony_ci{ 497bf215546Sopenharmony_ci assert(devinfo->ver >= 10); 498bf215546Sopenharmony_ci if (devinfo->ver >= 12) 499bf215546Sopenharmony_ci return brw_inst_bits(insn, 127, 112); 500bf215546Sopenharmony_ci else 501bf215546Sopenharmony_ci return brw_inst_bits(insn, 124, 109); 502bf215546Sopenharmony_ci} 503bf215546Sopenharmony_ci 504bf215546Sopenharmony_cistatic inline void 505bf215546Sopenharmony_cibrw_inst_set_3src_a1_src0_imm(ASSERTED const struct intel_device_info *devinfo, 506bf215546Sopenharmony_ci brw_inst *insn, uint16_t value) 507bf215546Sopenharmony_ci{ 508bf215546Sopenharmony_ci assert(devinfo->ver >= 10); 509bf215546Sopenharmony_ci if (devinfo->ver >= 12) 510bf215546Sopenharmony_ci brw_inst_set_bits(insn, 79, 64, value); 511bf215546Sopenharmony_ci else 512bf215546Sopenharmony_ci brw_inst_set_bits(insn, 82, 67, value); 513bf215546Sopenharmony_ci} 514bf215546Sopenharmony_ci 515bf215546Sopenharmony_cistatic inline void 516bf215546Sopenharmony_cibrw_inst_set_3src_a1_src2_imm(ASSERTED const struct intel_device_info *devinfo, 517bf215546Sopenharmony_ci brw_inst *insn, uint16_t value) 518bf215546Sopenharmony_ci{ 519bf215546Sopenharmony_ci assert(devinfo->ver >= 10); 520bf215546Sopenharmony_ci if (devinfo->ver >= 12) 521bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 112, value); 522bf215546Sopenharmony_ci else 523bf215546Sopenharmony_ci brw_inst_set_bits(insn, 124, 109, value); 524bf215546Sopenharmony_ci} 525bf215546Sopenharmony_ci/** @} */ 526bf215546Sopenharmony_ci 527bf215546Sopenharmony_ci/** 528bf215546Sopenharmony_ci * Flow control instruction bits: 529bf215546Sopenharmony_ci * @{ 530bf215546Sopenharmony_ci */ 531bf215546Sopenharmony_cistatic inline void 532bf215546Sopenharmony_cibrw_inst_set_uip(const struct intel_device_info *devinfo, 533bf215546Sopenharmony_ci brw_inst *inst, int32_t value) 534bf215546Sopenharmony_ci{ 535bf215546Sopenharmony_ci assert(devinfo->ver >= 6); 536bf215546Sopenharmony_ci 537bf215546Sopenharmony_ci if (devinfo->ver >= 12) 538bf215546Sopenharmony_ci brw_inst_set_src1_is_imm(devinfo, inst, 1); 539bf215546Sopenharmony_ci 540bf215546Sopenharmony_ci if (devinfo->ver >= 8) { 541bf215546Sopenharmony_ci brw_inst_set_bits(inst, 95, 64, (uint32_t)value); 542bf215546Sopenharmony_ci } else { 543bf215546Sopenharmony_ci assert(value <= (1 << 16) - 1); 544bf215546Sopenharmony_ci assert(value > -(1 << 16)); 545bf215546Sopenharmony_ci brw_inst_set_bits(inst, 127, 112, (uint16_t)value); 546bf215546Sopenharmony_ci } 547bf215546Sopenharmony_ci} 548bf215546Sopenharmony_ci 549bf215546Sopenharmony_cistatic inline int32_t 550bf215546Sopenharmony_cibrw_inst_uip(const struct intel_device_info *devinfo, const brw_inst *inst) 551bf215546Sopenharmony_ci{ 552bf215546Sopenharmony_ci assert(devinfo->ver >= 6); 553bf215546Sopenharmony_ci 554bf215546Sopenharmony_ci if (devinfo->ver >= 8) { 555bf215546Sopenharmony_ci return brw_inst_bits(inst, 95, 64); 556bf215546Sopenharmony_ci } else { 557bf215546Sopenharmony_ci return (int16_t)brw_inst_bits(inst, 127, 112); 558bf215546Sopenharmony_ci } 559bf215546Sopenharmony_ci} 560bf215546Sopenharmony_ci 561bf215546Sopenharmony_cistatic inline void 562bf215546Sopenharmony_cibrw_inst_set_jip(const struct intel_device_info *devinfo, 563bf215546Sopenharmony_ci brw_inst *inst, int32_t value) 564bf215546Sopenharmony_ci{ 565bf215546Sopenharmony_ci assert(devinfo->ver >= 6); 566bf215546Sopenharmony_ci 567bf215546Sopenharmony_ci if (devinfo->ver >= 12) 568bf215546Sopenharmony_ci brw_inst_set_src0_is_imm(devinfo, inst, 1); 569bf215546Sopenharmony_ci 570bf215546Sopenharmony_ci if (devinfo->ver >= 8) { 571bf215546Sopenharmony_ci brw_inst_set_bits(inst, 127, 96, (uint32_t)value); 572bf215546Sopenharmony_ci } else { 573bf215546Sopenharmony_ci assert(value <= (1 << 15) - 1); 574bf215546Sopenharmony_ci assert(value >= -(1 << 15)); 575bf215546Sopenharmony_ci brw_inst_set_bits(inst, 111, 96, (uint16_t)value); 576bf215546Sopenharmony_ci } 577bf215546Sopenharmony_ci} 578bf215546Sopenharmony_ci 579bf215546Sopenharmony_cistatic inline int32_t 580bf215546Sopenharmony_cibrw_inst_jip(const struct intel_device_info *devinfo, const brw_inst *inst) 581bf215546Sopenharmony_ci{ 582bf215546Sopenharmony_ci assert(devinfo->ver >= 6); 583bf215546Sopenharmony_ci 584bf215546Sopenharmony_ci if (devinfo->ver >= 8) { 585bf215546Sopenharmony_ci return brw_inst_bits(inst, 127, 96); 586bf215546Sopenharmony_ci } else { 587bf215546Sopenharmony_ci return (int16_t)brw_inst_bits(inst, 111, 96); 588bf215546Sopenharmony_ci } 589bf215546Sopenharmony_ci} 590bf215546Sopenharmony_ci 591bf215546Sopenharmony_ci/** Like FC, but using int16_t to handle negative jump targets. */ 592bf215546Sopenharmony_ci#define FJ(name, high, low, assertions) \ 593bf215546Sopenharmony_cistatic inline void \ 594bf215546Sopenharmony_cibrw_inst_set_##name(const struct intel_device_info *devinfo, brw_inst *inst, int16_t v) \ 595bf215546Sopenharmony_ci{ \ 596bf215546Sopenharmony_ci assert(assertions); \ 597bf215546Sopenharmony_ci (void) devinfo; \ 598bf215546Sopenharmony_ci brw_inst_set_bits(inst, high, low, (uint16_t) v); \ 599bf215546Sopenharmony_ci} \ 600bf215546Sopenharmony_cistatic inline int16_t \ 601bf215546Sopenharmony_cibrw_inst_##name(const struct intel_device_info *devinfo, const brw_inst *inst)\ 602bf215546Sopenharmony_ci{ \ 603bf215546Sopenharmony_ci assert(assertions); \ 604bf215546Sopenharmony_ci (void) devinfo; \ 605bf215546Sopenharmony_ci return brw_inst_bits(inst, high, low); \ 606bf215546Sopenharmony_ci} 607bf215546Sopenharmony_ci 608bf215546Sopenharmony_ciFJ(gfx6_jump_count, 63, 48, devinfo->ver == 6) 609bf215546Sopenharmony_ciFJ(gfx4_jump_count, 111, 96, devinfo->ver < 6) 610bf215546Sopenharmony_ciFC(gfx4_pop_count, /* 4+ */ 115, 112, /* 12+ */ -1, -1, devinfo->ver < 6) 611bf215546Sopenharmony_ci/** @} */ 612bf215546Sopenharmony_ci 613bf215546Sopenharmony_ci/** 614bf215546Sopenharmony_ci * SEND instructions: 615bf215546Sopenharmony_ci * @{ 616bf215546Sopenharmony_ci */ 617bf215546Sopenharmony_ciFC(send_ex_desc_ia_subreg_nr, /* 4+ */ 82, 80, /* 12+ */ 42, 40, devinfo->ver >= 9) 618bf215546Sopenharmony_ciFC(send_src0_address_mode, /* 4+ */ 79, 79, /* 12+ */ -1, -1, devinfo->ver >= 9) 619bf215546Sopenharmony_ciFC(send_sel_reg32_desc, /* 4+ */ 77, 77, /* 12+ */ 48, 48, devinfo->ver >= 9) 620bf215546Sopenharmony_ciFC(send_sel_reg32_ex_desc, /* 4+ */ 61, 61, /* 12+ */ 49, 49, devinfo->ver >= 9) 621bf215546Sopenharmony_ciF8(send_src0_reg_file, /* 4+ */ 38, 37, /* 8+ */ 42, 41, /* 12+ */ 66, 66) 622bf215546Sopenharmony_ciFC(send_src1_reg_nr, /* 4+ */ 51, 44, /* 12+ */ 111, 104, devinfo->ver >= 9) 623bf215546Sopenharmony_ciFC(send_src1_reg_file, /* 4+ */ 36, 36, /* 12+ */ 98, 98, devinfo->ver >= 9) 624bf215546Sopenharmony_ciFC(send_dst_reg_file, /* 4+ */ 35, 35, /* 12+ */ 50, 50, devinfo->ver >= 9) 625bf215546Sopenharmony_ci/** @} */ 626bf215546Sopenharmony_ci 627bf215546Sopenharmony_ci/* Message descriptor bits */ 628bf215546Sopenharmony_ci#define MD(x) ((x) + 96) 629bf215546Sopenharmony_ci#define MD12(x) ((x) >= 30 ? (x) - 30 + 122 : \ 630bf215546Sopenharmony_ci (x) >= 25 ? (x) - 25 + 67 : \ 631bf215546Sopenharmony_ci (x) >= 20 ? (x) - 20 + 51 : \ 632bf215546Sopenharmony_ci (x) >= 11 ? (x) - 11 + 113 : \ 633bf215546Sopenharmony_ci (x) - 0 + 81) 634bf215546Sopenharmony_ci 635bf215546Sopenharmony_ci/** 636bf215546Sopenharmony_ci * Set the SEND(C) message descriptor immediate. 637bf215546Sopenharmony_ci * 638bf215546Sopenharmony_ci * This doesn't include the SFID nor the EOT field that were considered to be 639bf215546Sopenharmony_ci * part of the message descriptor by ancient versions of the BSpec, because 640bf215546Sopenharmony_ci * they are present in the instruction even if the message descriptor is 641bf215546Sopenharmony_ci * provided indirectly in the address register, so we want to specify them 642bf215546Sopenharmony_ci * separately. 643bf215546Sopenharmony_ci */ 644bf215546Sopenharmony_cistatic inline void 645bf215546Sopenharmony_cibrw_inst_set_send_desc(const struct intel_device_info *devinfo, 646bf215546Sopenharmony_ci brw_inst *inst, uint32_t value) 647bf215546Sopenharmony_ci{ 648bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 649bf215546Sopenharmony_ci brw_inst_set_bits(inst, 123, 122, GET_BITS(value, 31, 30)); 650bf215546Sopenharmony_ci brw_inst_set_bits(inst, 71, 67, GET_BITS(value, 29, 25)); 651bf215546Sopenharmony_ci brw_inst_set_bits(inst, 55, 51, GET_BITS(value, 24, 20)); 652bf215546Sopenharmony_ci brw_inst_set_bits(inst, 121, 113, GET_BITS(value, 19, 11)); 653bf215546Sopenharmony_ci brw_inst_set_bits(inst, 91, 81, GET_BITS(value, 10, 0)); 654bf215546Sopenharmony_ci } else if (devinfo->ver >= 9) { 655bf215546Sopenharmony_ci brw_inst_set_bits(inst, 126, 96, value); 656bf215546Sopenharmony_ci assert(value >> 31 == 0); 657bf215546Sopenharmony_ci } else if (devinfo->ver >= 5) { 658bf215546Sopenharmony_ci brw_inst_set_bits(inst, 124, 96, value); 659bf215546Sopenharmony_ci assert(value >> 29 == 0); 660bf215546Sopenharmony_ci } else { 661bf215546Sopenharmony_ci brw_inst_set_bits(inst, 119, 96, value); 662bf215546Sopenharmony_ci assert(value >> 24 == 0); 663bf215546Sopenharmony_ci } 664bf215546Sopenharmony_ci} 665bf215546Sopenharmony_ci 666bf215546Sopenharmony_ci/** 667bf215546Sopenharmony_ci * Get the SEND(C) message descriptor immediate. 668bf215546Sopenharmony_ci * 669bf215546Sopenharmony_ci * \sa brw_inst_set_send_desc(). 670bf215546Sopenharmony_ci */ 671bf215546Sopenharmony_cistatic inline uint32_t 672bf215546Sopenharmony_cibrw_inst_send_desc(const struct intel_device_info *devinfo, 673bf215546Sopenharmony_ci const brw_inst *inst) 674bf215546Sopenharmony_ci{ 675bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 676bf215546Sopenharmony_ci return (brw_inst_bits(inst, 123, 122) << 30 | 677bf215546Sopenharmony_ci brw_inst_bits(inst, 71, 67) << 25 | 678bf215546Sopenharmony_ci brw_inst_bits(inst, 55, 51) << 20 | 679bf215546Sopenharmony_ci brw_inst_bits(inst, 121, 113) << 11 | 680bf215546Sopenharmony_ci brw_inst_bits(inst, 91, 81)); 681bf215546Sopenharmony_ci } else if (devinfo->ver >= 9) { 682bf215546Sopenharmony_ci return brw_inst_bits(inst, 126, 96); 683bf215546Sopenharmony_ci } else if (devinfo->ver >= 5) { 684bf215546Sopenharmony_ci return brw_inst_bits(inst, 124, 96); 685bf215546Sopenharmony_ci } else { 686bf215546Sopenharmony_ci return brw_inst_bits(inst, 119, 96); 687bf215546Sopenharmony_ci } 688bf215546Sopenharmony_ci} 689bf215546Sopenharmony_ci 690bf215546Sopenharmony_ci/** 691bf215546Sopenharmony_ci * Set the SEND(C) message extended descriptor immediate. 692bf215546Sopenharmony_ci * 693bf215546Sopenharmony_ci * This doesn't include the SFID nor the EOT field that were considered to be 694bf215546Sopenharmony_ci * part of the extended message descriptor by some versions of the BSpec, 695bf215546Sopenharmony_ci * because they are present in the instruction even if the extended message 696bf215546Sopenharmony_ci * descriptor is provided indirectly in a register, so we want to specify them 697bf215546Sopenharmony_ci * separately. 698bf215546Sopenharmony_ci */ 699bf215546Sopenharmony_cistatic inline void 700bf215546Sopenharmony_cibrw_inst_set_send_ex_desc(const struct intel_device_info *devinfo, 701bf215546Sopenharmony_ci brw_inst *inst, uint32_t value) 702bf215546Sopenharmony_ci{ 703bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 704bf215546Sopenharmony_ci brw_inst_set_bits(inst, 127, 124, GET_BITS(value, 31, 28)); 705bf215546Sopenharmony_ci brw_inst_set_bits(inst, 97, 96, GET_BITS(value, 27, 26)); 706bf215546Sopenharmony_ci brw_inst_set_bits(inst, 65, 64, GET_BITS(value, 25, 24)); 707bf215546Sopenharmony_ci brw_inst_set_bits(inst, 47, 35, GET_BITS(value, 23, 11)); 708bf215546Sopenharmony_ci brw_inst_set_bits(inst, 103, 99, GET_BITS(value, 10, 6)); 709bf215546Sopenharmony_ci assert(GET_BITS(value, 5, 0) == 0); 710bf215546Sopenharmony_ci } else { 711bf215546Sopenharmony_ci assert(devinfo->ver >= 9); 712bf215546Sopenharmony_ci brw_inst_set_bits(inst, 94, 91, GET_BITS(value, 31, 28)); 713bf215546Sopenharmony_ci brw_inst_set_bits(inst, 88, 85, GET_BITS(value, 27, 24)); 714bf215546Sopenharmony_ci brw_inst_set_bits(inst, 83, 80, GET_BITS(value, 23, 20)); 715bf215546Sopenharmony_ci brw_inst_set_bits(inst, 67, 64, GET_BITS(value, 19, 16)); 716bf215546Sopenharmony_ci assert(GET_BITS(value, 15, 0) == 0); 717bf215546Sopenharmony_ci } 718bf215546Sopenharmony_ci} 719bf215546Sopenharmony_ci 720bf215546Sopenharmony_ci/** 721bf215546Sopenharmony_ci * Set the SENDS(C) message extended descriptor immediate. 722bf215546Sopenharmony_ci * 723bf215546Sopenharmony_ci * This doesn't include the SFID nor the EOT field that were considered to be 724bf215546Sopenharmony_ci * part of the extended message descriptor by some versions of the BSpec, 725bf215546Sopenharmony_ci * because they are present in the instruction even if the extended message 726bf215546Sopenharmony_ci * descriptor is provided indirectly in a register, so we want to specify them 727bf215546Sopenharmony_ci * separately. 728bf215546Sopenharmony_ci */ 729bf215546Sopenharmony_cistatic inline void 730bf215546Sopenharmony_cibrw_inst_set_sends_ex_desc(const struct intel_device_info *devinfo, 731bf215546Sopenharmony_ci brw_inst *inst, uint32_t value) 732bf215546Sopenharmony_ci{ 733bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 734bf215546Sopenharmony_ci brw_inst_set_send_ex_desc(devinfo, inst, value); 735bf215546Sopenharmony_ci } else { 736bf215546Sopenharmony_ci brw_inst_set_bits(inst, 95, 80, GET_BITS(value, 31, 16)); 737bf215546Sopenharmony_ci assert(GET_BITS(value, 15, 10) == 0); 738bf215546Sopenharmony_ci brw_inst_set_bits(inst, 67, 64, GET_BITS(value, 9, 6)); 739bf215546Sopenharmony_ci assert(GET_BITS(value, 5, 0) == 0); 740bf215546Sopenharmony_ci } 741bf215546Sopenharmony_ci} 742bf215546Sopenharmony_ci 743bf215546Sopenharmony_ci/** 744bf215546Sopenharmony_ci * Get the SEND(C) message extended descriptor immediate. 745bf215546Sopenharmony_ci * 746bf215546Sopenharmony_ci * \sa brw_inst_set_send_ex_desc(). 747bf215546Sopenharmony_ci */ 748bf215546Sopenharmony_cistatic inline uint32_t 749bf215546Sopenharmony_cibrw_inst_send_ex_desc(const struct intel_device_info *devinfo, 750bf215546Sopenharmony_ci const brw_inst *inst) 751bf215546Sopenharmony_ci{ 752bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 753bf215546Sopenharmony_ci return (brw_inst_bits(inst, 127, 124) << 28 | 754bf215546Sopenharmony_ci brw_inst_bits(inst, 97, 96) << 26 | 755bf215546Sopenharmony_ci brw_inst_bits(inst, 65, 64) << 24 | 756bf215546Sopenharmony_ci brw_inst_bits(inst, 47, 35) << 11 | 757bf215546Sopenharmony_ci brw_inst_bits(inst, 103, 99) << 6); 758bf215546Sopenharmony_ci } else { 759bf215546Sopenharmony_ci assert(devinfo->ver >= 9); 760bf215546Sopenharmony_ci return (brw_inst_bits(inst, 94, 91) << 28 | 761bf215546Sopenharmony_ci brw_inst_bits(inst, 88, 85) << 24 | 762bf215546Sopenharmony_ci brw_inst_bits(inst, 83, 80) << 20 | 763bf215546Sopenharmony_ci brw_inst_bits(inst, 67, 64) << 16); 764bf215546Sopenharmony_ci } 765bf215546Sopenharmony_ci} 766bf215546Sopenharmony_ci 767bf215546Sopenharmony_ci/** 768bf215546Sopenharmony_ci * Get the SENDS(C) message extended descriptor immediate. 769bf215546Sopenharmony_ci * 770bf215546Sopenharmony_ci * \sa brw_inst_set_send_ex_desc(). 771bf215546Sopenharmony_ci */ 772bf215546Sopenharmony_cistatic inline uint32_t 773bf215546Sopenharmony_cibrw_inst_sends_ex_desc(const struct intel_device_info *devinfo, 774bf215546Sopenharmony_ci const brw_inst *inst) 775bf215546Sopenharmony_ci{ 776bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 777bf215546Sopenharmony_ci return brw_inst_send_ex_desc(devinfo, inst); 778bf215546Sopenharmony_ci } else { 779bf215546Sopenharmony_ci return (brw_inst_bits(inst, 95, 80) << 16 | 780bf215546Sopenharmony_ci brw_inst_bits(inst, 67, 64) << 6); 781bf215546Sopenharmony_ci } 782bf215546Sopenharmony_ci} 783bf215546Sopenharmony_ci 784bf215546Sopenharmony_ci/** 785bf215546Sopenharmony_ci * Fields for SEND messages: 786bf215546Sopenharmony_ci * @{ 787bf215546Sopenharmony_ci */ 788bf215546Sopenharmony_ciF(eot, /* 4+ */ 127, 127, /* 12+ */ 34, 34) 789bf215546Sopenharmony_ciFF(mlen, 790bf215546Sopenharmony_ci /* 4: */ 119, 116, 791bf215546Sopenharmony_ci /* 4.5: */ 119, 116, 792bf215546Sopenharmony_ci /* 5: */ 124, 121, 793bf215546Sopenharmony_ci /* 6: */ 124, 121, 794bf215546Sopenharmony_ci /* 7: */ 124, 121, 795bf215546Sopenharmony_ci /* 8: */ 124, 121, 796bf215546Sopenharmony_ci /* 12: */ MD12(28), MD12(25)); 797bf215546Sopenharmony_ciFF(rlen, 798bf215546Sopenharmony_ci /* 4: */ 115, 112, 799bf215546Sopenharmony_ci /* 4.5: */ 115, 112, 800bf215546Sopenharmony_ci /* 5: */ 120, 116, 801bf215546Sopenharmony_ci /* 6: */ 120, 116, 802bf215546Sopenharmony_ci /* 7: */ 120, 116, 803bf215546Sopenharmony_ci /* 8: */ 120, 116, 804bf215546Sopenharmony_ci /* 12: */ MD12(24), MD12(20)); 805bf215546Sopenharmony_ciFF(header_present, 806bf215546Sopenharmony_ci /* 4: doesn't exist */ -1, -1, -1, -1, 807bf215546Sopenharmony_ci /* 5: */ 115, 115, 808bf215546Sopenharmony_ci /* 6: */ 115, 115, 809bf215546Sopenharmony_ci /* 7: */ 115, 115, 810bf215546Sopenharmony_ci /* 8: */ 115, 115, 811bf215546Sopenharmony_ci /* 12: */ MD12(19), MD12(19)) 812bf215546Sopenharmony_ciF(gateway_notify, /* 4+ */ MD(16), MD(15), /* 12+ */ -1, -1) 813bf215546Sopenharmony_ciFD(function_control, 814bf215546Sopenharmony_ci /* 4: */ 111, 96, 815bf215546Sopenharmony_ci /* 4.5: */ 111, 96, 816bf215546Sopenharmony_ci /* 5: */ 114, 96, 817bf215546Sopenharmony_ci /* 6: */ 114, 96, 818bf215546Sopenharmony_ci /* 7: */ 114, 96, 819bf215546Sopenharmony_ci /* 8: */ 114, 96, 820bf215546Sopenharmony_ci /* 12: */ MD12(18), MD12(11), MD12(10), MD12(0)) 821bf215546Sopenharmony_ciFF(gateway_subfuncid, 822bf215546Sopenharmony_ci /* 4: */ MD(1), MD(0), 823bf215546Sopenharmony_ci /* 4.5: */ MD(1), MD(0), 824bf215546Sopenharmony_ci /* 5: */ MD(1), MD(0), /* 2:0, but bit 2 is reserved MBZ */ 825bf215546Sopenharmony_ci /* 6: */ MD(2), MD(0), 826bf215546Sopenharmony_ci /* 7: */ MD(2), MD(0), 827bf215546Sopenharmony_ci /* 8: */ MD(2), MD(0), 828bf215546Sopenharmony_ci /* 12: */ MD12(2), MD12(0)) 829bf215546Sopenharmony_ciFF(sfid, 830bf215546Sopenharmony_ci /* 4: */ 123, 120, /* called msg_target */ 831bf215546Sopenharmony_ci /* 4.5 */ 123, 120, 832bf215546Sopenharmony_ci /* 5: */ 95, 92, 833bf215546Sopenharmony_ci /* 6: */ 27, 24, 834bf215546Sopenharmony_ci /* 7: */ 27, 24, 835bf215546Sopenharmony_ci /* 8: */ 27, 24, 836bf215546Sopenharmony_ci /* 12: */ 95, 92) 837bf215546Sopenharmony_ciFF(null_rt, 838bf215546Sopenharmony_ci /* 4-7: */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 839bf215546Sopenharmony_ci /* 8: */ 80, 80, 840bf215546Sopenharmony_ci /* 12: */ 44, 44) /* actually only Gfx11+ */ 841bf215546Sopenharmony_ciFC(base_mrf, /* 4+ */ 27, 24, /* 12+ */ -1, -1, devinfo->ver < 6); 842bf215546Sopenharmony_ciFF(send_rta_index, 843bf215546Sopenharmony_ci /* 4: */ -1, -1, 844bf215546Sopenharmony_ci /* 4.5 */ -1, -1, 845bf215546Sopenharmony_ci /* 5: */ -1, -1, 846bf215546Sopenharmony_ci /* 6: */ -1, -1, 847bf215546Sopenharmony_ci /* 7: */ -1, -1, 848bf215546Sopenharmony_ci /* 8: */ -1, -1, 849bf215546Sopenharmony_ci /* 12: */ 38, 36) 850bf215546Sopenharmony_ci/** @} */ 851bf215546Sopenharmony_ci 852bf215546Sopenharmony_ci/** 853bf215546Sopenharmony_ci * URB message function control bits: 854bf215546Sopenharmony_ci * @{ 855bf215546Sopenharmony_ci */ 856bf215546Sopenharmony_ciFF(urb_per_slot_offset, 857bf215546Sopenharmony_ci /* 4-6: */ -1, -1, -1, -1, -1, -1, -1, -1, 858bf215546Sopenharmony_ci /* 7: */ MD(16), MD(16), 859bf215546Sopenharmony_ci /* 8: */ MD(17), MD(17), 860bf215546Sopenharmony_ci /* 12: */ MD12(17), MD12(17)) 861bf215546Sopenharmony_ciFC(urb_channel_mask_present, /* 4+ */ MD(15), MD(15), /* 12+ */ MD12(15), MD12(15), devinfo->ver >= 8) 862bf215546Sopenharmony_ciFC(urb_complete, /* 4+ */ MD(15), MD(15), /* 12+ */ -1, -1, devinfo->ver < 8) 863bf215546Sopenharmony_ciFC(urb_used, /* 4+ */ MD(14), MD(14), /* 12+ */ -1, -1, devinfo->ver < 7) 864bf215546Sopenharmony_ciFC(urb_allocate, /* 4+ */ MD(13), MD(13), /* 12+ */ -1, -1, devinfo->ver < 7) 865bf215546Sopenharmony_ciFF(urb_swizzle_control, 866bf215546Sopenharmony_ci /* 4: */ MD(11), MD(10), 867bf215546Sopenharmony_ci /* 4.5: */ MD(11), MD(10), 868bf215546Sopenharmony_ci /* 5: */ MD(11), MD(10), 869bf215546Sopenharmony_ci /* 6: */ MD(11), MD(10), 870bf215546Sopenharmony_ci /* 7: */ MD(14), MD(14), 871bf215546Sopenharmony_ci /* 8: */ MD(15), MD(15), 872bf215546Sopenharmony_ci /* 12: */ -1, -1) 873bf215546Sopenharmony_ciFD(urb_global_offset, 874bf215546Sopenharmony_ci /* 4: */ MD( 9), MD(4), 875bf215546Sopenharmony_ci /* 4.5: */ MD( 9), MD(4), 876bf215546Sopenharmony_ci /* 5: */ MD( 9), MD(4), 877bf215546Sopenharmony_ci /* 6: */ MD( 9), MD(4), 878bf215546Sopenharmony_ci /* 7: */ MD(13), MD(3), 879bf215546Sopenharmony_ci /* 8: */ MD(14), MD(4), 880bf215546Sopenharmony_ci /* 12: */ MD12(14), MD12(11), MD12(10), MD12(4)) 881bf215546Sopenharmony_ciFF(urb_opcode, 882bf215546Sopenharmony_ci /* 4: */ MD( 3), MD(0), 883bf215546Sopenharmony_ci /* 4.5: */ MD( 3), MD(0), 884bf215546Sopenharmony_ci /* 5: */ MD( 3), MD(0), 885bf215546Sopenharmony_ci /* 6: */ MD( 3), MD(0), 886bf215546Sopenharmony_ci /* 7: */ MD( 2), MD(0), 887bf215546Sopenharmony_ci /* 8: */ MD( 3), MD(0), 888bf215546Sopenharmony_ci /* 12: */ MD12(3), MD12(0)) 889bf215546Sopenharmony_ci/** @} */ 890bf215546Sopenharmony_ci 891bf215546Sopenharmony_ci/** 892bf215546Sopenharmony_ci * Gfx4-5 math messages: 893bf215546Sopenharmony_ci * @{ 894bf215546Sopenharmony_ci */ 895bf215546Sopenharmony_ciFC(math_msg_data_type, /* 4+ */ MD(7), MD(7), /* 12+ */ -1, -1, devinfo->ver < 6) 896bf215546Sopenharmony_ciFC(math_msg_saturate, /* 4+ */ MD(6), MD(6), /* 12+ */ -1, -1, devinfo->ver < 6) 897bf215546Sopenharmony_ciFC(math_msg_precision, /* 4+ */ MD(5), MD(5), /* 12+ */ -1, -1, devinfo->ver < 6) 898bf215546Sopenharmony_ciFC(math_msg_signed_int, /* 4+ */ MD(4), MD(4), /* 12+ */ -1, -1, devinfo->ver < 6) 899bf215546Sopenharmony_ciFC(math_msg_function, /* 4+ */ MD(3), MD(0), /* 12+ */ -1, -1, devinfo->ver < 6) 900bf215546Sopenharmony_ci/** @} */ 901bf215546Sopenharmony_ci 902bf215546Sopenharmony_ci/** 903bf215546Sopenharmony_ci * Sampler message function control bits: 904bf215546Sopenharmony_ci * @{ 905bf215546Sopenharmony_ci */ 906bf215546Sopenharmony_ciFF(sampler_simd_mode, 907bf215546Sopenharmony_ci /* 4: doesn't exist */ -1, -1, -1, -1, 908bf215546Sopenharmony_ci /* 5: */ MD(17), MD(16), 909bf215546Sopenharmony_ci /* 6: */ MD(17), MD(16), 910bf215546Sopenharmony_ci /* 7: */ MD(18), MD(17), 911bf215546Sopenharmony_ci /* 8: */ MD(18), MD(17), 912bf215546Sopenharmony_ci /* 12: */ MD12(18), MD12(17)) 913bf215546Sopenharmony_ciFF(sampler_msg_type, 914bf215546Sopenharmony_ci /* 4: */ MD(15), MD(14), 915bf215546Sopenharmony_ci /* 4.5: */ MD(15), MD(12), 916bf215546Sopenharmony_ci /* 5: */ MD(15), MD(12), 917bf215546Sopenharmony_ci /* 6: */ MD(15), MD(12), 918bf215546Sopenharmony_ci /* 7: */ MD(16), MD(12), 919bf215546Sopenharmony_ci /* 8: */ MD(16), MD(12), 920bf215546Sopenharmony_ci /* 12: */ MD12(16), MD12(12)) 921bf215546Sopenharmony_ciFC(sampler_return_format, /* 4+ */ MD(13), MD(12), /* 12+ */ -1, -1, devinfo->verx10 == 40) 922bf215546Sopenharmony_ciFD(sampler, 923bf215546Sopenharmony_ci /* 4: */ MD(11), MD(8), 924bf215546Sopenharmony_ci /* 4.5: */ MD(11), MD(8), 925bf215546Sopenharmony_ci /* 5: */ MD(11), MD(8), 926bf215546Sopenharmony_ci /* 6: */ MD(11), MD(8), 927bf215546Sopenharmony_ci /* 7: */ MD(11), MD(8), 928bf215546Sopenharmony_ci /* 8: */ MD(11), MD(8), 929bf215546Sopenharmony_ci /* 12: */ MD12(11), MD12(11), MD12(10), MD12(8)) 930bf215546Sopenharmony_ciF(binding_table_index, /* 4+ */ MD(7), MD(0), /* 12+ */ MD12(7), MD12(0)) /* also used by other messages */ 931bf215546Sopenharmony_ci/** @} */ 932bf215546Sopenharmony_ci 933bf215546Sopenharmony_ci/** 934bf215546Sopenharmony_ci * Data port message function control bits: 935bf215546Sopenharmony_ci * @{ 936bf215546Sopenharmony_ci */ 937bf215546Sopenharmony_ciFC(dp_category, /* 4+ */ MD(18), MD(18), /* 12+ */ MD12(18), MD12(18), devinfo->ver >= 7) 938bf215546Sopenharmony_ci 939bf215546Sopenharmony_ci/* Gfx4-5 store fields in different bits for read/write messages. */ 940bf215546Sopenharmony_ciFF(dp_read_msg_type, 941bf215546Sopenharmony_ci /* 4: */ MD(13), MD(12), 942bf215546Sopenharmony_ci /* 4.5: */ MD(13), MD(11), 943bf215546Sopenharmony_ci /* 5: */ MD(13), MD(11), 944bf215546Sopenharmony_ci /* 6: */ MD(16), MD(13), 945bf215546Sopenharmony_ci /* 7: */ MD(17), MD(14), 946bf215546Sopenharmony_ci /* 8: */ MD(17), MD(14), 947bf215546Sopenharmony_ci /* 12: */ MD12(17), MD12(14)) 948bf215546Sopenharmony_ciFF(dp_write_msg_type, 949bf215546Sopenharmony_ci /* 4: */ MD(14), MD(12), 950bf215546Sopenharmony_ci /* 4.5: */ MD(14), MD(12), 951bf215546Sopenharmony_ci /* 5: */ MD(14), MD(12), 952bf215546Sopenharmony_ci /* 6: */ MD(16), MD(13), 953bf215546Sopenharmony_ci /* 7: */ MD(17), MD(14), 954bf215546Sopenharmony_ci /* 8: */ MD(17), MD(14), 955bf215546Sopenharmony_ci /* 12: */ MD12(17), MD12(14)) 956bf215546Sopenharmony_ciFD(dp_read_msg_control, 957bf215546Sopenharmony_ci /* 4: */ MD(11), MD( 8), 958bf215546Sopenharmony_ci /* 4.5: */ MD(10), MD( 8), 959bf215546Sopenharmony_ci /* 5: */ MD(10), MD( 8), 960bf215546Sopenharmony_ci /* 6: */ MD(12), MD( 8), 961bf215546Sopenharmony_ci /* 7: */ MD(13), MD( 8), 962bf215546Sopenharmony_ci /* 8: */ MD(13), MD( 8), 963bf215546Sopenharmony_ci /* 12: */ MD12(13), MD12(11), MD12(10), MD12(8)) 964bf215546Sopenharmony_ciFD(dp_write_msg_control, 965bf215546Sopenharmony_ci /* 4: */ MD(11), MD( 8), 966bf215546Sopenharmony_ci /* 4.5: */ MD(11), MD( 8), 967bf215546Sopenharmony_ci /* 5: */ MD(11), MD( 8), 968bf215546Sopenharmony_ci /* 6: */ MD(12), MD( 8), 969bf215546Sopenharmony_ci /* 7: */ MD(13), MD( 8), 970bf215546Sopenharmony_ci /* 8: */ MD(13), MD( 8), 971bf215546Sopenharmony_ci /* 12: */ MD12(13), MD12(11), MD12(10), MD12(8)) 972bf215546Sopenharmony_ciFC(dp_read_target_cache, /* 4+ */ MD(15), MD(14), /* 12+ */ -1, -1, devinfo->ver < 6); 973bf215546Sopenharmony_ci 974bf215546Sopenharmony_ciFF(dp_write_commit, 975bf215546Sopenharmony_ci /* 4: */ MD(15), MD(15), 976bf215546Sopenharmony_ci /* 4.5: */ MD(15), MD(15), 977bf215546Sopenharmony_ci /* 5: */ MD(15), MD(15), 978bf215546Sopenharmony_ci /* 6: */ MD(17), MD(17), 979bf215546Sopenharmony_ci /* 7+: does not exist */ -1, -1, -1, -1, 980bf215546Sopenharmony_ci /* 12: */ -1, -1) 981bf215546Sopenharmony_ci 982bf215546Sopenharmony_ci/* Gfx6+ use the same bit locations for everything. */ 983bf215546Sopenharmony_ciFF(dp_msg_type, 984bf215546Sopenharmony_ci /* 4-5: use dp_read_msg_type or dp_write_msg_type instead */ 985bf215546Sopenharmony_ci -1, -1, -1, -1, -1, -1, 986bf215546Sopenharmony_ci /* 6: */ MD(16), MD(13), 987bf215546Sopenharmony_ci /* 7: */ MD(17), MD(14), 988bf215546Sopenharmony_ci /* 8: */ MD(18), MD(14), 989bf215546Sopenharmony_ci /* 12: */ MD12(18), MD12(14)) 990bf215546Sopenharmony_ciFD(dp_msg_control, 991bf215546Sopenharmony_ci /* 4: */ MD(11), MD( 8), 992bf215546Sopenharmony_ci /* 4.5-5: use dp_read_msg_control or dp_write_msg_control */ -1, -1, -1, -1, 993bf215546Sopenharmony_ci /* 6: */ MD(12), MD( 8), 994bf215546Sopenharmony_ci /* 7: */ MD(13), MD( 8), 995bf215546Sopenharmony_ci /* 8: */ MD(13), MD( 8), 996bf215546Sopenharmony_ci /* 12: */ MD12(13), MD12(11), MD12(10), MD12(8)) 997bf215546Sopenharmony_ci/** @} */ 998bf215546Sopenharmony_ci 999bf215546Sopenharmony_ci/** 1000bf215546Sopenharmony_ci * Scratch message bits (Gfx7+): 1001bf215546Sopenharmony_ci * @{ 1002bf215546Sopenharmony_ci */ 1003bf215546Sopenharmony_ciFC(scratch_read_write, /* 4+ */ MD(17), MD(17), /* 12+ */ MD12(17), MD12(17), devinfo->ver >= 7) /* 0 = read, 1 = write */ 1004bf215546Sopenharmony_ciFC(scratch_type, /* 4+ */ MD(16), MD(16), /* 12+ */ -1, -1, devinfo->ver >= 7) /* 0 = OWord, 1 = DWord */ 1005bf215546Sopenharmony_ciFC(scratch_invalidate_after_read, /* 4+ */ MD(15), MD(15), /* 12+ */ MD12(15), MD12(15), devinfo->ver >= 7) 1006bf215546Sopenharmony_ciFC(scratch_block_size, /* 4+ */ MD(13), MD(12), /* 12+ */ MD12(13), MD12(12), devinfo->ver >= 7) 1007bf215546Sopenharmony_ciFD(scratch_addr_offset, 1008bf215546Sopenharmony_ci /* 4: */ -1, -1, 1009bf215546Sopenharmony_ci /* 4.5: */ -1, -1, 1010bf215546Sopenharmony_ci /* 5: */ -1, -1, 1011bf215546Sopenharmony_ci /* 6: */ -1, -1, 1012bf215546Sopenharmony_ci /* 7: */ MD(11), MD(0), 1013bf215546Sopenharmony_ci /* 8: */ MD(11), MD(0), 1014bf215546Sopenharmony_ci /* 12: */ MD12(11), MD12(11), MD12(10), MD12(0)) 1015bf215546Sopenharmony_ci/** @} */ 1016bf215546Sopenharmony_ci 1017bf215546Sopenharmony_ci/** 1018bf215546Sopenharmony_ci * Render Target message function control bits: 1019bf215546Sopenharmony_ci * @{ 1020bf215546Sopenharmony_ci */ 1021bf215546Sopenharmony_ciFF(rt_last, 1022bf215546Sopenharmony_ci /* 4: */ MD(11), MD(11), 1023bf215546Sopenharmony_ci /* 4.5: */ MD(11), MD(11), 1024bf215546Sopenharmony_ci /* 5: */ MD(11), MD(11), 1025bf215546Sopenharmony_ci /* 6: */ MD(12), MD(12), 1026bf215546Sopenharmony_ci /* 7: */ MD(12), MD(12), 1027bf215546Sopenharmony_ci /* 8: */ MD(12), MD(12), 1028bf215546Sopenharmony_ci /* 12: */ MD12(12), MD12(12)) 1029bf215546Sopenharmony_ciFC(rt_slot_group, /* 4+ */ MD(11), MD(11), /* 12+ */ MD12(11), MD12(11), devinfo->ver >= 6) 1030bf215546Sopenharmony_ciF(rt_message_type, /* 4+ */ MD(10), MD( 8), /* 12+ */ MD12(10), MD12(8)) 1031bf215546Sopenharmony_ci/** @} */ 1032bf215546Sopenharmony_ci 1033bf215546Sopenharmony_ci/** 1034bf215546Sopenharmony_ci * Thread Spawn message function control bits: 1035bf215546Sopenharmony_ci * @{ 1036bf215546Sopenharmony_ci */ 1037bf215546Sopenharmony_ciFC(ts_resource_select, /* 4+ */ MD( 4), MD( 4), /* 12+ */ -1, -1, devinfo->ver < 11) 1038bf215546Sopenharmony_ciFC(ts_request_type, /* 4+ */ MD( 1), MD( 1), /* 12+ */ -1, -1, devinfo->ver < 11) 1039bf215546Sopenharmony_ciF(ts_opcode, /* 4+ */ MD( 0), MD( 0), /* 12+ */ MD12(0), MD12(0)) 1040bf215546Sopenharmony_ci/** @} */ 1041bf215546Sopenharmony_ci 1042bf215546Sopenharmony_ci/** 1043bf215546Sopenharmony_ci * Pixel Interpolator message function control bits: 1044bf215546Sopenharmony_ci * @{ 1045bf215546Sopenharmony_ci */ 1046bf215546Sopenharmony_ciF(pi_simd_mode, /* 4+ */ MD(16), MD(16), /* 12+ */ MD12(16), MD12(16)) 1047bf215546Sopenharmony_ciF(pi_nopersp, /* 4+ */ MD(14), MD(14), /* 12+ */ MD12(14), MD12(14)) 1048bf215546Sopenharmony_ciF(pi_message_type, /* 4+ */ MD(13), MD(12), /* 12+ */ MD12(13), MD12(12)) 1049bf215546Sopenharmony_ciF(pi_slot_group, /* 4+ */ MD(11), MD(11), /* 12+ */ MD12(11), MD12(11)) 1050bf215546Sopenharmony_ciF(pi_message_data, /* 4+ */ MD(7), MD(0), /* 12+ */ MD12(7), MD12(0)) 1051bf215546Sopenharmony_ci/** @} */ 1052bf215546Sopenharmony_ci 1053bf215546Sopenharmony_ci/** 1054bf215546Sopenharmony_ci * Immediates: 1055bf215546Sopenharmony_ci * @{ 1056bf215546Sopenharmony_ci */ 1057bf215546Sopenharmony_cistatic inline int 1058bf215546Sopenharmony_cibrw_inst_imm_d(const struct intel_device_info *devinfo, const brw_inst *insn) 1059bf215546Sopenharmony_ci{ 1060bf215546Sopenharmony_ci (void) devinfo; 1061bf215546Sopenharmony_ci return brw_inst_bits(insn, 127, 96); 1062bf215546Sopenharmony_ci} 1063bf215546Sopenharmony_ci 1064bf215546Sopenharmony_cistatic inline unsigned 1065bf215546Sopenharmony_cibrw_inst_imm_ud(const struct intel_device_info *devinfo, const brw_inst *insn) 1066bf215546Sopenharmony_ci{ 1067bf215546Sopenharmony_ci (void) devinfo; 1068bf215546Sopenharmony_ci return brw_inst_bits(insn, 127, 96); 1069bf215546Sopenharmony_ci} 1070bf215546Sopenharmony_ci 1071bf215546Sopenharmony_cistatic inline uint64_t 1072bf215546Sopenharmony_cibrw_inst_imm_uq(ASSERTED const struct intel_device_info *devinfo, 1073bf215546Sopenharmony_ci const brw_inst *insn) 1074bf215546Sopenharmony_ci{ 1075bf215546Sopenharmony_ci assert(devinfo->ver >= 8); 1076bf215546Sopenharmony_ci return brw_inst_bits(insn, 127, 64); 1077bf215546Sopenharmony_ci} 1078bf215546Sopenharmony_ci 1079bf215546Sopenharmony_cistatic inline float 1080bf215546Sopenharmony_cibrw_inst_imm_f(const struct intel_device_info *devinfo, const brw_inst *insn) 1081bf215546Sopenharmony_ci{ 1082bf215546Sopenharmony_ci union { 1083bf215546Sopenharmony_ci float f; 1084bf215546Sopenharmony_ci uint32_t u; 1085bf215546Sopenharmony_ci } ft; 1086bf215546Sopenharmony_ci (void) devinfo; 1087bf215546Sopenharmony_ci ft.u = brw_inst_bits(insn, 127, 96); 1088bf215546Sopenharmony_ci return ft.f; 1089bf215546Sopenharmony_ci} 1090bf215546Sopenharmony_ci 1091bf215546Sopenharmony_cistatic inline double 1092bf215546Sopenharmony_cibrw_inst_imm_df(const struct intel_device_info *devinfo, const brw_inst *insn) 1093bf215546Sopenharmony_ci{ 1094bf215546Sopenharmony_ci union { 1095bf215546Sopenharmony_ci double d; 1096bf215546Sopenharmony_ci uint64_t u; 1097bf215546Sopenharmony_ci } dt; 1098bf215546Sopenharmony_ci (void) devinfo; 1099bf215546Sopenharmony_ci dt.u = brw_inst_bits(insn, 127, 64); 1100bf215546Sopenharmony_ci return dt.d; 1101bf215546Sopenharmony_ci} 1102bf215546Sopenharmony_ci 1103bf215546Sopenharmony_cistatic inline void 1104bf215546Sopenharmony_cibrw_inst_set_imm_d(const struct intel_device_info *devinfo, 1105bf215546Sopenharmony_ci brw_inst *insn, int value) 1106bf215546Sopenharmony_ci{ 1107bf215546Sopenharmony_ci (void) devinfo; 1108bf215546Sopenharmony_ci return brw_inst_set_bits(insn, 127, 96, value); 1109bf215546Sopenharmony_ci} 1110bf215546Sopenharmony_ci 1111bf215546Sopenharmony_cistatic inline void 1112bf215546Sopenharmony_cibrw_inst_set_imm_ud(const struct intel_device_info *devinfo, 1113bf215546Sopenharmony_ci brw_inst *insn, unsigned value) 1114bf215546Sopenharmony_ci{ 1115bf215546Sopenharmony_ci (void) devinfo; 1116bf215546Sopenharmony_ci return brw_inst_set_bits(insn, 127, 96, value); 1117bf215546Sopenharmony_ci} 1118bf215546Sopenharmony_ci 1119bf215546Sopenharmony_cistatic inline void 1120bf215546Sopenharmony_cibrw_inst_set_imm_f(const struct intel_device_info *devinfo, 1121bf215546Sopenharmony_ci brw_inst *insn, float value) 1122bf215546Sopenharmony_ci{ 1123bf215546Sopenharmony_ci union { 1124bf215546Sopenharmony_ci float f; 1125bf215546Sopenharmony_ci uint32_t u; 1126bf215546Sopenharmony_ci } ft; 1127bf215546Sopenharmony_ci (void) devinfo; 1128bf215546Sopenharmony_ci ft.f = value; 1129bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 96, ft.u); 1130bf215546Sopenharmony_ci} 1131bf215546Sopenharmony_ci 1132bf215546Sopenharmony_cistatic inline void 1133bf215546Sopenharmony_cibrw_inst_set_imm_df(const struct intel_device_info *devinfo, 1134bf215546Sopenharmony_ci brw_inst *insn, double value) 1135bf215546Sopenharmony_ci{ 1136bf215546Sopenharmony_ci union { 1137bf215546Sopenharmony_ci double d; 1138bf215546Sopenharmony_ci uint64_t u; 1139bf215546Sopenharmony_ci } dt; 1140bf215546Sopenharmony_ci (void) devinfo; 1141bf215546Sopenharmony_ci dt.d = value; 1142bf215546Sopenharmony_ci 1143bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 1144bf215546Sopenharmony_ci brw_inst_set_bits(insn, 95, 64, dt.u >> 32); 1145bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 96, dt.u & 0xFFFFFFFF); 1146bf215546Sopenharmony_ci } else { 1147bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 64, dt.u); 1148bf215546Sopenharmony_ci } 1149bf215546Sopenharmony_ci} 1150bf215546Sopenharmony_ci 1151bf215546Sopenharmony_cistatic inline void 1152bf215546Sopenharmony_cibrw_inst_set_imm_uq(const struct intel_device_info *devinfo, 1153bf215546Sopenharmony_ci brw_inst *insn, uint64_t value) 1154bf215546Sopenharmony_ci{ 1155bf215546Sopenharmony_ci (void) devinfo; 1156bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 1157bf215546Sopenharmony_ci brw_inst_set_bits(insn, 95, 64, value >> 32); 1158bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 96, value & 0xFFFFFFFF); 1159bf215546Sopenharmony_ci } else { 1160bf215546Sopenharmony_ci brw_inst_set_bits(insn, 127, 64, value); 1161bf215546Sopenharmony_ci } 1162bf215546Sopenharmony_ci} 1163bf215546Sopenharmony_ci 1164bf215546Sopenharmony_ci/** @} */ 1165bf215546Sopenharmony_ci 1166bf215546Sopenharmony_ci#define REG_TYPE(reg) \ 1167bf215546Sopenharmony_cistatic inline void \ 1168bf215546Sopenharmony_cibrw_inst_set_##reg##_file_type(const struct intel_device_info *devinfo, \ 1169bf215546Sopenharmony_ci brw_inst *inst, enum brw_reg_file file, \ 1170bf215546Sopenharmony_ci enum brw_reg_type type) \ 1171bf215546Sopenharmony_ci{ \ 1172bf215546Sopenharmony_ci assert(file <= BRW_IMMEDIATE_VALUE); \ 1173bf215546Sopenharmony_ci unsigned hw_type = brw_reg_type_to_hw_type(devinfo, file, type); \ 1174bf215546Sopenharmony_ci brw_inst_set_##reg##_reg_file(devinfo, inst, file); \ 1175bf215546Sopenharmony_ci brw_inst_set_##reg##_reg_hw_type(devinfo, inst, hw_type); \ 1176bf215546Sopenharmony_ci} \ 1177bf215546Sopenharmony_ci \ 1178bf215546Sopenharmony_cistatic inline enum brw_reg_type \ 1179bf215546Sopenharmony_cibrw_inst_##reg##_type(const struct intel_device_info *devinfo, \ 1180bf215546Sopenharmony_ci const brw_inst *inst) \ 1181bf215546Sopenharmony_ci{ \ 1182bf215546Sopenharmony_ci unsigned file = __builtin_strcmp("dst", #reg) == 0 ? \ 1183bf215546Sopenharmony_ci (unsigned) BRW_GENERAL_REGISTER_FILE : \ 1184bf215546Sopenharmony_ci brw_inst_##reg##_reg_file(devinfo, inst); \ 1185bf215546Sopenharmony_ci unsigned hw_type = brw_inst_##reg##_reg_hw_type(devinfo, inst); \ 1186bf215546Sopenharmony_ci return brw_hw_type_to_reg_type(devinfo, (enum brw_reg_file)file, hw_type); \ 1187bf215546Sopenharmony_ci} 1188bf215546Sopenharmony_ci 1189bf215546Sopenharmony_ciREG_TYPE(dst) 1190bf215546Sopenharmony_ciREG_TYPE(src0) 1191bf215546Sopenharmony_ciREG_TYPE(src1) 1192bf215546Sopenharmony_ci#undef REG_TYPE 1193bf215546Sopenharmony_ci 1194bf215546Sopenharmony_ci 1195bf215546Sopenharmony_ci/* The AddrImm fields are split into two discontiguous sections on Gfx8+ */ 1196bf215546Sopenharmony_ci#define BRW_IA1_ADDR_IMM(reg, g4_high, g4_low, g8_nine, g8_high, g8_low, \ 1197bf215546Sopenharmony_ci g12_high, g12_low) \ 1198bf215546Sopenharmony_cistatic inline void \ 1199bf215546Sopenharmony_cibrw_inst_set_##reg##_ia1_addr_imm(const struct \ 1200bf215546Sopenharmony_ci intel_device_info *devinfo, \ 1201bf215546Sopenharmony_ci brw_inst *inst, \ 1202bf215546Sopenharmony_ci unsigned value) \ 1203bf215546Sopenharmony_ci{ \ 1204bf215546Sopenharmony_ci assert((value & ~0x3ff) == 0); \ 1205bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 1206bf215546Sopenharmony_ci brw_inst_set_bits(inst, g12_high, g12_low, value); \ 1207bf215546Sopenharmony_ci } else if (devinfo->ver >= 8) { \ 1208bf215546Sopenharmony_ci brw_inst_set_bits(inst, g8_high, g8_low, value & 0x1ff); \ 1209bf215546Sopenharmony_ci brw_inst_set_bits(inst, g8_nine, g8_nine, value >> 9); \ 1210bf215546Sopenharmony_ci } else { \ 1211bf215546Sopenharmony_ci brw_inst_set_bits(inst, g4_high, g4_low, value); \ 1212bf215546Sopenharmony_ci } \ 1213bf215546Sopenharmony_ci} \ 1214bf215546Sopenharmony_cistatic inline unsigned \ 1215bf215546Sopenharmony_cibrw_inst_##reg##_ia1_addr_imm(const struct intel_device_info *devinfo, \ 1216bf215546Sopenharmony_ci const brw_inst *inst) \ 1217bf215546Sopenharmony_ci{ \ 1218bf215546Sopenharmony_ci if (devinfo->ver >= 12) { \ 1219bf215546Sopenharmony_ci return brw_inst_bits(inst, g12_high, g12_low); \ 1220bf215546Sopenharmony_ci } else if (devinfo->ver >= 8) { \ 1221bf215546Sopenharmony_ci return brw_inst_bits(inst, g8_high, g8_low) | \ 1222bf215546Sopenharmony_ci (brw_inst_bits(inst, g8_nine, g8_nine) << 9); \ 1223bf215546Sopenharmony_ci } else { \ 1224bf215546Sopenharmony_ci return brw_inst_bits(inst, g4_high, g4_low); \ 1225bf215546Sopenharmony_ci } \ 1226bf215546Sopenharmony_ci} 1227bf215546Sopenharmony_ci 1228bf215546Sopenharmony_ci/* AddrImm[9:0] for Align1 Indirect Addressing */ 1229bf215546Sopenharmony_ci/* -Gen 4- ----Gfx8---- -Gfx12- */ 1230bf215546Sopenharmony_ciBRW_IA1_ADDR_IMM(src1, 105, 96, 121, 104, 96, 107, 98) 1231bf215546Sopenharmony_ciBRW_IA1_ADDR_IMM(src0, 73, 64, 95, 72, 64, 75, 66) 1232bf215546Sopenharmony_ciBRW_IA1_ADDR_IMM(dst, 57, 48, 47, 56, 48, 59, 50) 1233bf215546Sopenharmony_ci 1234bf215546Sopenharmony_ci#define BRW_IA16_ADDR_IMM(reg, g4_high, g4_low, g8_nine, g8_high, g8_low) \ 1235bf215546Sopenharmony_cistatic inline void \ 1236bf215546Sopenharmony_cibrw_inst_set_##reg##_ia16_addr_imm(const struct \ 1237bf215546Sopenharmony_ci intel_device_info *devinfo, \ 1238bf215546Sopenharmony_ci brw_inst *inst, unsigned value) \ 1239bf215546Sopenharmony_ci{ \ 1240bf215546Sopenharmony_ci assert(devinfo->ver < 12); \ 1241bf215546Sopenharmony_ci assert((value & ~0x3ff) == 0); \ 1242bf215546Sopenharmony_ci if (devinfo->ver >= 8) { \ 1243bf215546Sopenharmony_ci assert(GET_BITS(value, 3, 0) == 0); \ 1244bf215546Sopenharmony_ci brw_inst_set_bits(inst, g8_high, g8_low, GET_BITS(value, 8, 4)); \ 1245bf215546Sopenharmony_ci brw_inst_set_bits(inst, g8_nine, g8_nine, GET_BITS(value, 9, 9)); \ 1246bf215546Sopenharmony_ci } else { \ 1247bf215546Sopenharmony_ci brw_inst_set_bits(inst, g4_high, g4_low, value); \ 1248bf215546Sopenharmony_ci } \ 1249bf215546Sopenharmony_ci} \ 1250bf215546Sopenharmony_cistatic inline unsigned \ 1251bf215546Sopenharmony_cibrw_inst_##reg##_ia16_addr_imm(const struct intel_device_info *devinfo, \ 1252bf215546Sopenharmony_ci const brw_inst *inst) \ 1253bf215546Sopenharmony_ci{ \ 1254bf215546Sopenharmony_ci assert(devinfo->ver < 12); \ 1255bf215546Sopenharmony_ci if (devinfo->ver >= 8) { \ 1256bf215546Sopenharmony_ci return (brw_inst_bits(inst, g8_high, g8_low) << 4) | \ 1257bf215546Sopenharmony_ci (brw_inst_bits(inst, g8_nine, g8_nine) << 9); \ 1258bf215546Sopenharmony_ci } else { \ 1259bf215546Sopenharmony_ci return brw_inst_bits(inst, g4_high, g4_low); \ 1260bf215546Sopenharmony_ci } \ 1261bf215546Sopenharmony_ci} 1262bf215546Sopenharmony_ci 1263bf215546Sopenharmony_ci/* AddrImm[9:0] for Align16 Indirect Addressing: 1264bf215546Sopenharmony_ci * Compared to Align1, these are missing the low 4 bits. 1265bf215546Sopenharmony_ci * -Gen 4- ----Gfx8---- 1266bf215546Sopenharmony_ci */ 1267bf215546Sopenharmony_ciBRW_IA16_ADDR_IMM(src1, 105, 96, 121, 104, 100) 1268bf215546Sopenharmony_ciBRW_IA16_ADDR_IMM(src0, 73, 64, 95, 72, 68) 1269bf215546Sopenharmony_ciBRW_IA16_ADDR_IMM(dst, 57, 52, 47, 56, 52) 1270bf215546Sopenharmony_ciBRW_IA16_ADDR_IMM(send_src0, -1, -1, 78, 72, 68) 1271bf215546Sopenharmony_ciBRW_IA16_ADDR_IMM(send_dst, -1, -1, 62, 56, 52) 1272bf215546Sopenharmony_ci 1273bf215546Sopenharmony_ci/** 1274bf215546Sopenharmony_ci * Fetch a set of contiguous bits from the instruction. 1275bf215546Sopenharmony_ci * 1276bf215546Sopenharmony_ci * Bits indices range from 0..127; fields may not cross 64-bit boundaries. 1277bf215546Sopenharmony_ci */ 1278bf215546Sopenharmony_cistatic inline uint64_t 1279bf215546Sopenharmony_cibrw_inst_bits(const brw_inst *inst, unsigned high, unsigned low) 1280bf215546Sopenharmony_ci{ 1281bf215546Sopenharmony_ci assume(high < 128); 1282bf215546Sopenharmony_ci assume(high >= low); 1283bf215546Sopenharmony_ci /* We assume the field doesn't cross 64-bit boundaries. */ 1284bf215546Sopenharmony_ci const unsigned word = high / 64; 1285bf215546Sopenharmony_ci assert(word == low / 64); 1286bf215546Sopenharmony_ci 1287bf215546Sopenharmony_ci high %= 64; 1288bf215546Sopenharmony_ci low %= 64; 1289bf215546Sopenharmony_ci 1290bf215546Sopenharmony_ci const uint64_t mask = (~0ull >> (64 - (high - low + 1))); 1291bf215546Sopenharmony_ci 1292bf215546Sopenharmony_ci return (inst->data[word] >> low) & mask; 1293bf215546Sopenharmony_ci} 1294bf215546Sopenharmony_ci 1295bf215546Sopenharmony_ci/** 1296bf215546Sopenharmony_ci * Set bits in the instruction, with proper shifting and masking. 1297bf215546Sopenharmony_ci * 1298bf215546Sopenharmony_ci * Bits indices range from 0..127; fields may not cross 64-bit boundaries. 1299bf215546Sopenharmony_ci */ 1300bf215546Sopenharmony_cistatic inline void 1301bf215546Sopenharmony_cibrw_inst_set_bits(brw_inst *inst, unsigned high, unsigned low, uint64_t value) 1302bf215546Sopenharmony_ci{ 1303bf215546Sopenharmony_ci assume(high < 128); 1304bf215546Sopenharmony_ci assume(high >= low); 1305bf215546Sopenharmony_ci const unsigned word = high / 64; 1306bf215546Sopenharmony_ci assert(word == low / 64); 1307bf215546Sopenharmony_ci 1308bf215546Sopenharmony_ci high %= 64; 1309bf215546Sopenharmony_ci low %= 64; 1310bf215546Sopenharmony_ci 1311bf215546Sopenharmony_ci const uint64_t mask = (~0ull >> (64 - (high - low + 1))) << low; 1312bf215546Sopenharmony_ci 1313bf215546Sopenharmony_ci /* Make sure the supplied value actually fits in the given bitfield. */ 1314bf215546Sopenharmony_ci assert((value & (mask >> low)) == value); 1315bf215546Sopenharmony_ci 1316bf215546Sopenharmony_ci inst->data[word] = (inst->data[word] & ~mask) | (value << low); 1317bf215546Sopenharmony_ci} 1318bf215546Sopenharmony_ci 1319bf215546Sopenharmony_ci#undef BRW_IA16_ADDR_IMM 1320bf215546Sopenharmony_ci#undef BRW_IA1_ADDR_IMM 1321bf215546Sopenharmony_ci#undef MD 1322bf215546Sopenharmony_ci#undef F8 1323bf215546Sopenharmony_ci#undef FF 1324bf215546Sopenharmony_ci#undef BOUNDS 1325bf215546Sopenharmony_ci#undef F 1326bf215546Sopenharmony_ci#undef FC 1327bf215546Sopenharmony_ci 1328bf215546Sopenharmony_citypedef struct { 1329bf215546Sopenharmony_ci uint64_t data; 1330bf215546Sopenharmony_ci} brw_compact_inst; 1331bf215546Sopenharmony_ci 1332bf215546Sopenharmony_ci/** 1333bf215546Sopenharmony_ci * Fetch a set of contiguous bits from the compacted instruction. 1334bf215546Sopenharmony_ci * 1335bf215546Sopenharmony_ci * Bits indices range from 0..63. 1336bf215546Sopenharmony_ci */ 1337bf215546Sopenharmony_cistatic inline unsigned 1338bf215546Sopenharmony_cibrw_compact_inst_bits(const brw_compact_inst *inst, unsigned high, unsigned low) 1339bf215546Sopenharmony_ci{ 1340bf215546Sopenharmony_ci const uint64_t mask = (1ull << (high - low + 1)) - 1; 1341bf215546Sopenharmony_ci 1342bf215546Sopenharmony_ci return (inst->data >> low) & mask; 1343bf215546Sopenharmony_ci} 1344bf215546Sopenharmony_ci 1345bf215546Sopenharmony_ci/** 1346bf215546Sopenharmony_ci * Set bits in the compacted instruction. 1347bf215546Sopenharmony_ci * 1348bf215546Sopenharmony_ci * Bits indices range from 0..63. 1349bf215546Sopenharmony_ci */ 1350bf215546Sopenharmony_cistatic inline void 1351bf215546Sopenharmony_cibrw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low, 1352bf215546Sopenharmony_ci uint64_t value) 1353bf215546Sopenharmony_ci{ 1354bf215546Sopenharmony_ci const uint64_t mask = ((1ull << (high - low + 1)) - 1) << low; 1355bf215546Sopenharmony_ci 1356bf215546Sopenharmony_ci /* Make sure the supplied value actually fits in the given bitfield. */ 1357bf215546Sopenharmony_ci assert((value & (mask >> low)) == value); 1358bf215546Sopenharmony_ci 1359bf215546Sopenharmony_ci inst->data = (inst->data & ~mask) | (value << low); 1360bf215546Sopenharmony_ci} 1361bf215546Sopenharmony_ci 1362bf215546Sopenharmony_ci#define FC(name, high, low, gfx12_high, gfx12_low, assertions) \ 1363bf215546Sopenharmony_cistatic inline void \ 1364bf215546Sopenharmony_cibrw_compact_inst_set_##name(const struct \ 1365bf215546Sopenharmony_ci intel_device_info *devinfo, \ 1366bf215546Sopenharmony_ci brw_compact_inst *inst, unsigned v) \ 1367bf215546Sopenharmony_ci{ \ 1368bf215546Sopenharmony_ci assert(assertions); \ 1369bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 1370bf215546Sopenharmony_ci brw_compact_inst_set_bits(inst, gfx12_high, gfx12_low, v); \ 1371bf215546Sopenharmony_ci else \ 1372bf215546Sopenharmony_ci brw_compact_inst_set_bits(inst, high, low, v); \ 1373bf215546Sopenharmony_ci} \ 1374bf215546Sopenharmony_cistatic inline unsigned \ 1375bf215546Sopenharmony_cibrw_compact_inst_##name(const struct intel_device_info *devinfo, \ 1376bf215546Sopenharmony_ci const brw_compact_inst *inst) \ 1377bf215546Sopenharmony_ci{ \ 1378bf215546Sopenharmony_ci assert(assertions); \ 1379bf215546Sopenharmony_ci if (devinfo->ver >= 12) \ 1380bf215546Sopenharmony_ci return brw_compact_inst_bits(inst, gfx12_high, gfx12_low); \ 1381bf215546Sopenharmony_ci else \ 1382bf215546Sopenharmony_ci return brw_compact_inst_bits(inst, high, low); \ 1383bf215546Sopenharmony_ci} 1384bf215546Sopenharmony_ci 1385bf215546Sopenharmony_ci/* A simple macro for fields which stay in the same place on all generations 1386bf215546Sopenharmony_ci * except for Gfx12. 1387bf215546Sopenharmony_ci */ 1388bf215546Sopenharmony_ci#define F(name, high, low, gfx12_high, gfx12_low) \ 1389bf215546Sopenharmony_ci FC(name, high, low, gfx12_high, gfx12_low, true) 1390bf215546Sopenharmony_ci 1391bf215546Sopenharmony_ciF(src1_reg_nr, /* 4+ */ 63, 56, /* 12+ */ 63, 56) 1392bf215546Sopenharmony_ciF(src0_reg_nr, /* 4+ */ 55, 48, /* 12+ */ 47, 40) 1393bf215546Sopenharmony_ciF(dst_reg_nr, /* 4+ */ 47, 40, /* 12+ */ 23, 16) 1394bf215546Sopenharmony_ciF(src1_index, /* 4+ */ 39, 35, /* 12+ */ 55, 52) 1395bf215546Sopenharmony_ciF(src0_index, /* 4+ */ 34, 30, /* 12+ */ 51, 48) 1396bf215546Sopenharmony_ciF(cmpt_control, /* 4+ */ 29, 29, /* 12+ */ 29, 29) /* Same location as brw_inst */ 1397bf215546Sopenharmony_ciFC(flag_subreg_nr, /* 4+ */ 28, 28, /* 12+ */ -1, -1, devinfo->ver <= 6) 1398bf215546Sopenharmony_ciF(cond_modifier, /* 4+ */ 27, 24, /* 12+ */ -1, -1) /* Same location as brw_inst */ 1399bf215546Sopenharmony_ciFC(acc_wr_control, /* 4+ */ 23, 23, /* 12+ */ -1, -1, devinfo->ver >= 6) 1400bf215546Sopenharmony_ciFC(mask_control_ex, /* 4+ */ 23, 23, /* 12+ */ -1, -1, devinfo->verx10 == 45 || devinfo->ver == 5) 1401bf215546Sopenharmony_ciF(subreg_index, /* 4+ */ 22, 18, /* 12+ */ 39, 35) 1402bf215546Sopenharmony_ciF(datatype_index, /* 4+ */ 17, 13, /* 12+ */ 34, 30) 1403bf215546Sopenharmony_ciF(control_index, /* 4+ */ 12, 8, /* 12+ */ 28, 24) 1404bf215546Sopenharmony_ciFC(swsb, /* 4+ */ -1, -1, /* 12+ */ 15, 8, devinfo->ver >= 12) 1405bf215546Sopenharmony_ciF(debug_control, /* 4+ */ 7, 7, /* 12+ */ 7, 7) 1406bf215546Sopenharmony_ciF(hw_opcode, /* 4+ */ 6, 0, /* 12+ */ 6, 0) /* Same location as brw_inst */ 1407bf215546Sopenharmony_ci 1408bf215546Sopenharmony_cistatic inline unsigned 1409bf215546Sopenharmony_cibrw_compact_inst_imm(const struct intel_device_info *devinfo, 1410bf215546Sopenharmony_ci const brw_compact_inst *inst) 1411bf215546Sopenharmony_ci{ 1412bf215546Sopenharmony_ci if (devinfo->ver >= 12) { 1413bf215546Sopenharmony_ci return brw_compact_inst_bits(inst, 63, 52); 1414bf215546Sopenharmony_ci } else { 1415bf215546Sopenharmony_ci return (brw_compact_inst_bits(inst, 39, 35) << 8) | 1416bf215546Sopenharmony_ci (brw_compact_inst_bits(inst, 63, 56)); 1417bf215546Sopenharmony_ci } 1418bf215546Sopenharmony_ci} 1419bf215546Sopenharmony_ci 1420bf215546Sopenharmony_ci/** 1421bf215546Sopenharmony_ci * (Gfx8+) Compacted three-source instructions: 1422bf215546Sopenharmony_ci * @{ 1423bf215546Sopenharmony_ci */ 1424bf215546Sopenharmony_ciFC(3src_src2_reg_nr, /* 4+ */ 63, 57, /* 12+ */ 55, 48, devinfo->ver >= 8) 1425bf215546Sopenharmony_ciFC(3src_src1_reg_nr, /* 4+ */ 56, 50, /* 12+ */ 63, 56, devinfo->ver >= 8) 1426bf215546Sopenharmony_ciFC(3src_src0_reg_nr, /* 4+ */ 49, 43, /* 12+ */ 47, 40, devinfo->ver >= 8) 1427bf215546Sopenharmony_ciFC(3src_src2_subreg_nr, /* 4+ */ 42, 40, /* 12+ */ -1, -1, devinfo->ver >= 8) 1428bf215546Sopenharmony_ciFC(3src_src1_subreg_nr, /* 4+ */ 39, 37, /* 12+ */ -1, -1, devinfo->ver >= 8) 1429bf215546Sopenharmony_ciFC(3src_src0_subreg_nr, /* 4+ */ 36, 34, /* 12+ */ -1, -1, devinfo->ver >= 8) 1430bf215546Sopenharmony_ciFC(3src_src2_rep_ctrl, /* 4+ */ 33, 33, /* 12+ */ -1, -1, devinfo->ver >= 8) 1431bf215546Sopenharmony_ciFC(3src_src1_rep_ctrl, /* 4+ */ 32, 32, /* 12+ */ -1, -1, devinfo->ver >= 8) 1432bf215546Sopenharmony_ciFC(3src_saturate, /* 4+ */ 31, 31, /* 12+ */ -1, -1, devinfo->ver >= 8) 1433bf215546Sopenharmony_ciFC(3src_debug_control, /* 4+ */ 30, 30, /* 12+ */ 7, 7, devinfo->ver >= 8) 1434bf215546Sopenharmony_ciFC(3src_cmpt_control, /* 4+ */ 29, 29, /* 12+ */ 29, 29, devinfo->ver >= 8) 1435bf215546Sopenharmony_ciFC(3src_src0_rep_ctrl, /* 4+ */ 28, 28, /* 12+ */ -1, -1, devinfo->ver >= 8) 1436bf215546Sopenharmony_ci/* Reserved */ 1437bf215546Sopenharmony_ciFC(3src_dst_reg_nr, /* 4+ */ 18, 12, /* 12+ */ 23, 16, devinfo->ver >= 8) 1438bf215546Sopenharmony_ciFC(3src_source_index, /* 4+ */ 11, 10, /* 12+ */ 34, 30, devinfo->ver >= 8) 1439bf215546Sopenharmony_ciFC(3src_subreg_index, /* 4+ */ -1, -1, /* 12+ */ 39, 35, devinfo->ver >= 12) 1440bf215546Sopenharmony_ciFC(3src_control_index, /* 4+ */ 9, 8, /* 12+ */ 28, 24, devinfo->ver >= 8) 1441bf215546Sopenharmony_ciFC(3src_swsb, /* 4+ */ -1, -1, /* 12+ */ 15, 8, devinfo->ver >= 8) 1442bf215546Sopenharmony_ci/* Bit 7 is Reserved (for future Opcode expansion) */ 1443bf215546Sopenharmony_ciFC(3src_hw_opcode, /* 4+ */ 6, 0, /* 12+ */ 6, 0, devinfo->ver >= 8) 1444bf215546Sopenharmony_ci/** @} */ 1445bf215546Sopenharmony_ci 1446bf215546Sopenharmony_ci#undef F 1447bf215546Sopenharmony_ci 1448bf215546Sopenharmony_cistatic inline void 1449bf215546Sopenharmony_cibrw_inst_set_opcode(const struct brw_isa_info *isa, 1450bf215546Sopenharmony_ci struct brw_inst *inst, enum opcode opcode) 1451bf215546Sopenharmony_ci{ 1452bf215546Sopenharmony_ci brw_inst_set_hw_opcode(isa->devinfo, inst, brw_opcode_encode(isa, opcode)); 1453bf215546Sopenharmony_ci} 1454bf215546Sopenharmony_ci 1455bf215546Sopenharmony_cistatic inline enum opcode 1456bf215546Sopenharmony_cibrw_inst_opcode(const struct brw_isa_info *isa, 1457bf215546Sopenharmony_ci const struct brw_inst *inst) 1458bf215546Sopenharmony_ci{ 1459bf215546Sopenharmony_ci return brw_opcode_decode(isa, brw_inst_hw_opcode(isa->devinfo, inst)); 1460bf215546Sopenharmony_ci} 1461bf215546Sopenharmony_ci 1462bf215546Sopenharmony_ci#ifdef __cplusplus 1463bf215546Sopenharmony_ci} 1464bf215546Sopenharmony_ci#endif 1465bf215546Sopenharmony_ci 1466bf215546Sopenharmony_ci#endif 1467