Bug 385411 s390x: Tests and internals for z13 vector FP support
[valgrind.git] / none / tests / x86 / fxtract.c
blob235cda72c4b6150821b642cbcd97dff46fede8f8
1 #include "tests/asm.h"
2 #include <stdio.h>
3 #include <math.h>
5 double arg, res1, res2;
7 extern void do_fxtract ( void );
8 asm("\n"
9 VG_SYM(do_fxtract) ":\n"
10 "\tfinit\n"
11 "\tfldl " VG_SYM(arg) "\n"
12 "\tfxtract\n"
13 "\tfstpl " VG_SYM(res1) "\n"
14 "\tfstpl " VG_SYM(res2) "\n"
15 "\tret"
18 void try ( double x )
20 arg = x * 1.414213562373049;
21 res1 = res2 = 0.0;
22 do_fxtract();
23 printf("%17.10e -> %14.10f %14.10f\n", arg, res1, res2);
26 int main ( void )
28 int i;
30 /* positives */
32 for (i = 0; i < 40; i++)
33 try( 1.27 + (double)(i*10 - 200) );
35 try(+0.0);
36 try(1.0 / 0.0);
37 try(sqrt(-1.0));
39 try(5.1e-308);
40 try(4.1e-308);
41 try(3.1e-308);
42 try(2.1e-308);
43 try(1.1e-308);
44 try(0.9e-308);
45 try(0.7e-308);
46 try(0.6e-308);
47 try(0.5e-308);
48 try(0.4e-308);
49 try(0.3e-308);
50 try(0.1e-308);
52 try(1.3e-320);
53 try(1.3e-321);
54 try(1.3e-322);
55 try(1.3e-323);
56 try(0.9e-323);
57 try(0.7e-323);
58 try(0.5e-323);
59 try(0.3e-323);
60 try(0.2e-323);
61 try(1.3e-324);
63 /* negatives */
65 printf("\n");
66 for (i = 0; i < 40; i++)
67 try( - (1.27 + (double)(i*10 - 200)) );
69 try(-0.0);
70 try(-(1.0 / 0.0));
71 try(-sqrt(-1.0));
73 try(-5.1e-308);
74 try(-4.1e-308);
75 try(-3.1e-308);
76 try(-2.1e-308);
77 try(-1.1e-308);
78 try(-0.9e-308);
79 try(-0.7e-308);
80 try(-0.6e-308);
81 try(-0.5e-308);
82 try(-0.4e-308);
83 try(-0.3e-308);
84 try(-0.1e-308);
86 try(-1.3e-320);
87 try(-1.3e-321);
88 try(-1.3e-322);
89 try(-1.3e-323);
90 try(-0.9e-323);
91 try(-0.7e-323);
92 try(-0.5e-323);
93 try(-0.3e-323);
94 try(-0.2e-323);
95 try(-1.3e-324);
97 return 0;