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]

Hitachi SH lib1funcs.asm patch


This is a small improvement for Hitachi SH1-SH3E. It changes movstr to 
copy longwords by pairs because the Hitachi SH architecture has a load 
latency of two clocks.

Wed Jul  7 16:27:20 1999  Toshiyasu Morita  (tm@netcom.com)

	* config/sh/lib1funcs.asm (___movstr): Copy longs in pairs
	* config/sh/sh.md (block_lump_real): Add r1 clobber

*** config/sh/lib1funcs.asm.bak	Tue Jul  6 15:10:54 1999
--- config/sh/lib1funcs.asm	Wed Jul  7 15:54:49 1999
*************** LOCAL(lshrsi3_0):
*** 630,773 ****
  
  #ifdef L_movstr
  	.text
! ! done all the large groups, do the remainder
  
  ! jump to movstr+
  done:
  	add	#64,r5
! 	mova	___movstrSI0,r0
! 	shll2	r6
  	add	r6,r0
  	jmp	@r0
  	add	#64,r4
! 	.align	4
  	.global	___movstrSI64
  ___movstrSI64:
  	mov.l	@(60,r5),r0
  	mov.l	r0,@(60,r4)
! 	.global	___movstrSI60
! ___movstrSI60:
! 	mov.l	@(56,r5),r0
! 	mov.l	r0,@(56,r4)
  	.global	___movstrSI56
  ___movstrSI56:
  	mov.l	@(52,r5),r0
  	mov.l	r0,@(52,r4)
! 	.global	___movstrSI52
! ___movstrSI52:
! 	mov.l	@(48,r5),r0
! 	mov.l	r0,@(48,r4)
  	.global	___movstrSI48
  ___movstrSI48:
  	mov.l	@(44,r5),r0
  	mov.l	r0,@(44,r4)
! 	.global	___movstrSI44
! ___movstrSI44:
! 	mov.l	@(40,r5),r0
! 	mov.l	r0,@(40,r4)
  	.global	___movstrSI40
  ___movstrSI40:
  	mov.l	@(36,r5),r0
  	mov.l	r0,@(36,r4)
! 	.global	___movstrSI36
! ___movstrSI36:
! 	mov.l	@(32,r5),r0
! 	mov.l	r0,@(32,r4)
  	.global	___movstrSI32
  ___movstrSI32:
  	mov.l	@(28,r5),r0
  	mov.l	r0,@(28,r4)
! 	.global	___movstrSI28
! ___movstrSI28:
! 	mov.l	@(24,r5),r0
! 	mov.l	r0,@(24,r4)
  	.global	___movstrSI24
  ___movstrSI24:
  	mov.l	@(20,r5),r0
  	mov.l	r0,@(20,r4)
! 	.global	___movstrSI20
! ___movstrSI20:
! 	mov.l	@(16,r5),r0
! 	mov.l	r0,@(16,r4)
  	.global	___movstrSI16
  ___movstrSI16:
  	mov.l	@(12,r5),r0
  	mov.l	r0,@(12,r4)
! 	.global	___movstrSI12
! ___movstrSI12:
! 	mov.l	@(8,r5),r0
! 	mov.l	r0,@(8,r4)
  	.global	___movstrSI8
  ___movstrSI8:
  	mov.l	@(4,r5),r0
  	mov.l	r0,@(4,r4)
! 	.global	___movstrSI4
! ___movstrSI4:
! 	mov.l	@(0,r5),r0
! 	mov.l	r0,@(0,r4)
  ___movstrSI0:
  	rts
! 	or	r0,r0,r0
! 
! 	.align	4
! 
! 	.global	___movstr
! ___movstr:
! 	mov.l	@(60,r5),r0
! 	mov.l	r0,@(60,r4)
! 
  	mov.l	@(56,r5),r0
  	mov.l	r0,@(56,r4)
! 
! 	mov.l	@(52,r5),r0
! 	mov.l	r0,@(52,r4)
! 
  	mov.l	@(48,r5),r0
  	mov.l	r0,@(48,r4)
! 
! 	mov.l	@(44,r5),r0
! 	mov.l	r0,@(44,r4)
! 
  	mov.l	@(40,r5),r0
  	mov.l	r0,@(40,r4)
! 
! 	mov.l	@(36,r5),r0
! 	mov.l	r0,@(36,r4)
! 
  	mov.l	@(32,r5),r0
  	mov.l	r0,@(32,r4)
! 
! 	mov.l	@(28,r5),r0
! 	mov.l	r0,@(28,r4)
! 
  	mov.l	@(24,r5),r0
  	mov.l	r0,@(24,r4)
