match.pd: Fold vec_perm with view_convert
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / float128-hw11.c
bloba3fe8d0b95d6bb3d70390b4cc3f672330c5e300f
1 /* { dg-do run { target lp64 } } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-require-effective-target float128 } */
4 /* { dg-options "-mvsx -O2" } */
5 /* { dg-additional-options "-mdejagnu-cpu=power9" { target { ! has_arch_pwr9 } } } */
7 #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
8 #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
10 #include <math.h>
11 #include <stdlib.h>
12 #include <stddef.h>
14 extern _Float128 roundf128 (_Float128);
15 extern _Float128 floorf128 (_Float128);
16 extern _Float128 ceilf128 (_Float128);
17 extern _Float128 truncf128 (_Float128);
19 static const struct {
20 _Float128 value;
21 _Float128 exp_round;
22 _Float128 exp_floor;
23 _Float128 exp_ceil;
24 _Float128 exp_trunc;
25 } a[] = {
26 { -2.0Q, -2.0Q, -2.0Q, -2.0Q, -2.0Q },
27 { -1.7Q, -2.0Q, -2.0Q, -1.0Q, -1.0Q },
28 { -1.5Q, -2.0Q, -2.0Q, -1.0Q, -1.0Q },
29 { -1.3Q, -1.0Q, -2.0Q, -1.0Q, -1.0Q },
30 { +0.0Q, +0.0Q, +0.0Q, +0.0Q, +0.0Q },
31 { +1.3Q, +1.0Q, +1.0Q, +2.0Q, +1.0Q },
32 { +1.5Q, +2.0Q, +1.0Q, +2.0Q, +1.0Q },
33 { +1.7Q, +2.0Q, +1.0Q, +2.0Q, +1.0Q },
34 { +2.0Q, +2.0Q, +2.0Q, +2.0Q, +2.0Q }
37 int
38 main (void)
40 size_t i;
41 _Float128 v;
43 for (i = 0; i < sizeof (a) / sizeof (a[0]); i++)
45 v = a[i].value;
46 if (roundf128 (v) != a[i].exp_round)
47 abort ();
49 if (floorf128 (v) != a[i].exp_floor)
50 abort ();
52 if (ceilf128 (v) != a[i].exp_ceil)
53 abort ();
55 if (truncf128 (v) != a[i].exp_trunc)
56 abort ();
59 return 0;