+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
name, "cold");
*no_add_attrs = true;
}
-
else
{
tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node);
/* 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. */
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
{
/* 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. */
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node)
= optimization_cold_node;
}
+ /* Most of the rest of the cold processing is done later with
+ lookup_attribute. */
}
}
else
{ "-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 },
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)
*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);
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. */
#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;
\f
#include "gt-i386.h"
#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;
\f
typedef enum
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;
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);
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")}.
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
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
@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
#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, \
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. */
/* 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
+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):
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}