avr port patch

Denis Chertykov denisc@overta.ru
Wed Mar 1 12:23:00 GMT 2000


Wed Mar  1 23:13:54 2000  Denis Chertykov  <denisc@overta.ru>

	* config/avr/avr.c: (print_operand): use print_operand_address
        instead of output_addr_const.
	* config/avr/libgcc.S: Cleanup code.


Index: egcs/gcc/config/avr/avr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/avr.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 avr.c
*** avr.c	2000/02/11 22:31:46	1.1
--- avr.c	2000/03/01 04:09:34
*************** print_operand (file, x, code)
*** 911,917 ****
    else if (code == 'k')
      asm_fprintf (file, cond_string (reverse_condition (GET_CODE (x))));
    else
!     output_addr_const (file, x);
  }
  
  /* Recognise operand OP of mode MODE used in call instructions */
--- 911,917 ----
    else if (code == 'k')
      asm_fprintf (file, cond_string (reverse_condition (GET_CODE (x))));
    else
!     print_operand_address (file, x);
  }
  
  /* Recognise operand OP of mode MODE used in call instructions */
Index: egcs/gcc/config/avr/libgcc.S
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/avr/libgcc.S,v
retrieving revision 1.1
diff -c -3 -p -r1.1 libgcc.S
*** libgcc.S	2000/02/11 22:31:46	1.1
--- libgcc.S	2000/03/01 04:09:37
*************** Boston, MA 02111-1307, USA.  */
*** 32,49 ****
     This exception does not however invalidate any other reasons why
     the executable file might be covered by the GNU General Public License.  */
  
- #define TEXT_SEG(x) .section .text.libgcc ; x
- #define GLOBAL(x) .global _##x
- #define FUNCTION(x) .func _##x
- #define LABEL(x) _##x##:
- #define ENDFUNC .endfunc
- 
  #define __zero_reg__ r1
  #define __tmp_reg__ r0
  #define __SREG__ 0x3f
  #define __SP_H__ 0x3e
  #define __SP_L__ 0x3d
  
  /*******************************************************
                 Multiplication  8 x 8
  *******************************************************/
--- 32,45 ----
     This exception does not however invalidate any other reasons why
     the executable file might be covered by the GNU General Public License.  */
  
  #define __zero_reg__ r1
  #define __tmp_reg__ r0
  #define __SREG__ 0x3f
  #define __SP_H__ 0x3e
  #define __SP_L__ 0x3d
  
+ 	.section .text.libgcc
+ 	
  /*******************************************************
                 Multiplication  8 x 8
  *******************************************************/
*************** Boston, MA 02111-1307, USA.  */
*** 53,65 ****
  #define	r_arg1 	r24		/* multiplier */
  #define r_res	__tmp_reg__	/* result */
  
! TEXT_SEG(mulqi3)
! GLOBAL (mulqi3)
! FUNCTION (mulqi3)
! LABEL(mulqi3)
  
! GLOBAL (umulqi3)
! LABEL(umulqi3)
  	clr	r_res		; clear result
  __mulqi3_loop:
  	sbrc	r_arg1,0
--- 49,60 ----
  #define	r_arg1 	r24		/* multiplier */
  #define r_res	__tmp_reg__	/* result */
  
! 	.global	_mulqi3
! 	.func	_mulqi3
! _mulqi3:
  
! 	.global	_umulqi3
! _umulqi3:
  	clr	r_res		; clear result
  __mulqi3_loop:
  	sbrc	r_arg1,0
*************** __mulqi3_exit:	
*** 76,82 ****
  #undef r_arg1  
  #undef r_res   
  	
! ENDFUNC
  #endif 	/* defined (Lmulqi3) */
  
  
--- 71,77 ----
  #undef r_arg1  
  #undef r_res   
  	
! .endfunc
  #endif 	/* defined (Lmulqi3) */
  
  
*************** ENDFUNC
*** 91,103 ****
  #define r_resL	r20		/* result Low */
  #define r_resH  r21		/* result High */
  
! TEXT_SEG(mulhi3)
! GLOBAL (mulhi3)
! FUNCTION (mulhi3)
! LABEL(mulhi3)
  
! GLOBAL (umulhi3)
! LABEL(umulhi3)
  	
  	clr	r_resH		; clear result
  	clr	r_resL		; clear result
