From patchwork Wed Aug 17 20:47:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryce Lanham X-Patchwork-Id: 110407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 92D92B6FAF for ; Thu, 18 Aug 2011 08:35:03 +1000 (EST) Received: from localhost ([::1]:60523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtohQ-0006zD-O8 for incoming@patchwork.ozlabs.org; Wed, 17 Aug 2011 18:35:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtn4M-0000Nx-4i for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qtn4K-00077T-SN for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:34 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:35219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qtn4K-0006n9-Pm for qemu-devel@nongnu.org; Wed, 17 Aug 2011 16:50:32 -0400 Received: by mail-yi0-f45.google.com with SMTP id 10so1232200yih.4 for ; Wed, 17 Aug 2011 13:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=dlO1d2uO0tPLzbw6CyjKwAoyuEocFdyGHZAmPH3RDLM=; b=G1bZt9gOSqJwwcxr1FjhgrW0ABXoHWbL5BhcTE5uIEln7Q9UQgHUozEp6DY7VWXdL9 xwk5964CpXGvwvizchZEZnS6BhwZppgcDIzPns2GP+ad7JvSJcC9AXDHNYvIiPkJacNd q/rNmPEi/5PjHlb5WVNZCqUX253js9NAFDYQA= Received: by 10.236.125.225 with SMTP id z61mr4768096yhh.194.1313614232566; Wed, 17 Aug 2011 13:50:32 -0700 (PDT) Received: from localhost.localdomain (betelgeuse.cs.uchicago.edu [128.135.24.226]) by mx.google.com with ESMTPS id a29sm1237029yhj.59.2011.08.17.13.50.31 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 13:50:31 -0700 (PDT) From: Bryce Lanham To: qemu-devel@nongnu.org Date: Wed, 17 Aug 2011 15:47:32 -0500 Message-Id: <1313614076-28878-88-git-send-email-blanham@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1313614076-28878-1-git-send-email-blanham@gmail.com> References: <1313614076-28878-1-git-send-email-blanham@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.218.45 Cc: Laurent Vivier Subject: [Qemu-devel] [PATCH 087/111] m68k: fcmp correctly compares infinity. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laurent Vivier seen with gcc testsuite, gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/960405-1.c Signed-off-by: Laurent Vivier --- target-m68k/helper.c | 4 ++-- tests/m68k/Makefile | 2 +- tests/m68k/inf.S | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 tests/m68k/inf.S diff --git a/target-m68k/helper.c b/target-m68k/helper.c index 62aadfd..6cc4202 100644 --- a/target-m68k/helper.c +++ b/target-m68k/helper.c @@ -1581,8 +1581,8 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env) /* +/-inf compares equal against itself, but sub returns nan. */ if (!floatx80_is_any_nan(FP0_to_floatx80(env)) && !floatx80_is_any_nan(FP1_to_floatx80(env))) { - if (floatx80_lt_quiet(FP1_to_floatx80(env), floatx80_zero, - &env->fp_status)) + res = floatx80_zero; + if (floatx80_lt_quiet(FP1_to_floatx80(env), res, &env->fp_status)) res = floatx80_chs(res); } } diff --git a/tests/m68k/Makefile b/tests/m68k/Makefile index d043aeb..27525d3 100644 --- a/tests/m68k/Makefile +++ b/tests/m68k/Makefile @@ -1,5 +1,5 @@ TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale flogn fetox \ - bfins + bfins inf all: $(TESTS) diff --git a/tests/m68k/inf.S b/tests/m68k/inf.S new file mode 100644 index 0000000..2b2de84 --- /dev/null +++ b/tests/m68k/inf.S @@ -0,0 +1,17 @@ + .include "trap.i" + + .data +X: .long 0x7ffe0000, 0x80000000, 0x00000000 + + .text + .globl _start +_start: + fmove.x X, %fp0 + fmove.x X, %fp1 + fadd.x %fp0, %fp1 + fmul.l #2,%fp0 + fcmp.x %fp0, %fp1 + fbeq a + nop +a: + exit 0