p->current->header.destreg__conditionalmod = conditional;
}
+void brw_set_flag_reg(struct brw_compile *p, int reg, int subreg)
+{
+ p->current->bits2.da1.flag_reg_nr = reg;
+ p->current->bits2.da1.flag_subreg_nr = subreg;
+}
+
void brw_set_access_mode( struct brw_compile *p, GLuint access_mode )
{
p->current->header.access_mode = access_mode;
void brw_set_predicate_control( struct brw_compile *p, GLuint pc );
void brw_set_predicate_inverse(struct brw_compile *p, bool predicate_inverse);
void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional );
+void brw_set_flag_reg(struct brw_compile *p, int reg, int subreg);
void brw_set_acc_write_control(struct brw_compile *p, GLuint value);
void brw_init_compile(struct brw_context *, struct brw_compile *p,
void
fs_visitor::dump_instruction(fs_inst *inst)
{
+ if (inst->predicate) {
+ printf("(%cf0.%d) ",
+ inst->predicate_inverse ? '-' : '+',
+ inst->flag_subreg);
+ }
+
if (inst->opcode < ARRAY_SIZE(opcode_descs) &&
opcode_descs[inst->opcode].name) {
printf("%s", opcode_descs[inst->opcode].name);
}
if (inst->saturate)
printf(".sat");
+ if (inst->conditional_mod) {
+ printf(".cmod");
+ if (!inst->predicate &&
+ (intel->gen < 5 || (inst->opcode != BRW_OPCODE_SEL &&
+ inst->opcode != BRW_OPCODE_IF &&
+ inst->opcode != BRW_OPCODE_WHILE))) {
+ printf(".f0.%d\n", inst->flag_subreg);
+ }
+ }
printf(" ");
+
switch (inst->dst.file) {
case GRF:
printf("vgrf%d", inst->dst.reg);
bool saturate;
int conditional_mod; /**< BRW_CONDITIONAL_* */
+ /* Chooses which flag subregister (f0.0 or f0.1) is used for conditional
+ * mod and predication.
+ */
+ uint8_t flag_subreg;
+
int mlen; /**< SEND message length */
int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
uint32_t texture_offset; /**< Texture offset bitfield */
struct brw_reg dst,
struct brw_reg index,
struct brw_reg offset);
- void generate_mov_dispatch_to_flags();
+ void generate_mov_dispatch_to_flags(fs_inst *inst);
struct brw_context *brw;
struct intel_context *intel;
* Used only on Gen6 and above.
*/
void
-fs_generator::generate_mov_dispatch_to_flags()
+fs_generator::generate_mov_dispatch_to_flags(fs_inst *inst)
{
- struct brw_reg f0 = brw_flag_reg(0, 0);
+ struct brw_reg flags = brw_flag_reg(0, inst->flag_subreg);
struct brw_reg g1 = retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UW);
assert (intel->gen >= 6);
brw_push_insn_state(p);
brw_set_mask_control(p, BRW_MASK_DISABLE);
- brw_MOV(p, f0, g1);
+ brw_MOV(p, flags, g1);
brw_pop_insn_state(p);
}
brw_set_conditionalmod(p, inst->conditional_mod);
brw_set_predicate_control(p, inst->predicate);
brw_set_predicate_inverse(p, inst->predicate_inverse);
+ brw_set_flag_reg(p, 0, inst->flag_subreg);
brw_set_saturate(p, inst->saturate);
brw_set_mask_control(p, inst->force_writemask_all);
break;
case FS_OPCODE_MOV_DISPATCH_TO_FLAGS:
- generate_mov_dispatch_to_flags();
+ generate_mov_dispatch_to_flags(inst);
break;
case SHADER_OPCODE_SHADER_TIME_ADD:
{
schedule_node *last_grf_write[virtual_grf_count];
schedule_node *last_mrf_write[BRW_MAX_MRF];
- schedule_node *last_conditional_mod = NULL;
+ schedule_node *last_conditional_mod[2] = { NULL, NULL };
/* Fixed HW registers are assumed to be separate from the virtual
* GRFs, so they can be tracked separately. We don't really write
* to fixed GRFs much, so don't bother tracking them on a more
}
if (inst->predicate) {
- assert(last_conditional_mod);
- add_dep(last_conditional_mod, n);
+ assert(last_conditional_mod[inst->flag_subreg]);
+ add_dep(last_conditional_mod[inst->flag_subreg], n);
}
/* write-after-write deps. */
*/
if (inst->conditional_mod ||
inst->opcode == FS_OPCODE_MOV_DISPATCH_TO_FLAGS) {
- add_dep(last_conditional_mod, n, 0);
- last_conditional_mod = n;
+ add_dep(last_conditional_mod[inst->flag_subreg], n, 0);
+ last_conditional_mod[inst->flag_subreg] = n;
}
}
/* bottom-to-top dependencies: WAR */
memset(last_grf_write, 0, sizeof(last_grf_write));
memset(last_mrf_write, 0, sizeof(last_mrf_write));
- last_conditional_mod = NULL;
+ memset(last_conditional_mod, 0, sizeof(last_conditional_mod));
last_fixed_grf_write = NULL;
exec_node *node;
}
if (inst->predicate) {
- add_dep(n, last_conditional_mod);
+ add_dep(n, last_conditional_mod[inst->flag_subreg]);
}
/* Update the things this instruction wrote, so earlier reads
*/
if (inst->conditional_mod ||
inst->opcode == FS_OPCODE_MOV_DISPATCH_TO_FLAGS) {
- last_conditional_mod = n;
+ last_conditional_mod[inst->flag_subreg] = n;
}
}
}