From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64() Date: Fri, 26 Mar 2010 11:03:09 -0700 (PDT) Message-ID: References: <20100326144241.8583.95617.stgit@warthog.procyon.org.uk> <28287.1269625325@redhat.com> <20100326175827.GD20055@linux-mips.org> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:44643 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753056Ab0CZSIc (ORCPT ); Fri, 26 Mar 2010 14:08:32 -0400 In-Reply-To: <20100326175827.GD20055@linux-mips.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Ralf Baechle Cc: David Howells , mingo@elte.hu, tglx@linutronix.de, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org On Fri, 26 Mar 2010, Ralf Baechle wrote: > > My trusty old 486 book [1] in the remarks about the BSF instruction: > > "The documentation on the 80386 and 80486 states that op1 is undefined if > op2 is 0. In reality the 80386 will leave the value in op1 unchanged. > The first versions of the 80486 will change op1 to an undefined value. > Later version again will leave it unchanged." > > [1] Die Intel Familie in German language, by Robert Hummel, 1992 Ok, that explains my memory of us having tried this, at least. But I do wonder if any of the people working for Intel could ask the CPU architects whether we could depend on the "don't write" for 64-bit mode. If AMD already documents the don't-touch semantics, and if Intel were to be ok with documenting it for their 64-bit capable CPU's, we wouldn't then need to rely on undefined behavior. Linus