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]

v850 patch to avoid clobbering app register r5 in muldi3


The v850 ABI reserves r2 and r5 as application registers.  There is an option
-mno-app-regs to disable use of these registers, and this option is used for
compiling system libraries like libgcc and newlib.

Unfortunately, there is one assembly language routine in libgcc that uses r5.
It shouldn't.  Since r28 is unused in the function, and r28 is already being
saved/restored in the prologue/epilogue, this problem can be fixed by replacing
all occurrences of r5 with r28.

This was regression tested with an uberbaum tree configured for v850-elf
by running make check in the gcc directory.

I have checked in this patch.

2002-09-20  Jim Wilson  <wilson@redhat.com>

	* config/v850/v850/lib1funcs.asm (__muldi3): Change r5 to r28.

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/lib1funcs.asm,v
retrieving revision 1.14
diff -p -r1.14 lib1funcs.asm
*** lib1funcs.asm	29 Aug 2002 09:50:19 -0000	1.14
--- lib1funcs.asm	20 Sep 2002 23:32:26 -0000
*************** ___muldi3:
*** 1765,1774 ****
  #ifdef __v850__
          jarl  __save_r26_r31, r10
          addi  16,  sp, sp
!         mov   r6,  r5
!         shr   15,  r5
          movea lo(32767), r0, r14
!         and   r14, r5
          mov   r8,  r10
          shr   15,  r10
          and   r14, r10
--- 1765,1774 ----
  #ifdef __v850__
          jarl  __save_r26_r31, r10
          addi  16,  sp, sp
!         mov   r6,  r28
!         shr   15,  r28
          movea lo(32767), r0, r14
!         and   r14, r28
          mov   r8,  r10
          shr   15,  r10
          and   r14, r10
*************** ___muldi3:
*** 1807,1822 ****
          mov   r6,  r15
          mulh  r31, r15
          mulh  r12, r6
!         mov   r5,  r17
          mulh  r10, r17
          add   -16, sp
!         mov   r5,  r12
          mulh  r8,  r12
          add   r17, r18
!         mov   r5,  r17
          mulh  r31, r17
          add   r12, r16
!         mov   r5,  r12
          mulh  r13, r12
          add   r17, r6
          mov   r19, r17
--- 1807,1822 ----
          mov   r6,  r15
          mulh  r31, r15
          mulh  r12, r6
!         mov   r28,  r17
          mulh  r10, r17
          add   -16, sp
!         mov   r28,  r12
          mulh  r8,  r12
          add   r17, r18
!         mov   r28,  r17
          mulh  r31, r17
          add   r12, r16
!         mov   r28,  r12
          mulh  r13, r12
          add   r17, r6
          mov   r19, r17


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