3 #include "tests/malloc.h"
5 /* This is a Marie Celeste instruction. Some IBM documents think it
6 exists, others don't. The same appears to be true for
7 implementations - ppc970 doesn't think it exists, but POWER5
9 double do_fre ( double x
)
15 ".long 0xfc200830\n\t" /* == fre %%f1,%%f1 */
18 : /*in*/ "b" (&block
[0])
19 : /*trash*/ "memory", "fr1"
24 double do_fres ( double x
)
33 : /*in*/ "b" (&block
[0])
34 : /*trash*/ "memory", "fr1"
39 double do_frsqrte ( double x
)
45 "frsqrte %%f1,%%f1\n\t"
48 : /*in*/ "b" (&block
[0])
49 : /*trash*/ "memory", "fr1"
54 /* Another Marie Celeste insn. */
55 double do_frsqrtes ( double x
)
61 ".long 0xec200834\n\t" /* == frsqrtes %%f1,%%f1 */
64 : /*in*/ "b" (&block
[0])
65 : /*trash*/ "memory", "fr1"
70 ////////////////////////////////////////////////////////////
72 void do_one ( char* name
,
74 double* args
, int nargs
,
75 char* argfmt
, char* resfmt
)
81 for (i
= 0; i
< nargs
; i
++) {
95 double* args
= malloc(nargs
* sizeof(double));
97 args
[1] = 1.0 / 0.0; // inf
98 args
[2] = -args
[1]; // -inf
99 args
[3] = args
[2]/args
[2]; // nan
100 args
[4] = -args
[3]; // -nan
116 do_one( "fre", do_fre
, args
, nargs
, "%e", "%4.1e");
117 do_one( "fres", do_fres
, args
, nargs
, "%e", "%4.1e");
119 do_one( "frsqrte", do_frsqrte
, args
, nargs
, "%e", "%4.1e");
120 do_one( "frsqrtes", do_frsqrtes
, args
, nargs
, "%e", "%4.1e");