! 
! 	mov.l	@(20,r5),r0
! 	mov.l	r0,@(20,r4)
! 
  	mov.l	@(16,r5),r0
  	mov.l	r0,@(16,r4)
! 
! 	mov.l	@(12,r5),r0
! 	mov.l	r0,@(12,r4)
! 
  	mov.l	@(8,r5),r0
  	mov.l	r0,@(8,r4)
! 
! 	mov.l	@(4,r5),r0
! 	mov.l	r0,@(4,r4)
! 
! 	mov.l	@(0,r5),r0
! 	mov.l	r0,@(0,r4)
! 
! 	add	#-16,r6
! 	cmp/pl	r6
! 	bf	done
! 
! 	add	#64,r5
! 	bra	___movstr
! 	add	#64,r4
  #endif
  
  #ifdef L_movstr_i4
--- 630,822 ----
  
  #ifdef L_movstr
  	.text
! 	.align	4
! 	.global	___movstr
! ___movstr:
! 	mov.l	@(0,r5),r0	! Copy longs consecutively, because 
! 	mov.l	@(4,r5),r1	! the SH4 cache implements
! 	mov.l	r0,@(0,r4)	| release-on-critical-word-read
! 	mov.l	r1,@(4,r4)
! 
! 	mov.l	@(8,r5),r0
! 	mov.l	@(12,r5),r1
! 	mov.l	r0,@(8,r4)
! 	mov.l	r1,@(12,r4)
! 
! 	mov.l	@(16,r5),r0
! 	mov.l	@(20,r5),r1
! 	mov.l	r0,@(16,r4)
! 	mov.l	r1,@(20,r4)
! 
! 	mov.l	@(24,r5),r0
! 	mov.l	@(28,r5),r1
! 	mov.l	r0,@(24,r4)
! 	mov.l	r1,@(28,r4)
! 
! 	mov.l	@(32,r5),r0
! 	mov.l	@(36,r5),r1
! 	mov.l	r0,@(32,r4)
! 	mov.l	r1,@(36,r4)
  
+ 	mov.l	@(40,r5),r0
+ 	mov.l	@(44,r5),r1
+ 	mov.l	r0,@(40,r4)
+ 	mov.l	r1,@(44,r4)
+ 
+ 	mov.l	@(48,r5),r0
+ 	mov.l	@(52,r5),r1
+ 	mov.l	r0,@(48,r4)
+ 	mov.l	r1,@(52,r4)
+ 
+ 	mov.l	@(56,r5),r0
+ 	mov.l	@(60,r5),r1
+ 	mov.l	r0,@(56,r4)
+ 	mov.l	r1,@(60,r4)
+ 
+ 	add	#-16,r6
+ 	cmp/pl	r6
+ 	bf	done
+ 
+ 	add	#64,r5
+ 	bra	___movstr
+ 	add	#64,r4
+ 
+ ! done all the large groups, do the remainder
  ! jump to movstr+
+ 
  done:
  	add	#64,r5
! 	mova	LOCAL(movstr_table),r0
! 	add	#16,r6
! 	shll	r6
! 	mov.w	@(r0,r6),r6
! #ifdef __sh1__
  	add	r6,r0
  	jmp	@r0
+ #else
+ 	braf	r6
+ #endif
  	add	#64,r4
! 
! 	.align	2
! LOCAL(movstr_table):
! 	.word		___movstrSI64-LOCAL(movstr_table)
! 	.word		___movstrSI60-LOCAL(movstr_table)
! 	.word		___movstrSI56-LOCAL(movstr_table)
! 	.word		___movstrSI52-LOCAL(movstr_table)
! 	.word		___movstrSI48-LOCAL(movstr_table)
! 	.word		___movstrSI44-LOCAL(movstr_table)
! 	.word		___movstrSI40-LOCAL(movstr_table)
! 	.word		___movstrSI36-LOCAL(movstr_table)
! 	.word		___movstrSI32-LOCAL(movstr_table)
! 	.word		___movstrSI28-LOCAL(movstr_table)
! 	.word		___movstrSI24-LOCAL(movstr_table)
! 	.word		___movstrSI20-LOCAL(movstr_table)
! 	.word		___movstrSI16-LOCAL(movstr_table)
! 	.word		___movstrSI12-LOCAL(movstr_table)
! 	.word		___movstrSI8-LOCAL(movstr_table)
! 	.word		___movstrSI4-LOCAL(movstr_table)
! 	.word		___movstrSI0-LOCAL(movstr_table)
! 
! 	.align	2
  	.global	___movstrSI64
  ___movstrSI64:
  	mov.l	@(60,r5),r0
+ 	mov.l	@(56,r5),r1
  	mov.l	r0,@(60,r4)
