i965: Move up fs_inst::flag_subreg to backend_instruction.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 5 Feb 2015 23:28:12 +0000 (01:28 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 10 Feb 2015 14:05:51 +0000 (16:05 +0200)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_ir_fs.h
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index a85adaebe99ed289db24f8ecdd5da0e85af7b708..0c7dcaf27509fe1edd9c172f9ea0c26f3f7f60f9 100644 (file)
@@ -239,11 +239,6 @@ public:
     */
    uint8_t exec_size;
 
-   /* Chooses which flag subregister (f0.0 or f0.1) is used for conditional
-    * mod and predication.
-    */
-   uint8_t flag_subreg;
-
    bool eot:1;
    bool force_uncompressed:1;
    bool force_sechalf:1;
index 00bb4905c4c40ec8f5e09dcddea6d1c8b442f09c..281d5ee0c12a189ed1953a7d9484795589081517 100644 (file)
@@ -135,6 +135,11 @@ struct backend_instruction {
    bool saturate:1;
    bool shadow_compare:1;
    bool header_present:1;
+
+   /* Chooses which flag subregister (f0.0 or f0.1) is used for conditional
+    * mod and predication.
+    */
+   unsigned flag_subreg:1;
 };
 
 #ifdef __cplusplus
index f2339b399e37ee92ce4490ae6427d9af091dca98..622502ef3d91a8dce7313220f519d8a06fcfb332 100644 (file)
@@ -1283,13 +1283,20 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst, FILE *file)
    vec4_instruction *inst = (vec4_instruction *)be_inst;
 
    if (inst->predicate) {
-      fprintf(file, "(%cf0) ",
-             inst->predicate_inverse ? '-' : '+');
+      fprintf(file, "(%cf0.%d) ",
+              inst->predicate_inverse ? '-' : '+',
+              inst->flag_subreg);
    }
 
    fprintf(file, "%s", brw_instruction_name(inst->opcode));
    if (inst->conditional_mod) {
       fprintf(file, "%s", conditional_modifier[inst->conditional_mod]);
+      if (!inst->predicate &&
+          (brw->gen < 5 || (inst->opcode != BRW_OPCODE_SEL &&
+                            inst->opcode != BRW_OPCODE_IF &&
+                            inst->opcode != BRW_OPCODE_WHILE))) {
+         fprintf(file, ".f0.%d", inst->flag_subreg);
+      }
    }
    fprintf(file, " ");
 
index 898a6db4abfadc2d90177b3f3104f2f392418fcd..e38e6eae35b801ac0d01a01006545c69152e99f7 100644 (file)
@@ -1167,6 +1167,7 @@ vec4_generator::generate_code(const cfg_t *cfg)
 
       brw_set_default_predicate_control(p, inst->predicate);
       brw_set_default_predicate_inverse(p, inst->predicate_inverse);
+      brw_set_default_flag_reg(p, 0, inst->flag_subreg);
       brw_set_default_saturate(p, inst->saturate);
       brw_set_default_mask_control(p, inst->force_writemask_all);
       brw_set_default_acc_write_control(p, inst->writes_accumulator);
index ada4a0cdc4d98f92aeffa1c879c1f7f65affdf78..8eb00e737f710e650033a90124de99d741168c91 100644 (file)
@@ -49,6 +49,7 @@ vec4_instruction::vec4_instruction(enum opcode opcode, const dst_reg &dst,
    this->ir = NULL;
    this->urb_write_flags = BRW_URB_WRITE_NO_FLAGS;
    this->header_present = false;
+   this->flag_subreg = 0;
    this->mlen = 0;
    this->base_mrf = 0;
    this->offset = 0;