This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [Patch : H8300] Fix regressions for bit related instructions


Hi,
Thanks for looking into this.

>> It looks like you added a "can_delay" "no" attribute to one of the
>> division patterns.  That change isn't mentioned in the ChangeLog 
>> and I suspect it's a bugfix that probably should be integrated now
>> rather than waiting.  If so, can you split that change into a 
>> distinct patch and submit it so it can be installed onto the trunk
>> immediately?  Do you have a testcase which led to this patch that
>> we could add to the regression testsuite?

The below patch separates out just the change to the "can_delay" 
attribute of the division pattern and also adds a testcase to gcc.dg.

>> Just a few minor comments:
>> Just to be clear, overall the patch looks pretty good -- the stuff
>> above is fairly minor.

Thanks a lot for verifying the patch and useful comments. We will 
address these comments separately.

Regards,
Kaushik Phatak
www.kpitgnutools.com 

=======================Start of Patch================================

ChangeLog
2010-03-05  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>

        * config/h8300/h8300.md (udivsi3): Set can_delay to "no".
        * gcc.dg/h8300-div-delay-slot.c: New test.

--- trunk.orig/gcc/config/h8300/h8300.md	2009-05-12 15:13:48.000000000 +0530
+++ trunk/gcc/config/h8300/h8300.md	2010-03-05 14:57:43.000000000 +0530
@@ -1636,7 +1636,8 @@
 	 (match_operand:SI 2 "reg_or_nibble_operand" "r IP4>X")))]
   "TARGET_H8300SX"
   "divu.l\\t%S2,%S0"
-  [(set_attr "length" "2")])
+  [(set_attr "length" "2")
+   (set_attr "can_delay" "no")])
   
 (define_insn "divsi3"
   [(set (match_operand:SI 0 "register_operand" "=r")
diff -uprN trunk.orig/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c trunk/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c
--- trunk.orig/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c	1970-01-01 05:30:00.000000000 +0530
+++ trunk/gcc/testsuite/gcc.dg/h8300-div-delay-slot.c	2010-03-05 16:02:05.000000000 +0530
@@ -0,0 +1,19 @@
+/* Make sure that the H8 backend does not generate a divu 
+   instruction in a delay slot. */
+/* { dg-options "-Os" } */
+/* { dg-skip-if "" { "h8300*-*-*" } "*" "-msx*" }  */
+/* { dg-final { scan-assembler-not "\tbra/s\t.L2\n\tdivu.l\t*" } } */
+
+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;
+        }
+}		
=========================End Of Patch================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]