Commit d7a9e7c5 by Nathan Froyd Committed by Jakub Jelinek

re PR target/41175 (-Os generates significantly larger code)

	PR target/41175
	PR target/40677
	* config/rs6000/rs6000.c (no_global_regs_above): Fix precedence
	problem.
	(SAVRES_NOINLINE_GPRS_SAVES_LR, SAVRES_NOINLINE_FPRS_SAVES_LR,
	SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR): New strategy bits.
	(rs6000_savres_strategy): Always save FP registers inline if the
	target doesn't support hardware double-precision.  Set the above
	bits in return value when needed.
	(rs6000_savres_routine_sym): Fix computation for cache selector.
	Mark the generated symbol as a function.  Rename exitp argument to
	lr.  Move code for determining the name of the symbol...
	(rs6000_savres_routine_name): ...here.  New function.  Add cases for
	getting the names right on AIX and 64-bit Linux.
	(savres_routine_name): New variable.
	(rs6000_make_savres_rtx): Rename exitp argument to lr.  Don't assert
	lr isn't set when savep.  Use r12 resp. r1 instead of r11 depending
	on what the target routine uses as a base register.  If savep && lr
	describe saving of r0 into memory slot.
	(rs6000_emit_prologue): Correct use of call_used_regs.  Fix out of
	line calls for AIX ABI.
	(rs6000_output_function_prologue): Use rs6000_savres_routine_name to
	determine FP save/restore functions.
	(rs6000_emit_stack_reset): Handle savres if sp_offset != 0 and
	frame_reg_rtx != sp_reg_rtx.  Use gen_add3_insn instead of
	gen_addsi3.
	(rs6000_emit_epilogue): Adjust computation of restore_lr.
	Duplicate restoration of LR and execute the appropriate one
	depending on whether GPRs are being restored inline.  Set r11 from
	offsetted frame_reg_rtx instead of sp_reg_rtx; if frame_reg_rtx is
	r11, adjust sp_offset.  Use gen_add3_insn instead of gen_addsi3.
	Fix out of line calls for AIX ABI.
	* config/rs6000/rs6000.md (*return_and_restore_fpregs_aix_<mode>):
	New insn.
	* config/rs6000/spe.md (*save_gpregs_spe): Use explicit match for
	register 11.
	(*restore_gpregs_spe): Likewise.
	(*return_and_restore_gpregs_spe): Likewise.
	* config/rs6000/linux64.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
	Define to empty string unconditionally.
	* config/rs6000/sysv4.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
	Define to empty string unconditionally.
	(GP_SAVE_INLINE, FP_SAVE_INLINE): Handle TARGET_64BIT the same as
	!TARGET_64BIT.

	* gcc.target/powerpc/pr41175.c: New test.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r151729
