diff mbox

RFA: RL78: Fix gcc testsuite failures

Message ID 87d25qrks7.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Feb. 4, 2015, 11:14 a.m. UTC
Hi DJ,

  Please can I apply the patch below to fix some RL78 gcc testsuite
  failures ?

  The patch does two things:  Firstly in the RL78 assembler version of
  the __addsf3 function it fixes a corner case where rounding up the 
  fraction results in an overflow into an unused bit.  The problem here
  was that the exponent was not being increased to cover this lost bit.

  The second fix is to the RL78 specific dead-code elimination pass
  which was failing to note the REGs inside a MEM are used when that MEM
  is the destination of a SET insn.

  Tested with no regressions and lots of fixes using an rl78-elf
  toolchain.

  OK to apply ?

Cheers
  Nick

libgcc/ChangeLog
2015-02-04  Nick Clifton  <nickc@redhat.com>

	* config/rl78/fpmath-sf.S (__addsf3): Add code for the special
          case where rounding the fraction up results in an overflow
          into unused bits.

gcc/ChangeLog
2015-02-04  Nick Clifton  <nickc@redhat.com>

	* config/rl8/rl78.c (rl78_note_reg_set): If the dest is a MEM
          note that any REGs that is contains are being USED.

Comments

DJ Delorie Feb. 4, 2015, 3:16 p.m. UTC | #1
Ok.
Jan-Benedict Glaw Feb. 7, 2015, 9:51 a.m. UTC | #2
On Wed, 2015-02-04 11:14:16 +0000, Nick Clifton <nickc@redhat.com> wrote:
>   Please can I apply the patch below to fix some RL78 gcc testsuite
>   failures ?
[...]
>   The second fix is to the RL78 specific dead-code elimination pass
>   which was failing to note the REGs inside a MEM are used when that MEM
>   is the destination of a SET insn.
> 
>   Tested with no regressions and lots of fixes using an rl78-elf
>   toolchain.
> 
>   OK to apply ?

Seems you accidentally committed quite some more code you're currently
working on in that very commit, which is now breaking (see eg.
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=417627):

[...]
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I/home/jbglaw/repos/gcc/gcc -I/home/jbglaw/repos/gcc/gcc/. -I/home/jbglaw/repos/gcc/gcc/../include -I/home/jbglaw/repos/gcc/gcc/../libcpp/include  -I/home/jbglaw/repos/gcc/gcc/../libdecnumber -I/home/jbglaw/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/jbglaw/repos/gcc/gcc/../libbacktrace   -o rl78.o -MT rl78.o -MMD -MP -MF ./.deps/rl78.TPo /home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c: In function ‘tree_node* rl78_handle_func_attribute(tree_node**, tree_node*, tree_node*, int, bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:728: warning: unknown conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:728: warning: too many arguments for format
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c: In function ‘tree_node* rl78_handle_saddr_attribute(tree_node**, tree_node*, tree_node*, int, bool*)’:
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:775: warning: unknown conversion type character ‘E’ in format
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:775: warning: too many arguments for format
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c: In function ‘void rl78_alloc_physical_registers()’:
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3465: error: ‘VALLOC_DIVHI’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3470: error: ‘VALLOC_DIVSI’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3512: error: ‘VALLOC_DIVSI’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3519: error: ‘VALLOC_DIVHI’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c: In function ‘void set_origin(rtx_def*, rtx_insn*, int*, int*)’:
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3838: error: ‘VALLOC_DIVHI’ was not declared in this scope
/home/jbglaw/repos/gcc/gcc/config/rl78/rl78.c:3857: error: ‘VALLOC_DIVSI’ was not declared in this scope
make[1]: *** [rl78.o] Error 1


With a more recent compiler, that condenses to:

[...]
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace   -o rl78.o -MT rl78.o -MMD -MP -MF ./.deps/rl78.TPo ../../gcc/gcc/config/rl78/rl78.c
../../gcc/gcc/config/rl78/rl78.c: In function ‘void rl78_alloc_physical_registers()’:
../../gcc/gcc/config/rl78/rl78.c:3465:33: error: ‘VALLOC_DIVHI’ was not declared in this scope
       else if (valloc_method == VALLOC_DIVHI)
                                 ^
../../gcc/gcc/config/rl78/rl78.c:3470:33: error: ‘VALLOC_DIVSI’ was not declared in this scope
       else if (valloc_method == VALLOC_DIVSI)
                                 ^
../../gcc/gcc/config/rl78/rl78.c:3512:7: error: ‘VALLOC_DIVSI’ was not declared in this scope
  case VALLOC_DIVSI:
       ^
../../gcc/gcc/config/rl78/rl78.c:3519:7: error: ‘VALLOC_DIVHI’ was not declared in this scope
  case VALLOC_DIVHI:
       ^
../../gcc/gcc/config/rl78/rl78.c: In function ‘void set_origin(rtx, rtx_insn*, int*, int*)’:
../../gcc/gcc/config/rl78/rl78.c:3838:38: error: ‘VALLOC_DIVHI’ was not declared in this scope
   else if (get_attr_valloc (insn) == VALLOC_DIVHI)
                                      ^
../../gcc/gcc/config/rl78/rl78.c:3857:38: error: ‘VALLOC_DIVSI’ was not declared in this scope
   else if (get_attr_valloc (insn) == VALLOC_DIVSI)
                                      ^
make[1]: *** [rl78.o] Error 1



MfG, JBG
Nick Clifton Feb. 10, 2015, 10:17 a.m. UTC | #3
Hi Jan-Benedict,

> Seems you accidentally committed quite some more code you're currently
> working on in that very commit, which is now breaking

Doh!  Yes, sorry about that.  I have now reverted the DIV attribute part 
of the patch.  (I am hoping that this work will be ready for 
contributing soon, but it is not quite there yet).


Cheers
   Nick
diff mbox

Patch

Index: libgcc/config/rl78/fpmath-sf.S
===================================================================
--- libgcc/config/rl78/fpmath-sf.S	(revision 220389)
+++ libgcc/config/rl78/fpmath-sf.S	(working copy)
@@ -517,8 +517,14 @@ 
 	movw	ax, A_FRAC_L
 	addw	ax, #1
 	movw	A_FRAC_L, ax
-	sknc
+	bnc	$1f
 	incw	A_FRAC_H
+
+	;; If the rounding set the bit beyond the end of the fraction, increment the exponent.
+	mov	a, A_FRAC_HH
+	bf	a.1, $1f
+	incw	A_EXP
+	
 1:	
 	movw	ax, A_FRAC_H
 	shrw	ax, 1
Index: gcc/config/rl78/rl78.c
===================================================================
--- gcc/config/rl78/rl78.c	(revision 220393)
+++ gcc/config/rl78/rl78.c	(working copy)
@@ -3577,6 +3608,9 @@ 
 {
   int r, i;
 
+  if (GET_CODE (d) == MEM)
+    rl78_note_reg_uses (dead, XEXP (d, 0), insn);
+
   if (GET_CODE (d) != REG)
     return;