5 typedef unsigned long long int ULong
;
8 struct { double d
; int i
; } Res
;
10 static void do_fprem ( Res
* res
, double x
, double y
)
22 "movq %%rax,%%r15\n\t"
23 "xorq %%rax,%%rax\n\t"
27 : /*out*/ "=r" (c3210
), "=m" (f64
)
28 : /*in*/ "m" (xx
), "m" (yy
)
29 : /*trash*/ "r15", "rax", "%st", "%st(1)", "cc"
32 res
->i
= (int)(c3210
& 0x4700); /* mask for C3,2,1,0 */
35 static void show ( char* s
, Res
* res
)
37 printf("%s -> 0x%04x %f\n", s
, (int)res
->i
, (double)res
->d
);
46 do_fprem(&r
, 10.1, 200.2); show("xx1", &r
);
47 do_fprem(&r
, 20.3, 1.44); show("xx2", &r
);
49 for (i
= 0; i
< 20; i
++) {
50 theta
= (2.0 * 3.14159) / 10.0 * (double)i
;
51 do_fprem(&r
, 12.3*sin(theta
), cos(theta
)); show("xx", &r
);