h8300-div-delay-slot.c: New test.
[gcc.git] / gcc / testsuite / gcc.dg / h8300-div-delay-slot.c
1 /* Make sure that the H8 backend does not generate a div
2 instruction in a delay slot. */
3 /* { dg-options "-Os" } */
4 /* { dg-skip-if "" { "h8300*-*-*" } "*" "-msx*" } */
5 /* { dg-final { scan-assembler-not "\tbra/s\t.*\n\tdiv*" } } */
6
7 extern volatile unsigned long timer_ticks;
8 #define timer_ms_elapsed(ticks) (((unsigned long)(timer_ticks-ticks))/10)
9 unsigned long ticks;
10
11 unsigned tst_read( unsigned char idx )
12 {
13 switch( idx )
14 {
15 case 0x62: return timer_ms_elapsed(ticks);
16 case 0x61: return timer_ticks;
17 default: return 0;
18 }
19 }