Commit b96c5923 by David Daney Committed by David Daney

re PR target/39079 (MIPS: __builtin___clear_cache() broken on SMP ISA_HAS_SYNCI systems.)

2009-07-10  David Daney  <ddaney@caviumnetworks.com>

	PR target/39079
	* testsuite/gcc.target/mips/mips.exp: Make -msynci a known option.
	* gcc.target/mips/clear-cache-1.c (dg-options): Add -msynci.

2009-07-10  David Daney  <ddaney@caviumnetworks.com>

	PR target/39079
	* config.gcc (supported_defaults): Add synci.
	(with_synci): Add validation.
	(all_defaults): Add synci.
	* config/mips/mips.md (clear_cache): Use TARGET_SYNCI instead of
	ISA_HAS_SYNCI.
	(synci): Same.
	* config/mips/mips.opt (msynci): New option.
	* config/mips/mips.c (mips_override_options): Warn on use of
	-msynci for targets that do now support it.
	* gcc/config/mips/mips.h (OPTION_DEFAULT_SPECS): Add a default for
	msynci.
	* gcc/doc/invoke.texi (-msynci): Document the new option.
	* doc/install.texi (--with-synci): Document the new option.

From-SVN: r149500
parent 5bde96d2
2009-07-10 David Daney <ddaney@caviumnetworks.com>
PR target/39079
* config.gcc (supported_defaults): Add synci.
(with_synci): Add validation.
(all_defaults): Add synci.
* config/mips/mips.md (clear_cache): Use TARGET_SYNCI instead of
ISA_HAS_SYNCI.
(synci): Same.
* config/mips/mips.opt (msynci): New option.
* config/mips/mips.c (mips_override_options): Warn on use of
-msynci for targets that do now support it.
* gcc/config/mips/mips.h (OPTION_DEFAULT_SPECS): Add a default for
msynci.
* gcc/doc/invoke.texi (-msynci): Document the new option.
* doc/install.texi (--with-synci): Document the new option.
2009-07-10 Richard Guenther <rguenther@suse.de> 2009-07-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40496 PR tree-optimization/40496
......
...@@ -2902,7 +2902,7 @@ case "${target}" in ...@@ -2902,7 +2902,7 @@ case "${target}" in
;; ;;
mips*-*-*) mips*-*-*)
supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt" supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64 divide llsc mips-plt synci"
case ${with_float} in case ${with_float} in
"" | soft | hard) "" | soft | hard)
...@@ -2964,6 +2964,20 @@ case "${target}" in ...@@ -2964,6 +2964,20 @@ case "${target}" in
exit 1 exit 1
;; ;;
esac esac
case ${with_synci} in
yes)
with_synci=synci
;;
"" | no)
# No is the default.
with_synci=no-synci
;;
*)
echo "Unknown synci type used in --with-synci" 1>&2
exit 1
;;
esac
;; ;;
powerpc*-*-* | rs6000-*-*) powerpc*-*-* | rs6000-*-*)
...@@ -3230,7 +3244,7 @@ case ${target} in ...@@ -3230,7 +3244,7 @@ case ${target} in
esac esac
t= t=
all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt" all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt synci"
for option in $all_defaults for option in $all_defaults
do do
eval "val=\$with_"`echo $option | sed s/-/_/g` eval "val=\$with_"`echo $option | sed s/-/_/g`
......
...@@ -14524,6 +14524,13 @@ mips_override_options (void) ...@@ -14524,6 +14524,13 @@ mips_override_options (void)
: !TARGET_BRANCHLIKELY)) : !TARGET_BRANCHLIKELY))
sorry ("%qs requires branch-likely instructions", "-mfix-r10000"); sorry ("%qs requires branch-likely instructions", "-mfix-r10000");
if (TARGET_SYNCI && !ISA_HAS_SYNCI)
{
warning (0, "the %qs architecture does not support the synci "
"instruction", mips_arch_info->name);
target_flags &= ~MASK_SYNCI;
}
/* Save base state of options. */ /* Save base state of options. */
mips_base_target_flags = target_flags; mips_base_target_flags = target_flags;
mips_base_schedule_insns = flag_schedule_insns; mips_base_schedule_insns = flag_schedule_insns;
......
...@@ -787,7 +787,8 @@ enum mips_code_readable_setting { ...@@ -787,7 +787,8 @@ enum mips_code_readable_setting {
{"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \ {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \
{"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \ {"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \
{"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" }, \ {"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" }, \
{"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" } {"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }, \
{"synci", "%{!msynci:%{!mno-synci:-m%(VALUE)}}" }
/* A spec that infers the -mdsp setting from an -march argument. */ /* A spec that infers the -mdsp setting from an -march argument. */
......
...@@ -4728,7 +4728,7 @@ ...@@ -4728,7 +4728,7 @@
"" ""
" "
{ {
if (ISA_HAS_SYNCI) if (TARGET_SYNCI)
{ {
mips_expand_synci_loop (operands[0], operands[1]); mips_expand_synci_loop (operands[0], operands[1]);
emit_insn (gen_sync ()); emit_insn (gen_sync ());
...@@ -4753,7 +4753,7 @@ ...@@ -4753,7 +4753,7 @@
(define_insn "synci" (define_insn "synci"
[(unspec_volatile [(match_operand 0 "pmode_register_operand" "d")] [(unspec_volatile [(match_operand 0 "pmode_register_operand" "d")]
UNSPEC_SYNCI)] UNSPEC_SYNCI)]
"ISA_HAS_SYNCI" "TARGET_SYNCI"
"synci\t0(%0)") "synci\t0(%0)")
(define_insn "rdhwr_synci_step_<mode>" (define_insn "rdhwr_synci_step_<mode>"
......
...@@ -268,6 +268,10 @@ msym32 ...@@ -268,6 +268,10 @@ msym32
Target Report Var(TARGET_SYM32) Target Report Var(TARGET_SYM32)
Assume all symbols have 32-bit values Assume all symbols have 32-bit values
msynci
Target Report Mask(SYNCI)
Use synci instruction to invalidate i-cache
mtune= mtune=
Target RejectNegative Joined Var(mips_tune_string) Target RejectNegative Joined Var(mips_tune_string)
-mtune=PROCESSOR Optimize the output for PROCESSOR -mtune=PROCESSOR Optimize the output for PROCESSOR
......
...@@ -1170,6 +1170,14 @@ not provide them. ...@@ -1170,6 +1170,14 @@ not provide them.
On MIPS targets, make @option{-mno-llsc} the default when no On MIPS targets, make @option{-mno-llsc} the default when no
@option{-mllsc} option is passed. @option{-mllsc} option is passed.
@item --with-synci
On MIPS targets, make @option{-msynci} the default when no
@option{-mno-synci} option is passed.
@item --without-synci
On MIPS targets, make @option{-mno-synci} the default when no
@option{-msynci} option is passed. This is the default.
@item --with-mips-plt @item --with-mips-plt
On MIPS targets, make use of copy relocations and PLTs. On MIPS targets, make use of copy relocations and PLTs.
These features are extensions to the traditional These features are extensions to the traditional
......
...@@ -695,7 +695,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -695,7 +695,7 @@ Objective-C and Objective-C++ Dialects}.
-mflush-func=@var{func} -mno-flush-func @gol -mflush-func=@var{func} -mno-flush-func @gol
-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
-mfp-exceptions -mno-fp-exceptions @gol -mfp-exceptions -mno-fp-exceptions @gol
-mvr4130-align -mno-vr4130-align} -mvr4130-align -mno-vr4130-align -msynci -mno-synci}
@emph{MMIX Options} @emph{MMIX Options}
@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
...@@ -13712,6 +13712,22 @@ thinks should execute in parallel. ...@@ -13712,6 +13712,22 @@ thinks should execute in parallel.
This option only has an effect when optimizing for the VR4130. This option only has an effect when optimizing for the VR4130.
It normally makes code faster, but at the expense of making it bigger. It normally makes code faster, but at the expense of making it bigger.
It is enabled by default at optimization level @option{-O3}. It is enabled by default at optimization level @option{-O3}.
@item -msynci
@itemx -mno-synci
@opindex msynci
Enable (disable) generation of @code{synci} instructions on
architectures that support it. The @code{synci} instructions (if
enabled) will be generated when @code{__builtin___clear_cache()} is
compiled.
This option defaults to @code{-mno-synci}, but the default can be
overridden by configuring with @code{--with-synci}.
When compiling code for single processor systems, it is generally safe
to use @code{synci}. However, on many multi-core (SMP) systems, it
will not invalidate the instruction caches on all cores and may lead
to undefined behavior.
@end table @end table
@node MMIX Options @node MMIX Options
......
2009-07-10 David Daney <ddaney@caviumnetworks.com>
PR target/39079
* testsuite/gcc.target/mips/mips.exp: Make -msynci a known option.
* gcc.target/mips/clear-cache-1.c (dg-options): Add -msynci.
2009-07-10 Jakub Jelinek <jakub@redhat.com> 2009-07-10 Jakub Jelinek <jakub@redhat.com>
PR c++/40502 PR c++/40502
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 isa_rev>=2" } */ /* { dg-options "-O2 -msynci isa_rev>=2" } */
/* { dg-final { scan-assembler "synci" } } */ /* { dg-final { scan-assembler "synci" } } */
/* { dg-final { scan-assembler "jr.hb" } } */ /* { dg-final { scan-assembler "jr.hb" } } */
/* { dg-final { scan-assembler-not "_flush_cache" } } */ /* { dg-final { scan-assembler-not "_flush_cache" } } */
......
...@@ -234,6 +234,7 @@ foreach option { ...@@ -234,6 +234,7 @@ foreach option {
shared shared
smartmips smartmips
sym32 sym32
synci
} { } {
lappend mips_option_groups $option "-m(no-|)$option" lappend mips_option_groups $option "-m(no-|)$option"
} }
......
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