(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr83210.c
       1  /* PR target/83210 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2" } */
       4  /* { dg-final { scan-assembler-not {\mmul[lq]\M} } } */
       5  
       6  void bar (void);
       7  
       8  unsigned
       9  f1 (unsigned int x)
      10  {
      11    unsigned res;
      12    if (__builtin_mul_overflow (x, 2, &res))
      13      bar ();
      14    return res;
      15  }
      16  
      17  unsigned long
      18  f2 (unsigned long x)
      19  {
      20    unsigned long res;
      21    if (__builtin_mul_overflow (16, x, &res))
      22      bar ();
      23    return res;
      24  }
      25  
      26  unsigned long long
      27  f3 (unsigned long long x)
      28  {
      29    unsigned long long res;
      30    if (__builtin_mul_overflow (x, (1ULL << (__SIZEOF_LONG_LONG__ * __CHAR_BIT__ - 1)), &res))
      31      bar ();
      32    return res;
      33  }
      34  
      35  #ifdef __SIZEOF_INT128__
      36  unsigned __int128
      37  f4 (unsigned __int128 x)
      38  {
      39    unsigned __int128 res;
      40    if (__builtin_mul_overflow (x, (((unsigned __int128) 1) << (__SIZEOF_INT128__ * __CHAR_BIT__ / 2)), &res))
      41      bar ();
      42    return res;
      43  }
      44  
      45  unsigned __int128
      46  f5 (unsigned __int128 x)
      47  {
      48    unsigned __int128 res;
      49    if (__builtin_mul_overflow (x, (((unsigned __int128) 1) << (__SIZEOF_INT128__ * __CHAR_BIT__ / 2 + 3)), &res))
      50      bar ();
      51    return res;
      52  }
      53  #endif