diff options
author | Francisco Jerez <[email protected]> | 2018-06-01 18:21:37 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2018-07-09 23:46:57 -0700 |
commit | f55884cad38516c2f6c62065c614a764c0a6f15e (patch) | |
tree | 58d771b70785f7d62d1b352bb7ead0df35888034 /src | |
parent | 1c8a045bfb17e6a44ff0c3d47747d574688f032d (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/compiler/brw_inst.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_inst.h b/src/intel/compiler/brw_inst.h index 8663c1b7f5b..438a473c1cd 100644 --- a/src/intel/compiler/brw_inst.h +++ b/src/intel/compiler/brw_inst.h @@ -459,6 +459,84 @@ FC(gen4_pop_count, 115, 112, devinfo->gen < 6) #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: * @{ */ |