/* Expand the __sync_lock_release intrinsic. EXP is the CALL_EXPR. */
-static void
+static rtx
expand_builtin_sync_lock_release (machine_mode mode, tree exp)
{
rtx mem;
/* Expand the operands. */
mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode);
- expand_atomic_store (mem, const0_rtx, MEMMODEL_SYNC_RELEASE, true);
+ return expand_atomic_store (mem, const0_rtx, MEMMODEL_SYNC_RELEASE, true);
}
/* Given an integer representing an ``enum memmodel'', verify its
case BUILT_IN_SYNC_LOCK_RELEASE_8:
case BUILT_IN_SYNC_LOCK_RELEASE_16:
mode = get_builtin_sync_mode (fcode - BUILT_IN_SYNC_LOCK_RELEASE_1);
- expand_builtin_sync_lock_release (mode, exp);
- return const0_rtx;
+ if (expand_builtin_sync_lock_release (mode, exp))
+ return const0_rtx;
+ break;
case BUILT_IN_SYNC_SYNCHRONIZE:
expand_builtin_sync_synchronize ();
--- /dev/null
+/* PR target/117642 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mno-cx16" } */
+/* { dg-final { scan-assembler "__sync_lock_test_and_set_16" } } */
+/* { dg-final { scan-assembler "__sync_lock_release_16" } } */
+
+__int128 t = 1;
+
+void
+foo (void)
+{
+ __sync_lock_test_and_set (&t, 1);
+}
+
+void
+bar (void)
+{
+ __sync_lock_release (&t);
+}
--- /dev/null
+/* PR target/117642 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-march=i486" } */
+/* { dg-final { scan-assembler "__sync_lock_test_and_set_8" } } */
+/* { dg-final { scan-assembler "__sync_lock_release_8" } } */
+
+long long t = 1;
+
+void
+foo (void)
+{
+ __sync_lock_test_and_set (&t, 1);
+}
+
+void
+bar (void)
+{
+ __sync_lock_release (&t);
+}