diff options
author | Marek Olšák <[email protected]> | 2013-02-03 16:54:59 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-06 14:45:20 +0100 |
commit | 1d3561d877c8294ffccfd6765268f32dc9ae62cf (patch) | |
tree | 3e918d769e7dca7afc84f017be8d435cb5eea26d /src/gallium/drivers/r300/compiler | |
parent | ae8696c7eeae939428a52c0d5113b5b08b049395 (diff) |
r300/compiler: copy-propagate saturate mode when possible
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300/compiler')
-rw-r--r-- | src/gallium/drivers/r300/compiler/radeon_optimize.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index 0714d794182..7be9d9e525b 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -143,8 +143,7 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i unsigned int i; if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY || - inst_mov->U.I.WriteALUResult || - inst_mov->U.I.SaturateMode) + inst_mov->U.I.WriteALUResult) return; /* Get a list of all the readers of this MOV instruction. */ @@ -156,6 +155,22 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i if (reader_data.Abort || reader_data.ReaderCount == 0) return; + /* We can propagate SaturateMode if all the readers are MOV instructions + * without a presubtract operation, source negation and absolute. + * In that case, we just move SaturateMode to all readers. */ + if (inst_mov->U.I.SaturateMode) { + for (i = 0; i < reader_data.ReaderCount; i++) { + struct rc_instruction * inst = reader_data.Readers[i].Inst; + + if (inst->U.I.Opcode != RC_OPCODE_MOV || + inst->U.I.SrcReg[0].File == RC_FILE_PRESUB || + inst->U.I.SrcReg[0].Abs || + inst->U.I.SrcReg[0].Negate) { + return; + } + } + } + /* Propagate the MOV instruction. */ for (i = 0; i < reader_data.ReaderCount; i++) { struct rc_instruction * inst = reader_data.Readers[i].Inst; @@ -163,6 +178,8 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i if (inst_mov->U.I.SrcReg[0].File == RC_FILE_PRESUB) inst->U.I.PreSub = inst_mov->U.I.PreSub; + if (!inst->U.I.SaturateMode) + inst->U.I.SaturateMode = inst_mov->U.I.SaturateMode; } /* Finally, remove the original MOV instruction */ |