qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Rytarowski <n54@gmx.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Laurent Vivier" <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target/m68k: Change fpu_rom from const static array to switch
Date: Mon, 4 Sep 2017 16:53:30 +0200	[thread overview]
Message-ID: <cfa07f00-a650-a08f-76c4-8412d8d44edf@gmx.com> (raw)
In-Reply-To: <047f9b63-2dcc-e8ba-90c1-965e253fcbf5@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

On 04.09.2017 16:41, Philippe Mathieu-Daudé wrote:
> On 09/04/2017 11:09 AM, Laurent Vivier wrote:
>> Le 04/09/2017 à 15:54, Kamil Rytarowski a écrit :
>>> On 04.09.2017 02:27, Philippe Mathieu-Daudé wrote:
>>>> On 09/03/2017 02:05 PM, Laurent Vivier wrote:
>>>>> Le 03/09/2017 à 18:31, Kamil Rytarowski a écrit :
>>>>>> GCC 4.7.2 on SunOS reports that the values assigned to array members
>>>>>> are not
>>>>>> real constants:
>>>>>>
>>>>>> target/m68k/fpu_helper.c:32:5: error: initializer element is not
>>>>>> constant
>>>>>> target/m68k/fpu_helper.c:32:5: error: (near initialization for
>>>>>> 'fpu_rom[0]')
>>>>>> rules.mak:66: recipe for target 'target/m68k/fpu_helper.o' failed
>>>>>>
>>>>>> Convert the array to switch() to workaround the issue.
>>>>>
>>>>> I don't like the idea. It's really an array and should be managed
>>>>> as an
>>>>> array.
>>>>
>>>> I agree with Laurent.
>>>>
>>>>>
>>>>> Could you try to use make_floatx80_init() instead of make_floatx80() ?
>>>>
>>>> I guess the problem comes from the macro which cast as not const:
>>>>
>>>> #define make_floatx80(exp, mant) ((floatx80) { mant, exp })
>>>>
>>>
>>> Adding const to make_floatx80 - ((const floatx80) { mant, exp }) - does
>>> not fix the problem.
>>>
>>>> make_floatx80_init() doesn't cast so it might work,
>>>> else we could add a macro such const_floatx80():
>>>>
>>>> #define const_floatx80(exp, mant) ((const floatx80) { mant, exp })
>>>
>>> Switching make_floatx80() to make_floatx80_init() in works.
>>>
>>> How about floatx80_zero, floatx80_one etc? We cannot translate them to
>>> make_floatx80_init() as this breaks in other parts of the code in
>>> functions like:
>>>
>>> void helper_fldpi_ST0(CPUX86State *env)
>>> {
>>>      ST0 = floatx80_pi;
>>> }
>>>
>>> -- target/i386/fpu_helper.c
>>>
>>
>> You can:
>>
>> either replace the "#define floatx80_pi make_floatx80(...)" by a "const
>> floatx80 floatx80_pi = make_floatx80_init(...)"
> 
> this won't work with:
> 
> const floatx80 2pi = floatx80_mul(floatx80_pi, floatx80_pi, &s);
> 
> however this should work fine:
> 
> #define floatx80_pi make_floatx80_init(0x4000, 0xc90fdaa22168c235LL)
> 

This breaks as mentioned above, in target/i386/fpu_helper.c.

>>
>> or replace all the macros in the m68k/fpu_helper.c array by
>> make_floatx80_init(...)
>>

I've copied the float_* numbers to target/m68k/fpu_helper.c and it
builds on SmartOS machine with GCC 4.7.2 (from Joyent shell) and on my
local NetBSD workstation with Clang 5.0.0

>> Thanks,
>> Laurent
>>

I'm going to submit the new patch soon.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-09-04 14:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 16:31 [Qemu-devel] [PATCH] target/m68k: Change fpu_rom from const static array to switch Kamil Rytarowski
2017-09-03 17:05 ` Laurent Vivier
2017-09-04  0:27   ` Philippe Mathieu-Daudé
2017-09-04 13:54     ` Kamil Rytarowski
2017-09-04 14:09       ` Laurent Vivier
2017-09-04 14:41         ` Philippe Mathieu-Daudé
2017-09-04 14:53           ` Kamil Rytarowski [this message]
2017-09-04 15:02         ` Peter Maydell
2017-09-04 15:16           ` Kamil Rytarowski
2017-09-04 15:53           ` Laurent Vivier
2017-09-04 16:17             ` Peter Maydell
2017-09-04 16:38               ` Kamil Rytarowski
2017-09-04 16:38                 ` Laurent Vivier
2017-09-04 16:40                   ` Peter Maydell
2017-09-04  8:00 ` no-reply
2017-09-04 16:46 ` [Qemu-devel] [PATCH v2] target/m68k: Switch fpu_rom from make_floatx80() to make_floatx80_init() Kamil Rytarowski
2017-09-04 17:16   ` Philippe Mathieu-Daudé
2017-09-04 17:23   ` Laurent Vivier
2017-09-04 18:01     ` Philippe Mathieu-Daudé
2017-09-04 17:32   ` [Qemu-devel] [PATCH v3] " Kamil Rytarowski
2017-09-04 19:02     ` Laurent Vivier
2017-09-04 21:38       ` Kamil Rytarowski
2017-09-04 21:23     ` [Qemu-devel] [PATCH v4] " Kamil Rytarowski
2017-09-04 21:44       ` Laurent Vivier

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=cfa07f00-a650-a08f-76c4-8412d8d44edf@gmx.com \
    --to=n54@gmx.com \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --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).