From 45cc9ddcc14416eb53626cf26ba0e0047e23bec4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 7 Jun 2014 22:58:26 -0700 Subject: [PATCH] i965: Convert test_eu_compact.c to the new brw_inst API. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/test_eu_compact.c | 41 ++++++++++----------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/mesa/drivers/dri/i965/test_eu_compact.c b/src/mesa/drivers/dri/i965/test_eu_compact.c index 809b557c18f..1802f643b68 100644 --- a/src/mesa/drivers/dri/i965/test_eu_compact.c +++ b/src/mesa/drivers/dri/i965/test_eu_compact.c @@ -67,23 +67,20 @@ test_compact_instruction(struct brw_compile *p, struct brw_instruction src) * 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) @@ -102,12 +99,12 @@ skip_bit(struct brw_instruction *src, int bit) 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; } @@ -120,20 +117,20 @@ test_fuzz_compact_instruction(struct brw_compile *p, 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); @@ -237,7 +234,7 @@ gen_f0_1_MOV_GRF_GRF(struct brw_compile *p) 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); } -- 2.30.2