third_party/mesa/src/src/mesa/drivers/dri/i965/brw_fs.cpp
/**
 * Attempts to move immediate constants into the immediate
 * constant slot of following instructions.
 *
 * Immediate constants are a bit tricky -- they have to be in the last
 * operand slot, you can't do abs/negate on them,
 */
Attempts to move immediate constants into the immediate
constant slot of following instructions.

Immediate constants are a bit tricky -- they have to be in the last
operand slot, you can't do abs/negate on them.
Attempts to move immediate constants into the immediate constant slot of following instructions . Immediate constants are a bit tricky -- they have to be in the last operand slot you can ' t do abs / negate on them .
bool
fs_visitor::opt_algebraic()
{
   bool progress = false;
   calculate_live_intervals();
   foreach_list(node, &this->instructions) {
      fs_inst *inst = (fs_inst *)node;
      switch (inst->opcode) {
      case BRW_OPCODE_MUL:
	 if (inst->src[1].file != IMM)
	    continue;
	 if (inst->src[1].type == BRW_REGISTER_TYPE_F &&
	     inst->src[1].imm.f == 1.0) {
	    inst->opcode = BRW_OPCODE_MOV;
	    inst->src[1] = reg_undef;
	    progress = true;
	    break;
	 }
	 break;
      default:
	 break;
      }
   }
   return progress;
}
bool fs_visitor :: opt_algebraic ( ) { bool progress = false ; calculate_live_intervals ( ) ; foreach_list ( node , & this -> instructions ) { fs_inst * inst = ( fs_inst * ) node ; switch ( inst -> opcode ) { case BRW_OPCODE_MUL : if ( inst -> src [ 1 ] . file != IMM ) continue ; if ( inst -> src [ 1 ] . type == BRW_REGISTER_TYPE_F && inst -> src [ 1 ] . imm . f == 1.0 ) { inst -> opcode = BRW_OPCODE_MOV ; inst -> src [ 1 ] = reg_undef ; progress = true ; break ; } break ; default : break ; } } return progress ; }
Attempts to move immediate constants into the immediate
 constant slot of following instructions.
Attempts to move immediate constants into the immediate constant slot of following instructions .
/* a * 1.0 = a */