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
This commit is contained in:
Hans-Peter Nilsson 2012-08-17 00:18:35 +00:00
parent b897f4eacc
commit 79cd6f1501
1 changed files with 4 additions and 0 deletions

View File

@ -7826,6 +7826,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
{
rtx libfunc;
bool fixup = false;
enum rtx_code orig_code = code;
libfunc = optab_libfunc (after ? optab.fetch_after
: optab.fetch_before, mode);
@ -7849,6 +7850,9 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code,
true, OPTAB_LIB_WIDEN);
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. */