gcc/
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Aug 2014 23:03:16 +0000 (23:03 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Aug 2014 23:03:16 +0000 (23:03 +0000)
2014-08-11 Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r213555.
2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

PR target/61713
* gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
move to subtarget in serial version if result is ignored.

gcc/testsuite
2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
Backport from trunk r213555.
2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

PR target/61713
* gcc.dg/pr61756.c: New test.

git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@213801 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.linaro
gcc/optabs.c
gcc/testsuite/ChangeLog.linaro
gcc/testsuite/gcc.dg/pr61756.c [new file with mode: 0644]

index 6f0c074..6087bf8 100644 (file)
@@ -1,5 +1,14 @@
 2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r213555.
+       2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/61713
+       * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit
+       move to subtarget in serial version if result is ignored.
+
+2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r213376.
        2014-07-31  Charles Baylis  <charles.baylis@linaro.org>
 
index 54f07ab..5359257 100644 (file)
@@ -7334,7 +7334,10 @@ expand_atomic_test_and_set (rtx target, rtx mem, enum memmodel model)
      perform the operation.  */
   if (!ret)
     {
-      emit_move_insn (subtarget, mem);
+      /* If the result is ignored skip the move to target.  */
+      if (subtarget != const0_rtx)
+        emit_move_insn (subtarget, mem);
+
       emit_move_insn (mem, trueval);
       ret = subtarget;
     }
index 6306751..4130c63 100644 (file)
@@ -1,4 +1,11 @@
 2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
+       Backport from trunk r213555.
+       2014-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/61713
+       * gcc.dg/pr61756.c: New test.
+
+2014-08-11 Yvan Roux  <yvan.roux@linaro.org>
        Backport from trunk r213376.
        2014-07-31  Charles Baylis  <charles.baylis@linaro.org>
 
diff --git a/gcc/testsuite/gcc.dg/pr61756.c b/gcc/testsuite/gcc.dg/pr61756.c
new file mode 100644 (file)
index 0000000..c021290
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/61756  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -march=armv5" { target arm*-*-*  } } */
+
+#include <stdatomic.h>
+
+static volatile atomic_flag guard = ATOMIC_FLAG_INIT;
+
+void
+try_atomic_flag_test_and_set (void)
+{
+  atomic_flag_test_and_set (&guard);
+}