Fix IA-64 breakage...

Fix IA-64 breakage; Make hot/cold optimization conversation port specific; Move
disabling of scheduling from OVERRIDE_OPTIONS to OPTIMIZATION_OPTIONS

Files modified:
gcc/doc/extend.texi
gcc/doc/tm.texi
gcc/target.h
gcc/ChangeLog
gcc/testsuite/gcc.target/i386/cmov8.c
gcc/testsuite/gcc.target/i386/funcspec-10.c
gcc/testsuite/gcc.target/i386/funcspec-11.c
gcc/testsuite/ChangeLog
gcc/target-def.h
gcc/c-common.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c

From-SVN: r138154
This commit is contained in:
Michael Meissner 2008-07-25 23:44:24 +00:00
parent 26f130aa70
commit a51fa0f4ca
12 changed files with 149 additions and 21 deletions

View file

@ -1,3 +1,46 @@
2008-07-25 Michael Meissner <gnu@the-meissners.org>
* doc/extend.texi (hot attribute): Document that the hot attribute
turns on -O3 for some ports.
(cold attribute): Document that the cold attribute turns on -Os
for some ports
* doc/tm.texi (OPTIMIZATION_OPTIONS): Update documentation to
reflect function specific option support.
* target.h (struct target_option_hooks): Add fields to say whether
the cold attribute implies -Os and the hot attribute implies -O3.
* target-def.h (TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION):
By default, do not turn on -Os for cold functions.
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): By default, do
not turn on -O3 for hot functions.
* c-common.c (handle_hot_attribute): Use target hook to determine
if hot functions should enable -O3.
(handle_cold_attribute): Use target hook to determine if cold
functions should enable -Os.
* config/i386/i386.c (ix86_target_string): Add -m3dnowa support.
(override_options): Move disable scheduling to
optimization_options.
(optimization_options): Disable scheduling here, not
override_options.
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Define.
(TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION): Define.
* config/ia64/ia64.c (ia64_override_options): Move setting
scheduling flags to ia64_optimization_options.
(ia64_optimization_options): Disable scheduling options here, and
not in ia64_override_options.
(TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION): Define.
(TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION): Define.
2008-07-25 H.J. Lu <hongjiu.lu@intel.com>
PR target/36936
* config/i386/i386.c (override_options): Don't clear TARGET_CMOVE.
2008-07-25 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/36926

View file

@ -5046,7 +5046,6 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args),
name, "cold");
*no_add_attrs = true;
}
else
{
tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
@ -5054,6 +5053,7 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* If we are not at -O3, but are optimizing, turn on -O3
optimizations just for this one function. */
if (((optimize > 0 && optimize < 3) || optimize_size)
&& targetm.target_option.hot_attribute_sets_optimization
&& (!old_opts || old_opts == optimization_default_node))
{
/* Create the hot optimization node if needed. */
@ -5071,9 +5071,9 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args),
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
= optimization_hot_node;
}
/* Most of the rest of the hot processing is done later with
lookup_attribute. */
}
/* Most of the rest of the hot processing is done later with
lookup_attribute. */
}
else
{
@ -5105,6 +5105,7 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* If we are optimizing, but not optimizing for space, turn on -Os
optimizations just for this one function. */
if (optimize && !optimize_size
&& targetm.target_option.cold_attribute_sets_optimization
&& (!old_opts || old_opts == optimization_default_node))
{
/* Create the cold optimization node if needed. */
@ -5122,6 +5123,8 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args),
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
= optimization_cold_node;
}
/* Most of the rest of the cold processing is done later with
lookup_attribute. */
}
}
else

View file

@ -2215,6 +2215,7 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
{ "-msse2", OPTION_MASK_ISA_SSE2 },
{ "-msse", OPTION_MASK_ISA_SSE },
{ "-m3dnow", OPTION_MASK_ISA_3DNOW },
{ "-m3dnowa", OPTION_MASK_ISA_3DNOW_A },
{ "-mmmx", OPTION_MASK_ISA_MMX },
{ "-mabm", OPTION_MASK_ISA_ABM },
{ "-mpopcnt", OPTION_MASK_ISA_POPCNT },
@ -3123,8 +3124,6 @@ override_options (bool main_args_p)
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
}
TARGET_CMOVE = 0;
/* For sane SSE instruction set generation we need fcomi instruction.
It is safe to enable all CMOVE instructions. */
if (TARGET_SSE)
@ -3139,11 +3138,6 @@ override_options (bool main_args_p)
*p = '\0';
}
/* When scheduling description is not available, disable scheduler pass
so it won't slow down the compilation and make x87 code slower. */
if (!TARGET_SCHEDULE)
flag_schedule_insns_after_reload = flag_schedule_insns = 0;
if (!PARAM_SET_P (PARAM_SIMULTANEOUS_PREFETCHES))
set_param_value ("simultaneous-prefetches",
ix86_cost->simultaneous_prefetches);
@ -3911,6 +3905,11 @@ optimization_options (int level, int size ATTRIBUTE_UNUSED)
flag_schedule_insns = 0;
#endif
/* When scheduling description is not available, disable scheduler pass
so it won't slow down the compilation and make x87 code slower. */
if (!TARGET_SCHEDULE)
flag_schedule_insns_after_reload = flag_schedule_insns = 0;
if (TARGET_MACHO)
/* The Darwin libraries never set errno, so we might as well
avoid calling them when that's the only reason we would. */
@ -27345,6 +27344,12 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_OPTION_CAN_INLINE_P
#define TARGET_OPTION_CAN_INLINE_P ix86_can_inline_p
#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-i386.h"

View file

