[ARM] Fix PR85203: cmse_nonsecure_caller returns wrong result
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sdiv_costs_1.c
blob24d7f7df2089398288bdf67a489eb71d733a4450
1 /* { dg-do compile } */
2 /* { dg-options "-O3" } */
4 /* Both sdiv and udiv can be used here, so prefer udiv. */
5 int f1 (unsigned char *p)
7 return 100 / p[1];
10 int f2 (unsigned char *p, unsigned short x)
12 return x / p[0];
15 int f3 (unsigned char *p, int x)
17 x &= 0x7fffffff;
18 return x / p[0];
21 int f5 (unsigned char *p, unsigned short x)
23 return x % p[0];
26 /* This should only generate signed divisions. */
27 int f4 (unsigned char *p)
29 return -100 / p[1];
32 int f6 (unsigned char *p, short x)
34 return x % p[0];
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 } } */