From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757742AbbJ2QKs (ORCPT ); Thu, 29 Oct 2015 12:10:48 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:59934 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757721AbbJ2QKr convert rfc822-to-8bit (ORCPT ); Thu, 29 Oct 2015 12:10:47 -0400 From: Vincent ABRIOU To: Rasmus Villemoes , Benjamin Gaignard , David Airlie CC: "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Date: Thu, 29 Oct 2015 17:10:33 +0100 Subject: Re: [PATCH] drm: sti: remove redundant sign extensions Thread-Topic: [PATCH] drm: sti: remove redundant sign extensions Thread-Index: AdESZFew7gVK7RHnTC+BmicZgoLPuA== Message-ID: <563244F9.1050103@st.com> References: <1445001296-23029-1-git-send-email-linux@rasmusvillemoes.dk> In-Reply-To: <1445001296-23029-1-git-send-email-linux@rasmusvillemoes.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 acceptlanguage: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.21,1.0.33,0.0.0000 definitions=2015-10-29_10:2015-10-28,2015-10-29,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: 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 > --- > 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: >