Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-22 Thread G 3


On Jun 22, 2017, at 3:25 AM, Peter Maydell wrote:


On 22 June 2017 at 03:54, G 3  wrote:
The advantage a test image would have is the user doesn't have to  
worry
about compiling a test using a cross compiler. Everything the user  
would

need to test QEMU is already inside the image file (hopefully).

Is the setup you want something like running 'make test' ? I  
imagine binary
files included with QEMU would test the emulated CPU. There would  
be no need

to cross compile anything.


I want our tests to be easy to add new tests for, and easy
for anybody to recreate the binary files. Certainly providing
pre-built binaries would be helpful (faster than rebuilding
whole system images), but we must have an automated mechanism
for saying "build this image from sources" too, so that if
we want to update the test program later it's easy to do that,
or if we want to add a second test that's like the first
one but slightly modified we can easily do that too.


So what you want is a test system that is easy to write. Maybe as  
easy as writing a python script? What I thought up is a collection of  
functions that implement assembly language code. Say you want to make  
a test that runs the fadds instruction. You might run it like this:


def my_float_test:
inputA = 0.5
inputB = 0.25
result = fadds(inputA, inputB)
if result != 0.75:
print("Error with fadds calculation")
if get_FPSCR() != expect_fpscr_value:
print("FPSCR error")


Then all we would be left to figure out is how to turn this code into  
a mach-o or elf binary. Then again this might not be a requirement.  
What if we had python running on the guest. The above code might work  
as is. No cross compiling required.


Implementing the callable assembly language code from python could be  
done using a single command-line program. This program would simply  
receive its arguments and return a value. If this program was called  
assembly _adapter, it would run like this:


% assembly_adapter fadds 0.5 0.25

The return value of this command is where we would see the result.  
This command-line program would only need to be compiled once and  
included with QEMU. The format of this program's arguments would be  
something like this:


This input would probably work for most instructions but doesn't  
necessarily need to be applied to all instructions.


Would this kind of system be something you want? 



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-22 Thread Peter Maydell
On 22 June 2017 at 03:54, G 3  wrote:
> The advantage a test image would have is the user doesn't have to worry
> about compiling a test using a cross compiler. Everything the user would
> need to test QEMU is already inside the image file (hopefully).
>
> Is the setup you want something like running 'make test' ? I imagine binary
> files included with QEMU would test the emulated CPU. There would be no need
> to cross compile anything.

I want our tests to be easy to add new tests for, and easy
for anybody to recreate the binary files. Certainly providing
pre-built binaries would be helpful (faster than rebuilding
whole system images), but we must have an automated mechanism
for saying "build this image from sources" too, so that if
we want to update the test program later it's easy to do that,
or if we want to add a second test that's like the first
one but slightly modified we can easily do that too.

thanks
-- PMM



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread G 3


On Jun 21, 2017, at 12:28 PM, Peter Maydell wrote:


On 21 June 2017 at 17:27, G 3  wrote:

On Jun 21, 2017, at 12:20 PM, Peter Maydell wrote:

We don't yet have any mechanism for having tests that need to
be compiled for the target architecture, do we?



I don't know about that but I do know we have image files that can  
be booted
in various guest. These image files could include tests like the  
floating

point test.

Here is the link to the test images page:
http://wiki.qemu.org/Testing/System_Images


Yes -- those are almost all very out of date, not reproducible
at all and don't cover very many of our systems, because we
don't have a good mechanism for writing tests that need
to be built for the target architecture. I'd like us to
have a setup so that it's easy to say "just add a new test",
rather than accumulating more random images on the wiki...


The advantage a test image would have is the user doesn't have to  
worry about compiling a test using a cross compiler. Everything the  
user would need to test QEMU is already inside the image file  
(hopefully).


Is the setup you want something like running 'make test' ? I imagine  
binary files included with QEMU would test the emulated CPU. There  
would be no need to cross compile anything. 



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread G 3


On Jun 21, 2017, at 12:20 PM, Peter Maydell wrote:

On 21 June 2017 at 17:14, Philippe Mathieu-Daudé   
wrote:
do you think you can add your test as a qtest, to run it with  
check-qtest?


We don't yet have any mechanism for having tests that need to
be compiled for the target architecture, do we?


I don't know about that but I do know we have image files that can be  
booted in various guest. These image files could include tests like  
the floating point test.


Here is the link to the test images page:
http://wiki.qemu.org/Testing/System_Images




Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread G 3


On Jun 21, 2017, at 12:14 PM, Philippe Mathieu-Daudé wrote:


