xref: /qemu/tests/tcg/i386/test-i386-pseudo-denormal.c (revision be53fa785ab766d2722628403edee75b3e6ab599)
1 /* Test pseudo-denormal operations.  */
2 
3 #include <stdint.h>
4 #include <stdio.h>
5 
6 union u {
7     struct { uint64_t sig; uint16_t sign_exp; } s;
8     long double ld;
9 };
10 
11 volatile union u ld_pseudo_m16382 = { .s = { UINT64_C(1) << 63, 0 } };
12 
13 volatile long double ld_res;
14 
15 int main(void)
16 {
17     int ret = 0;
18     ld_res = ld_pseudo_m16382.ld + ld_pseudo_m16382.ld;
19     if (ld_res != 0x1p-16381L) {
20         printf("FAIL: pseudo-denormal add\n");
21         ret = 1;
22     }
23     if (ld_pseudo_m16382.ld != 0x1p-16382L) {
24         printf("FAIL: pseudo-denormal compare\n");
25         ret = 1;
26     }
27     return ret;
28 }
29