From: Richard Sandiford Date: Mon, 17 May 2004 06:50:51 +0000 (+0000) Subject: optabs.c (expand_unop): Try implementing negation using subtraction from zero. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d83aba0f8b3bfec016bb62d146e022b15c35f1ca;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cabd0f3fd77..80bbf2a57ad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-05-17 Richard Sandiford + + * optabs.c (expand_unop): Try implementing negation using subtraction + from zero. + 2004-05-16 John David Anglin * pa.md: Fix typo from last change. Remove DFmode move to and from 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)