@ -493,6 +493,12 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_C_MODE_FOR_SUFFIX
#define TARGET_C_MODE_FOR_SUFFIX ia64_c_mode_for_suffix
#undef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION true
#undef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION true
struct gcc_target targetm = TARGET_INITIALIZER;
typedef enum
@ -5232,9 +5238,6 @@ ia64_override_options (void)
TARGET_INLINE_SQRT = INL_MAX_THR;
}
ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
flag_schedule_insns_after_reload = 0;
ia64_section_threshold = g_switch_set ? g_switch_value : IA64_DEFAULT_GVALUE;
init_machine_status = ia64_init_machine_status;
@ -9927,6 +9930,13 @@ void
ia64_optimization_options (int level ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED)
{
/* Disable the second machine independent scheduling pass and use one for the
IA-64. This needs to be here instead of in OVERRIDE_OPTIONS because this
is done whenever the optimization is changed via #pragma GCC optimize or
attribute((optimize(...))). */
ia64_flag_schedule_insns2 = flag_schedule_insns_after_reload;
flag_schedule_insns_after_reload = 0;
/* Let the scheduler form additional regions. */
set_param_value ("max-sched-extend-regions-iters", 2);

View file

@ -2853,7 +2853,7 @@ that affect more than one function.
This can be used for instance to have frequently executed functions
compiled with more aggressive optimization options that produce faster
and larger code, while other functions can be called with less
aggressive options. The @code{hot} attribute implies
aggressive options. On some targets, the @code{hot} attribute implies
@code{optimize("O3")}, and @code{cold} attribute implies
@code{optimize("Os")}.
@ -2903,8 +2903,9 @@ are automatically detected and this attribute is ignored.
The @code{hot} attribute is not implemented in GCC versions earlier
than 4.3.
Starting with GCC 4.4, the @code{hot} attribute sets
@code{optimize("O3")} to turn on more aggressive optimization.
Starting with GCC 4.4, the @code{cold} attribute sets
@code{optimize("O3")} to turn on more aggressive optimization on the
the i386, x86_64, and IA-64 targets.
@item cold
@cindex @code{cold} function attribute
@ -2924,7 +2925,8 @@ are automatically detected and this attribute is ignored.
The @code{cold} attribute is not implemented in GCC versions earlier than 4.3.
Starting with GCC 4.4, the @code{cold} attribute sets
@code{optimize("Os")} to save space.
@code{optimize("Os")} to save space on the the i386, x86_64, and IA-64
targets.
@item regparm (@var{number})
@cindex @code{regparm} attribute

View file

@ -833,10 +833,9 @@ specified, 1 if @option{-O} is specified, and 0 if neither is specified.
@var{size} is nonzero if @option{-Os} is specified and zero otherwise.
You should not use this macro to change options that are not
machine-specific. These should uniformly selected by the same
optimization level on all supported machines. Use this macro to enable
machine-specific optimizations.
This macro is run once at program startup and when the optimization
options are changed via @code{#pragma GCC optimize} or by using the
@code{optimize} attribute.
@strong{Do not examine @code{write_symbols} in
this macro!} The debugging options are not supposed to alter the

View file

@ -783,6 +783,14 @@
#define TARGET_OPTION_CAN_INLINE_P default_target_option_can_inline_p
#endif
#ifndef TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION false
#endif
#ifndef TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION
#define TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION false
#endif
#define TARGET_OPTION_HOOKS \
{ \
TARGET_OPTION_VALID_ATTRIBUTE_P, \
@ -791,6 +799,8 @@
TARGET_OPTION_PRINT, \
TARGET_OPTION_PRAGMA_PARSE, \
TARGET_OPTION_CAN_INLINE_P, \
TARGET_OPTION_COLD_ATTRIBUTE_SETS_OPTIMIZATION, \
TARGET_OPTION_HOT_ATTRIBUTE_SETS_OPTIMIZATION, \
}
/* The whole shebang. */

View file

@ -989,6 +989,12 @@ struct gcc_target
/* Function to determine if one function can inline another function. */
bool (*can_inline_p) (tree, tree);
/* Whether the cold attribute changes the optimization level. */
bool cold_attribute_sets_optimization;
/* Whether the hot attribute changes the optimization level. */
bool hot_attribute_sets_optimization;
} target_option;
/* For targets that need to mark extra registers as live on entry to

View file

@ -1,3 +1,10 @@
2008-07-25 H.J. Lu <hongjiu.lu@intel.com>
PR target/36936
* gcc.target/i386/cmov8.c: New.
* gcc.target/i386/funcspec-10.c: Likewise.
* gcc.target/i386/funcspec-11.c: Likewise.
2008-07-25 Joseph Myers <joseph@codesourcery.com>
* lib/target-supports.exp (check_effective_target_arm_thumb1_ok):

View file

@ -0,0 +1,13 @@
/* PR target/36936 */
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -march=i686" } */
/* { dg-final { scan-assembler "cmov\[^8\]" } } */
int
foo (int x)
{
if (x < 0)
x = 1;
return x;
}

View file

@ -0,0 +1,15 @@
/* PR target/36936 */
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -march=i686" } */
/* { dg-final { scan-assembler-not "cmov" } } */
extern int foo (int) __attribute__((__option__("arch=i386")));
int
foo (int x)
{
if (x < 0)
x = 1;
return x;
}

View file

@ -0,0 +1,15 @@
/* PR target/36936 */
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O2 -march=i386" } */
/* { dg-final { scan-assembler "cmov" } } */
extern int foo (int) __attribute__((__option__("arch=i686")));
int
foo (int x)
{
if (x < 0)
x = 1;
return x;
}