aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-07-20 19:13:00 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-07-20 19:13:00 +0200
commit4b3df2657401475f94a7fc60e4e7f8ed6bbe2610 (patch)
tree316f4240bcb8ca389b783c719572a6ecf96ea6ac /gcc/optabs.c
parent7604f4351a2c08ea9340bd124570d2c4bb11d3cd (diff)
downloadgcc-4b3df2657401475f94a7fc60e4e7f8ed6bbe2610.zip
gcc-4b3df2657401475f94a7fc60e4e7f8ed6bbe2610.tar.gz
gcc-4b3df2657401475f94a7fc60e4e7f8ed6bbe2610.tar.bz2
re PR target/91204 (ICE in expand_expr_real_2, at expr.c:9215 with -O3)
PR target/91204 * optabs.c (expand_unop): As fallback, expand ~op0 as op0 ^ -1. * gcc.c-torture/compile/pr91204.c: New test. From-SVN: r273629
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 4b39ff6..06bcaab 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -2972,6 +2972,17 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target,
return target;
}
+ /* Emit ~op0 as op0 ^ -1. */
+ if (unoptab == one_cmpl_optab
+ && (SCALAR_INT_MODE_P (mode) || GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
+ && optab_handler (xor_optab, mode) != CODE_FOR_nothing)
+ {
+ temp = expand_binop (mode, xor_optab, op0, CONSTM1_RTX (mode),
+ target, unsignedp, OPTAB_DIRECT);
+ if (temp)
+ return temp;
+ }
+
if (optab_to_code (unoptab) == NEG)
{
/* Try negating floating point values by flipping the sign bit. */