--- 86,97 ----
  #define r_resL	r20		/* result Low */
  #define r_resH  r21		/* result High */
  
! 	.global	_mulhi3
! 	.func	_mulhi3
! _mulhi3:
  
! 	.global	_umulhi3
! _umulhi3:
  	
  	clr	r_resH		; clear result
  	clr	r_resL		; clear result
*************** __mulhi3_exit:
*** 129,135 ****
  #undef r_resL 	
  #undef r_resH 
  
! ENDFUNC
  #endif /* defined (Lmulhi3) */
  
  #if defined (Lmulsi3)
--- 123,129 ----
  #undef r_resL 	
  #undef r_resH 
  
! .endfunc
  #endif /* defined (Lmulhi3) */
  
  #if defined (Lmulsi3)
*************** ENDFUNC
*** 153,165 ****
  #define r_resHH  r31		/* result High */
  
  	
! TEXT_SEG(mulsi3)
! GLOBAL (mulsi3)
! FUNCTION (mulsi3)
! LABEL(mulsi3)
  
! GLOBAL (umulsi3)
! LABEL(umulsi3)
  	clr	r_resHH		; clear result
  	clr	r_resHL		; clear result
  	clr	r_resH		; clear result
--- 147,158 ----
  #define r_resHH  r31		/* result High */
  
  	
! 	.global	_mulsi3
! 	.func	_mulsi3
! _mulsi3:
  
! 	.global	_umulsi3
! _umulsi3:
  	clr	r_resHH		; clear result
  	clr	r_resHL		; clear result
  	clr	r_resH		; clear result
*************** __mulsi3_exit:
*** 207,213 ****
  #undef r_resHL 
  #undef r_resHH 
  
! ENDFUNC
  #endif /* defined (Lmulsi3) */
  	
  /*******************************************************
--- 200,206 ----
  #undef r_resHL 
  #undef r_resHH 
  
! .endfunc
  #endif /* defined (Lmulsi3) */
  	
  /*******************************************************
*************** ENDFUNC
*** 220,265 ****
  
  #if defined (Lumodqi3)
  
! TEXT_SEG(divqi3)
! GLOBAL (umodqi3)
! FUNCTION (umodqi3)
! LABEL(umodqi3)
  	clt
  	rcall	_udivqi3
  	mov	r24,r_rem
  	ret
! ENDFUNC
  #endif /* defined (Lumodqi3) */
  	
  #if defined (Ludivqi3)
  
! TEXT_SEG(divqi3)
! GLOBAL (udivqi3)
! FUNCTION (udivqi3)
! LABEL(udivqi3)
  	clr	__tmp_reg__
  	rjmp	_divqi_raw
! ENDFUNC
  #endif /* defined (Ludivqi3) */
  
  #if defined (Lmodqi3)
  	
! TEXT_SEG (divqi3)
! GLOBAL (moqhi3)
! FUNCTION (moqhi3)
! LABEL (modqi3)
  	rcall	_divqi3
  	mov	r24,r_rem
  	ret
! ENDFUNC
  #endif /* defined (Lmodqi3) */
  
  #if defined (Ldivqi3)
  
! TEXT_SEG(divqi3)
! GLOBAL (divqi3)
! FUNCTION (divqi3)
! LABEL(divqi3)
          bst     r_arg1,7	; store sign of divident
          mov     __tmp_reg__,r_arg1
          eor     __tmp_reg__,r_arg2; r0.7 is sign of result
--- 213,254 ----
  
  #if defined (Lumodqi3)
  
! 	.global	_umodqi3
! 	.func	_umodqi3
! _umodqi3:
  	clt
  	rcall	_udivqi3
  	mov	r24,r_rem
  	ret
! .endfunc
  #endif /* defined (Lumodqi3) */
  	
  #if defined (Ludivqi3)
  
! 	.global	_udivqi3
! 	.func	_udivqi3
! _udivqi3:
  	clr	__tmp_reg__
  	rjmp	_divqi_raw
! .endfunc
  #endif /* defined (Ludivqi3) */
  
  #if defined (Lmodqi3)
  	
! 	.global	_moqhi3
! 	.func	_moqhi3
! _modqi3:
  	rcall	_divqi3
  	mov	r24,r_rem
  	ret
! .endfunc
  #endif /* defined (Lmodqi3) */
  
  #if defined (Ldivqi3)
  
