qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: G 3 <programmingkidx@gmail.com>
Cc: qemu-ppc@nongnu.org, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Effective way to test PowerPC lwbrx instruction
Date: Thu, 25 Aug 2016 22:30:38 -0400	[thread overview]
Message-ID: <e3e491d3-533a-a7a8-c6c0-af3579e6e46e@redhat.com> (raw)
In-Reply-To: <945CA755-7606-46CD-B095-95F87663A792@gmail.com>

On 25.08.2016 18:55, G 3 wrote:
> 
> On Aug 25, 2016, at 6:03 PM, Thomas Huth wrote:
> 
>> On 25.08.2016 14:54, G 3 wrote:
>>> I'm chasing down a bug with QEMU that causes audio to fail on a Mac OS
>>> guest. In this file:
>>> https://github.com/nixxcode/AppleUSBAudio-273.4.1/blob/master/AppleUSBAudioClip.cpp
>>>
>>> is where a lot of assembly language code is located. I think one or more
>>> of the PowerPC instructions might be incorrectly implemented so I am
>>> checking each one that the file uses. Starting with lwbrx I made this
>>> program that gives this instruction sample inputs and checks them with
>>> real outputs. According to the program QEMU implements this instruction
>>> correctly. Does this program effectively check the lwbrx instruction or
>>> is it missing something?
>> ...
>>>     // Go thru each rA value
>>>     for(rA = 0; rA <=12; rA=rA+4)
>>>     {
>>>         // set the correct answer array for each rA value
>>>         if(rA == 0)
>>>             answer_array = answer_array0;
>>>         else if(rA == 4)
>>>             answer_array = answer_array4;
>>>         else if(rA == 8)
>>>             answer_array = answer_array8;
>>>         else
>>>             answer_array = answer_array12;
>>>
>>>         // Go thru each rB value
>>>         for(index = 0; index < rB_size; index++)
>>>         {
>>>             asm volatile("lwbrx %0, %1, %2" : "=r" (result) : "b%" (rA),
>>> "r" (&(rB[index])));
>>
>> I think you're not testing the case where rA is r0 here (only where the
>> content of rA is 0) ... and rA == r0 is a special case for this
>> instruction, see the PowerISA for details. So you'd need a separate asm
>> volatile statement to test this.
>> (Also a question: What is the "%" here good for? I did not quite
>> understand why you're using that here)
>>
>>  Thomas
> 
> Thank you very much for commenting. For the case where rA is r0, are you
> saying something like this:
> 
> asm volatile("lwbrx %0, 0, %1" : "=r" (result) :  "r" (&(rB[index])));

Yes, this is what I had in mind.

> Didn't find the text 'r0' here, but it did mention this:
> "If GPR RA is 0, then the EA is the contents of GPR RB". Is that the
> same thing?

Yes, I am normally using "r0" instead of "0" so that it can not be
confused that easily with an immediate value.

By the way, if you don't know it yet, you can get the official Power ISA
here:

https://www.power.org/wp-content/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf

> The percent is for me to quickly see if any of the test failed. QEMU is
> at 100% for this test.

I didn't mean the printf statement, but the % character in the "b%" part
of the asm volatile statement.

 Thomas

  reply	other threads:[~2016-08-26  2:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 18:54 [Qemu-devel] Effective way to test PowerPC lwbrx instruction G 3
2016-08-25 22:03 ` Thomas Huth
2016-08-25 22:55   ` G 3
2016-08-26  2:30     ` Thomas Huth [this message]
2016-08-26 12:33       ` G 3

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=e3e491d3-533a-a7a8-c6c0-af3579e6e46e@redhat.com \
    --to=thuth@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).