X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fbrw_inst.h;h=d98bbf538a82ffd0bf2f9ecc5a19d8f32928f288;hb=be095e11e41158f91bcb3f6fcbc2e2a91a5d9124;hp=4ed95c473cd9fe2d6a6d76736729f686ed05059e;hpb=fed60e3c73c7be7c1e2194054daf29381d0ddc18;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h index 4ed95c473cd..d98bbf538a8 100644 --- a/src/mesa/drivers/dri/i965/brw_inst.h +++ b/src/mesa/drivers/dri/i965/brw_inst.h @@ -39,15 +39,6 @@ extern "C" { #endif -/** Maximum SEND message length */ -#define BRW_MAX_MSG_LENGTH 15 - -/** First MRF register used by pull loads */ -#define FIRST_SPILL_MRF(gen) ((gen) == 6 ? 21 : 13) - -/** First MRF register used by spills */ -#define FIRST_PULL_LOAD_MRF(gen) ((gen) == 6 ? 16 : 13) - /* brw_context.h has a forward declaration of brw_inst, so name the struct. */ typedef struct brw_inst { uint64_t data[2]; @@ -61,7 +52,7 @@ static inline void brw_inst_set_bits(brw_inst *inst, #define FC(name, high, low, assertions) \ static inline void \ -brw_inst_set_##name(const struct brw_device_info *devinfo, \ +brw_inst_set_##name(const struct gen_device_info *devinfo, \ brw_inst *inst, uint64_t v) \ { \ assert(assertions); \ @@ -69,7 +60,7 @@ brw_inst_set_##name(const struct brw_device_info *devinfo, \ brw_inst_set_bits(inst, high, low, v); \ } \ static inline uint64_t \ -brw_inst_##name(const struct brw_device_info *devinfo, \ +brw_inst_##name(const struct gen_device_info *devinfo, \ const brw_inst *inst) \ { \ assert(assertions); \ @@ -103,14 +94,14 @@ brw_inst_##name(const struct brw_device_info *devinfo, \ */ #define FF(name, hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, hi7, lo7, hi8, lo8)\ static inline void \ -brw_inst_set_##name(const struct brw_device_info *devinfo, \ +brw_inst_set_##name(const struct gen_device_info *devinfo, \ brw_inst *inst, uint64_t value) \ { \ BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, hi7, lo7, hi8, lo8) \ brw_inst_set_bits(inst, high, low, value); \ } \ static inline uint64_t \ -brw_inst_##name(const struct brw_device_info *devinfo, const brw_inst *inst) \ +brw_inst_##name(const struct gen_device_info *devinfo, const brw_inst *inst) \ { \ BOUNDS(hi4, lo4, hi45, lo45, hi5, lo5, hi6, lo6, hi7, lo7, hi8, lo8) \ return brw_inst_bits(inst, high, low); \ @@ -257,7 +248,7 @@ F(3src_opcode, 6, 0) * @{ */ static inline void -brw_inst_set_uip(const struct brw_device_info *devinfo, +brw_inst_set_uip(const struct gen_device_info *devinfo, brw_inst *inst, int32_t value) { assert(devinfo->gen >= 6); @@ -272,7 +263,7 @@ brw_inst_set_uip(const struct brw_device_info *devinfo, } static inline int32_t -brw_inst_uip(const struct brw_device_info *devinfo, const brw_inst *inst) +brw_inst_uip(const struct gen_device_info *devinfo, const brw_inst *inst) { assert(devinfo->gen >= 6); @@ -284,7 +275,7 @@ brw_inst_uip(const struct brw_device_info *devinfo, const brw_inst *inst) } static inline void -brw_inst_set_jip(const struct brw_device_info *devinfo, +brw_inst_set_jip(const struct gen_device_info *devinfo, brw_inst *inst, int32_t value) { assert(devinfo->gen >= 6); @@ -299,7 +290,7 @@ brw_inst_set_jip(const struct brw_device_info *devinfo, } static inline int32_t -brw_inst_jip(const struct brw_device_info *devinfo, const brw_inst *inst) +brw_inst_jip(const struct gen_device_info *devinfo, const brw_inst *inst) { assert(devinfo->gen >= 6); @@ -313,14 +304,14 @@ brw_inst_jip(const struct brw_device_info *devinfo, const brw_inst *inst) /** Like FC, but using int16_t to handle negative jump targets. */ #define FJ(name, high, low, assertions) \ static inline void \ -brw_inst_set_##name(const struct brw_device_info *devinfo, brw_inst *inst, int16_t v) \ +brw_inst_set_##name(const struct gen_device_info *devinfo, brw_inst *inst, int16_t v) \ { \ assert(assertions); \ (void) devinfo; \ brw_inst_set_bits(inst, high, low, (uint16_t) v); \ } \ static inline int16_t \ -brw_inst_##name(const struct brw_device_info *devinfo, const brw_inst *inst) \ +brw_inst_##name(const struct gen_device_info *devinfo, const brw_inst *inst) \ { \ assert(assertions); \ (void) devinfo; \ @@ -563,21 +554,21 @@ F(pi_message_data, MD(7), MD(0)) * @{ */ static inline int -brw_inst_imm_d(const struct brw_device_info *devinfo, const brw_inst *insn) +brw_inst_imm_d(const struct gen_device_info *devinfo, const brw_inst *insn) { (void) devinfo; return brw_inst_bits(insn, 127, 96); } static inline unsigned -brw_inst_imm_ud(const struct brw_device_info *devinfo, const brw_inst *insn) +brw_inst_imm_ud(const struct gen_device_info *devinfo, const brw_inst *insn) { (void) devinfo; return brw_inst_bits(insn, 127, 96); } static inline float -brw_inst_imm_f(const struct brw_device_info *devinfo, const brw_inst *insn) +brw_inst_imm_f(const struct gen_device_info *devinfo, const brw_inst *insn) { fi_type ft; (void) devinfo; @@ -585,8 +576,20 @@ brw_inst_imm_f(const struct brw_device_info *devinfo, const brw_inst *insn) return ft.f; } +static inline double +brw_inst_imm_df(const struct gen_device_info *devinfo, const brw_inst *insn) +{ + union { + double d; + uint64_t u; + } dt; + (void) devinfo; + dt.u = brw_inst_bits(insn, 127, 64); + return dt.d; +} + static inline void -brw_inst_set_imm_d(const struct brw_device_info *devinfo, +brw_inst_set_imm_d(const struct gen_device_info *devinfo, brw_inst *insn, int value) { (void) devinfo; @@ -594,7 +597,7 @@ brw_inst_set_imm_d(const struct brw_device_info *devinfo, } static inline void -brw_inst_set_imm_ud(const struct brw_device_info *devinfo, +brw_inst_set_imm_ud(const struct gen_device_info *devinfo, brw_inst *insn, unsigned value) { (void) devinfo; @@ -602,7 +605,7 @@ brw_inst_set_imm_ud(const struct brw_device_info *devinfo, } static inline void -brw_inst_set_imm_f(const struct brw_device_info *devinfo, +brw_inst_set_imm_f(const struct gen_device_info *devinfo, brw_inst *insn, float value) { fi_type ft; @@ -611,12 +614,25 @@ brw_inst_set_imm_f(const struct brw_device_info *devinfo, brw_inst_set_bits(insn, 127, 96, ft.u); } +static inline void +brw_inst_set_imm_df(const struct gen_device_info *devinfo, + brw_inst *insn, double value) +{ + union { + double d; + uint64_t u; + } dt; + (void) devinfo; + dt.d = value; + brw_inst_set_bits(insn, 127, 64, dt.u); +} + /** @} */ /* The AddrImm fields are split into two discontiguous sections on Gen8+ */ #define BRW_IA1_ADDR_IMM(reg, g4_high, g4_low, g8_nine, g8_high, g8_low) \ static inline void \ -brw_inst_set_##reg##_ia1_addr_imm(const struct brw_device_info *devinfo, \ +brw_inst_set_##reg##_ia1_addr_imm(const struct gen_device_info *devinfo, \ brw_inst *inst, \ unsigned value) \ { \ @@ -629,7 +645,7 @@ brw_inst_set_##reg##_ia1_addr_imm(const struct brw_device_info *devinfo, \ } \ } \ static inline unsigned \ -brw_inst_##reg##_ia1_addr_imm(const struct brw_device_info *devinfo, \ +brw_inst_##reg##_ia1_addr_imm(const struct gen_device_info *devinfo, \ const brw_inst *inst) \ { \ if (devinfo->gen >= 8) { \ @@ -648,7 +664,7 @@ BRW_IA1_ADDR_IMM(dst, 57, 48, 47, 56, 48) #define BRW_IA16_ADDR_IMM(reg, g4_high, g4_low, g8_nine, g8_high, g8_low) \ static inline void \ -brw_inst_set_##reg##_ia16_addr_imm(const struct brw_device_info *devinfo, \ +brw_inst_set_##reg##_ia16_addr_imm(const struct gen_device_info *devinfo, \ brw_inst *inst, unsigned value) \ { \ assert((value & ~0x3ff) == 0); \ @@ -660,7 +676,7 @@ brw_inst_set_##reg##_ia16_addr_imm(const struct brw_device_info *devinfo, \ } \ } \ static inline unsigned \ -brw_inst_##reg##_ia16_addr_imm(const struct brw_device_info *devinfo, \ +brw_inst_##reg##_ia16_addr_imm(const struct gen_device_info *devinfo, \ const brw_inst *inst) \ { \ if (devinfo->gen >= 8) { \ @@ -694,7 +710,7 @@ brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low) high %= 64; low %= 64; - const uint64_t mask = (1ull << (high - low + 1)) - 1; + const uint64_t mask = (~0ull >> (64 - (high - low + 1))); return (inst->data[word] >> low) & mask; } @@ -713,7 +729,7 @@ brw_inst_set_bits(brw_inst *inst, unsigned high, unsigned low, uint64_t value) high %= 64; low %= 64; - const uint64_t mask = ((1ull << (high - low + 1)) - 1) << low; + const uint64_t mask = (~0ull >> (64 - (high - low + 1))) << low; /* Make sure the supplied value actually fits in the given bitfield. */ assert((value & (mask >> low)) == value); @@ -766,7 +782,7 @@ brw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low, #define FC(name, high, low, assertions) \ static inline void \ -brw_compact_inst_set_##name(const struct brw_device_info *devinfo, \ +brw_compact_inst_set_##name(const struct gen_device_info *devinfo, \ brw_compact_inst *inst, unsigned v) \ { \ assert(assertions); \ @@ -774,7 +790,7 @@ brw_compact_inst_set_##name(const struct brw_device_info *devinfo, \ brw_compact_inst_set_bits(inst, high, low, v); \ } \ static inline unsigned \ -brw_compact_inst_##name(const struct brw_device_info *devinfo, \ +brw_compact_inst_##name(const struct gen_device_info *devinfo, \ const brw_compact_inst *inst) \ { \ assert(assertions); \