The test gcc.target/arm/di-longlong64-sync-withldrexd.c fails on
arm-none-eabi target, because gcc generates 48 LDREXD and 48 STREXD
instructions instead of the expected 46.

FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-times
tldrexd 46
FAIL: gcc.target/arm/di-longlong64-sync-withldrexd.c scan-assembler-times
tstrexd 46

An extra LDREXD and an extra STREXD instruction is generated by the
expansion of each one of the two occurrences of builtin __sync_lock_release
in the test.
The regression PASS->FAIL was introduced for target arm-none-eabi in the
first week of November 2011.
A patch related to sync_lock_release and most likely to have caused the
change(r181111):
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01039.html
Before the change, __sync_lock_release expanded into STRD, storing DI value
0.
After the change, __sync_lock_release expands into LDREXD followed by STREXD
for an atomic store of 0, which should be the correct behaviour (because
STRD does not guarantee that the store of DI value 0 is atomic).

The attached patch adjusts the test to accept the new behaviour.

gcc/testsuite/ChangeLog

2012-01-25  Greta Yorsh  <greta.yo...@arm.com>

        * gcc.target/arm/di-longlong64-sync-withldrexd.c:

diff --git a/gcc/testsuite/gcc.target/arm/di-longlong64-sync-withldrexd.c 
b/gcc/testsuite/gcc.target/arm/di-longlong64-sync-withldrexd.c
index dab6940..5b8f212 100644
--- a/gcc/testsuite/gcc.target/arm/di-longlong64-sync-withldrexd.c
+++ b/gcc/testsuite/gcc.target/arm/di-longlong64-sync-withldrexd.c
@@ -10,8 +10,8 @@
 #include "../../gcc.dg/di-longlong64-sync-1.c"
 
 /* We should be using ldrexd, strexd and no helpers or shorter ldrex.  */
-/* { dg-final { scan-assembler-times "\tldrexd" 46 } } */
-/* { dg-final { scan-assembler-times "\tstrexd" 46 } } */
+/* { dg-final { scan-assembler-times "\tldrexd" 48 } } */
+/* { dg-final { scan-assembler-times "\tstrexd" 48 } } */
 /* { dg-final { scan-assembler-not "__sync_" } } */
 /* { dg-final { scan-assembler-not "ldrex\t" } } */
 /* { dg-final { scan-assembler-not "strex\t" } } */

Reply via email to