* become meaningless once fuzzing twiddles a related bit.
*/
static void
-clear_pad_bits(struct brw_instruction *inst)
+clear_pad_bits(const struct brw_context *brw, struct brw_instruction *inst)
{
- if (inst->header.opcode != BRW_OPCODE_SEND &&
- inst->header.opcode != BRW_OPCODE_SENDC &&
- inst->header.opcode != BRW_OPCODE_BREAK &&
- inst->header.opcode != BRW_OPCODE_CONTINUE &&
- inst->bits1.da1.src0_reg_file != BRW_IMMEDIATE_VALUE &&
- inst->bits1.da1.src1_reg_file != BRW_IMMEDIATE_VALUE) {
- if (inst->bits3.da1.src1_address_mode)
- inst->bits3.ia1.pad1 = 0;
- else
- inst->bits3.da1.pad0 = 0;
+ if (brw_inst_opcode(brw, inst) != BRW_OPCODE_SEND &&
+ brw_inst_opcode(brw, inst) != BRW_OPCODE_SENDC &&
+ brw_inst_opcode(brw, inst) != BRW_OPCODE_BREAK &&
+ brw_inst_opcode(brw, inst) != BRW_OPCODE_CONTINUE &&
+ brw_inst_src0_reg_file(brw, inst) != BRW_IMMEDIATE_VALUE &&
+ brw_inst_src1_reg_file(brw, inst) != BRW_IMMEDIATE_VALUE) {
+ brw_inst_set_bits(inst, 127, 111, 0);
}
}
static bool
-skip_bit(struct brw_instruction *src, int bit)
+skip_bit(const struct brw_context *brw, struct brw_instruction *src, int bit)
{
/* pad bit */
if (bit == 7)
return true;
/* sometimes these are pad bits. */
- if (src->header.opcode != BRW_OPCODE_SEND &&
- src->header.opcode != BRW_OPCODE_SENDC &&
- src->header.opcode != BRW_OPCODE_BREAK &&
- src->header.opcode != BRW_OPCODE_CONTINUE &&
- src->bits1.da1.src0_reg_file != BRW_IMMEDIATE_VALUE &&
- src->bits1.da1.src1_reg_file != BRW_IMMEDIATE_VALUE &&
+ if (brw_inst_opcode(brw, src) != BRW_OPCODE_SEND &&
+ brw_inst_opcode(brw, src) != BRW_OPCODE_SENDC &&
+ brw_inst_opcode(brw, src) != BRW_OPCODE_BREAK &&
+ brw_inst_opcode(brw, src) != BRW_OPCODE_CONTINUE &&
+ brw_inst_src0_reg_file(brw, src) != BRW_IMMEDIATE_VALUE &&
+ brw_inst_src1_reg_file(brw, src) != BRW_IMMEDIATE_VALUE &&
bit >= 121) {
return true;
}
struct brw_instruction src)
{
for (int bit0 = 0; bit0 < 128; bit0++) {
- if (skip_bit(&src, bit0))
+ if (skip_bit(p->brw, &src, bit0))
continue;
for (int bit1 = 0; bit1 < 128; bit1++) {
struct brw_instruction instr = src;
uint32_t *bits = (uint32_t *)&instr;
- if (skip_bit(&src, bit1))
+ if (skip_bit(p->brw, &src, bit1))
continue;
bits[bit0 / 32] ^= (1 << (bit0 & 31));
bits[bit1 / 32] ^= (1 << (bit1 & 31));
- clear_pad_bits(&instr);
+ clear_pad_bits(p->brw, &instr);
if (!test_compact_instruction(p, instr)) {
printf(" twiddled bits for fuzzing %d, %d\n", bit0, bit1);
brw_push_insn_state(p);
brw_set_default_predicate_control(p, true);
struct brw_instruction *mov = brw_MOV(p, g0, g2);
- mov->bits2.da1.flag_subreg_nr = 1;
+ brw_inst_set_flag_subreg_nr(p->brw, mov, 1);
brw_pop_insn_state(p);
}