diff --git a/src/intel/compiler/gen/gen_encoding.cpp b/src/intel/compiler/gen/gen_encoding.cpp index 8451e6856b5..c257843ad67 100644 --- a/src/intel/compiler/gen/gen_encoding.cpp +++ b/src/intel/compiler/gen/gen_encoding.cpp @@ -13,6 +13,8 @@ #include "gen_private.h" +#include "gen_info_util.h" + enum { GEN_SYSTOLIC_DEPTH_16 = 0, GEN_SYSTOLIC_DEPTH_2 = 1, @@ -165,39 +167,12 @@ gen_inst_is_unordered(const intel_device_info *devinfo, inst_has_type(devinfo, inst, GEN_TYPE_DF)); } -enum gen_encoding_type { - GEN_ENCODING_XE, - GEN_ENCODING_XE2, -}; - -#define FIELD(name, high, low) \ - static constexpr gen_range name = { .hi = high, .lo = low }; - -#define SUB_FIELD(name, high, low) \ - static constexpr gen_sub_range name = { .hi = high, .lo = low }; - /* Provide some clue in the compiler error if this gets used wrongly. */ struct gen_invalid_range {}; #define DELETE_FIELD(name) \ static constexpr gen_invalid_range name = {}; -struct gen_inst_description { - gen_opcode gen_op = GEN_OP_ILLEGAL; - gen_format format = GEN_FORMAT_ILLEGAL; - unsigned hw_opcode = 0; - bool has_dst = false; - - constexpr gen_inst_description() = default; - - constexpr gen_inst_description(gen_opcode op, unsigned hw) - : gen_op(op), - format(gen_inst_format(op)), - hw_opcode(hw), - has_dst(gen_inst_has_dst(format, op)) - {} -}; - static constexpr std::array gen_sort_by_hw_opcode(const std::array &table) { std::array r; diff --git a/src/intel/compiler/gen/gen_encoding_pre_xe.cpp b/src/intel/compiler/gen/gen_encoding_pre_xe.cpp index cf276403e5a..256cdbaa8f4 100644 --- a/src/intel/compiler/gen/gen_encoding_pre_xe.cpp +++ b/src/intel/compiler/gen/gen_encoding_pre_xe.cpp @@ -9,6 +9,8 @@ #include "gen_private.h" +#include "gen_info_util.h" + #define WIDTH(width) (1 << (width)) inline unsigned @@ -29,12 +31,6 @@ DECODE_VSTRIDE(unsigned raw_value) return STRIDE(raw_value); } -#define FIELD(name, high, low) \ - static constexpr gen_range name = { .hi = high, .lo = low }; - -#define SUB_FIELD(name, high, low) \ - static constexpr gen_sub_range name = { .hi = high, .lo = low }; - FIELD(HW_OPCODE, 6, 0); FIELD(CONTROLS, 31, 8); FIELD(OPERAND_CONTROLS, 63, 32); @@ -215,23 +211,6 @@ SUB_FIELD(CONTROLS_A, 15, 0); SUB_FIELD(COND_MODIFIER, 19, 16); SUB_FIELD(CONTROLS_B, 23, 20); - -struct gen_inst_description { - gen_opcode gen_op = GEN_OP_ILLEGAL; - gen_format format = GEN_FORMAT_ILLEGAL; - unsigned hw_opcode = 0; - bool has_dst = false; - - constexpr gen_inst_description() = default; - - constexpr gen_inst_description(gen_opcode op, unsigned hw) - : gen_op(op), - format(gen_inst_format(op)), - hw_opcode(hw), - has_dst(gen_inst_has_dst(format, op)) - {} -}; - static constexpr std::array gen_to_description = []() constexpr { std::array r; r[GEN_OP_ILLEGAL] = gen_inst_description(GEN_OP_ILLEGAL, 0); diff --git a/src/intel/compiler/gen/gen_info_util.h b/src/intel/compiler/gen/gen_info_util.h new file mode 100644 index 00000000000..21d73a14e1d --- /dev/null +++ b/src/intel/compiler/gen/gen_info_util.h @@ -0,0 +1,44 @@ +/* + * Copyright © 2026 Intel Corporation + * SPDX-License-Identifier: MIT + * + * Autogenerated file, do not edit! + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +enum gen_encoding_type { + GEN_ENCODING_PRE_XE, + GEN_ENCODING_XE, + GEN_ENCODING_XE2, +}; + +#define FIELD(name, high, low) \ + static constexpr gen_range name = { .hi = high, .lo = low }; + +#define SUB_FIELD(name, high, low) \ + static constexpr gen_sub_range name = { .hi = high, .lo = low }; + +struct gen_inst_description { + gen_opcode gen_op = GEN_OP_ILLEGAL; + gen_format format = GEN_FORMAT_ILLEGAL; + uint8_t hw_opcode = 0; + bool has_dst = false; + + constexpr gen_inst_description() = default; + + constexpr gen_inst_description(gen_opcode op, unsigned hw) + : gen_op(op), + format(gen_inst_format(op)), + hw_opcode(hw), + has_dst(gen_inst_has_dst(format, op)) + {} +}; + +#ifdef __cplusplus +} +#endif diff --git a/src/intel/compiler/gen/meson.build b/src/intel/compiler/gen/meson.build index 96cddf0f13d..5f00f16b299 100644 --- a/src/intel/compiler/gen/meson.build +++ b/src/intel/compiler/gen/meson.build @@ -7,6 +7,7 @@ libintel_compiler_gen_files = files( 'gen_types.h', 'gen_helpers.h', 'gen_names.h', + 'gen_info_util.h', 'gen_private.h',