From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 21 11:27:00 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 0CFF51065672; Tue, 21 Aug 2012 11:27:00 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 92C848FC08; Tue, 21 Aug 2012 11:26:59 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q7LBQtKZ090094; Tue, 21 Aug 2012 13:26:55 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q7LBQtv0090093; Tue, 21 Aug 2012 13:26:55 +0200 (CEST) (envelope-from marius) Date: Tue, 21 Aug 2012 13:26:55 +0200 From: Marius Strobl To: Warner Losh Message-ID: <20120821112655.GA90066@alchemy.franken.de> References: <50324DB4.6080905@cabletv.dp.ua> <5452BF37-3658-4C1F-B965-CE3EA28B6EA5@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5452BF37-3658-4C1F-B965-CE3EA28B6EA5@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: Wojciech Puchar , freebsd-net@freebsd.org, Mitya , freebsd-hackers@freebsd.org 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:27:00 -0000 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