Commit 79cd6f15 by Hans-Peter Nilsson

re PR middle-end/54261 (reverse sync/atomic operators when only…

re PR middle-end/54261 (reverse sync/atomic operators when only sync_compare_and_swap_optab libfuncs implemented)

	PR middle-end/54261
	* optabs.c (expand_atomic_fetch_op): Save and restore code when
	retrying after failed attempt.

From-SVN: r190463
parent b897f4ea
...@@ -7826,6 +7826,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code, ...@@ -7826,6 +7826,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
{ {
rtx libfunc; rtx libfunc;
bool fixup = false; bool fixup = false;
enum rtx_code orig_code = code;
libfunc = optab_libfunc (after ? optab.fetch_after libfunc = optab_libfunc (after ? optab.fetch_after
: optab.fetch_before, mode); : optab.fetch_before, mode);
...@@ -7849,6 +7850,9 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code, ...@@ -7849,6 +7850,9 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
true, OPTAB_LIB_WIDEN); true, OPTAB_LIB_WIDEN);
return result; return result;
} }
/* We need the original code for any further attempts. */
code = orig_code;
} }
/* If nothing else has succeeded, default to a compare and swap loop. */ /* If nothing else has succeeded, default to a compare and swap loop. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment