From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bd2kh-0007O7-Q6 for qemu-devel@nongnu.org; Thu, 25 Aug 2016 18:04:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bd2kc-0005M9-Oq for qemu-devel@nongnu.org; Thu, 25 Aug 2016 18:03:58 -0400 References: From: Thomas Huth Message-ID: Date: Thu, 25 Aug 2016 18:03:47 -0400 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Effective way to test PowerPC lwbrx instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: G 3 , qemu-ppc@nongnu.org Cc: QEMU Developers 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