December 25, 2006 Re: GDC release 0.20 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | Thomas Kuehne wrote:
> Neither floating point nor MMX nor SSE instructions where the cause but the "cpuid" feature tests.
>
> I had to replace
>
> asm{ cpuid; }
>
> with
> asm{db 0x53; cpuid; db 0x5B;}
Does GDC's asm not support a more clear
asm {push EBX; cpuid; pop EBX; }
?
Or for that matter, doesn't it know what registers are changed by instructions so it can save the ones it needs to preserve (DMD does that IIRC)?
(Or if it isn't sure, doesn't it at least make sure they get pushed & popped as a precaution?)
|
December 27, 2006 Re: GDC release 0.20 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel Attachments: | Frits van Bommel schrieb am 2006-12-25: > Thomas Kuehne wrote: >> Neither floating point nor MMX nor SSE instructions where the cause but the "cpuid" feature tests. >> >> I had to replace >> >> asm{ cpuid; } >> >> with >> asm{db 0x53; cpuid; db 0x5B;} > > Does GDC's asm not support a more clear > asm {push EBX; cpuid; pop EBX; } > ? It does, however if I compile with "-fPIC" GDC errors with: error: PIC register `ebx' clobbered in `asm' > Or for that matter, doesn't it know what registers are changed by > instructions so it can save the ones it needs to preserve (DMD does that > IIRC)? > (Or if it isn't sure, doesn't it at least make sure they get pushed & > popped as a precaution?) DMD preserves them via copying to the stack. GDC doesn't preserve them and apparently only knowns the clobbering rules for some instructions (e.g. pop EBX) but not others (e.g. push EBX). Thomas |
December 27, 2006 Re: GDC release 0.20 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | On Wed, 27 Dec 2006, Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Frits van Bommel schrieb am 2006-12-25:
> > Thomas Kuehne wrote:
> >> Neither floating point nor MMX nor SSE instructions where the cause but the "cpuid" feature tests.
> >>
> >> I had to replace
> >>
> >> asm{ cpuid; }
> >>
> >> with
> >> asm{db 0x53; cpuid; db 0x5B;}
> >
> > Does GDC's asm not support a more clear
> > asm {push EBX; cpuid; pop EBX; }
> > ?
>
> It does, however if I compile with "-fPIC" GDC errors with: error: PIC register `ebx' clobbered in `asm'
>
> > Or for that matter, doesn't it know what registers are changed by
> > instructions so it can save the ones it needs to preserve (DMD does that
> > IIRC)?
> > (Or if it isn't sure, doesn't it at least make sure they get pushed &
> > popped as a precaution?)
>
> DMD preserves them via copying to the stack. GDC doesn't preserve them
> and apparently only knowns the clobbering rules for some instructions
> (e.g. pop EBX) but not others (e.g. push EBX).
>
> Thomas
>
>
> -----BEGIN PGP SIGNATURE-----
>
> iD8DBQFFkkZKLK5blCcjpWoRAnsHAJ4wH4Z6+SiJkllM6S48AXEJCRqWcwCfXUww
> sV5ZrY1kUPbnov5YXAkcTWc=
> =7zkJ
> -----END PGP SIGNATURE-----
I'm not sure which compiler is at 'fault' here, but having them behave differently with the same block of asm code on the same platform seems like a violation of the intent of having asm be part of the language spec. A bug needs to be filed against one of the two compilers.
Later,
Brad
|
Copyright © 1999-2021 by the D Language Foundation