Re: [Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-11 Thread Brian Paul
On 10/09/2011 12:50 PM, Bryan Cain wrote: I don't think there's any reason we can't eliminate a dead instruction when the writemask is zero. I do wonder, though, why this patch actually makes a difference. There's an if (!inst-dead_mask || !inst-dst.writemask) three lines before the code

Re: [Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-10 Thread Brian Paul
I tested with a shader that generates an ARL instruction and found inst-dst is: {file = PROGRAM_ADDRESS, index = 0, writemask = 1, cond_mask = 8, type = 2, reladdr = 0x0} in the code in question. I don't think there's any way that the dest register's writemask could be set to zero.

Re: [Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-09 Thread Bryan Cain
I don't think there's any reason we can't eliminate a dead instruction when the writemask is zero. I do wonder, though, why this patch actually makes a difference. There's an if (!inst-dead_mask || !inst-dst.writemask) three lines before the code visible in the patch that makes it not kill the

Re: [Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-09 Thread Bryan Cain
What does it do if there's no destination register? In any case, I don't think glsl_to_tgsi emits any ARLs of that form, so it shouldn't be a problem. Bryan On 10/07/2011 01:06 PM, Marek Olšák wrote: I think ARL is allowed to have no destination register, right? In that case, there should be

Re: [Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-09 Thread Marek Olšák
Correct. The thing was: even though we have an addressing register in TGSI (e.g. tgsi_full_dst|src_register::Indirect), everybody except nv50 and partially svga doesn't use it now. They expect the indirect register file is always TGSI_FILE_ADDRESS and the index is 0, making the destination of ARL

[Mesa-dev] [PATCH] st/mesa: kill instruction if writemask=0 in eliminate_dead_code_advanced()

2011-10-07 Thread Brian Paul
From: Brian Paul bri...@vmware.com This fixes a bug where we'd wind up emitting an invalid instruction like MOVE R[0]., R[1]; - note the empty/zero writemask. If we don't write to any dest register channels, cull the instruction. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp |8 +++-