intel/eu: Add brw_inst.h helpers for the SEND(C) descriptor and extended descriptor.

This introduces helpers that can be used to specify or extract the
whole descriptor of a SEND message instruction at once.  Because the
the instruction encoding of these is rather awkward on some
generations using the generic brw_inst.h macros doesn't seem like an
option.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Francisco Jerez 2018-06-01 18:21:37 -07:00
parent 1c8a045bfb
commit f55884cad3
1 changed files with 78 additions and 0 deletions

View File

@ -458,6 +458,84 @@ FC(gen4_pop_count, 115, 112, devinfo->gen < 6)
/* Message descriptor bits */
#define MD(x) ((x) + 96)
/**
* Set the SEND(C) message descriptor immediate.
*
* This doesn't include the SFID nor the EOT field that were considered to be
* part of the message descriptor by ancient versions of the BSpec, because
* they are present in the instruction even if the message descriptor is
* provided indirectly in the address register, so we want to specify them
* separately.
*/
static inline void
brw_inst_set_send_desc(const struct gen_device_info *devinfo,
brw_inst *inst, uint32_t value)
{
if (devinfo->gen >= 9) {
brw_inst_set_bits(inst, 126, 96, value);
assert(value >> 31 == 0);
} else if (devinfo->gen >= 5) {
brw_inst_set_bits(inst, 124, 96, value);
assert(value >> 29 == 0);
} else {
brw_inst_set_bits(inst, 119, 96, value);
assert(value >> 24 == 0);
}
}
/**
* Get the SEND(C) message descriptor immediate.
*
* \sa brw_inst_set_send_desc().
*/
static inline uint32_t
brw_inst_send_desc(const struct gen_device_info *devinfo, const brw_inst *inst)
{
if (devinfo->gen >= 9)
return brw_inst_bits(inst, 126, 96);
else if (devinfo->gen >= 5)
return brw_inst_bits(inst, 124, 96);
else
return brw_inst_bits(inst, 119, 96);
}
/**
* Set the SEND(C) message extended descriptor immediate.
*
* This doesn't include the SFID nor the EOT field that were considered to be
* part of the extended message descriptor by some versions of the BSpec,
* because they are present in the instruction even if the extended message
* descriptor is provided indirectly in a register, so we want to specify them
* separately.
*/
static inline void
brw_inst_set_send_ex_desc(const struct gen_device_info *devinfo,
brw_inst *inst, uint32_t value)
{
assert(devinfo->gen >= 9);
brw_inst_set_bits(inst, 94, 91, (value >> 28) & ((1u << 4) - 1));
brw_inst_set_bits(inst, 88, 85, (value >> 24) & ((1u << 4) - 1));
brw_inst_set_bits(inst, 83, 80, (value >> 20) & ((1u << 4) - 1));
brw_inst_set_bits(inst, 67, 64, (value >> 16) & ((1u << 4) - 1));
assert((value & ((1u << 16) - 1)) == 0);
}
/**
* Get the SEND(C) message extended descriptor immediate.
*
* \sa brw_inst_set_send_ex_desc().
*/
static inline uint32_t
brw_inst_send_ex_desc(const struct gen_device_info *devinfo,
const brw_inst *inst)
{
assert(devinfo->gen >= 9);
return (brw_inst_bits(inst, 94, 91) << 28 |
brw_inst_bits(inst, 88, 85) << 24 |
brw_inst_bits(inst, 83, 80) << 20 |
brw_inst_bits(inst, 67, 64) << 16);
}
/**
* Fields for SEND messages:
* @{