} \
} while (0)
+#define STRIDE(stride) (stride != 0 ? 1 << ((stride) - 1) : 0)
+#define WIDTH(width) (1 << (width))
+
static bool
inst_is_send(const struct gen_device_info *devinfo, const brw_inst *inst)
{
* In fact, checking it would weaken testing of the other rules.
*/
- unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
+ unsigned dst_stride = STRIDE(brw_inst_dst_hstride(devinfo, inst));
enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
bool dst_type_is_byte =
brw_inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_B ||
BRW_IMMEDIATE_VALUE) \
continue; \
\
- vstride = brw_inst_src ## n ## _vstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _vstride(devinfo, inst) - 1)) : 0; \
- width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
- hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
+ vstride = STRIDE(brw_inst_src ## n ## _vstride(devinfo, inst)); \
+ width = WIDTH(brw_inst_src ## n ## _width(devinfo, inst)); \
+ hstride = STRIDE(brw_inst_src ## n ## _hstride(devinfo, inst)); \
type = brw_inst_src ## n ## _type(devinfo, inst); \
element_size = brw_reg_type_to_size(type); \
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst)
BRW_IMMEDIATE_VALUE) \
continue; \
\
- vstride = brw_inst_src ## n ## _vstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _vstride(devinfo, inst) - 1)) : 0; \
- width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
- hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
+ vstride = STRIDE(brw_inst_src ## n ## _vstride(devinfo, inst)); \
+ width = WIDTH(brw_inst_src ## n ## _width(devinfo, inst)); \
+ hstride = STRIDE(brw_inst_src ## n ## _hstride(devinfo, inst)); \
type = brw_inst_src ## n ## _type(devinfo, inst); \
element_size = brw_reg_type_to_size(type); \
subreg = brw_inst_src ## n ## _da1_subreg_nr(devinfo, inst); \
if (desc->ndst == 0 || dst_is_null(devinfo, inst))
return error_msg;
- unsigned stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
+ unsigned stride = STRIDE(brw_inst_dst_hstride(devinfo, inst));
enum brw_reg_type dst_type = brw_inst_dst_type(devinfo, inst);
unsigned element_size = brw_reg_type_to_size(dst_type);
unsigned subreg = brw_inst_dst_da1_subreg_nr(devinfo, inst);
for (unsigned i = 0; i < num_sources; i++) {
#define DO_SRC(n) \
unsigned vstride, width, hstride; \
- vstride = brw_inst_src ## n ## _vstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _vstride(devinfo, inst) - 1)) : 0; \
- width = 1 << brw_inst_src ## n ## _width(devinfo, inst); \
- hstride = brw_inst_src ## n ## _hstride(devinfo, inst) ? \
- (1 << (brw_inst_src ## n ## _hstride(devinfo, inst) - 1)) : 0; \
+ vstride = STRIDE(brw_inst_src ## n ## _vstride(devinfo, inst)); \
+ width = WIDTH(brw_inst_src ## n ## _width(devinfo, inst)); \
+ hstride = STRIDE(brw_inst_src ## n ## _hstride(devinfo, inst)); \
bool src ## n ## _is_packed_word = \
is_packed(vstride, width, hstride) && \
(brw_inst_src ## n ## _type(devinfo, inst) == BRW_REGISTER_TYPE_W || \
unsigned dst_type_size = brw_reg_type_to_size(dst_type);
unsigned dst_subreg = brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1 ?
brw_inst_dst_da1_subreg_nr(devinfo, inst) : 0;
- unsigned dst_stride = 1 << (brw_inst_dst_hstride(devinfo, inst) - 1);
+ unsigned dst_stride = STRIDE(brw_inst_dst_hstride(devinfo, inst));
enum brw_reg_type type = num_sources == 1 ?
brw_inst_src0_type(devinfo, inst) :
brw_inst_src1_type(devinfo, inst);