diff --git a/src/intel/compiler/brw_opt_algebraic.cpp b/src/intel/compiler/brw_opt_algebraic.cpp index 2e26c12c1bf..3d1931daef8 100644 --- a/src/intel/compiler/brw_opt_algebraic.cpp +++ b/src/intel/compiler/brw_opt_algebraic.cpp @@ -181,12 +181,12 @@ brw_opt_constant_fold_instruction(const intel_device_info *devinfo, brw_inst *in break; case BRW_OPCODE_MAD: - if (inst->src[1].file == IMM && + if (inst->src[0].file == IMM && + inst->src[1].file == IMM && inst->src[2].file == IMM && - inst->src[3].file == IMM && + !brw_type_is_vector_imm(inst->src[0].type) && !brw_type_is_vector_imm(inst->src[1].type) && - !brw_type_is_vector_imm(inst->src[2].type) && - !brw_type_is_vector_imm(inst->src[3].type)) { + !brw_type_is_vector_imm(inst->src[2].type)) { fold_multiplicands_of_MAD(inst); assert(inst->opcode == BRW_OPCODE_ADD); diff --git a/src/intel/compiler/test_opt_algebraic.cpp b/src/intel/compiler/test_opt_algebraic.cpp index e3e8acd2af0..397b6aefd90 100644 --- a/src/intel/compiler/test_opt_algebraic.cpp +++ b/src/intel/compiler/test_opt_algebraic.cpp @@ -59,7 +59,7 @@ TEST_F(algebraic_test, fmax_a_a) EXPECT_NO_PROGRESS(brw_opt_algebraic, bld); } -TEST_F(algebraic_test, mad_with_all_immediates_DISABLED) +TEST_F(algebraic_test, mad_with_all_immediates) { brw_builder bld = make_shader(); brw_builder exp = make_shader();