summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/h8300-div-delay-slot.c')
-rw-r--r--gcc/testsuite/gcc.dg/h8300-div-delay-slot.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c b/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c
new file mode 100644
index 000000000..5fa60ec4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c
@@ -0,0 +1,19 @@
+/* Make sure that the H8 backend does not generate a div
+ instruction in a delay slot. */
+/* { dg-options "-Os" } */
+/* { dg-skip-if "" { "h8300*-*-*" } "*" "-msx*" } */
+/* { dg-final { scan-assembler-not "\tbra/s\t.*\n\tdiv*" } } */
+
+extern volatile unsigned long timer_ticks;
+#define timer_ms_elapsed(ticks) (((unsigned long)(timer_ticks-ticks))/10)
+unsigned long ticks;
+
+unsigned tst_read( unsigned char idx )
+{
+ switch( idx )
+ {
+ case 0x62: return timer_ms_elapsed(ticks);
+ case 0x61: return timer_ticks;
+ default: return 0;
+ }
+}