This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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 RL78] Update crt0.S


Hi DJ,
Thanks for your prompt review.

>> +        bz      $_bss_zero_done
>> +        br      $1b
>> 
>> +_bss_zero_done:

>Any reason to not do this?
>
>	bnz $1b
>_bss_zero_done:

Yes, that should make it more compact, I should have thought of that earlier.
Please find below an updated patch. This is regression tested and will also reduce code size
by 2 bytes as compared to the earlier version.

Best Regards,
Kaushik
p.s. Kindly ignore any disclaimers at end of this e-mail as they are auto-inserted.

2015-10-15  Kaushik Phatak <kaushik.phatak@kpit.com>

        * rl78/crt0.S (_start): Fixed code that clears .bss

===================================================================
--- libgloss/rl78/crt0.S	(revision 2805)
+++ libgloss/rl78/crt0.S	(working copy)
@@ -176,17 +176,19 @@
 
 ;; block fill to .bss
 
-	movw	bc, #__bsssize
-	movw	ax, #0
-1:	
-	cmpw	ax, bc
-	bz	$1f
-	movw	__bssstart[bc], ax
-	decw	bc
-	decw	bc
-	br	$1b
-1:	
+	movw    bc, #__bsssize
+	movw    ax, #0
+	cmpw    ax, bc
+	bz      $_bss_zero_done
+1:
+	decw    bc
+	decw    bc
+	movw    __bssstart[bc], ax
+	cmpw    ax, bc
+	bnz      $1b
 
+_bss_zero_done:
+
 	call	!!__rl78_init
 
 #ifdef PROFILE_SUPPORT	/* Defined in gcrt0.S.  */

Attachment: rl78_crt02.diff
Description: rl78_crt02.diff


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