aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2011-11-10 16:39:32 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2011-11-10 16:39:32 +0000
commit154b68db9bee50c8acb1c0440987f4ef176d2a65 (patch)
treeb11770e605e88e4c894d09421e2b55b78d37b982 /gcc/builtins.c
parentc8bf99b4e84b9b0783aca23ecc85425cb3569f16 (diff)
downloadgcc-154b68db9bee50c8acb1c0440987f4ef176d2a65.zip
gcc-154b68db9bee50c8acb1c0440987f4ef176d2a65.tar.gz
gcc-154b68db9bee50c8acb1c0440987f4ef176d2a65.tar.bz2
re PR rtl-optimization/51040 (ICE: RTL check: access of elt 1 of 'not' with last elt 0 in gen_rtx_fmt_ee_stat, at ./genrtl.h:33 with __atomic_nand_fetch())
PR rtl-optimization/51040 * optabs.c (expand_atomic_fetch_op): Patchup code for NAND should be AND followed by NOT. * builtins.c (expand_builtin_atomic_fetch_op): Patchup code for NAND should be AND followed by NOT. * testsuite/gcc.dg/atomic-noinline[-aux].c: Test no-inline NAND and patchup code. From-SVN: r181259
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 5162927..d949dbb 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5460,8 +5460,17 @@ expand_builtin_atomic_fetch_op (enum machine_mode mode, tree exp, rtx target,
/* Then issue the arithmetic correction to return the right result. */
if (!ignore)
- ret = expand_simple_binop (mode, code, ret, val, NULL_RTX, true,
- OPTAB_LIB_WIDEN);
+ {
+ if (code == NOT)
+ {
+ ret = expand_simple_binop (mode, AND, ret, val, NULL_RTX, true,
+ OPTAB_LIB_WIDEN);
+ ret = expand_simple_unop (mode, NOT, ret, target, true);
+ }
+ else
+ ret = expand_simple_binop (mode, code, ret, val, target, true,
+ OPTAB_LIB_WIDEN);
+ }
return ret;
}