Mail Archives: djgpp/1997/02/01/06:31:11
On Fri, 31 Jan 97 19:18:29 GMT, frabb AT worldaccess DOT nl wrote:
>I am trying to compiloe this program:
>
>/* find out about sqrt */
>#include <stdio.h>
#include <math.h>
>
>main()
>{
>long double dest, srce = 2.0;
>dest = sqrt(srce);
>printf("%.18Lf\n",dest);
>asm ("fsqrt %1,%0" : "=f" (dest) : "f" (srce));
change asm line to following
asm (
"fldt %1\n\t"
"fsqrt\n\t"
"fstpt %0"
: "=m" (dest)
: "m" (srce));
>printf("%.18Lf\n",dest);
>}
>
>
>There is an error in the asm line, but I can't find it. And yes, I did try to
>find it in Info, and in the faq.
>
>The purpose of the program is to see if there is a difference in the two ways
>to do sqrt. A call to sqrt() gives a double result. Using the hardware FPP
>instruction fsqrt directly should produce a long double.
>Maybe I should download the library sources, but 20:15 hours is a very bad time
>to do so...
>
>frank abbing.
>
I wasn't able to get the compiler to store the destination using a register
constraint so I used the memory constraint with explicit load and stores.
Bill Lanam
- Raw text -