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]

[committed]: Disable the generation of the v850 SLD and SSTinstructions


Hi Guys,

  NEC have discovered a hardware bug on the v850 series of processors
  which means that under some conditions the SLD and SST instructions
  will behave badly.  They have asked me to update the GCC sources so
  that these instructions are no longer generated by default, but can
  still be emitted if the "-mep" command line switch is used.

  I applying the patch below to make this change.  I am applying it to
  the mainline sources and the 4.0 branch.  I tested the resulting
  toolchain, and although newlib does not currently build (due to an
  ICE unrelated to this patch) I was able to verify that the patched
  toolchain builds and has no regressions in the gcc.c-torture/compile
  part of the testsuite.

Cheers
  Nick

gcc/ChangeLog
2005-08-26  Nick Clifton  <nickc@redhat.com>

	* config/v850/v850.c (ep_memory_operand): Return FALSE if
	TARGET_EP is not defined.
	* config/v850/c850.h (TARGET_CPU_CPP_BUILTINS): Define __EP__ if
	TARGET_EP is enabled.
	(OPTIMIZATION_OPTIONS): Do not define MASK_EP when optimizing.
	* config/v850/v850.md (save_all_interrupt): Only use the EP
	register if TARGET_EP is defined.
	(restore_all_interrupt): Likewise.
	* config/v850/lib1funcs.asm: Update functions so that the EP
	register is only used if __EP__ is defined.

Index: gcc/config/v850/lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/lib1funcs.asm,v
retrieving revision 1.19
diff -c -3 -p -r1.19 lib1funcs.asm
*** gcc/config/v850/lib1funcs.asm	17 Aug 2005 22:19:19 -0000	1.19
--- gcc/config/v850/lib1funcs.asm	26 Aug 2005 11:58:21 -0000
*************** ___modsi3:
*** 268,273 ****
--- 268,274 ----
  	/* Allocate space and save registers 2, 20 .. 29 on the stack */
  	/* Called via:	jalr __save_r2_r29,r10 */
  __save_r2_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-44,sp,sp
  	mov	sp,ep
*************** __save_r2_r29:
*** 283,288 ****
--- 284,303 ----
  	sst.w	r20,36[ep]
  	sst.w	r2,40[ep]
  	mov	r1,ep
