Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / torture / vshuf-mem.C
blob1d828e33a14043e6dc388ff504d21d3836975bd0
1 // { dg-options "-std=c++11 -Wno-psabi" }
2 // { dg-do run }
3 // { dg-additional-options "-march=z14" { target s390_vxe } }
5 /* This used to trigger (2024-05-28) the vectorize_vec_perm_const
6    backend hook to be invoked with a MEM source operand.  Extracted
7    from onnxruntime's mlas library.  */
9 typedef float V4SF __attribute__((vector_size (16)));
10 typedef int V4SI __attribute__((vector_size (16)));
12 template < unsigned I0, unsigned I1, unsigned I2, unsigned I3 > V4SF
13 MlasShuffleFloat32x4 (V4SF Vector)
15   return __builtin_shuffle (Vector, Vector, V4SI{I0, I1, I2, I3});
18 int
19 main ()
21   V4SF f = { 1.0f, 2.0f, 3.0f, 4.0f };
22   if (MlasShuffleFloat32x4 < 1, 1, 1, 1 > (f)[3] != 2.0f)
23     __builtin_abort ();
24   if (MlasShuffleFloat32x4 < 3, 3, 3, 3 > (f)[1] != 4.0f)
25     __builtin_abort ();
26   return 0;