(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
s390/
vector/
vec-shift-1.c
       1  /* { dg-do compile { target { s390*-*-* } } } */
       2  /* { dg-options "-O3 -mzarch -march=z13" } */
       3  
       4  /* { dg-final { scan-assembler-times "veslb" 2 } } */
       5  /* { dg-final { scan-assembler-times "veslh" 2 } } */
       6  /* { dg-final { scan-assembler-times "veslf" 2 } } */
       7  /* { dg-final { scan-assembler-times "veslg" 2 } } */
       8  
       9  /* { dg-final { scan-assembler-times "vesrab" 1 } } */
      10  /* { dg-final { scan-assembler-times "vesrah" 1 } } */
      11  /* { dg-final { scan-assembler-times "vesraf" 1 } } */
      12  /* { dg-final { scan-assembler-times "vesrag" 1 } } */
      13  
      14  /* { dg-final { scan-assembler-times "vesrlb" 1 } } */
      15  /* { dg-final { scan-assembler-times "vesrlh" 1 } } */
      16  /* { dg-final { scan-assembler-times "vesrlf" 1 } } */
      17  /* { dg-final { scan-assembler-times "vesrlg" 1 } } */
      18  
      19  /* { dg-final { scan-assembler-times "veslvb" 2 } } */
      20  /* { dg-final { scan-assembler-times "veslvh" 2 } } */
      21  /* { dg-final { scan-assembler-times "veslvf" 2 } } */
      22  /* { dg-final { scan-assembler-times "veslvg" 2 } } */
      23  
      24  /* { dg-final { scan-assembler-times "vesravb" 1 } } */
      25  /* { dg-final { scan-assembler-times "vesravh" 1 } } */
      26  /* { dg-final { scan-assembler-times "vesravf" 1 } } */
      27  /* { dg-final { scan-assembler-times "vesravg" 1 } } */
      28  
      29  /* { dg-final { scan-assembler-times "vesrlvb" 1 } } */
      30  /* { dg-final { scan-assembler-times "vesrlvh" 1 } } */
      31  /* { dg-final { scan-assembler-times "vesrlvf" 1 } } */
      32  /* { dg-final { scan-assembler-times "vesrlvg" 1 } } */
      33  
      34  typedef __attribute__((vector_size(16))) signed char v16qi;
      35  typedef __attribute__((vector_size(16))) unsigned char uv16qi;
      36  
      37  typedef __attribute__((vector_size(16))) signed short v8hi;
      38  typedef __attribute__((vector_size(16))) unsigned short uv8hi;
      39  
      40  typedef __attribute__((vector_size(16))) signed int v4si;
      41  typedef __attribute__((vector_size(16))) unsigned int uv4si;
      42  
      43  typedef __attribute__((vector_size(16))) signed long long v2di;
      44  typedef __attribute__((vector_size(16))) unsigned long long uv2di;
      45  
      46  uv16qi g_uvqi0, g_uvqi1, g_uvqi2;
      47  v16qi g_vqi0, g_vqi1, g_vqi2;
      48  
      49  uv8hi g_uvhi0, g_uvhi1, g_uvhi2;
      50  v8hi g_vhi0, g_vhi1, g_vhi2;
      51  
      52  uv4si g_uvsi0, g_uvsi1, g_uvsi2;
      53  v4si g_vsi0, g_vsi1, g_vsi2;
      54  
      55  uv2di g_uvdi0, g_uvdi1, g_uvdi2;
      56  v2di g_vdi0, g_vdi1, g_vdi2;
      57  
      58  void
      59  shift_left_by_scalar (int s)
      60  {
      61    g_uvqi0 = g_uvqi1 << s;
      62    g_vqi0 = g_vqi1 << s;
      63    g_uvhi0 = g_uvhi1 << s;
      64    g_vhi0 = g_vhi1 << s;
      65    g_uvsi0 = g_uvsi1 << s;
      66    g_vsi0 = g_vsi1 << s;
      67    g_uvdi0 = g_uvdi1 << s;
      68    g_vdi0 = g_vdi1 << s;
      69  }
      70  
      71  void
      72  shift_right_by_scalar (int s)
      73  {
      74    g_uvqi0 = g_uvqi1 >> s;
      75    g_vqi0 = g_vqi1 >> s;
      76    g_uvhi0 = g_uvhi1 >> s;
      77    g_vhi0 = g_vhi1 >> s;
      78    g_uvsi0 = g_uvsi1 >> s;
      79    g_vsi0 = g_vsi1 >> s;
      80    g_uvdi0 = g_uvdi1 >> s;
      81    g_vdi0 = g_vdi1 >> s;
      82  }
      83  
      84  void
      85  shift_left_by_vector ()
      86  {
      87    g_uvqi0 = g_uvqi1 << g_uvqi2;
      88    g_vqi0 = g_vqi1 << g_vqi2;
      89    g_uvhi0 = g_uvhi1 << g_uvhi2;
      90    g_vhi0 = g_vhi1 << g_vhi2;
      91    g_uvsi0 = g_uvsi1 << g_uvsi2;
      92    g_vsi0 = g_vsi1 << g_vsi2;
      93    g_uvdi0 = g_uvdi1 << g_uvdi2;
      94    g_vdi0 = g_vdi1 << g_vdi2;
      95  }
      96  
      97  void
      98  shift_right_by_vector ()
      99  {
     100    g_uvqi0 = g_uvqi1 >> g_uvqi2;
     101    g_vqi0 = g_vqi1 >> g_vqi2;
     102    g_uvhi0 = g_uvhi1 >> g_uvhi2;
     103    g_vhi0 = g_vhi1 >> g_vhi2;
     104    g_uvsi0 = g_uvsi1 >> g_uvsi2;
     105    g_vsi0 = g_vsi1 >> g_vsi2;
     106    g_uvdi0 = g_uvdi1 >> g_uvdi2;
     107    g_vdi0 = g_vdi1 >> g_vdi2;
     108  }