assembler: Get rid of src operand's swizzle_set
authorDamien Lespiau <damien.lespiau@intel.com>
Wed, 23 Jan 2013 21:46:21 +0000 (21:46 +0000)
committerDamien Lespiau <damien.lespiau@intel.com>
Mon, 4 Mar 2013 15:54:38 +0000 (15:54 +0000)
swizzle_set can be derived from the value of swizzle itself, no need for
that field.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
assembler/gen4asm.h
assembler/gram.y

index 0048b4a..b4ea647 100644 (file)
@@ -96,7 +96,6 @@ struct src_operand {
        int address_mode; /* 0 if direct, 1 if register-indirect */
        int indirect_offset; /* XXX */
 
-       int swizzle_set;
        unsigned swizzle: 8;
 
        uint32_t imm32; /* set if reg_file == BRW_IMMEDIATE_VALUE or it is expressing a branch offset */
index a10198b..c1029fa 100644 (file)
@@ -1891,7 +1891,6 @@ directsrcoperand: negate abs symbol_reg region regtype
                  $$.default_region = $4.is_default;
                  $$.negate = $1;
                  $$.abs = $2;
-                 $$.swizzle_set = $6.swizzle_set;
                  $$.swizzle = $6.swizzle;
                }
                | srcarchoperandex
@@ -1911,7 +1910,6 @@ indirectsrcoperand:
                  $$.horiz_stride = $4.horiz_stride;
                  $$.negate = $1;
                  $$.abs = $2;
-                 $$.swizzle_set = $6.swizzle_set;
                  $$.swizzle = $6.swizzle;
                }
 ;
@@ -2389,17 +2387,14 @@ srcimmtype:     /* empty */
  */
 swizzle:       /* empty */
                {
-                 $$.swizzle_set = 0;
                  $$.swizzle = BRW_SWIZZLE_NOOP;
                }
                | DOT chansel
                {
-                 $$.swizzle_set = 1;
                  $$.swizzle = BRW_SWIZZLE4($2, $2, $2, $2);
                }
                | DOT chansel chansel chansel chansel
                {
-                 $$.swizzle_set = 1;
                  $$.swizzle = BRW_SWIZZLE4($2, $3, $4, $5);
                }
 ;
@@ -2875,7 +2870,7 @@ int set_instruction_src0(struct brw_instruction *instr,
                instr->bits2.da1.src0_negate = src->negate;
                instr->bits2.da1.src0_abs = src->abs;
                instr->bits2.da1.src0_address_mode = src->address_mode;
-               if (src->swizzle_set) {
+               if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) {
                        fprintf(stderr, "error: swizzle bits set in align1 "
                                "instruction\n");
                        return 1;
@@ -2902,7 +2897,7 @@ int set_instruction_src0(struct brw_instruction *instr,
                instr->bits2.ia1.src0_horiz_stride = src->horiz_stride;
                instr->bits2.ia1.src0_width = src->width;
                instr->bits2.ia1.src0_vert_stride = src->vert_stride;
-               if (src->swizzle_set) {
+               if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) {
                        fprintf(stderr, "error: swizzle bits set in align1 "
                                "instruction\n");
                        return 1;
@@ -2953,7 +2948,7 @@ int set_instruction_src1(struct brw_instruction *instr,
                        return 1;
                }
                */
-               if (src->swizzle_set) {
+               if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) {
                        fprintf(stderr, "error: swizzle bits set in align1 "
                                "instruction\n");
                        return 1;
@@ -2985,7 +2980,7 @@ int set_instruction_src1(struct brw_instruction *instr,
                instr->bits3.ia1.src1_horiz_stride = src->horiz_stride;
                instr->bits3.ia1.src1_width = src->width;
                instr->bits3.ia1.src1_vert_stride = src->vert_stride;
-               if (src->swizzle_set) {
+               if (src->swizzle && src->swizzle != BRW_SWIZZLE_NOOP) {
                        fprintf(stderr, "error: swizzle bits set in align1 "
                                "instruction\n");
                        return 1;
@@ -3121,6 +3116,5 @@ void set_direct_src_operand(struct src_operand *src, struct brw_reg *reg,
        src->horiz_stride = 0;
        src->negate = 0;
        src->abs = 0;
-       src->swizzle_set = 0;
        src->swizzle = BRW_SWIZZLE_NOOP;
 }