Replace bcopy() to update ether_addr

Mitya mitya at cabletv.dp.ua
Tue Aug 21 11:52:50 UTC 2012


21.08.2012 14:26, Marius Strobl написал:
> On Mon, Aug 20, 2012 at 01:20:29PM -0600, Warner Losh wrote:
>> On Aug 20, 2012, at 1:17 PM, Wojciech Puchar wrote:
>>
>>>>> or use ++.
>>>>>
>>>>> 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.
>>>> 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.
>> If we are requiring this to be __aligned(2), we should tag it as such to enforce this.
>>
>> Even without this tagging, the code to do a structure level copy of 6 bytes is going to be tiny...
>>
> 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.
>
> Marius
>
Yes. I totally agree. That is why I have limited use of this feature 
only i386 and amd64 architectures.



More information about the freebsd-hackers mailing list