fprem.c revision 672f7784dfd614eb5ef9ebc1a76aaeaa8a195722
1
2/* Marginally test fprem/fprem1; these are hard to check otherwise */
3
4#include <stdio.h>
5
6double do_fprem ( void )
7{
8  double res;
9  __asm__ __volatile__(
10    "ffree %%st(0)\n\t"
11    "ffree %%st(1)\n\t"
12    "fldpi\n\t"
13    "fldln2\n\t"
14    "fprem\n\t"
15    "fstpl 0(%0)"
16    : : "r"(&res)
17  );
18  return res;
19}
20
21double do_fprem1 ( void )
22{
23  double res;
24  __asm__ __volatile__(
25    "ffree %%st(0)\n\t"
26    "ffree %%st(1)\n\t"
27    "fldpi\n\t"
28    "fldln2\n\t"
29    "fprem1\n\t"
30    "fstpl 0(%0)"
31    : : "r"(&res)
32  );
33  return res;
34}
35
36int main ( void )
37{
38  __asm__ __volatile__("finit");
39  printf("fprem  %f\n", do_fprem());
40  printf("fprem1 %f\n", do_fprem1());
41  return 0;
42}
43