svn commit: r252032 - head/sys/amd64/include

Konstantin Belousov kostikbel at gmail.com
Fri Jun 21 06:32:52 UTC 2013


On Fri, Jun 21, 2013 at 12:15:24PM +1000, Lawrence Stewart wrote:
> Hi Kostik,
> 
> On 06/21/13 00:30, Konstantin Belousov wrote:
> > Author: kib
> > Date: Thu Jun 20 14:30:04 2013
> > New Revision: 252032
> > URL: http://svnweb.freebsd.org/changeset/base/252032
> > 
> > Log:
> >   Allow immediate operand.
> >   
> >   Sponsored by:	The FreeBSD Foundation
> > 
> > Modified:
> >   head/sys/amd64/include/counter.h
> > 
> > Modified: head/sys/amd64/include/counter.h
> > ==============================================================================
> > --- head/sys/amd64/include/counter.h	Thu Jun 20 14:20:03 2013	(r252031)
> > +++ head/sys/amd64/include/counter.h	Thu Jun 20 14:30:04 2013	(r252032)
> > @@ -44,7 +44,7 @@ counter_u64_add(counter_u64_t c, int64_t
> >  
> >  	__asm __volatile("addq\t%1,%%gs:(%0)"
> >  	    :
> > -	    : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc)
> > +	    : "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc)
> >  	    : "memory", "cc");
> >  }
> 
> For mere mortals like myself, a verbose explanation of what this does,
> why it's necessary and what problem(s) it solves (if any) would be most
> helpful :)

It does what was written in the commit message.  The addq instructions
is allowed to take the immediate operand, besides the register, for the
increment value.  For the typical case of incrementing by the constant 1,
before the commit, the emited code was like
	movl	$1,%ecx
	addq	%ecx,%gs(%rdx)
now it could be
	addq	$1,%gs(%rdx)

Mostly aestetic, also slightly lowering the registers pressure.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20130621/d7355fc8/attachment.sig>


More information about the svn-src-all mailing list