www.digitalmars.com         C & C++   DMDScript  

D.gnu - jnp Assembler

reply Manfred Hansen <m.hansen kielnet.net> writes:
Hello,

the following programm runs with dmd but didn't with gdc .
 
import tango.io.Stdout;

real sin(real x)
{
        asm {
                fld x;
                fsin;
                sahf;
                jnp Lret;
        }
        end:
                return real.nan;
        Lret:
                ;
}
void main() {
        real r = sin(1);
        Stdout(r);
}

hansen hansen-lx:~/dd/tango$ rebuild fsin_gdc.d
./nmd_fsin_gdc.o: In function `_D8fsin_gdc3sinFeZe':
fsin_gdc.d:(.text+0xe): undefined reference to `.LDASM1'
collect2: ld returned 1 exit status

I think the problem is the "jnp Lret; command.


I also looked in Math.d for tangens from tango. 

real tan(real x)
{
    version (GNU) {
        return tanl(x);
    } else {
    asm
    {
    fld x[EBP]          ; // load theta
    ...
They make a difference between dmd and gdc Compiler.
(In Phobos not)

Is a jump outside the asm block not possible with gdc?
 
Manfred

 
Jun 05 2007
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manfred Hansen schrieb am 2007-06-05:
 Hello,

 the following programm runs with dmd but didn't with gdc .
  
 import tango.io.Stdout;

 real sin(real x)
 {
         asm {
                 fld x;
                 fsin;
                 sahf;
                 jnp Lret;
         }
         end:
                 return real.nan;
         Lret:
                 ;
 }
 void main() {
         real r = sin(1);
         Stdout(r);
 }

 hansen hansen-lx:~/dd/tango$ rebuild fsin_gdc.d
 ./nmd_fsin_gdc.o: In function `_D8fsin_gdc3sinFeZe':
 fsin_gdc.d:(.text+0xe): undefined reference to `.LDASM1'
 collect2: ld returned 1 exit status

 I think the problem is the "jnp Lret; command.
[snip]
 Is a jump outside the asm block not possible with gdc?
http://d.puremagic.com/issues/show_bug.cgi?id=747 Thomas -----BEGIN PGP SIGNATURE----- iQIVAwUBRmW6xbZlboUnBhRKAQJGwxAApWAAuAFHXzZpn1LDmp1XqOWs78mhLx8w kIhVoZa5pEQmL6eyAgNDqHlowDqwEkjtaGZzIjIFDKKpEoBm9mchRxUOJ3GUDp1a ITzSJwCM6qMN2kQZot63ZKPr+2myudSWpZfZ+xAyXlguTq/953KW23Olrdf3UhaP dI3Vf97V0TwC7cwG6NZoXlaUs4Xl7/zcch9V3/C7+hc2SSFIxJo2C1FHrSe6qmWQ f5i20MnHs8zL76QxWfkYNlDWrrgXgI7xOg1ZM0sAQHna29KbZ3uDHRXhAxdDHv+s mnirfXEqao2bSIBgYap6XwtU+dkR5lYFgtC4I5bxUnzqos0d8RQNve0nW8GBueWq 8PjkDSo71Oyvd7Kh5SRZ3lvQT9gHEvGCj/U9ts7uAsJ40UMGHAGdh8YA1TeE1jdo J3PjJKz156x1H5ysdwPX6twXM5RBgFC7Xv0HlBpGnWHfgKUh8e/xSuIC+TnZoyXk PrO8OwiTWmHoY0pMww1c29W2BxgfKzzBSaBgZDp2dGu1iyrQZY916FV/3AQD5C0u 5wMdG8vEAdAComcdsSxqAkzWZCh51WFluMfbaHi6aOY/rBTYOE1bPlwklm3C/Cru dOFsM7V8LIz9TGCwVuSASW2+kbBsE1fSC4g6DFK+HQe2B23GlenB595RJwXr7Y+9 n90LyfbDbjk= =p6Ml -----END PGP SIGNATURE-----
Jun 05 2007
parent Manfred Hansen <m.hansen kielnet.net> writes:
Thanks

Thomas Kuehne wrote:

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Manfred Hansen schrieb am 2007-06-05:
 Hello,

 the following programm runs with dmd but didn't with gdc .
  
 import tango.io.Stdout;

 real sin(real x)
 {
         asm {
                 fld x;
                 fsin;
                 sahf;
                 jnp Lret;
         }
         end:
                 return real.nan;
         Lret:
                 ;
 }
 void main() {
         real r = sin(1);
         Stdout(r);
 }

 hansen hansen-lx:~/dd/tango$ rebuild fsin_gdc.d
 ./nmd_fsin_gdc.o: In function `_D8fsin_gdc3sinFeZe':
 fsin_gdc.d:(.text+0xe): undefined reference to `.LDASM1'
 collect2: ld returned 1 exit status

 I think the problem is the "jnp Lret; command.
[snip]
 Is a jump outside the asm block not possible with gdc?
http://d.puremagic.com/issues/show_bug.cgi?id=747 Thomas -----BEGIN PGP SIGNATURE----- iQIVAwUBRmW6xbZlboUnBhRKAQJGwxAApWAAuAFHXzZpn1LDmp1XqOWs78mhLx8w kIhVoZa5pEQmL6eyAgNDqHlowDqwEkjtaGZzIjIFDKKpEoBm9mchRxUOJ3GUDp1a ITzSJwCM6qMN2kQZot63ZKPr+2myudSWpZfZ+xAyXlguTq/953KW23Olrdf3UhaP dI3Vf97V0TwC7cwG6NZoXlaUs4Xl7/zcch9V3/C7+hc2SSFIxJo2C1FHrSe6qmWQ f5i20MnHs8zL76QxWfkYNlDWrrgXgI7xOg1ZM0sAQHna29KbZ3uDHRXhAxdDHv+s mnirfXEqao2bSIBgYap6XwtU+dkR5lYFgtC4I5bxUnzqos0d8RQNve0nW8GBueWq 8PjkDSo71Oyvd7Kh5SRZ3lvQT9gHEvGCj/U9ts7uAsJ40UMGHAGdh8YA1TeE1jdo J3PjJKz156x1H5ysdwPX6twXM5RBgFC7Xv0HlBpGnWHfgKUh8e/xSuIC+TnZoyXk PrO8OwiTWmHoY0pMww1c29W2BxgfKzzBSaBgZDp2dGu1iyrQZY916FV/3AQD5C0u 5wMdG8vEAdAComcdsSxqAkzWZCh51WFluMfbaHi6aOY/rBTYOE1bPlwklm3C/Cru dOFsM7V8LIz9TGCwVuSASW2+kbBsE1fSC4g6DFK+HQe2B23GlenB595RJwXr7Y+9 n90LyfbDbjk= =p6Ml -----END PGP SIGNATURE-----
Jun 05 2007