FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / bfp-2.c
blob73349eddd228d07c16ac7dd87fc160cbcb378481
1 #include <stdio.h>
3 /* Test various BFP ops:
4 - square root
5 - load negative
6 - load positive
7 - load complement
8 */
10 void sqebr(float in)
12 float out;
14 __asm__ volatile("sqebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
15 printf("sqebr %f -> %f\n", in, out);
18 void sqdbr(double in)
20 double out;
22 __asm__ volatile("sqdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
23 printf("sqdbr %f -> %f\n", in, out);
26 void lnebr(float in)
28 float out;
30 __asm__ volatile("lnebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
31 printf("lnebr %f -> %f\n", in, out);
34 void lndbr(double in)
36 double out;
38 __asm__ volatile("lndbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
39 printf("lndbr %f -> %f\n", in, out);
42 void lpebr(float in)
44 float out;
46 __asm__ volatile("lpebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
47 printf("lpebr %f -> %f\n", in, out);
50 void lpdbr(double in)
52 double out;
54 __asm__ volatile("lpdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
55 printf("lpdbr %f -> %f\n", in, out);
58 void lcebr(float in)
60 float out;
62 __asm__ volatile("lcebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
63 printf("lcebr %f -> %f\n", in, out);
66 void lcdbr(double in)
68 double out;
70 __asm__ volatile("lcdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in) : "cc");
71 printf("lcdbr %f -> %f\n", in, out);
74 void lder(double prev, float in)
76 unsigned long out;
78 __asm__ volatile("lder %[prev],%[in]\n\t"
79 "std %[prev],%[out]" :
80 [out]"=R"(out) : [prev]"f"(prev), [in]"f"(in));
81 printf("lder %f -> %lx\n", in, out);
84 void lde(double prev, float in)
86 unsigned long out;
88 __asm__ volatile("lde %[prev],%[in]\n\t"
89 "std %[prev],%[out]" :
90 [out]"=R"(out) : [prev]"f"(prev), [in]"R"(in));
91 printf("lde %f -> %lx\n", in, out);
94 int main(void)
96 // square root
97 sqebr(121.0f); // 4 byte values
98 sqdbr(144.0); // 8 bytes values
100 // load negative
101 lnebr(-2.5f); // 4 byte values
102 lnebr(12.5f); // 4 byte values
104 lndbr(-0.5); // 8 byte values
105 lndbr(42.5); // 8 byte values
107 // load positive
108 lpebr(-2.5f); // 4 byte values
109 lpebr(12.5f); // 4 byte values
111 lpdbr(-0.5); // 8 byte values
112 lpdbr(42.5); // 8 byte values
114 // load complement
115 lcebr(-23.5f); // 4 byte values
116 lcebr(123.5f); // 4 byte values
118 lcdbr(-17.5); // 8 byte values
119 lcdbr(234.5); // 8 byte values
121 // load lengthened
122 lder(0.2, 321.5f);
123 lder(0.9, -8388607.f);
124 lde(0.2, -321.5f);
125 lde(0.9, 8388607.f);
127 return 0;