! 	.global	_divqi3
! 	.func	_divqi3
! _divqi3:
          bst     r_arg1,7	; store sign of divident
          mov     __tmp_reg__,r_arg1
          eor     __tmp_reg__,r_arg2; r0.7 is sign of result
*************** LABEL(divqi3)
*** 267,274 ****
          neg     r_arg1		; divident negative : negate
          sbrc	r_arg2,7
          neg     r_arg2		; divisor negative : negate
! GLOBAL (divqi_raw)
! LABEL (divqi_raw)	
  	sub	r_rem,r_rem	; clear remainder and carry
  	ldi	r_cnt,9		; init loop counter
  	rjmp	__divqi3_ep	; jump to entry point
--- 256,263 ----
          neg     r_arg1		; divident negative : negate
          sbrc	r_arg2,7
          neg     r_arg2		; divisor negative : negate
! 	.global	_divqi_raw
! _divqi_raw:	
  	sub	r_rem,r_rem	; clear remainder and carry
  	ldi	r_cnt,9		; init loop counter
  	rjmp	__divqi3_ep	; jump to entry point
*************** __divqi3_1:
*** 291,297 ****
  __divqi3_exit:
  	mov	r24,r_arg1	; put result to return register
  	ret
! ENDFUNC
  #endif /* defined (Ldivqi3) */
  
  #undef r_rem
--- 280,286 ----
  __divqi3_exit:
  	mov	r24,r_arg1	; put result to return register
  	ret
! .endfunc
  #endif /* defined (Ldivqi3) */
  
  #undef r_rem
*************** ENDFUNC
*** 315,367 ****
  #define	r_cnt	r21	/* loop count */
  #if defined (Lumodhi3)
  	
! TEXT_SEG (divhi3)
! GLOBAL (umodhi3)
! FUNCTION (umodhi3)
! LABEL (umodhi3)
  	clt
  	rcall	_udivhi3
! GLOBAL (umodhi3_ret)
! LABEL (umodhi3_ret)
  	mov	r24,r_remL
  	mov	r25,r_remH
  	ret
! ENDFUNC
  #endif /* defined (Lumodhi3) */
  	
  #if defined (Ludivhi3)
  	
! TEXT_SEG (divhi3)
! GLOBAL (udivhi3)
! FUNCTION (udivhi3)
! LABEL (udivhi3)
  	clr	__tmp_reg__
  	rjmp	_divhi_raw
! ENDFUNC
  #endif /* defined (Ludivhi3) */
  
  #if defined (Lmodhi3)
  	
! TEXT_SEG (divhi3)
! GLOBAL (modhi3)
! FUNCTION (modhi3)
! LABEL (modhi3)
! GLOBAL (div)
! LABEL (div)
  	rcall	_divhi3
  	mov	r22,r24		; needed for div () function
  	mov	r23,r25
  	rjmp	_umodhi3_ret
! ENDFUNC
  #endif /* defined (Lmodhi3) */
  	
  	
  #if defined (Ldivhi3)
  	
! TEXT_SEG (divhi3)
! GLOBAL (divhi3)
! FUNCTION (divhi3)
! LABEL (divhi3)
          bst     r_arg1H,7	; store sign of divident
          mov     __tmp_reg__,r_arg1H
          eor     __tmp_reg__,r_arg2H   ; r0.7 is sign of result
--- 304,352 ----
  #define	r_cnt	r21	/* loop count */
  #if defined (Lumodhi3)
  	
! 	.global	_umodhi3
! 	.func	_umodhi3
! _umodhi3:
  	clt
  	rcall	_udivhi3
! 	.global	_umodhi3_ret
! _umodhi3_ret:
  	mov	r24,r_remL
  	mov	r25,r_remH
  	ret
! .endfunc
  #endif /* defined (Lumodhi3) */
  	
  #if defined (Ludivhi3)
  	
! 	.global	_udivhi3
! 	.func	_udivhi3
! _udivhi3:
  	clr	__tmp_reg__
  	rjmp	_divhi_raw
! .endfunc
  #endif /* defined (Ludivhi3) */
  
  #if defined (Lmodhi3)
  	
