* [PATCH] drm: sti: remove redundant sign extensions
@ 2015-10-16 13:14 Rasmus Villemoes
2015-10-29 16:10 ` Vincent ABRIOU
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2015-10-16 13:14 UTC (permalink / raw)
To: Benjamin Gaignard, Vincent Abriou, David Airlie
Cc: Rasmus Villemoes, dri-devel, linux-kernel
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 <linux@rasmusvillemoes.dk>
---
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(-)
diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c b/drivers/gpu/drm/sti/sti_awg_utils.c
index 6029a2e3db1d..00d0698be9d3 100644
--- a/drivers/gpu/drm/sti/sti_awg_utils.c
+++ b/drivers/gpu/drm/sti/sti_awg_utils.c
@@ -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:
--
2.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: sti: remove redundant sign extensions
2015-10-16 13:14 [PATCH] drm: sti: remove redundant sign extensions Rasmus Villemoes
@ 2015-10-29 16:10 ` Vincent ABRIOU
0 siblings, 0 replies; 2+ messages in thread
From: Vincent ABRIOU @ 2015-10-29 16:10 UTC (permalink / raw)
To: Rasmus Villemoes, Benjamin Gaignard, David Airlie
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Hi Rasmus,
Thanks for the patch.
I will integrated it in the next pull request for the sti driver.
BR
Vincent
On 10/16/2015 03:14 PM, Rasmus Villemoes wrote:
> 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 <linux@rasmusvillemoes.dk>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c b/drivers/gpu/drm/sti/sti_awg_utils.c
> index 6029a2e3db1d..00d0698be9d3 100644
> --- a/drivers/gpu/drm/sti/sti_awg_utils.c
> +++ b/drivers/gpu/drm/sti/sti_awg_utils.c
> @@ -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:
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-29 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 13:14 [PATCH] drm: sti: remove redundant sign extensions Rasmus Villemoes
2015-10-29 16:10 ` Vincent ABRIOU
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox