Commit | Line | Data |
---|---|---|
0fa6cf1b MS |
1 | #include <stdio.h> |
2 | #include <math.h> | |
3 | #include <stdlib.h> | |
4 | ||
5 | ||
6 | float no1,no2,no3,no4,no5,no6,no7; | |
7 | float result,resultd,resultld; | |
8 | float *float_memory; | |
9 | long double ldx = 88888888888888888888.88, ldy = 9999999999999999999.99; | |
10 | double x = 100.345, y = 25.7789; | |
11 | /* marks FPU stack as empty */ | |
12 | void empty_fpu_stack() | |
13 | { | |
14 | asm ("ffree %st(1) \n\t" | |
15 | "ffree %st(2) \n\t" | |
16 | "ffree %st(3) \n\t" | |
17 | "ffree %st(4) \n\t" | |
18 | "ffree %st(5) \n\t" | |
19 | "ffree %st(6) \n\t" | |
20 | "ffree %st(7)"); | |
21 | } | |
22 | ||
23 | /* initialization of floats */ | |
24 | void init_floats() | |
25 | { | |
26 | no1 = 10.45; | |
27 | no2 = 20.77; | |
28 | no3 = 156.89874646; | |
29 | no4 = 14.56; | |
30 | no5 = 11.11; | |
31 | no6 = 66.77; | |
32 | no7 = 88.88; | |
33 | float_memory = malloc(sizeof(float) * 4); | |
34 | *float_memory = 256.256; | |
35 | *(float_memory + 1) = 356.356; | |
36 | *(float_memory + 2) = 456.456; | |
37 | *(float_memory + 3) = 556.556; | |
38 | } | |
39 | ||
40 | int main() | |
41 | { | |
42 | init_floats(); | |
43 | empty_fpu_stack(); /* BEGIN I387-FLOAT-REVERSE */ | |
44 | ||
45 | asm("nop"); /* TEST ENV */ | |
46 | asm ("fsave %0" : "=m"(*float_memory) : ); | |
47 | asm ("frstor %0" : : "m"(*float_memory)); | |
48 | asm ("fstsw %ax"); /* test eax register */ | |
49 | ||
50 | asm ("fld1"); | |
51 | asm ("fldl2t"); | |
52 | asm ("fldl2e"); | |
53 | asm ("fldpi"); | |
54 | asm ("fldlg2"); | |
55 | asm ("fldln2"); | |
56 | asm ("fldz"); | |
57 | asm ("nop"); | |
58 | ||
59 | return 1; /* END I387-FLOAT-REVERSE */ | |
60 | } |