(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
mul-vectorize-3.c
       1  /* { dg-require-effective-target power10_ok } */
       2  /* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -fdump-tree-vect-details" } */
       3  
       4  /* Test vectorizer can exploit ISA 3.1 instructions Vector Multiply
       5     High Signed/Unsigned Word for both signed and unsigned int high part
       6     multiplication.  */
       7  
       8  #define N 128
       9  
      10  extern signed int si_a[N], si_b[N], si_c[N];
      11  extern unsigned int ui_a[N], ui_b[N], ui_c[N];
      12  
      13  typedef signed long long sLL;
      14  typedef unsigned long long uLL;
      15  
      16  __attribute__ ((noipa)) void
      17  test_si ()
      18  {
      19    for (int i = 0; i < N; i++)
      20      si_c[i] = ((sLL) si_a[i] * (sLL) si_b[i]) >> 32;
      21  }
      22  
      23  __attribute__ ((noipa)) void
      24  test_ui ()
      25  {
      26    for (int i = 0; i < N; i++)
      27      ui_c[i] = ((uLL) ui_a[i] * (uLL) ui_b[i]) >> 32;
      28  }
      29  
      30  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
      31  /* { dg-final { scan-assembler-times {\mvmulhsw\M} 1 } } */
      32  /* { dg-final { scan-assembler-times {\mvmulhuw\M} 1 } } */