blob: 0810c270fd2fb02ef41d20d51f85e14ffcacdc7b [file] [log] [blame]
sewardj0c7a4f92005-03-25 20:29:00 +00001
2#include <stdio.h>
3#include <math.h>
4
5double d;
6int i;
7
8extern void do_tst ( void );
9
10asm(
11"\n"
12"do_tst:\n"
13"\txorl %eax,%eax\n"
14"\tfld d\n"
15"\tfxam\n"
16"\tfnstsw %ax\n"
17"\tffree %st(0)\n"
18"\tmovl %eax, i\n"
19"\tret\n"
20);
21
22int main ( void )
23{
24 d = -1.23; do_tst(); printf("%f -> 0x%x\n", d, i );
25 d = 0.0; do_tst(); printf("%f -> 0x%x\n", d, i );
26 d = 9.87; do_tst(); printf("%f -> 0x%x\n", d, i );
27 return 0;
28}