OSDN Git Service

* gcc.dg/h8300-div-delay-slot.c: New test.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Mar 2010 15:48:52 +0000 (15:48 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Mar 2010 15:48:52 +0000 (15:48 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157340 138bc75d-0d04-0410-961f-82ee72b054a4

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

index edb88dd..e58f57d 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;
+        }
+}