@@ -929,7 +929,7 @@ (define_predicate "lwa_operand"
if (gpc_reg_operand (inner, mode))
return true;
- if (!memory_operand (inner, mode))
+ if (!any_memory_operand (inner, mode))
return false;
addr = XEXP (inner, 0);
new file mode 100644
@@ -0,0 +1,16 @@
+/* { dg-options "-O2 -std=c11" } */
+/* { dg-require-effective-target lp64 } */
+
+/* This tests if the instructions used for C atomic are optimised properly
+ as atomic by the target code, too. */
+
+#include <stdatomic.h>
+
+int load(_Atomic int *ptr)
+{
+ return atomic_load_explicit(ptr, memory_order_relaxed);
+}
+
+/* There should be only two machine instructions, an lwa and a blr: */
+/* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 2 } } */
+/* { dg-final { scan-assembler-times {\mlwa\M} 1 } } */