! 	.global	_modhi3
! 	.func	_modhi3
! _modhi3:
! 	.global	_div
! _div:
  	rcall	_divhi3
  	mov	r22,r24		; needed for div () function
  	mov	r23,r25
  	rjmp	_umodhi3_ret
! .endfunc
  #endif /* defined (Lmodhi3) */
  	
  	
  #if defined (Ldivhi3)
  	
! 	.global	_divhi3
! 	.func	_divhi3
! _divhi3:
          bst     r_arg1H,7	; store sign of divident
          mov     __tmp_reg__,r_arg1H
          eor     __tmp_reg__,r_arg2H   ; r0.7 is sign of result
*************** __divhi3_skip1:
*** 376,383 ****
          neg     r_arg2L		; divisor negative : negate
  	sbci	r_arg2H,0xff
  __divhi3_skip2:
! GLOBAL (divhi_raw)
! LABEL (divhi_raw)
  	sub	r_remL,r_remL
  	sub	r_remH,r_remH		; clear remainder and carry
  	ldi	r_cnt,17	; init loop counter
--- 361,368 ----
          neg     r_arg2L		; divisor negative : negate
  	sbci	r_arg2H,0xff
  __divhi3_skip2:
! 	.global	_divhi_raw
! _divhi_raw:
  	sub	r_remL,r_remL
  	sub	r_remH,r_remH		; clear remainder and carry
  	ldi	r_cnt,17	; init loop counter
*************** __divhi3_exit:
*** 408,414 ****
  	com	r_arg1L
  	com	r_arg1H
  	ret
! ENDFUNC
  #endif /* defined (Ldivhi3) */
  	
  #undef r_remH  
--- 393,399 ----
  	com	r_arg1L
  	com	r_arg1H
  	ret
! .endfunc
  #endif /* defined (Ldivhi3) */
  	
  #undef r_remH  
*************** ENDFUNC
*** 444,501 ****
  
  #if defined (Lumodsi3)
  
! TEXT_SEG(divsi3)
! GLOBAL (umodsi3)
! FUNCTION (umodsi3)
! LABEL(umodsi3)
  	clt
  	rcall	_udivsi3
! GLOBAL (umodsi3_ret)
! LABEL (umodsi3_ret)
  	mov	r25,r_remHH
  	mov	r24,r_remHL
  	mov	r23,r_remH
  	mov	r22,r_remL
! GLOBAL (cleanup)
! LABEL (cleanup)
  	ret
! ENDFUNC
  #endif /* defined (Lumodsi3) */
  	
  #if defined (Ludivsi3)
  
! TEXT_SEG(divsi3)
! GLOBAL (udivsi3)
! FUNCTION (udivsi3)
! LABEL(udivsi3)
  	clr	__tmp_reg__
  	rjmp	_divsi_raw
! ENDFUNC
  #endif /* defined (Ludivsi3) */
  
  #if defined (Lmodsi3)
  	
! TEXT_SEG (divsi3)
! GLOBAL (modsi3)
! FUNCTION (modsi3)
! LABEL (modsi3)
! GLOBAL (ldiv)
! LABEL (ldiv)
  	rcall	_divsi3
  	mov	r18,r22		/* Needed for ldiv */
  	mov	r19,r23
  	mov	r20,r24
  	mov	r21,r25
  	rjmp	_umodsi3_ret
! ENDFUNC
  #endif /* defined (Lmodsi3) */
  
  #if defined (Ldivsi3)
  
! TEXT_SEG(divsi3)
! GLOBAL (divsi3)
! FUNCTION (divsi3)
! LABEL(divsi3)
          bst     r_arg1HH,7	; store sign of divident
          mov     __tmp_reg__,r_arg1HH
          eor     __tmp_reg__,r_arg2HH   ; r0.7 is sign of result
--- 429,482 ----
  
  #if defined (Lumodsi3)
  
! 	.global	_umodsi3
! 	.func	_umodsi3
! _umodsi3:
  	clt
  	rcall	_udivsi3
! 	.global	_umodsi3_ret
! _umodsi3_ret:
  	mov	r25,r_remHH
  	mov	r24,r_remHL
  	mov	r23,r_remH
  	mov	r22,r_remL
! 	.global	_cleanup
! _cleanup:
  	ret
! .endfunc
  #endif /* defined (Lumodsi3) */
  	
  #if defined (Ludivsi3)
  
