From 950b2cefe9d9a18c16e87f30fd49c1e30e7a95aa Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 5 Jan 2008 15:05:46 +0000 Subject: [PATCH] fix i386 floating-point sub(a,0,a) 2008-01-05 Paolo Bonzini * lightning/i386/fp-32.h: Fix sub(a,0,a). * lightning/tests/3to2.c: Add new testcases. * lightning/tests/3to2.ok: Add new testcases. git-archimport-id: bonzini@gnu.org--2004b/lightning--stable--1.2--patch-61 --- ChangeLog | 6 ++++++ lightning/i386/fp-32.h | 6 ++++-- tests/3to2.c | 8 ++++++++ tests/3to2.ok | 6 ++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63ea188f4..a7e8841c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-05 Paolo Bonzini + + * lightning/i386/fp-32.h: Fix sub(a,0,a). + * lightning/tests/3to2.c: Add new testcases. + * lightning/tests/3to2.ok: Add new testcases. + 2008-01-02 Paolo Bonzini * lightning/i386/fp-32.h: Fix sub(a,b,a) with a ~= JIT_FPR0. diff --git a/lightning/i386/fp-32.h b/lightning/i386/fp-32.h index 362c95510..b6cd9fd77 100644 --- a/lightning/i386/fp-32.h +++ b/lightning/i386/fp-32.h @@ -7,7 +7,7 @@ /*********************************************************************** * - * Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc. + * Copyright 2000, 2001, 2002, 2004, 2008 Free Software Foundation, Inc. * Written by Paolo Bonzini. * * This file is part of GNU lightning. @@ -63,7 +63,9 @@ ((s2) == 0 ? opr(0, (rd)) \ : (s2) == (s1) ? jit_fxch((rd), op(0, 0)) \ : jit_fxch((rd), op((s2), 0))) \ - : (rd) == (s2) ? jit_fxch((s2), opr((s1), 0)) \ + : (rd) == (s2) ? \ + ((s1) == 0 ? op(0, (rd)) \ + : jit_fxch((rd), opr((s1), 0))) \ : (FLDr (s1), op((s2)+1, 0), FSTPr((rd)+1))) #define jit_addr_d(rd,s1,s2) jit_fp_binary((rd),(s1),(s2),FADDrr,FADDrr) diff --git a/tests/3to2.c b/tests/3to2.c index b829d8492..cc5076736 100644 --- a/tests/3to2.c +++ b/tests/3to2.c @@ -114,6 +114,10 @@ main () test_double (JIT_FPR3, JIT_FPR1, JIT_FPR3); test_double (JIT_FPR3, JIT_FPR1, JIT_FPR2); + test_double (JIT_FPR3, JIT_FPR0, JIT_FPR0); + test_double (JIT_FPR3, JIT_FPR0, JIT_FPR3); + test_double (JIT_FPR3, JIT_FPR3, JIT_FPR0); + test_int (JIT_R0, JIT_R0, JIT_R0); test_int (JIT_R0, JIT_R0, JIT_R1); test_int (JIT_R0, JIT_R1, JIT_R0); @@ -124,6 +128,10 @@ main () test_int (JIT_V0, JIT_R1, JIT_V0); test_int (JIT_V0, JIT_R1, JIT_R2); + test_int (JIT_V0, JIT_R0, JIT_R0); + test_int (JIT_V0, JIT_R0, JIT_V0); + test_int (JIT_V0, JIT_V0, JIT_R0); + return 0; } #else diff --git a/tests/3to2.ok b/tests/3to2.ok index 8eec0b665..e97e0fc05 100644 --- a/tests/3to2.ok +++ b/tests/3to2.ok @@ -9,8 +9,14 @@ 0 0 1 1 1 1 +0 0 +1 1 +1 1 1 1 0 0 1 1 1 1 1 1 +0 0 +1 1 +1 1