[Patch] MIPS: Improve HI and QI atomic memory ops.

David Daney ddaney@avtrex.com
Sun May 4 17:14:00 GMT 2008


This patch does three things.  In theory they could be split up, but
they touch the same code.

1) We were not properly masking the HI and QI values when expanding
sync_compare_and_swap.  For some alignments of the memory location, sign
extension of negative values would cause memory to be clobbered outside
of the atomic object.  The patch now masks the values to correct this
problem.

2) If either the old or new value is a constant zero (a common
occurrence), shorter code can be emitted.  With the patch we now do this.

3) There are target independent tests for atomic memory operations. 
They were not enabled for MIPS.  The patch now enables these for MIPS.

Bootstrapped and regression tested on mipsel-linux w/
--enable-languages=all:  There are 13 new tests for gcc that are now run
and PASS.  In libgomp the libgomp.fortran/omp_atomic1.f90 test now
PASSes, but several other tests in libgomp now time-out.  In all other
tests there are no regressions.

Failing libgomp tests are:
WARNING: program timed out.
FAIL: libgomp.c/pr32468.c execution test
WARNING: program timed out.
FAIL: libgomp.fortran/appendix-a/a.18.1.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
WARNING: program timed out.
FAIL: libgomp.fortran/omp_parse2.f90  -O0  execution test
WARNING: program timed out.
FAIL: libgomp.fortran/pr27916-1.f90  -O3 -g  execution test
WARNING: program timed out.
FAIL: libgomp.fortran/pr34020.f90  -O3 -g  execution test

I think they are either transient failures or I will look at them in the
near future.

OK to commit?

gcc/testsuite:
2008-05-04  David Daney  <ddaney@avtrex.com>

    * lib/target-supports.exp (check_effective_target_sync_int_long): Add
    mips*-*-*.
    (check_effective_target_sync_char_short): Same.

gcc:
2008-05-04  David Daney  <ddaney@avtrex.com>

    * config/mips/mips.md (mips_expand_compare_and_swap_12): Handle
    special case of constant zero operands.
    * config/mips/mips.c (mips_expand_compare_and_swap_12): Mask old and
    new values.  Special case constand zero values.
    * config/mips/mips.h (MIPS_COMPARE_AND_SWAP): Skip 'sync' if compare
    fails.
    (MIPS_COMPARE_AND_SWAP_12): Handle constant zero operands.
    (MIPS_COMPARE_AND_SWAP_12_0): New macro.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic2.patch
Type: text/x-patch
Size: 4872 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080504/3e5af047/attachment.bin>


More information about the Gcc-patches mailing list