(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
sdiv_costs_1.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O3" } */
       3  
       4  /* Both sdiv and udiv can be used here, so prefer udiv.  */
       5  int f1 (unsigned char *p)
       6  {
       7    return 100 / p[1];
       8  }
       9  
      10  int f2 (unsigned char *p, unsigned short x)
      11  {
      12    return x / p[0];
      13  }
      14  
      15  int f3 (unsigned char *p, int x)
      16  {
      17    x &= 0x7fffffff;
      18    return x / p[0];
      19  }
      20  
      21  int f5 (unsigned char *p, unsigned short x)
      22  {
      23    return x % p[0];
      24  }
      25  
      26  /* This should only generate signed divisions.  */
      27  int f4 (unsigned char *p)
      28  {
      29    return -100 / p[1];
      30  }
      31  
      32  int f6 (unsigned char *p, short x)
      33  {
      34    return x % p[0];
      35  }
      36  
      37  /* { dg-final { scan-assembler-times "udiv\tw\[0-9\]+, w\[0-9\]+" 4 } } */
      38  /* { dg-final { scan-assembler-times "sdiv\tw\[0-9\]+, w\[0-9\]+" 2 } } */