qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurel32@debian.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 617528] Re: Incorrect translation of unary PPC/SPE instructions (efdneg etc.)
Date: Sat, 01 Jan 2011 14:29:37 -0000	[thread overview]
Message-ID: <20110101142937.19993.5310.launchpad@palladium.canonical.com> (raw)
In-Reply-To: 20100813182831.6211.99844.malonedeb@palladium.canonical.com

** Changed in: qemu
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/617528

Title:
  Incorrect translation of unary PPC/SPE instructions (efdneg etc.)

Status in QEMU:
  Fix Committed

Bug description:
  The translation for the following PPC/SPE (e500) instructions is wrong in QEMU git 6cbf4c8c:

    evfsabs, evfsnabs, evfsneg
    efdabs, efdnabs, efdneg
    efsabs, efsnabs, efsneg

As you can see from the provided patch, these ought to write their result to the destination register (rD) and not modify the source register (rA) in-place.

It's rather hard to generate a test-case for this with GCC, since it likes to put the input and output of a unary operation into the same registers (that's probably also the reason why this went unnoticed). There is however a broken code path in the EGLIBC function for sin() when compiled for e500v2. It returns nonsense results for e.g. -1.0. Trivial test code follows:

    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>

    int main(int argc, char **argv)
    {
      double x = strtod(argv[1], NULL);
      printf("%.14g\n", sin(x));
      return 0;
    }

Result before the patch (WRONG):

$ qemu-ppc -cpu e500v2 sintest -1.0
-1

Result after the patch (OK):

$ qemu-ppc -cpu e500v2 sintest -1.0
-0.84147071838379

A self-contained test-case using inline assembler can be provided upon request.

  parent reply	other threads:[~2011-01-01 14:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 18:28 [Qemu-devel] [Bug 617528] [NEW] Incorrect translation of unary PPC/SPE instructions (efdneg etc.) Mike Pall
2010-08-13 18:28 ` [Qemu-devel] [Bug 617528] " Mike Pall
2010-08-13 18:52 ` Mike Pall
2010-08-19 14:04 ` Nathan Froyd
2010-08-19 14:30 ` Mike Pall
2011-01-01 14:29 ` Aurelien Jarno [this message]
2011-02-20 17:14 ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110101142937.19993.5310.launchpad@palladium.canonical.com \
    --to=aurel32@debian.org \
    --cc=617528@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).