[Patch] MIPS: Add option to enable/disable atomic memory primitives.

David Daney ddaney@avtrex.com
Mon Sep 10 07:19:00 GMT 2007


This is a follow on patch to the atomic memory operations patch.  I have 
added both runtime and configure time options to enable and disable the 
atomic operations.  This is needed to allow systems that lack the 
underlying ll, sc and sync instructions, to use the atomic operations if 
there is emulation available.

The Linux kernel has emulation, so I set the default for mips*-linux* to 
be to use the instructions.  It other systems are known to have 
emulation we can add them in yet another patch.

Note that this patch conflicts slightly with the memory_barrier memory 
clobber patch, so I will adjust it after I commit the other patch.

So far it is tested by visually inspecting the output when configured 
with different combinations of --with-llsc=yes, --with-llsc=no, -mllsc 
-mno-llsc -mips1, -mips32.  I will also do a full bootstrap on 
mipsel-linux and either i686-pc-linux or x86_64-pc-linux.

OK?

2007-09-09  David Daney  <ddaney@avtrex.com>

    * doc/invoke.texi: Document new MIPS -mllsc and -mno-llsc options.
    * doc/install.texi: Document new --with-llsc=[yes|no] options.
    * config.gcc: Handle --with-llsc=[yes|no] configure options.
    * config/mips/mips.md (sync): Wrap sync instrunction in %| and %-
    operand codes.
    * config/mips/mips.opt (mllsc): New option.
    * config/mips/mips.c (mips_llsc): Define variable.
    (mips_handle_option): Handle mllsc option.
    (override_options): Set mips_print_operand_punct for '|' and '-'.
    (print_operand): Add new %| and %- operand codes.
    * config/mips/mips.h (mips_llsc_setting): New enum type.
    (mips_llsc): Declare.
    (OPTION_DEFAULT_SPECS): Add llsc handling.
    (ISA_HAS_SYNC_DEFAULT): New macro.
    (ISA_HAS_SYNC): Rewrite.
    (ISA_HAS_LL_SC_DEFAULT): New macro.
    (ISA_HAS_LL_SC): Rewrite.
    (MIPS_COMPARE_AND_SWAP, MIPS_SYNC_OP, MIPS_SYNC_OLD_OP,
    MIPS_SYNC_NEW_OP, MIPS_SYNC_NAND, MIPS_SYNC_OLD_NAND,
    MIPS_SYNC_NEW_NAND, MIPS_SYNC_EXCHANGE): Wrap instructions
    in %| and %- operand codes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: llsc-opt.diff
Type: text/x-patch
Size: 14447 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070910/51420fe9/attachment.bin>


More information about the Gcc-patches mailing list