From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 21 11:52:50 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A28EB106566C; Tue, 21 Aug 2012 11:52:50 +0000 (UTC) (envelope-from mitya@cabletv.dp.ua) Received: from mail.cabletv.dp.ua (mail.cabletv.dp.ua [193.34.20.8]) by mx1.freebsd.org (Postfix) with ESMTP id 586228FC08; Tue, 21 Aug 2012 11:52:49 +0000 (UTC) Received: from [193.34.20.2] (helo=m18.cabletv.dp.ua) by mail.cabletv.dp.ua with esmtp (Exim 4.72 (FreeBSD)) (envelope-from ) id 1T3nUG-000C1A-Uv; Tue, 21 Aug 2012 15:23:12 +0300 Message-ID: <5033751C.1050405@cabletv.dp.ua> Date: Tue, 21 Aug 2012 14:46:36 +0300 From: Mitya User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:12.0) Gecko/20120425 Thunderbird/12.0 MIME-Version: 1.0 To: Marius Strobl , freebsd-hackers@freebsd.org, freebsd-net@freebsd.org References: <50324DB4.6080905@cabletv.dp.ua> <5452BF37-3658-4C1F-B965-CE3EA28B6EA5@bsdimp.com> <20120821112655.GA90066@alchemy.franken.de> In-Reply-To: <20120821112655.GA90066@alchemy.franken.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 21 Aug 2012 11:58:50 +0000 Cc: Subject: Re: Replace bcopy() to update ether_addr X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Aug 2012 11:52:50 -0000 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.