[Mesa-stable] [Mesa-dev] [PATCH 2/3] i965/fs: Use fs_inst::overwrites_reg() in saturate propagation.

Matt Turner mattst88 at gmail.com
Thu Feb 19 15:29:59 PST 2015


On Thu, Feb 19, 2015 at 3:25 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 02/11/2015 02:54 PM, Matt Turner wrote:
>> This is safer and matches the conditional_mod propagation pass.
>>
>> Cc: <mesa-stable at lists.freedesktop.org>
>> ---
>>  .../dri/i965/brw_fs_saturate_propagation.cpp       |  8 ++---
>>  .../dri/i965/test_fs_saturate_propagation.cpp      | 40 ++++++++++++++++++++++
>>  2 files changed, 44 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
>> index a9966a4..bc51661 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
>> @@ -64,10 +64,10 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block)
>>
>>        bool interfered = false;
>>        foreach_inst_in_block_reverse_starting_from(fs_inst, scan_inst, inst, block) {
>> -         if (scan_inst->dst.file == GRF &&
>> -             scan_inst->dst.reg == inst->src[0].reg &&
>> -             scan_inst->dst.reg_offset == inst->src[0].reg_offset &&
>> -             !scan_inst->is_partial_write()) {
>> +         if (scan_inst->overwrites_reg(inst->src[0])) {
>> +            if (scan_inst->is_partial_write())
>> +               break;
>> +
>>              if (scan_inst->saturate) {
>>                 inst->saturate = false;
>>                 progress = true;
>> diff --git a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
>> index 2000830..f897bdd 100644
>> --- a/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
>> +++ b/src/mesa/drivers/dri/i965/test_fs_saturate_propagation.cpp
>> @@ -353,3 +353,43 @@ TEST_F(saturate_propagation_test, intervening_saturating_copy)
>>     EXPECT_EQ(BRW_OPCODE_MOV, instruction(block0, 2)->opcode);
>>     EXPECT_FALSE(instruction(block0, 2)->saturate);
>>  }
>> +
>> +TEST_F(saturate_propagation_test, intervening_dest_write)
>
> Does this test pass without the other change?

No. The test is for the bug this is fixing.


More information about the mesa-stable mailing list