linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@linux.intel.com>
To: Chinmay V S <chinmay.v.s@pathpartnertech.com>
Cc: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>,
	linux-kernel@vger.kernel.org, cvs268@gmail.com,
	tglx@linutronix.de, jeff.chua.linux@gmail.com
Subject: Re: [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed.
Date: Fri, 03 Feb 2012 06:52:23 -0800	[thread overview]
Message-ID: <4F2BF4A7.2070603@linux.intel.com> (raw)
In-Reply-To: <CAKZbaaTDcfEVPa2JRSnkv_YCiScoTTqpmzaGQGWT98QJpYzZ8A@mail.gmail.com>

On 2/2/2012 10:31 PM, Chinmay V S wrote:
> Here is the dis-assembly (build for x86) :
> 
> Original code snippet :
> mov    %eax,%ecx
> mov    $0x1,%edx
> shl    %cl,%edx
> sub    $0x1,%edx
> mov    %edx,-0x10(%ebp)
> not    %edx
> and    %esi,%edx
> mov    %edx,-0x14(%ebp)
> 
> Patched code snippet :
> mov    %eax,%ecx
> shrl   %cl,-0x14(%ebp)
> shll   %cl,-0x14(%ebp)
> 
> As is evident, we are able to reduce 5 instructions by using a bit-shift
> logic (compared to a masking logic).
> 

this code is so not performance critical to this level, that we should
optimize for readability, not for the output of a compiler.



      parent reply	other threads:[~2012-02-03 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31  9:37 [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed Chinmay V S
2012-02-02 22:59 ` Sebastian Andrzej Siewior
     [not found]   ` <CAKZbaaTDcfEVPa2JRSnkv_YCiScoTTqpmzaGQGWT98QJpYzZ8A@mail.gmail.com>
2012-02-03 14:52     ` Arjan van de Ven [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F2BF4A7.2070603@linux.intel.com \
    --to=arjan@linux.intel.com \
    --cc=chinmay.v.s@pathpartnertech.com \
    --cc=cvs268@gmail.com \
    --cc=jeff.chua.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sebastian@breakpoint.cc \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).