1/* { dg-do run } */ 2/* { dg-options "-O2 -m8bit-idiv" } */ 3 4extern void abort (void); 5 6void 7__attribute__((noinline)) 8test (unsigned int x, unsigned int y, unsigned int q, unsigned int r) 9{ 10 if ((x / y) != q || (x % y) != r) 11 abort (); 12} 13 14int 15main () 16{ 17 test (7, 6, 1, 1); 18 test (255, 254, 1, 1); 19 test (256, 254, 1, 2); 20 test (256, 256, 1, 0); 21 test (254, 256, 0, 254); 22 test (254, 255, 0, 254); 23 test (254, 1, 254, 0); 24 test (255, 2, 127, 1); 25 test (1, 256, 0, 1); 26 test (0x80000000, 0x7fffffff, 1, 1); 27 test (0x7fffffff, 0x80000000, 0, 0x7fffffff); 28 test (0x80000000, 0x80000003, 0, 0x80000000); 29 test (0xfffffffd, 0xfffffffe, 0, 0xfffffffd); 30 return 0; 31} 32