parent c7d68c96
2009-09-15 Nathan Froyd <froydnj@codesourcery.com>
Jakub Jelinek <jakub@redhat.com>
PR target/41175
PR target/40677
* config/rs6000/rs6000.c (no_global_regs_above): Fix precedence
problem.
(SAVRES_NOINLINE_GPRS_SAVES_LR, SAVRES_NOINLINE_FPRS_SAVES_LR,
SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR): New strategy bits.
(rs6000_savres_strategy): Always save FP registers inline if the
target doesn't support hardware double-precision. Set the above
bits in return value when needed.
(rs6000_savres_routine_sym): Fix computation for cache selector.
Mark the generated symbol as a function. Rename exitp argument to
lr. Move code for determining the name of the symbol...
(rs6000_savres_routine_name): ...here. New function. Add cases for
getting the names right on AIX and 64-bit Linux.
(savres_routine_name): New variable.
(rs6000_make_savres_rtx): Rename exitp argument to lr. Don't assert
lr isn't set when savep. Use r12 resp. r1 instead of r11 depending
on what the target routine uses as a base register. If savep && lr
describe saving of r0 into memory slot.
(rs6000_emit_prologue): Correct use of call_used_regs. Fix out of
line calls for AIX ABI.
(rs6000_output_function_prologue): Use rs6000_savres_routine_name to
determine FP save/restore functions.
(rs6000_emit_stack_reset): Handle savres if sp_offset != 0 and
frame_reg_rtx != sp_reg_rtx. Use gen_add3_insn instead of
gen_addsi3.
(rs6000_emit_epilogue): Adjust computation of restore_lr.
Duplicate restoration of LR and execute the appropriate one
depending on whether GPRs are being restored inline. Set r11 from
offsetted frame_reg_rtx instead of sp_reg_rtx; if frame_reg_rtx is
r11, adjust sp_offset. Use gen_add3_insn instead of gen_addsi3.
Fix out of line calls for AIX ABI.
* config/rs6000/rs6000.md (*return_and_restore_fpregs_aix_<mode>):
New insn.
* config/rs6000/spe.md (*save_gpregs_spe): Use explicit match for
register 11.
(*restore_gpregs_spe): Likewise.
(*return_and_restore_gpregs_spe): Likewise.
* config/rs6000/linux64.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
Define to empty string unconditionally.
* config/rs6000/sysv4.h (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX):
Define to empty string unconditionally.
(GP_SAVE_INLINE, FP_SAVE_INLINE): Handle TARGET_64BIT the same as
!TARGET_64BIT.
2009-09-15 Jan Hubicka <jh@suse.cz> 2009-09-15 Jan Hubicka <jh@suse.cz>
* doc/invoke.texi (inline-insns-auto): Drop from 60 to 50. * doc/invoke.texi (inline-insns-auto): Drop from 60 to 50.
......
...@@ -437,11 +437,11 @@ extern int dot_symbols; ...@@ -437,11 +437,11 @@ extern int dot_symbols;
#undef SAVE_FP_PREFIX #undef SAVE_FP_PREFIX
#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
#undef SAVE_FP_SUFFIX #undef SAVE_FP_SUFFIX
#define SAVE_FP_SUFFIX (TARGET_64BIT ? "" : "_l") #define SAVE_FP_SUFFIX ""
#undef RESTORE_FP_PREFIX #undef RESTORE_FP_PREFIX
#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
#undef RESTORE_FP_SUFFIX #undef RESTORE_FP_SUFFIX
#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "" : "_l") #define RESTORE_FP_SUFFIX ""
/* Dwarf2 debugging. */ /* Dwarf2 debugging. */
#undef PREFERRED_DEBUGGING_TYPE #undef PREFERRED_DEBUGGING_TYPE
......
...@@ -15436,6 +15436,19 @@ ...@@ -15436,6 +15436,19 @@
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set_attr "length" "4")]) (set_attr "length" "4")])
(define_insn "*return_and_restore_fpregs_aix_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(return)
(use (match_operand:P 1 "register_operand" "l"))
(use (match_operand:P 2 "symbol_ref_operand" "s"))
(use (match_operand:P 3 "gpc_reg_operand" "r"))
(set (match_operand:DF 4 "gpc_reg_operand" "=d")
(match_operand:DF 5 "memory_operand" "m"))])]
""
"b %z2"
[(set_attr "type" "branch")
(set_attr "length" "4")])
; This is used in compiling the unwind routines. ; This is used in compiling the unwind routines.
(define_expand "eh_return" (define_expand "eh_return"
[(use (match_operand 0 "general_operand" ""))] [(use (match_operand 0 "general_operand" ""))]
......
...@@ -3156,9 +3156,9 @@ ...@@ -3156,9 +3156,9 @@
[(match_parallel 0 "any_parallel_operand" [(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65)) [(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s")) (use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r")) (use (reg:P 11))
(set (match_operand:V2SI 3 "memory_operand" "=m") (set (match_operand:V2SI 2 "memory_operand" "=m")
(match_operand:V2SI 4 "gpc_reg_operand" "r"))])] (match_operand:V2SI 3 "gpc_reg_operand" "r"))])]
"TARGET_SPE_ABI" "TARGET_SPE_ABI"
"bl %z1" "bl %z1"
[(set_attr "type" "branch") [(set_attr "type" "branch")
...@@ -3168,9 +3168,9 @@ ...@@ -3168,9 +3168,9 @@
[(match_parallel 0 "any_parallel_operand" [(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65)) [(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s")) (use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r")) (use (reg:P 11))
(set (match_operand:V2SI 3 "gpc_reg_operand" "=r") (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
(match_operand:V2SI 4 "memory_operand" "m"))])] (match_operand:V2SI 3 "memory_operand" "m"))])]
"TARGET_SPE_ABI" "TARGET_SPE_ABI"
"bl %z1" "bl %z1"
[(set_attr "type" "branch") [(set_attr "type" "branch")
...@@ -3181,9 +3181,9 @@ ...@@ -3181,9 +3181,9 @@
[(return) [(return)
(clobber (reg:P 65)) (clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s")) (use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r")) (use (reg:P 11))
(set (match_operand:V2SI 3 "gpc_reg_operand" "=r") (set (match_operand:V2SI 2 "gpc_reg_operand" "=r")
(match_operand:V2SI 4 "memory_operand" "m"))])] (match_operand:V2SI 3 "memory_operand" "m"))])]
"TARGET_SPE_ABI" "TARGET_SPE_ABI"
"b %z1" "b %z1"
[(set_attr "type" "branch") [(set_attr "type" "branch")
......
...@@ -272,27 +272,25 @@ do { \ ...@@ -272,27 +272,25 @@ do { \
#endif #endif
/* Define cutoff for using external functions to save floating point. /* Define cutoff for using external functions to save floating point.
Currently on 64-bit V.4, always use inline stores. When optimizing When optimizing for size, use external functions when profitable. */
for size on 32-bit targets, use external functions when #define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
profitable. */
#define FP_SAVE_INLINE(FIRST_REG) (optimize_size && !TARGET_64BIT \
? ((FIRST_REG) == 62 \ ? ((FIRST_REG) == 62 \
|| (FIRST_REG) == 63) \ || (FIRST_REG) == 63) \
: (FIRST_REG) < 64) : (FIRST_REG) < 64)
/* And similarly for general purpose registers. */ /* And similarly for general purpose registers. */
#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \ #define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
&& (TARGET_64BIT || !optimize_size)) && !optimize_size)
/* Put jump tables in read-only memory, rather than in .text. */ /* Put jump tables in read-only memory, rather than in .text. */
#define JUMP_TABLES_IN_TEXT_SECTION 0 #define JUMP_TABLES_IN_TEXT_SECTION 0
/* Prefix and suffix to use to saving floating point. */ /* Prefix and suffix to use to saving floating point. */
#define SAVE_FP_PREFIX "_savefpr_" #define SAVE_FP_PREFIX "_savefpr_"
#define SAVE_FP_SUFFIX (TARGET_64BIT ? "_l" : "") #define SAVE_FP_SUFFIX ""
/* Prefix and suffix to use to restoring floating point. */ /* Prefix and suffix to use to restoring floating point. */
#define RESTORE_FP_PREFIX "_restfpr_" #define RESTORE_FP_PREFIX "_restfpr_"
#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "_l" : "") #define RESTORE_FP_SUFFIX ""
/* Type used for ptrdiff_t, as a string used in a declaration. */ /* Type used for ptrdiff_t, as a string used in a declaration. */
#define PTRDIFF_TYPE "int" #define PTRDIFF_TYPE "int"
......
2009-09-15 Nathan Froyd <froydnj@codesourcery.com>
Jakub Jelinek <jakub@redhat.com>
PR target/41175
* gcc.target/powerpc/pr41175.c: New test.
2009-09-14 Richard Henderson <rth@redhat.com> 2009-09-14 Richard Henderson <rth@redhat.com>
* c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c, * c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment