[Mesa-dev] [PATCH] st/mesa: keep track of saturated writes when eliminating dead code

Marek Olšák maraeo at gmail.com
Wed Sep 23 18:28:04 PDT 2015


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Sep 24, 2015 at 1:05 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Wed, Sep 23, 2015 at 12:33 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> It doesn't matter whether a write is saturated or not, in another
>> implementation it might even have been a separate opcode. This code was
>> most likely copied from the copy-propagation pass (where one does have
>> to distinguish saturation).
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>
>> Haven't run this through piglit yet, but happened upon it when I was
>> debugging the other issue. (Which turned out to be an odd dependence
>> on this pass by the regular emitter code.)
>
> This doesn't seem to regress anything in piglit. Note that this change
> isn't strictly required for correctness, but if we're going to do DCE,
> might as well not mess it up arbitrarily. The effect was that
> saturated ops (mov and maybe add) wouldn't get DCE'd.
>
>>
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> index 6762566..ee0acb5 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> @@ -4228,8 +4228,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code(void)
>>         */
>>        for (unsigned i = 0; i < ARRAY_SIZE(inst->dst); i++) {
>>           if (inst->dst[i].file == PROGRAM_TEMPORARY &&
>> -             !inst->dst[i].reladdr &&
>> -             !inst->saturate) {
>> +             !inst->dst[i].reladdr) {
>>              for (int c = 0; c < 4; c++) {
>>                 if (inst->dst[i].writemask & (1 << c)) {
>>                    if (writes[4 * inst->dst[i].index + c]) {
>> --
>> 2.4.9
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list