! 	.global	_udivsi3
! 	.func	_udivsi3
! _udivsi3:
  	clr	__tmp_reg__
  	rjmp	_divsi_raw
! .endfunc
  #endif /* defined (Ludivsi3) */
  
  #if defined (Lmodsi3)
  	
! 	.global	_modsi3
! 	.func	_modsi3
! _modsi3:
! 	.global	_ldiv
! _ldiv:
  	rcall	_divsi3
  	mov	r18,r22		/* Needed for ldiv */
  	mov	r19,r23
  	mov	r20,r24
  	mov	r21,r25
  	rjmp	_umodsi3_ret
! .endfunc
  #endif /* defined (Lmodsi3) */
  
  #if defined (Ldivsi3)
  
! 	.global	_divsi3
! 	.func	_divsi3
! _divsi3:
          bst     r_arg1HH,7	; store sign of divident
          mov     __tmp_reg__,r_arg1HH
          eor     __tmp_reg__,r_arg2HH   ; r0.7 is sign of result
*************** __divsi3_skip1:
*** 518,525 ****
  	sbci	r_arg2HL,0xff
  	sbci	r_arg2HH,0xff
  __divsi3_skip2:
! GLOBAL (divsi_raw)
! LABEL (divsi_raw)
  	push	r_cnt
  	sub	r_remL,r_remL
  	sub	r_remH,r_remH
--- 499,506 ----
  	sbci	r_arg2HL,0xff
  	sbci	r_arg2HH,0xff
  __divsi3_skip2:
! 	.global	_divsi_raw
! _divsi_raw:
  	push	r_cnt
  	sub	r_remL,r_remL
  	sub	r_remH,r_remH
*************** __divsi3_exit:
*** 571,577 ****
  	com	r_arg1HL
  	com	r_arg1HH
  	ret
! ENDFUNC
  #endif /* defined (Ldivsi3) */
  
  /**********************************
--- 552,558 ----
  	com	r_arg1HL
  	com	r_arg1HH
  	ret
! .endfunc
  #endif /* defined (Ldivsi3) */
  
  /**********************************
*************** ENDFUNC
*** 579,588 ****
   **********************************/
  #if defined (Lprologue)
  
! TEXT_SEG (_prologue_saves)
! GLOBAL (_prologue_saves__)
! FUNCTION (_prologue_saves__)
! LABEL (_prologue_saves__)
  	push r2
  	push r3
  	push r4
--- 560,568 ----
   **********************************/
  #if defined (Lprologue)
  
! 	.global	__prologue_saves__
! 	.func	__prologue_saves__
! __prologue_saves__:
  	push r2
  	push r3
  	push r4
*************** LABEL (_prologue_saves__)
*** 614,620 ****
  	out	__SP_H__,r29
  _prologue_end:
  	ijmp
! ENDFUNC
  #endif /* defined (Lprologue) */
  
  /*
--- 594,600 ----
  	out	__SP_H__,r29
  _prologue_end:
  	ijmp
! .endfunc
  #endif /* defined (Lprologue) */
  
  /*
*************** ENDFUNC
*** 622,631 ****
   */
  #if defined (Lepilogue)
  
! TEXT_SEG (_epilogue_restores)
! GLOBAL (_epilogue_restores__)
! FUNCTION (_epilogue_restores__)
! LABEL (_epilogue_restores__)
  	ldd	r2,Y+18
  	ldd	r3,Y+17
  	ldd	r4,Y+16
--- 602,610 ----
   */
  #if defined (Lepilogue)
  
! 	.global	__epilogue_restores__
! 	.func	__epilogue_restores__
! __epilogue_restores__:
  	ldd	r2,Y+18
  	ldd	r3,Y+17
  	ldd	r4,Y+16
*************** LABEL (_epilogue_restores__)
*** 657,666 ****
  #endif /* defined (Lepilogue) */
  
  #ifdef L__exit
! TEXT_SEG(exit)
! GLOBAL (exit)
! FUNCTION (exit)
! LABEL(exit)
  	rjmp	_exit
! ENDFUNC
! #endif
\ No newline at end of file
--- 636,644 ----
  #endif /* defined (Lepilogue) */
  
  #ifdef L__exit
! 	.global	_exit
! 	.func	_exit
! _exit:
  	rjmp	_exit
! .endfunc
! #endif



More information about the Gcc-patches mailing list