From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HRG6F-0006O1-1o for qemu-devel@nongnu.org; Tue, 13 Mar 2007 19:08:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HRG6D-0006N8-Kh for qemu-devel@nongnu.org; Tue, 13 Mar 2007 19:08:09 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HRG6D-0006N5-E6 for qemu-devel@nongnu.org; Tue, 13 Mar 2007 18:08:09 -0500 Received: from smtp.prismnet.com ([209.198.128.91]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HRG5N-0005E5-Vv for qemu-devel@nongnu.org; Tue, 13 Mar 2007 19:07:18 -0400 Received: from [10.0.1.201] (206-224-83-141-dialup.io.com [206.224.83.141]) by smtp.prismnet.com (8.13.4/8.13.4) with ESMTP id l2DN78nI016826 for ; Tue, 13 Mar 2007 18:07:09 -0500 (CDT) (envelope-from tim@io.com) Mime-Version: 1.0 (Apple Message framework v624) In-Reply-To: References: <200703121450.41180.jseward@acm.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <41decffa258b38db92ab799d6c2990bc@io.com> Content-Transfer-Encoding: 7bit From: Tim Olson Subject: Re: [Qemu-devel] SSE 'maxps' instruction bug? Date: Tue, 13 Mar 2007 18:07:22 -0500 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mar 12, 2007, at 11:27 AM, malc wrote: > > QEMU and Core 2 Duo disagree on the handling of NaNs it seems. > > http://courses.ece.uiuc.edu/ece390/books/labmanual/inst-ref-simd.html > - this implies that MAXPS should leave the NaNs alone, no idea how > normative that is though (and no IA32 manual at hand) I compiled and ran the code that Julian supplied on an AMD processor with SSE, and on qemu-i386 version 0.8.2 built with that system, and both agreed with the Intel Core 2 results that Julian supplied. That means that either qemu changed in this area between v 0.8.2 and 0.9.0, or that the compiler/host combination used to build the qemu binary Julian is running generated bad code for the float compares. The MAXPS instruction is defined to operate on NaNs in such a way that it can be used as a direct replacement for an iterated scalar max operation coded in C like: a = (a > b) ? a : b; Which is exactly how it is coded in qemu (at least in v0.8.2). This relies upon the fact that the greater-than comparison returns false anytime there is an unordered operand (NaN), for either operand -- in which case the result is the second argument. -- Tim Olson