1 /* { dg-do run { target *-*-*gnu* } } */
2 /* { dg-additional-options "-D_GNU_SOURCE" } */
3 /* { dg-require-effective-target fenv_exceptions } */
4
5 #include <fenv.h>
6
7 typedef int v4si __attribute__((vector_size(16)));
8 typedef float v4sf __attribute__((vector_size(16)));
9
10 void __attribute__((noipa))
foo(v4si * dstp,v4sf * srcp)11 foo (v4si *dstp, v4sf *srcp)
12 {
13 v4sf src = *srcp;
14 *dstp = (v4si) { src[0], src[1], 3, 4 };
15 }
16
17 void __attribute__((noipa))
bar(v4sf * dstp,v4si * srcp)18 bar (v4sf *dstp, v4si *srcp)
19 {
20 v4si src = *srcp;
21 *dstp = (v4sf) { src[0], src[1], 3.5, 4.5 };
22 }
23
24 int
main()25 main()
26 {
27 feenableexcept (FE_INVALID|FE_INEXACT);
28 v4sf x = (v4sf) { 1, 2, __builtin_nanf (""), 3.5 };
29 v4si y;
30 foo (&y, &x);
31 if (y[0] != 1 || y[1] != 2 || y[2] != 3 || y[3] != 4)
32 __builtin_abort ();
33 y = (v4si) { 0, 1, __INT_MAX__, -__INT_MAX__ };
34 bar (&x, &y);
35 if (x[0] != 0 || x[1] != 1 || x[2] != 3.5 || x[3] != 4.5)
36 __builtin_abort ();
37 return 0;
38 }
39