h8300-div-delay-slot.c: New test.
authorKaushik Phatak <kaushik.phatak@kpitcummins.com>
Wed, 10 Mar 2010 15:48:52 +0000 (15:48 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 10 Mar 2010 15:48:52 +0000 (08:48 -0700)
        * gcc.dg/h8300-div-delay-slot.c: New test.

From-SVN: r157340

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/h8300-div-delay-slot.c [new file with mode: 0644]

index edb88dd099b630119a2f264376e270808982aa23..e58f57d82e74a3c3900303a2b73a22e30a377653 100644 (file)
@@ -1,3 +1,7 @@
+2010-03-10  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
+
+       * gcc.dg/h8300-div-delay-slot.c: New test.
+
 2010-03-10  Alexander Monakov  <amonakov@ispras.ru>
 
        PR tree-optimization/43236
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 (file)
index 0000000..5fa60ec
--- /dev/null
@@ -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;
+        }
+}