From 09f72a4bae1164eaa5044eaa58759fa1e6139e6f Mon Sep 17 00:00:00 2001 From: Sabrina Ni Date: Wed, 19 Mar 2014 17:05:43 +0800 Subject: [PATCH 01/15] [nds32] Tweak code for optimization in the longjmp implementation. * newlib/libc/machine/nds32/setjmp.S: Optimize. --- newlib/libc/machine/nds32/setjmp.S | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/newlib/libc/machine/nds32/setjmp.S b/newlib/libc/machine/nds32/setjmp.S index 90b162e..906efab 100644 --- a/newlib/libc/machine/nds32/setjmp.S +++ b/newlib/libc/machine/nds32/setjmp.S @@ -78,10 +78,9 @@ longjmp: lmw.bim $r6, [$r0], $r14, 0x0 lmw.bim $r16, [$r0], $r19, 0xf #endif - /* If the value val is 0, 1 will be returned instead. */ - bnez $r1, 1f - movi $r1, 1 -1: - move $r0, $r1 + /* Set val as return value. If the value val is 0, 1 will be returned + instead. */ + movi $r0, 1 + cmovn $r0, $r1, $r1 /* r0=(r1!=0)? r1: r0 */ ret .size longjmp, .-longjmp -- 1.9.0