This patch series adds necessary patterns for __atomic_compare_exchange[_n], 
__atomic_exchange[_n] and __atomic_fetch_add builtins.  These are the builtins 
that correspond to inline assembly that MIPS GLIBC port is using.

The patches were originally developed by Tom de Vries a while ago, and I've 
rewrote parts of them to be better suited for upstream.

The second patch adds XLP-specific patterns to support its swap and ldadd 
instructions.  Unfortunately, there seem to be a problem in reload that 
prevents reload from properly spilling address for these two patterns.  I will 
work with reload experts on investigating and fixing this problem, but, 
meanwhile, the patch contains a workaround that avoids the problem.

The third patch is a small optimization to alleviate 
__atomic_compare_exchange[_n] builtins being a use-one-for-all solutions.  
These builtins return both boolean "success" and "oldval" results.  As most 
cases use only one of the results, this optimizations looks at REG_UNUSED notes 
to determine if instructions to set these results can be omitted.

The patch series was tested by running GLIBC testsuite for n32, n64 and o32 
ABIs on XLP and [in-progress] non-XLP MIPS boards with no regressions with a 
corresponding patch to MIPS GLIBC port to use the new atomic builtins.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



Reply via email to