1  /* PR tree-optimization/97997 */
       2  /* { dg-do compile { target { ilp32 || lp64 } } } */
       3  /* { dg-options "-O2 -fdump-tree-optimized" } */
       4  /* { dg-final { scan-tree-dump-times "return x_\[0-9]*\\\(D\\\);" 6 "optimized" } } */
       5  /* { dg-final { scan-tree-dump-not " / " "optimized" } } */
       6  /* { dg-final { scan-tree-dump-not " \\* " "optimized" } } */
       7  
       8  unsigned short
       9  f1 (unsigned short x)
      10  {
      11    return x * 10 / 10;
      12  }
      13  
      14  unsigned short
      15  f2 (unsigned short x)
      16  {
      17    int a = x;
      18    int b = 10;
      19    int c = 10;
      20    return a * b / c;
      21  }
      22  
      23  unsigned short
      24  f3 (unsigned short x)
      25  {
      26    return x * 10U / 10;
      27  }
      28  
      29  unsigned short
      30  f4 (unsigned short x)
      31  {
      32    unsigned a = x;
      33    unsigned b = 10;
      34    unsigned c = 10;
      35    return a * b / c;
      36  }
      37  
      38  unsigned short
      39  f5 (unsigned short x, unsigned short y)
      40  {
      41    return (unsigned) x * y / y;
      42  }
      43  
      44  unsigned int
      45  f6 (unsigned int x, unsigned int y)
      46  {
      47    if (x >= 30000)
      48      __builtin_unreachable ();
      49    if (y >= ~0U / 30000)
      50      __builtin_unreachable ();
      51    return x * y / y;
      52  }