(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
divmod-6.c
       1  /* { dg-require-effective-target divmod } */
       2  /* { dg-options "-O2 -fdump-tree-widening_mul-details" } */
       3  
       4  typedef int SImode __attribute__((mode(SI)));
       5  typedef unsigned USImode __attribute__((mode(SI)));
       6  
       7  typedef int DImode __attribute__((mode(DI)));
       8  typedef unsigned UDImode __attribute__((mode(DI)));
       9  
      10  extern int cond;
      11  void foo(void);
      12  
      13  #define FOO(smalltype, bigtype, no)	 \
      14  bigtype f_##no(smalltype x, bigtype y)   \
      15  {					 \
      16    bigtype q = x / y;                     \
      17    bigtype r1 = 0, r2 = 0;                \
      18    if (cond)                              \
      19      r1 = x % y;                          \
      20    else                                   \
      21      r2 = x % y;                          \
      22    return q + r1 + r2;                    \
      23  }
      24  
      25  FOO(SImode, DImode, 3)
      26  FOO(SImode, UDImode, 4)
      27  FOO(USImode, DImode, 6)
      28  FOO(USImode, UDImode, 7)
      29  FOO(DImode, DImode, 8)
      30  FOO(DImode, UDImode, 9)
      31  FOO(UDImode, UDImode, 10)
      32  
      33  /* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */