drm: sti: remove redundant sign extensions
Subsystems (3)
PATCH 1/1 drm: sti: remove redundant sign extensions
arg is long int, so arg = (arg << 22) >> 22 makes the upper 22 bits of arg equal to bit 9 (or bit 41). But we then mask away all but bits 0-9, so this is entirely redundant.
---
gcc seems to be smart enough to realize this - the generated code is the same. This is thus just a tiny cleanup.
drivers/gpu/drm/sti/sti_awg_utils.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/sti/sti_awg_utils.c +0 -4
@@ -65,7 +65,6 @@ static int awg_generate_instr(enum opcode opcode, mux =0 ; data_enable =0 ; - arg = (arg <<22 ) >>22 ; arg &= (0x3ff );break ;case REPEAT :
@@ -77,14 +76,12 @@ static int awg_generate_instr(enum opcode opcode, mux =0 ; data_enable =0 ; - arg = (arg <<22 ) >>22 ; arg &= (0x3ff );break ;case JUMP : mux =0 ; data_enable =0 ; arg |=0x40 ;/* for jump instruction 7th bit is 1 */ - arg = (arg <<22 ) >>22 ; arg &=0x3ff ;break ;case STOP :
@@ -94,7 +91,6 @@ static int awg_generate_instr(enum opcode opcode,case RPTSET :case RPLSET :case HOLD : - arg = (arg <<24 ) >>24 ; arg &= (0x0ff );break ;default :
Signature · 1 line
2.6.1
Hi Rasmus,
Thanks for the patch.
I will integrated it in the next pull request for the sti driver.
BR
Vincent
Quoted 41 lines · Rasmus Villemoes
arg is long int, so arg = (arg << 22) >> 22 makes the upper 22 bits of arg equal to bit 9 (or bit 41). But we then mask away all but bits 0-9, so this is entirely redundant.
Signed-off-by Rasmus Villemoes <[email protected]>---
gcc seems to be smart enough to realize this - the generated code is the same. This is thus just a tiny cleanup.drivers/gpu/drm/sti/sti_awg_utils.c | 4 ---- 1 file changed, 4 deletions(-)drivers/gpu/drm/sti/sti_awg_utils.c +0
-3@@ -65,7 +65,6 @@ static int awg_generate_instr(enum opcode opcode, mux =0 ; data_enable =0 ; - arg = (arg <<22 ) >>22 ; arg &= (0x3ff );break ;case REPEAT :@@ -77,14 +76,12 @@ static int awg_generate_instr(enum opcode opcode, mux =0 ; data_enable =0 ; - arg = (arg <<22 ) >>22 ; arg &= (0x3ff );break ;case JUMP : mux =0 ; data_enable =0 ; arg |=0x40 ;/* for jump instruction 7th bit is 1 */ - arg = (arg <<22 ) >>22 ; arg &=0x3ff ;break ;case STOP :
drivers/gpu/drm/sti/sti_awg_utils.c static int awg_generate_instr(enum opcode opcode, · line 96
Quoted 7 lines
drivers/gpu/drm/sti/sti_awg_utils.c +0
-1@@ -94,7 +91,6 @@ static int awg_generate_instr(enum opcode opcode,case RPTSET :case RPLSET :case HOLD : - arg = (arg <<24 ) >>24 ; arg &= (0x0ff );break ;default :
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel