Bug 39079 - MIPS: __builtin___clear_cache() broken on SMP ISA_HAS_SYNCI systems.
Summary: MIPS: __builtin___clear_cache() broken on SMP ISA_HAS_SYNCI systems.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: David Daney
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-02 17:00 UTC by David Daney
Modified: 2009-07-10 22:52 UTC (History)
1 user (show)

See Also:
Host: mips64-unknown-linux-gnu
Target: mips64-unknown-linux-gnu
Build: mips64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2009-05-18 17:39:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Daney 2009-02-02 17:00:30 UTC
We expand __builtin___clear_cache() to a 'synci' instruction on ISA_HAS_SYNCI systems, which invalidates the icache only on the local CPU.

On an SMP system, the caches on all CPUs should be invalidated.  To achieve this we need to drop back to the old way of doing things by using the cache flush system call.
Comment 1 David Daney 2009-05-18 17:39:10 UTC
I am working on a patch.
Comment 2 David Daney 2009-07-10 22:50:05 UTC
Subject: Bug 39079

Author: daney
Date: Fri Jul 10 22:49:52 2009
New Revision: 149500

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149500
Log:
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.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config/mips/mips.c
    trunk/gcc/config/mips/mips.h
    trunk/gcc/config/mips/mips.md
    trunk/gcc/config/mips/mips.opt
    trunk/gcc/doc/install.texi
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/mips/clear-cache-1.c
    trunk/gcc/testsuite/gcc.target/mips/mips.exp

Comment 3 David Daney 2009-07-10 22:52:34 UTC
Fixed by the patch.