+ #else
+ 	addi	-44,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ 	st.w	r23,24[sp]
+ 	st.w	r22,28[sp]
+ 	st.w	r21,32[sp]
+ 	st.w	r20,36[sp]
+ 	st.w	r2,40[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r2_r29,.-__save_r2_r29
  
*************** __save_r2_r29:
*** 292,297 ****
--- 307,313 ----
  	.globl	__return_r2_r29
  	.type	__return_r2_r29,@function
  __return_r2_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r2_r29:
*** 307,312 ****
--- 323,342 ----
  	sld.w	40[ep],r2
  	addi	44,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	ld.w	24[sp],r23
+ 	ld.w	28[sp],r22
+ 	ld.w	32[sp],r21
+ 	ld.w	36[sp],r20
+ 	ld.w	40[sp],r2
+ 	addi	44,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r2_r29,.-__return_r2_r29
  #endif /* L_save_2 */
*************** __return_r2_r29:
*** 319,324 ****
--- 349,355 ----
  	/* Allocate space and save registers 20 .. 29 on the stack */
  	/* Called via:	jalr __save_r20_r29,r10 */
  __save_r20_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-40,sp,sp
  	mov	sp,ep
*************** __save_r20_r29:
*** 333,338 ****
--- 364,382 ----
  	sst.w	r21,32[ep]
  	sst.w	r20,36[ep]
  	mov	r1,ep
+ #else
+ 	addi	-40,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ 	st.w	r23,24[sp]
+ 	st.w	r22,28[sp]
+ 	st.w	r21,32[sp]
+ 	st.w	r20,36[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r20_r29,.-__save_r20_r29
  
*************** __save_r20_r29:
*** 342,347 ****
--- 386,392 ----
  	.globl	__return_r20_r29
  	.type	__return_r20_r29,@function
  __return_r20_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r20_r29:
*** 356,361 ****
--- 401,419 ----
  	sld.w	36[ep],r20
  	addi	40,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	ld.w	24[sp],r23
+ 	ld.w	28[sp],r22
+ 	ld.w	32[sp],r21
+ 	ld.w	36[sp],r20
+ 	addi	40,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r20_r29,.-__return_r20_r29
  #endif /* L_save_20 */
*************** __return_r20_r29:
*** 368,373 ****
--- 426,432 ----
  	/* Allocate space and save registers 21 .. 29 on the stack */
  	/* Called via:	jalr __save_r21_r29,r10 */
  __save_r21_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-36,sp,sp
  	mov	sp,ep
*************** __save_r21_r29:
*** 381,386 ****
--- 440,457 ----
  	sst.w	r22,28[ep]
  	sst.w	r21,32[ep]
  	mov	r1,ep
+ #else
+ 	addi	-36,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ 	st.w	r23,24[sp]
+ 	st.w	r22,28[sp]
+ 	st.w	r21,32[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r21_r29,.-__save_r21_r29
  
*************** __save_r21_r29:
*** 390,395 ****
--- 461,467 ----
  	.globl	__return_r21_r29
  	.type	__return_r21_r29,@function
  __return_r21_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r21_r29:
*** 403,408 ****
--- 475,492 ----
  	sld.w	32[ep],r21
  	addi	36,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	ld.w	24[sp],r23
+ 	ld.w	28[sp],r22
+ 	ld.w	32[sp],r21
+ 	addi	36,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r21_r29,.-__return_r21_r29
  #endif /* L_save_21 */
*************** __return_r21_r29:
*** 415,420 ****
--- 499,505 ----
  	/* Allocate space and save registers 22 .. 29 on the stack */
  	/* Called via:	jalr __save_r22_r29,r10 */
  __save_r22_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-32,sp,sp
  	mov	sp,ep
*************** __save_r22_r29:
*** 427,432 ****
--- 512,528 ----
  	sst.w	r23,24[ep]
  	sst.w	r22,28[ep]
  	mov	r1,ep
+ #else
+ 	addi	-32,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ 	st.w	r23,24[sp]
+ 	st.w	r22,28[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r22_r29,.-__save_r22_r29
  
*************** __save_r22_r29:
*** 436,441 ****
--- 532,538 ----
  	.globl	__return_r22_r29
  	.type	__return_r22_r29,@function
  __return_r22_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r22_r29:
*** 448,453 ****
--- 545,561 ----
  	sld.w	28[ep],r22
  	addi	32,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	ld.w	24[sp],r23
+ 	ld.w	28[sp],r22
+ 	addi	32,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r22_r29,.-__return_r22_r29
  #endif /* L_save_22 */
*************** __return_r22_r29:
*** 460,465 ****
--- 568,574 ----
  	/* Allocate space and save registers 23 .. 29 on the stack */
  	/* Called via:	jalr __save_r23_r29,r10 */
  __save_r23_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-28,sp,sp
  	mov	sp,ep
*************** __save_r23_r29:
*** 471,476 ****
--- 580,595 ----
  	sst.w	r24,20[ep]
  	sst.w	r23,24[ep]
  	mov	r1,ep
+ #else
+ 	addi	-28,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ 	st.w	r23,24[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r23_r29,.-__save_r23_r29
  
*************** __save_r23_r29:
*** 480,485 ****
--- 599,605 ----
  	.globl	__return_r23_r29
  	.type	__return_r23_r29,@function
  __return_r23_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r23_r29:
*** 491,496 ****
--- 611,626 ----
  	sld.w	24[ep],r23
  	addi	28,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	ld.w	24[sp],r23
+ 	addi	28,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r23_r29,.-__return_r23_r29
  #endif /* L_save_23 */
*************** __return_r23_r29:
*** 503,508 ****
--- 633,639 ----
  	/* Allocate space and save registers 24 .. 29 on the stack */
  	/* Called via:	jalr __save_r24_r29,r10 */
  __save_r24_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-24,sp,sp
  	mov	sp,ep
*************** __save_r24_r29:
*** 513,518 ****
--- 644,658 ----
  	sst.w	r25,16[ep]
  	sst.w	r24,20[ep]
  	mov	r1,ep
+ #else
+ 	addi	-24,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ 	st.w	r24,20[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r24_r29,.-__save_r24_r29
  
*************** __save_r24_r29:
*** 522,527 ****
--- 662,668 ----
  	.globl	__return_r24_r29
  	.type	__return_r24_r29,@function
  __return_r24_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r24_r29:
*** 532,537 ****
--- 673,687 ----
  	sld.w	20[ep],r24
  	addi	24,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	ld.w	16[sp],r25
+ 	ld.w	20[sp],r24
+ 	addi	24,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r24_r29,.-__return_r24_r29
  #endif /* L_save_24 */
*************** __return_r24_r29:
*** 544,549 ****
--- 694,700 ----
  	/* Allocate space and save registers 25 .. 29 on the stack */
  	/* Called via:	jalr __save_r25_r29,r10 */
  __save_r25_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-20,sp,sp
  	mov	sp,ep
*************** __save_r25_r29:
*** 553,558 ****
--- 704,717 ----
  	sst.w	r26,12[ep]
  	sst.w	r25,16[ep]
  	mov	r1,ep
+ #else
+ 	addi	-20,sp,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ 	st.w	r25,16[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r25_r29,.-__save_r25_r29
  
*************** __save_r25_r29:
*** 562,567 ****
--- 721,727 ----
  	.globl	__return_r25_r29
  	.type	__return_r25_r29,@function
  __return_r25_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r25_r29:
*** 571,576 ****
--- 731,744 ----
  	sld.w	16[ep],r25
  	addi	20,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[ep],r29
+ 	ld.w	4[ep],r28
+ 	ld.w	8[ep],r27
+ 	ld.w	12[ep],r26
+ 	ld.w	16[ep],r25
+ 	addi	20,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r25_r29,.-__return_r25_r29
  #endif /* L_save_25 */
*************** __return_r25_r29:
*** 583,588 ****
--- 751,757 ----
  	/* Allocate space and save registers 26 .. 29 on the stack */
  	/* Called via:	jalr __save_r26_r29,r10 */
  __save_r26_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	add	-16,sp
  	mov	sp,ep
*************** __save_r26_r29:
*** 591,596 ****
--- 760,772 ----
  	sst.w	r27,8[ep]
  	sst.w	r26,12[ep]
  	mov	r1,ep
+ #else
+ 	add	-16,sp
+ 	st.w	r29,0[sp]
+ 	st.w	r28,4[sp]
+ 	st.w	r27,8[sp]
+ 	st.w	r26,12[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r26_r29,.-__save_r26_r29
  
*************** __save_r26_r29:
*** 600,605 ****
--- 776,782 ----
  	.globl	__return_r26_r29
  	.type	__return_r26_r29,@function
  __return_r26_r29:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	0[ep],r29
*************** __return_r26_r29:
*** 608,613 ****
--- 785,797 ----
  	sld.w	12[ep],r26
  	addi	16,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	0[sp],r29
+ 	ld.w	4[sp],r28
+ 	ld.w	8[sp],r27
+ 	ld.w	12[sp],r26
+ 	addi	16,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r26_r29,.-__return_r26_r29
  #endif /* L_save_26 */
*************** __return_r29:
*** 698,707 ****
  	.align	2
  	.globl	__save_r2_r31
  	.type	__save_r2_r31,@function
! 	/* Allocate space and save registers 20 .. 29, 31 on the stack */
! 	/* Also allocate space for the argument save area */
! 	/* Called via:	jalr __save_r2_r31,r10 */
  __save_r2_r31:
  	mov	ep,r1
  	addi	-64,sp,sp
  	mov	sp,ep
--- 882,892 ----
  	.align	2
  	.globl	__save_r2_r31
  	.type	__save_r2_r31,@function
! 	/* Allocate space and save registers 20 .. 29, 31 on the stack.  */
! 	/* Also allocate space for the argument save area.  */
! 	/* Called via:	jalr __save_r2_r31,r10.  */
  __save_r2_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-64,sp,sp
  	mov	sp,ep
*************** __save_r2_r31:
*** 718,723 ****
--- 903,923 ----
  	sst.w	r2,56[ep]
  	sst.w	r31,60[ep]
  	mov	r1,ep
+ #else
+ 	addi	-64,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r22,44[sp]
+ 	st.w	r21,48[sp]
+ 	st.w	r20,52[sp]
+ 	st.w	r2,56[sp]
+ 	st.w	r31,60[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r2_r31,.-__save_r2_r31
  
*************** __save_r2_r31:
*** 727,732 ****
--- 927,933 ----
  	.globl	__return_r2_r31
  	.type	__return_r2_r31,@function
  __return_r2_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r2_r31:
*** 743,748 ****
--- 944,964 ----
  	sld.w	60[ep],r31
  	addi	64,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r23
+ 	ld.w	44[sp],r22
+ 	ld.w	48[sp],r21
+ 	ld.w	52[sp],r20
+ 	ld.w	56[sp],r2
+ 	ld.w	60[sp],r31
+ 	addi	64,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r2_r31,.-__return_r2_r31
  #endif /* L_save_2c */
*************** __return_r2_r31:
*** 756,761 ****
--- 972,978 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r20_r31,r10 */
  __save_r20_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-60,sp,sp
  	mov	sp,ep
*************** __save_r20_r31:
*** 771,776 ****
--- 988,1007 ----
  	sst.w	r20,52[ep]
  	sst.w	r31,56[ep]
  	mov	r1,ep
+ #else
+ 	addi	-60,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r22,44[sp]
+ 	st.w	r21,48[sp]
+ 	st.w	r20,52[sp]
+ 	st.w	r31,56[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r20_r31,.-__save_r20_r31
  
*************** __save_r20_r31:
*** 780,785 ****
--- 1011,1017 ----
  	.globl	__return_r20_r31
  	.type	__return_r20_r31,@function
  __return_r20_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r20_r31:
*** 795,800 ****
--- 1027,1046 ----
  	sld.w	56[ep],r31
  	addi	60,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r23
+ 	ld.w	44[sp],r22
+ 	ld.w	48[sp],r21
+ 	ld.w	52[sp],r20
+ 	ld.w	56[sp],r31
+ 	addi	60,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r20_r31,.-__return_r20_r31
  #endif /* L_save_20c */
*************** __return_r20_r31:
*** 808,813 ****
--- 1054,1060 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r21_r31,r10 */
  __save_r21_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-56,sp,sp
  	mov	sp,ep
*************** __save_r21_r31:
*** 822,827 ****
--- 1069,1087 ----
  	sst.w	r21,48[ep]
  	sst.w	r31,52[ep]
  	mov	r1,ep
+ #else
+ 	addi	-56,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r22,44[sp]
+ 	st.w	r21,48[sp]
+ 	st.w	r31,52[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r21_r31,.-__save_r21_r31
  
*************** __save_r21_r31:
*** 831,836 ****
--- 1091,1097 ----
  	.globl	__return_r21_r31
  	.type	__return_r21_r31,@function
  __return_r21_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r21_r31:
*** 845,850 ****
--- 1106,1124 ----
  	sld.w	52[ep],r31
  	addi	56,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r23
+ 	ld.w	44[sp],r22
+ 	ld.w	48[sp],r21
+ 	ld.w	52[sp],r31
+ 	addi	56,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r21_r31,.-__return_r21_r31
  #endif /* L_save_21c */
*************** __return_r21_r31:
*** 858,863 ****
--- 1132,1138 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r22_r31,r10 */
  __save_r22_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-52,sp,sp
  	mov	sp,ep
*************** __save_r22_r31:
*** 871,876 ****
--- 1146,1163 ----
  	sst.w	r22,44[ep]
  	sst.w	r31,48[ep]
  	mov	r1,ep
+ #else
+ 	addi	-52,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r22,44[sp]
+ 	st.w	r31,48[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r22_r31,.-__save_r22_r31
  
*************** __save_r22_r31:
*** 880,885 ****
--- 1167,1173 ----
  	.globl	__return_r22_r31
  	.type	__return_r22_r31,@function
  __return_r22_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r22_r31:
*** 893,898 ****
--- 1181,1198 ----
  	sld.w	48[ep],r31
  	addi	52,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r23
+ 	ld.w	44[sp],r22
+ 	ld.w	48[sp],r31
+ 	addi	52,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r22_r31,.-__return_r22_r31
  #endif /* L_save_22c */
*************** __return_r22_r31:
*** 906,911 ****
--- 1206,1212 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r23_r31,r10 */
  __save_r23_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-48,sp,sp
  	mov	sp,ep
*************** __save_r23_r31:
*** 918,923 ****
--- 1219,1235 ----
  	sst.w	r23,40[ep]
  	sst.w	r31,44[ep]
  	mov	r1,ep
+ #else
+ 	addi	-48,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r31,44[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r23_r31,.-__save_r23_r31
  
*************** __save_r23_r31:
*** 927,932 ****
--- 1239,1245 ----
  	.globl	__return_r23_r31
  	.type	__return_r23_r31,@function
  __return_r23_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r23_r31:
*** 939,944 ****
--- 1252,1268 ----
  	sld.w	44[ep],r31
  	addi	48,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r23
+ 	ld.w	44[sp],r31
+ 	addi	48,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r23_r31,.-__return_r23_r31
  #endif /* L_save_23c */
*************** __return_r23_r31:
*** 952,957 ****
--- 1276,1282 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r24_r31,r10 */
  __save_r24_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-44,sp,sp
  	mov	sp,ep
*************** __save_r24_r31:
*** 963,968 ****
--- 1288,1303 ----
  	sst.w	r24,36[ep]
  	sst.w	r31,40[ep]
  	mov	r1,ep
+ #else
+ 	addi	-44,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r31,40[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r24_r31,.-__save_r24_r31
  
*************** __save_r24_r31:
*** 972,977 ****
--- 1307,1313 ----
  	.globl	__return_r24_r31
  	.type	__return_r24_r31,@function
  __return_r24_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r24_r31:
*** 983,988 ****
--- 1319,1334 ----
  	sld.w	40[ep],r31
  	addi	44,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r24
+ 	ld.w	40[sp],r31
+ 	addi	44,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r24_r31,.-__return_r24_r31
  #endif /* L_save_24c */
*************** __return_r24_r31:
*** 996,1001 ****
--- 1342,1348 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r25_r31,r10 */
  __save_r25_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-40,sp,sp
  	mov	sp,ep
*************** __save_r25_r31:
*** 1006,1011 ****
--- 1353,1367 ----
  	sst.w	r25,32[ep]
  	sst.w	r31,36[ep]
  	mov	r1,ep
+ #else
+ 	addi	-40,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r31,36[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r25_r31,.-__save_r25_r31
  
*************** __save_r25_r31:
*** 1015,1020 ****
--- 1371,1377 ----
  	.globl	__return_r25_r31
  	.type	__return_r25_r31,@function
  __return_r25_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r25_r31:
*** 1025,1030 ****
--- 1382,1396 ----
  	sld.w	36[ep],r31
  	addi	40,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r25
+ 	ld.w	36[sp],r31
+ 	addi	40,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r25_r31,.-__return_r25_r31
  #endif /* L_save_25c */
*************** __return_r25_r31:
*** 1038,1043 ****
--- 1404,1410 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r26_r31,r10 */
  __save_r26_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-36,sp,sp
  	mov	sp,ep
*************** __save_r26_r31:
*** 1047,1052 ****
--- 1414,1427 ----
  	sst.w	r26,28[ep]
  	sst.w	r31,32[ep]
  	mov	r1,ep
+ #else
+ 	addi	-36,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r31,32[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r26_r31,.-__save_r26_r31
  
*************** __save_r26_r31:
*** 1056,1061 ****
--- 1431,1437 ----
  	.globl	__return_r26_r31
  	.type	__return_r26_r31,@function
  __return_r26_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r26_r31:
*** 1065,1070 ****
--- 1441,1454 ----
  	sld.w	32[ep],r31
  	addi	36,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r26
+ 	ld.w	32[sp],r31
+ 	addi	36,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r26_r31,.-__return_r26_r31
  #endif /* L_save_26c */
*************** __return_r26_r31:
*** 1078,1083 ****
--- 1462,1468 ----
  	/* Also allocate space for the argument save area */
  	/* Called via:	jalr __save_r27_r31,r10 */
  __save_r27_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	addi	-32,sp,sp
  	mov	sp,ep
*************** __save_r27_r31:
*** 1086,1091 ****
--- 1471,1483 ----
  	sst.w	r27,24[ep]
  	sst.w	r31,28[ep]
  	mov	r1,ep
+ #else
+ 	addi	-32,sp,sp
+ 	st.w	r29,16[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r31,28[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r27_r31,.-__save_r27_r31
  
*************** __save_r27_r31:
*** 1095,1100 ****
--- 1487,1493 ----
  	.globl	__return_r27_r31
  	.type	__return_r27_r31,@function
  __return_r27_r31:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	16[ep],r29
*************** __return_r27_r31:
*** 1103,1108 ****
--- 1496,1508 ----
  	sld.w	28[ep],r31
  	addi	32,sp,sp
  	mov	r1,ep
+ #else
+ 	ld.w	16[sp],r29
+ 	ld.w	20[sp],r28
+ 	ld.w	24[sp],r27
+ 	ld.w	28[sp],r31
+ 	addi	32,sp,sp
+ #endif
  	jmp	[r31]
  	.size	__return_r27_r31,.-__return_r27_r31
  #endif /* L_save_27c */
*************** __return_r31:
*** 1199,1204 ****
--- 1599,1605 ----
  	/* Save registers 6 .. 9 on the stack for variable argument functions.  */
  	/* Called via:	jalr __save_r6_r9,r10 */
  __save_r6_r9:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sst.w	r6,0[ep]
*************** __save_r6_r9:
*** 1206,1211 ****
--- 1607,1618 ----
  	sst.w	r8,8[ep]
  	sst.w	r9,12[ep]
  	mov	r1,ep
+ #else
+ 	st.w	r6,0[sp]
+ 	st.w	r7,4[sp]
+ 	st.w	r8,8[sp]
+ 	st.w	r9,12[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_r6_r9,.-__save_r6_r9
  #endif /* L_save_varargs */
*************** __return_interrupt:
*** 1254,1259 ****
--- 1661,1667 ----
  	/* Called via:	jalr __save_all_interrupt,r10 */
  __save_all_interrupt:
  	addi	-120,sp,sp
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sst.w	r31,116[ep]
*************** __save_all_interrupt:
*** 1283,1288 ****
--- 1691,1724 ----
  	sst.w	r28,20[ep]
  	sst.w	r29,16[ep]
  	mov	r1,ep
+ #else
+ 	st.w	r31,116[sp]
+ 	st.w	r2,112[sp]
+ 	st.w	gp,108[sp]
+ 	st.w	r6,104[sp]
+ 	st.w	r7,100[sp]
+ 	st.w	r8,96[sp]
+ 	st.w	r9,92[sp]
+ 	st.w	r11,88[sp]
+ 	st.w	r12,84[sp]
+ 	st.w	r13,80[sp]
+ 	st.w	r14,76[sp]
+ 	st.w	r15,72[sp]
+ 	st.w	r16,68[sp]
+ 	st.w	r17,64[sp]
+ 	st.w	r18,60[sp]
+ 	st.w	r19,56[sp]
+ 	st.w	r20,52[sp]
+ 	st.w	r21,48[sp]
+ 	st.w	r22,44[sp]
+ 	st.w	r23,40[sp]
+ 	st.w	r24,36[sp]
+ 	st.w	r25,32[sp]
+ 	st.w	r26,28[sp]
+ 	st.w	r27,24[sp]
+ 	st.w	r28,20[sp]
+ 	st.w	r29,16[sp]
+ #endif
  	jmp	[r10]
  	.size	__save_all_interrupt,.-__save_all_interrupt
  
*************** __save_all_interrupt:
*** 1292,1297 ****
--- 1728,1734 ----
  	   deallocate the stack space.  */
  	/* Called via:	jalr __restore_all_interrupt,r10 */
  __restore_all_interrupt:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sld.w	116[ep],r31
*************** __restore_all_interrupt:
*** 1321,1327 ****
  	sld.w	20[ep],r28
  	sld.w	16[ep],r29
  	mov	r1,ep
! 	addi	120,sp,sp
  	jmp	[r10]
  	.size	__restore_all_interrupt,.-__restore_all_interrupt
  #endif /* L_save_all_interrupt */
--- 1758,1792 ----
  	sld.w	20[ep],r28
  	sld.w	16[ep],r29
  	mov	r1,ep
! #else
! 	ld.w	116[sp],r31
! 	ld.w	112[sp],r2
! 	ld.w	108[sp],gp
! 	ld.w	104[sp],r6
! 	ld.w	100[sp],r7
! 	ld.w	96[sp],r8
! 	ld.w	92[sp],r9
! 	ld.w	88[sp],r11
! 	ld.w	84[sp],r12
! 	ld.w	80[sp],r13
! 	ld.w	76[sp],r14
! 	ld.w	72[sp],r15
! 	ld.w	68[sp],r16
! 	ld.w	64[sp],r17
! 	ld.w	60[sp],r18
! 	ld.w	56[sp],r19
! 	ld.w	52[sp],r20
! 	ld.w	48[sp],r21
! 	ld.w	44[sp],r22
! 	ld.w	40[sp],r23
! 	ld.w	36[sp],r24
! 	ld.w	32[sp],r25
! 	ld.w	28[sp],r26
! 	ld.w	24[sp],r27
! 	ld.w	20[sp],r28
! 	ld.w	16[sp],r29
! #endif
! 	addi	120,sp,sp	
  	jmp	[r10]
  	.size	__restore_all_interrupt,.-__restore_all_interrupt
  #endif /* L_save_all_interrupt */
*************** __callt_return_r2_r31:	.short ctoff(.L_r
*** 1409,1414 ****
--- 1874,1880 ----
  	   Called via:	callt ctoff(__callt_save_r6_r9).  */
  	.align	2
  .L_save_r6_r9:
+ #ifdef __EP__
  	mov	ep,r1
  	mov	sp,ep
  	sst.w	r6,0[ep]
*************** __callt_return_r2_r31:	.short ctoff(.L_r
*** 1416,1421 ****
--- 1882,1893 ----
  	sst.w	r8,8[ep]
  	sst.w	r9,12[ep]
  	mov	r1,ep
+ #else
+ 	st.w	r6,0[sp]
+ 	st.w	r7,4[sp]
+ 	st.w	r8,8[sp]
+ 	st.w	r9,12[sp]
+ #endif
  	ctret
  
  	/* Place the offsets of the start of this routines into the call table.  */
*************** __callt_return_interrupt:       .short c
*** 1486,1491 ****
--- 1958,1964 ----
  	.align	2
  .L_save_all_interrupt:
  	addi	-60, sp, sp
+ #ifdef __EP__
  	mov	ep,  r1
  	mov	sp,  ep
  	sst.w	r2,  56[ep]
*************** __callt_return_interrupt:       .short c
*** 1504,1510 ****
  	sst.w	r18, 4[ep]
  	sst.w	r19, 0[ep]
  	mov	r1,  ep
! 
  	prepare {r20 - r29, r31}, 4
  	ctret	
  
--- 1977,1999 ----
  	sst.w	r18, 4[ep]
  	sst.w	r19, 0[ep]
  	mov	r1,  ep
! #else
! 	st.w	r2,  56[sp]
! 	st.w	r5,  52[sp]
! 	st.w	r6,  48[sp]
! 	st.w	r7,  44[sp]
! 	st.w	r8,  40[sp]
! 	st.w	r9,  36[sp]
! 	st.w	r11, 32[sp]
! 	st.w	r12, 28[sp]
! 	st.w	r13, 24[sp]
! 	st.w	r14, 20[sp]
! 	st.w	r15, 16[sp]
! 	st.w	r16, 12[sp]
! 	st.w	r17, 8[sp]
! 	st.w	r18, 4[sp]
! 	st.w	r19, 0[sp]
! #endif
  	prepare {r20 - r29, r31}, 4
  	ctret	
  
*************** __callt_return_interrupt:       .short c
*** 1514,1520 ****
  	.align 2
  .L_restore_all_interrupt:
  	dispose 4, {r20 - r29, r31}
! 	
  	mov	ep, r1
  	mov	sp, ep
  	sld.w	0 [ep], r19
--- 2003,2009 ----
  	.align 2
  .L_restore_all_interrupt:
  	dispose 4, {r20 - r29, r31}
! #ifdef __EP__	
  	mov	ep, r1
  	mov	sp, ep
  	sld.w	0 [ep], r19
*************** __callt_return_interrupt:       .short c
*** 1533,1538 ****
--- 2022,2044 ----
  	sld.w	52[ep], r5
  	sld.w	56[ep], r2
  	mov	r1, ep
+ #else
+ 	ld.w	0 [sp], r19
+ 	ld.w	4 [sp], r18
+ 	ld.w	8 [sp], r17
+ 	ld.w	12[sp], r16
+ 	ld.w	16[sp], r15
+ 	ld.w	20[sp], r14
+ 	ld.w	24[sp], r13
+ 	ld.w	28[sp], r12
+ 	ld.w	32[sp], r11
+ 	ld.w	36[sp], r9
+ 	ld.w	40[sp], r8
+ 	ld.w	44[sp], r7
+ 	ld.w	48[sp], r6
+ 	ld.w	52[sp], r5
+ 	ld.w	56[sp], r2
+ #endif
  	addi	60, sp, sp
  	ctret
  
Index: gcc/config/v850/v850.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.c,v
retrieving revision 1.106
diff -c -3 -p -r1.106 v850.c
*** gcc/config/v850/v850.c	3 Jul 2005 21:08:10 -0000	1.106
--- gcc/config/v850/v850.c	26 Aug 2005 11:58:21 -0000
*************** ep_memory_operand (rtx op, enum machine_
*** 1057,1062 ****
--- 1057,1069 ----
    int max_offset;
    int mask;
  
+   /* If we are not using the EP register on a per-function basis
+      then do not allow this optimisation at all.  This is to
+      prevent the use of the SLD/SST instructions which cannot be
+      guaranteed to work properly due to a hardware bug.  */
+   if (!TARGET_EP)
+     return FALSE;
+ 
    if (GET_CODE (op) != MEM)
      return FALSE;
  
Index: gcc/config/v850/v850.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.h,v
retrieving revision 1.107
diff -c -3 -p -r1.107 v850.h
*** gcc/config/v850/v850.h	6 Aug 2005 13:26:25 -0000	1.107
--- gcc/config/v850/v850.h	26 Aug 2005 11:58:22 -0000
***************
*** 81,86 ****
--- 81,88 ----
    builtin_define( "__v850" );			\
    builtin_assert( "machine=v850" );		\
    builtin_assert( "cpu=v850" );			\
+   if (TARGET_EP)				\
+     builtin_define ("__EP__");			\
  } while(0)
  
  #define MASK_CPU (MASK_V850 | MASK_V850E)
*************** extern struct small_memory_info small_me
*** 131,137 ****
  {									\
    target_flags |= MASK_STRICT_ALIGN;					\
    if (LEVEL)								\
!     target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION);			\
  }
  
  
--- 133,145 ----
  {									\
    target_flags |= MASK_STRICT_ALIGN;					\
    if (LEVEL)								\
!     /* Note - we no longer enable MASK_EP when optimizing.  This is	\
!        because of a hardware bug which stops the SLD and SST instructions\
!        from correctly detecting some hazards.  If the user is sure that \
!        their hardware is fixed or that their program will not encounter \
!        the conditions that trigger the bug then they can enable -mep by \
!        hand.  */							\
!     target_flags |= MASK_PROLOG_FUNCTION;				\
  }
  
  
Index: gcc/config/v850/v850.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.md,v
retrieving revision 1.34
diff -c -3 -p -r1.34 v850.md
*** gcc/config/v850/v850.md	25 Jun 2005 01:22:36 -0000	1.34
--- gcc/config/v850/v850.md	26 Aug 2005 11:58:22 -0000
***************
*** 1832,1866 ****
      return \"jarl __save_all_interrupt,r10\";
  
    output_asm_insn (\"addi -120, sp, sp\", operands);
!   output_asm_insn (\"mov ep, r1\", operands);
!   output_asm_insn (\"mov sp, ep\", operands);
!   output_asm_insn (\"sst.w r31, 116[ep]\", operands);
!   output_asm_insn (\"sst.w r2,  112[ep]\", operands);
!   output_asm_insn (\"sst.w gp,  108[ep]\", operands);
!   output_asm_insn (\"sst.w r6,  104[ep]\", operands);
!   output_asm_insn (\"sst.w r7,  100[ep]\", operands);
!   output_asm_insn (\"sst.w r8,   96[ep]\", operands);
!   output_asm_insn (\"sst.w r9,   92[ep]\", operands);
!   output_asm_insn (\"sst.w r11,  88[ep]\", operands);
!   output_asm_insn (\"sst.w r12,  84[ep]\", operands);
!   output_asm_insn (\"sst.w r13,  80[ep]\", operands);
!   output_asm_insn (\"sst.w r14,  76[ep]\", operands);
!   output_asm_insn (\"sst.w r15,  72[ep]\", operands);
!   output_asm_insn (\"sst.w r16,  68[ep]\", operands);
!   output_asm_insn (\"sst.w r17,  64[ep]\", operands);
!   output_asm_insn (\"sst.w r18,  60[ep]\", operands);
!   output_asm_insn (\"sst.w r19,  56[ep]\", operands);
!   output_asm_insn (\"sst.w r20,  52[ep]\", operands);
!   output_asm_insn (\"sst.w r21,  48[ep]\", operands);
!   output_asm_insn (\"sst.w r22,  44[ep]\", operands);
!   output_asm_insn (\"sst.w r23,  40[ep]\", operands);
!   output_asm_insn (\"sst.w r24,  36[ep]\", operands);
!   output_asm_insn (\"sst.w r25,  32[ep]\", operands);
!   output_asm_insn (\"sst.w r26,  28[ep]\", operands);
!   output_asm_insn (\"sst.w r27,  24[ep]\", operands);
!   output_asm_insn (\"sst.w r28,  20[ep]\", operands);
!   output_asm_insn (\"sst.w r29,  16[ep]\", operands);
!   output_asm_insn (\"mov   r1,   ep\", operands);
    return \"\";
  }"
    [(set (attr "length")
--- 1832,1900 ----
      return \"jarl __save_all_interrupt,r10\";
  
    output_asm_insn (\"addi -120, sp, sp\", operands);
! 
!   if (TARGET_EP)
!     {
!       output_asm_insn (\"mov ep, r1\", operands);
!       output_asm_insn (\"mov sp, ep\", operands);
!       output_asm_insn (\"sst.w r31, 116[ep]\", operands);
!       output_asm_insn (\"sst.w r2,  112[ep]\", operands);
!       output_asm_insn (\"sst.w gp,  108[ep]\", operands);
!       output_asm_insn (\"sst.w r6,  104[ep]\", operands);
!       output_asm_insn (\"sst.w r7,  100[ep]\", operands);
!       output_asm_insn (\"sst.w r8,   96[ep]\", operands);
!       output_asm_insn (\"sst.w r9,   92[ep]\", operands);
!       output_asm_insn (\"sst.w r11,  88[ep]\", operands);
!       output_asm_insn (\"sst.w r12,  84[ep]\", operands);
!       output_asm_insn (\"sst.w r13,  80[ep]\", operands);
!       output_asm_insn (\"sst.w r14,  76[ep]\", operands);
!       output_asm_insn (\"sst.w r15,  72[ep]\", operands);
!       output_asm_insn (\"sst.w r16,  68[ep]\", operands);
!       output_asm_insn (\"sst.w r17,  64[ep]\", operands);
!       output_asm_insn (\"sst.w r18,  60[ep]\", operands);
!       output_asm_insn (\"sst.w r19,  56[ep]\", operands);
!       output_asm_insn (\"sst.w r20,  52[ep]\", operands);
!       output_asm_insn (\"sst.w r21,  48[ep]\", operands);
!       output_asm_insn (\"sst.w r22,  44[ep]\", operands);
!       output_asm_insn (\"sst.w r23,  40[ep]\", operands);
!       output_asm_insn (\"sst.w r24,  36[ep]\", operands);
!       output_asm_insn (\"sst.w r25,  32[ep]\", operands);
!       output_asm_insn (\"sst.w r26,  28[ep]\", operands);
!       output_asm_insn (\"sst.w r27,  24[ep]\", operands);
!       output_asm_insn (\"sst.w r28,  20[ep]\", operands);
!       output_asm_insn (\"sst.w r29,  16[ep]\", operands);
!       output_asm_insn (\"mov   r1,   ep\", operands);
!     }
!   else
!     {
!       output_asm_insn (\"st.w r31, 116[sp]\", operands);
!       output_asm_insn (\"st.w r2,  112[sp]\", operands);
!       output_asm_insn (\"st.w gp,  108[sp]\", operands);
!       output_asm_insn (\"st.w r6,  104[sp]\", operands);
!       output_asm_insn (\"st.w r7,  100[sp]\", operands);
!       output_asm_insn (\"st.w r8,   96[sp]\", operands);
!       output_asm_insn (\"st.w r9,   92[sp]\", operands);
!       output_asm_insn (\"st.w r11,  88[sp]\", operands);
!       output_asm_insn (\"st.w r12,  84[sp]\", operands);
!       output_asm_insn (\"st.w r13,  80[sp]\", operands);
!       output_asm_insn (\"st.w r14,  76[sp]\", operands);
!       output_asm_insn (\"st.w r15,  72[sp]\", operands);
!       output_asm_insn (\"st.w r16,  68[sp]\", operands);
!       output_asm_insn (\"st.w r17,  64[sp]\", operands);
!       output_asm_insn (\"st.w r18,  60[sp]\", operands);
!       output_asm_insn (\"st.w r19,  56[sp]\", operands);
!       output_asm_insn (\"st.w r20,  52[sp]\", operands);
!       output_asm_insn (\"st.w r21,  48[sp]\", operands);
!       output_asm_insn (\"st.w r22,  44[sp]\", operands);
!       output_asm_insn (\"st.w r23,  40[sp]\", operands);
!       output_asm_insn (\"st.w r24,  36[sp]\", operands);
!       output_asm_insn (\"st.w r25,  32[sp]\", operands);
!       output_asm_insn (\"st.w r26,  28[sp]\", operands);
!       output_asm_insn (\"st.w r27,  24[sp]\", operands);
!       output_asm_insn (\"st.w r28,  20[sp]\", operands);
!       output_asm_insn (\"st.w r29,  16[sp]\", operands);
!     }
!     
    return \"\";
  }"
    [(set (attr "length")
***************
*** 1897,1903 ****
  {
    if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS)
      return \"jarl __restore_all_interrupt,r10\";
!   else
      {
        output_asm_insn (\"mov   ep,      r1\", operands);
        output_asm_insn (\"mov   sp,      ep\", operands);
--- 1931,1938 ----
  {
    if (TARGET_PROLOG_FUNCTION && !TARGET_LONG_CALLS)
      return \"jarl __restore_all_interrupt,r10\";
! 
!   if (TARGET_EP)
      {
        output_asm_insn (\"mov   ep,      r1\", operands);
        output_asm_insn (\"mov   sp,      ep\", operands);
***************
*** 1928,1936 ****
        output_asm_insn (\"sld.w 20[ep],  r28\", operands);
        output_asm_insn (\"sld.w 16[ep],  r29\", operands);
        output_asm_insn (\"mov   r1,      ep\", operands);
-       output_asm_insn (\"addi  120, sp, sp\", operands);
-       return \"\";
      }
  }"
    [(set (attr "length")
          (if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0))
--- 1963,2000 ----
        output_asm_insn (\"sld.w 20[ep],  r28\", operands);
        output_asm_insn (\"sld.w 16[ep],  r29\", operands);
        output_asm_insn (\"mov   r1,      ep\", operands);
      }
+   else
+     {
+       output_asm_insn (\"ld.w 116[sp], r31\", operands);
+       output_asm_insn (\"ld.w 112[sp], r2\", operands);
+       output_asm_insn (\"ld.w 108[sp], gp\", operands);
+       output_asm_insn (\"ld.w 104[sp], r6\", operands);
+       output_asm_insn (\"ld.w 100[sp], r7\", operands);
+       output_asm_insn (\"ld.w 96[sp],  r8\", operands);
+       output_asm_insn (\"ld.w 92[sp],  r9\", operands);
+       output_asm_insn (\"ld.w 88[sp],  r11\", operands);
+       output_asm_insn (\"ld.w 84[sp],  r12\", operands);
+       output_asm_insn (\"ld.w 80[sp],  r13\", operands);
+       output_asm_insn (\"ld.w 76[sp],  r14\", operands);
+       output_asm_insn (\"ld.w 72[sp],  r15\", operands);
+       output_asm_insn (\"ld.w 68[sp],  r16\", operands);
+       output_asm_insn (\"ld.w 64[sp],  r17\", operands);
+       output_asm_insn (\"ld.w 60[sp],  r18\", operands);
+       output_asm_insn (\"ld.w 56[sp],  r19\", operands);
+       output_asm_insn (\"ld.w 52[sp],  r20\", operands);
+       output_asm_insn (\"ld.w 48[sp],  r21\", operands);
+       output_asm_insn (\"ld.w 44[sp],  r22\", operands);
+       output_asm_insn (\"ld.w 40[sp],  r23\", operands);
+       output_asm_insn (\"ld.w 36[sp],  r24\", operands);
+       output_asm_insn (\"ld.w 32[sp],  r25\", operands);
+       output_asm_insn (\"ld.w 28[sp],  r26\", operands);
+       output_asm_insn (\"ld.w 24[sp],  r27\", operands);
+       output_asm_insn (\"ld.w 20[sp],  r28\", operands);
+       output_asm_insn (\"ld.w 16[sp],  r29\", operands);
+     }
+   output_asm_insn (\"addi  120, sp, sp\", operands);
+   return \"\";
  }"
    [(set (attr "length")
          (if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0))

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