Hi John,

On 05/09/2017 10:58 AM, G 3 wrote:


On May 9, 2017, at 5:55 AM, BALATON Zoltan wrote:


On Tue, 9 May 2017, Aurelien Jarno wrote:

| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in
operand of '&' [-Wparentheses]
|  if ((fpscr >> i) & 0x1 == 1) {
|   ^


Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the
same by chance if 0x1 == 1 is always 1 and ANDing the shifted value
with this is either 0 or 1 so it may give the correct result but not
the way one would think looking at the expression.


I changed it to this:
if (((fpscr >> i) & 0x1) == 1)

Thank you.


do you think you can add your test as a qtest, to run it with check- 
qtest?


Regards,

Phil.


I would like to see floating point tests added to QEMU. Problem is  
they will always fail due to a ton of bugs with the floating point unit.


Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread Alex Bennée

Peter Maydell  writes:

> On 21 June 2017 at 17:14, Philippe Mathieu-Daudé  wrote:
>> do you think you can add your test as a qtest, to run it with check-qtest?
>
> We don't yet have any mechanism for having tests that need to
> be compiled for the target architecture, do we?

I posted a proof of concept a while ago:

  Subject: [RFC/POC PATCH 0/4] Building TCG tests with emdebian cross compilers
  Date: Wed, 14 Dec 2016 17:12:40 +
  Message-Id: <20161214171244.26813-1-alex.ben...@linaro.org>

And I think Pranith respun his TCG tests cleanup with them. But that
work isn't merged yet.

>
> thanks
> -- PMM


--
Alex Bennée



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread Peter Maydell
On 21 June 2017 at 17:27, G 3  wrote:
> On Jun 21, 2017, at 12:20 PM, Peter Maydell wrote:
>> We don't yet have any mechanism for having tests that need to
>> be compiled for the target architecture, do we?
>
>
> I don't know about that but I do know we have image files that can be booted
> in various guest. These image files could include tests like the floating
> point test.
>
> Here is the link to the test images page:
> http://wiki.qemu.org/Testing/System_Images

Yes -- those are almost all very out of date, not reproducible
at all and don't cover very many of our systems, because we
don't have a good mechanism for writing tests that need
to be built for the target architecture. I'd like us to
have a setup so that it's easy to say "just add a new test",
rather than accumulating more random images on the wiki...

thanks
-- PMM



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread Peter Maydell
On 21 June 2017 at 17:14, Philippe Mathieu-Daudé  wrote:
> do you think you can add your test as a qtest, to run it with check-qtest?

We don't yet have any mechanism for having tests that need to
be compiled for the target architecture, do we?

thanks
-- PMM



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-06-21 Thread Philippe Mathieu-Daudé

Hi John,

On 05/09/2017 10:58 AM, G 3 wrote:


On May 9, 2017, at 5:55 AM, BALATON Zoltan wrote:


On Tue, 9 May 2017, Aurelien Jarno wrote:

| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in
operand of '&' [-Wparentheses]
|  if ((fpscr >> i) & 0x1 == 1) {
|   ^


Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the
same by chance if 0x1 == 1 is always 1 and ANDing the shifted value
with this is either 0 or 1 so it may give the correct result but not
the way one would think looking at the expression.


I changed it to this:
if (((fpscr >> i) & 0x1) == 1)

Thank you.


do you think you can add your test as a qtest, to run it with check-qtest?

Regards,

Phil.







Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-05-09 Thread G 3


On May 9, 2017, at 5:55 AM, BALATON Zoltan wrote:


On Tue, 9 May 2017, Aurelien Jarno wrote:

| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in  
operand of '&' [-Wparentheses]

|  if ((fpscr >> i) & 0x1 == 1) {
|   ^


Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the  
same by chance if 0x1 == 1 is always 1 and ANDing the shifted value  
with this is either 0 or 1 so it may give the correct result but  
not the way one would think looking at the expression.


I changed it to this:
if (((fpscr >> i) & 0x1) == 1)

Thank you.



Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs

2017-05-09 Thread BALATON Zoltan

On Tue, 9 May 2017, Aurelien Jarno wrote:

| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in operand of 
'&' [-Wparentheses]
|  if ((fpscr >> i) & 0x1 == 1) {
|   ^


Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the same 
by chance if 0x1 == 1 is always 1 and ANDing the shifted value with this 
is either 0 or 1 so it may give the correct result but not the way one 
would think looking at the expression.


Regards,
BALATON Zoltan