! 	mov.l	r1,@(56,r4)
  	.global	___movstrSI56
  ___movstrSI56:
  	mov.l	@(52,r5),r0
+ 	mov.l	@(48,r5),r1
  	mov.l	r0,@(52,r4)
! 	mov.l	r1,@(48,r4)
  	.global	___movstrSI48
  ___movstrSI48:
  	mov.l	@(44,r5),r0
+ 	mov.l	@(40,r5),r1
  	mov.l	r0,@(44,r4)
! 	mov.l	r1,@(40,r4)
  	.global	___movstrSI40
  ___movstrSI40:
  	mov.l	@(36,r5),r0
+ 	mov.l	@(32,r5),r1
  	mov.l	r0,@(36,r4)
! 	mov.l	r1,@(32,r4)
  	.global	___movstrSI32
  ___movstrSI32:
  	mov.l	@(28,r5),r0
+ 	mov.l	@(24,r5),r1
  	mov.l	r0,@(28,r4)
! 	mov.l	r1,@(24,r4)
  	.global	___movstrSI24
  ___movstrSI24:
  	mov.l	@(20,r5),r0
+ 	mov.l	@(16,r5),r1
  	mov.l	r0,@(20,r4)
! 	mov.l	r1,@(16,r4)
  	.global	___movstrSI16
  ___movstrSI16:
  	mov.l	@(12,r5),r0
+ 	mov.l	@(8,r5),r1
  	mov.l	r0,@(12,r4)
! 	mov.l	r1,@(8,r4)
  	.global	___movstrSI8
  ___movstrSI8:
  	mov.l	@(4,r5),r0
+ 	mov.l	@(0,r5),r1
  	mov.l	r0,@(4,r4)
! 	rts
! 	mov.l	r1,@(0,r4)
  ___movstrSI0:
  	rts
! 	nop
! ___movstrSI60:
  	mov.l	@(56,r5),r0
+ 	mov.l	@(52,r5),r1
  	mov.l	r0,@(56,r4)
! 	mov.l	r1,@(52,r4)
! 	.global	___movstrSI56
! ___movstrSI52:
  	mov.l	@(48,r5),r0
+ 	mov.l	@(44,r5),r1
  	mov.l	r0,@(48,r4)
! 	mov.l	r1,@(44,r4)
! 	.global	___movstrSI48
! ___movstrSI44:
  	mov.l	@(40,r5),r0
+ 	mov.l	@(36,r5),r1
  	mov.l	r0,@(40,r4)
! 	mov.l	r1,@(36,r4)
! 	.global	___movstrSI40
! ___movstrSI36:
  	mov.l	@(32,r5),r0
+ 	mov.l	@(28,r5),r1
  	mov.l	r0,@(32,r4)
! 	mov.l	r1,@(28,r4)
! 	.global	___movstrSI32
! ___movstrSI28:
  	mov.l	@(24,r5),r0
+ 	mov.l	@(20,r5),r1
  	mov.l	r0,@(24,r4)
! 	mov.l	r1,@(20,r4)
! 	.global	___movstrSI24
! ___movstrSI20:
  	mov.l	@(16,r5),r0
+ 	mov.l	@(12,r5),r1
  	mov.l	r0,@(16,r4)
! 	mov.l	r1,@(12,r4)
! 	.global	___movstrSI16
! ___movstrSI12:
  	mov.l	@(8,r5),r0
+ 	mov.l	@(4,r5),r1
  	mov.l	r0,@(8,r4)
! 	mov.l	r1,@(4,r4)
! 	.global	___movstrSI8
! ___movstrSI4:
! 	mov.l	@r5,r0
! 	rts
! 	mov.l	r0,@r4
  #endif
  
  #ifdef L_movstr_i4
*** config/sh/sh.md.bak	Wed Jul  7 10:49:01 1999
--- config/sh/sh.md	Wed Jul  7 10:49:45 1999
***************
*** 3691,3696 ****
--- 3691,3697 ----
  		   (mem:BLK (reg:SI 5)))
  	      (use (match_operand:SI 0 "arith_reg_operand" "r"))
  	      (clobber (reg:SI 17))
+               (clobber (reg:SI 1))
  	      (clobber (reg:SI 0))])]
    "! TARGET_HARD_SH4"
    "jsr	@%0%#"
***************
*** 3706,3711 ****
--- 3707,3713 ----
  	      (clobber (reg:SI 4))
  	      (clobber (reg:SI 5))
  	      (clobber (reg:SI 6))
+               (clobber (reg:SI 1))
  	      (clobber (reg:SI 0))])]
    "! TARGET_HARD_SH4"
    "jsr	@%0%#"


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