Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 2013 09:32:48 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Lawrence Stewart <lstewart@freebsd.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r252032 - head/sys/amd64/include
Message-ID:  <20130621063248.GN91021@kib.kiev.ua>
In-Reply-To: <51C3B73C.70900@freebsd.org>
References:  <201306201430.r5KEU4G5049115@svn.freebsd.org> <51C3B73C.70900@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Lv9rZMuwYml21e6Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jun 21, 2013 at 12:15:24PM +1000, Lawrence Stewart wrote:
> Hi Kostik,
>=20
> 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
> >=20
> > Log:
> >   Allow immediate operand.
> >  =20
> >   Sponsored by:	The FreeBSD Foundation
> >=20
> > Modified:
> >   head/sys/amd64/include/counter.h
> >=20
> > Modified: head/sys/amd64/include/counter.h
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- 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
> > =20
> >  	__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");
> >  }
>=20
> 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.

--Lv9rZMuwYml21e6Z
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (FreeBSD)

iQIcBAEBAgAGBQJRw/OPAAoJEJDCuSvBvK1BFQQP/2o51rsAef7M6zzoHUnMMfJQ
UknRxPbEEnbwgiZdEsIvPMZCQaF7Ohs/BJdGF5WHt8X9U93smhxzfPGyeseRLZ0f
ZO0F0s22HEPepoXfB6iQHwi8+MecGYqc1Y9OTqIlk7zxVPCgFgSRX6FTxV211fNl
NkSRzsmKp7GsFT8/qPbUqmlWri+SdSvNy1OvZnVH8bh/7MuXslmSVVmvvSV7HMaB
aghcVobKosRDqimXDI4P3AVMIXYrpc7/e0DwEERxB3pSeUmsq7pL51OlkQTZpQQy
OhNbG52LO690l1eE1p2o71zxBnlYTQNAlDVoFcwGeIwtVvJW/3w4XI362BiarY8o
r0lS3Y8rSiD0etBNq+JOner1PMPc8F/qx/a9s8fA/wgd2WI56n3pwGTIaYMnuq0s
I0L9XE0rng4SbziUs+R3qfHeC4cCsjuY3OiNb+P7zSCJGaBhNfd8ocht0ulHVQa1
0WjKvpMrbyw6iknA+SPJ0LhkseAUvRfTn/OVNitRlZCeBw39jON05swerJg0SvqX
lUTl4GwJSXoDgW+bFqbhUt9nDtv5WCdLzTh48YjxuVuMmOkye30RCy7c5DWxl5cE
rn3Ooh8ZNwtxR5kvWyr90cfW4UyEmep1AKb0pYJnpTYBbh78mlovibq/YAP5jf8j
JG7mBrVkryvAj4aQEhqo
=528p
-----END PGP SIGNATURE-----

--Lv9rZMuwYml21e6Z--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130621063248.GN91021>