Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2012 08:31:00 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>, freebsd-net@freebsd.org, Mitya <mitya@cabletv.dp.ua>, freebsd-hackers@freebsd.org
Subject:   Re: Replace bcopy() to update ether_addr
Message-ID:  <92186FE4-F83A-43A2-B1C9-85A1C42513AC@bsdimp.com>
In-Reply-To: <20120821112655.GA90066@alchemy.franken.de>
References:  <50324DB4.6080905@cabletv.dp.ua> <alpine.BSF.2.00.1208201844220.35173@wojtek.tensor.gdynia.pl> <B2BB7724-57A9-40C9-AE9F-FFEC83D9DE9A@bsdimp.com> <alpine.BSF.2.00.1208202117230.19372@wojtek.tensor.gdynia.pl> <5452BF37-3658-4C1F-B965-CE3EA28B6EA5@bsdimp.com> <20120821112655.GA90066@alchemy.franken.de>

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

On Aug 21, 2012, at 5:26 AM, Marius Strobl wrote:

> On Mon, Aug 20, 2012 at 01:20:29PM -0600, Warner Losh wrote:
>>=20
>> On Aug 20, 2012, at 1:17 PM, Wojciech Puchar wrote:
>>=20
>>>>> or use ++.
>>>>>=20
>>>>> i think it is always aligned to 2 bytes and this should produce =
usable code on any CPU? should be 6 instructions on MIPS and PPC IMHO.
>>>>=20
>>>> We should tag it as __aligned(2) then, no?  If so, then the =
compiler should generate the code you posted.
>>> should is the most important word in Your post. what it actually do =
- i don't know.
>>=20
>> If we are requiring this to be __aligned(2), we should tag it as such =
to enforce this.
>>=20
>> Even without this tagging, the code to do a structure level copy of 6 =
bytes is going to be tiny...
>>=20
>=20
> While the __aligned(2) approach certainly works, I've actually rather
> mixed experiences on x86 with it as the compiler doesn't necessarily
> produce the small and efficient one would expect from code it. Such
> a change certainly shouldn't be done just on the assumption that the
> compiler has all hints required to produce good code from it but the
> resulting asm should be verified across all affected architectures.

Very true...  I would have thought that went without saying...

Warner=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92186FE4-F83A-43A2-B1C9-85A1C42513AC>