summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2004-05-17 06:50:51 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2004-05-17 06:50:51 +0000
commitd83aba0f8b3bfec016bb62d146e022b15c35f1ca (patch)
tree131eefbed273dab9a9fd55429e994aa6633bb521 /gcc/optabs.c
parent15581992c8bbae7f8b4b75e088bcd61edc2355f3 (diff)
downloadgcc-d83aba0f8b3bfec016bb62d146e022b15c35f1ca.tar.gz
optabs.c (expand_unop): Try implementing negation using subtraction from zero.
* optabs.c (expand_unop): Try implementing negation using subtraction from zero. From-SVN: r81933
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index f89e053c456..562eb2902f9 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -2737,6 +2737,15 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
return temp;
}
+ /* If there is no negation pattern, try subtracting from zero. */
+ if (unoptab == neg_optab && class == MODE_INT)
+ {
+ temp = expand_binop (mode, sub_optab, CONST0_RTX (mode), op0,
+ target, unsignedp, OPTAB_DIRECT);
+ if (temp)
+ return temp;
+ }
+
try_libcall:
/* Now try a library call in this mode. */
if (unoptab->handlers[(int) mode].libfunc)