Commit 12f61e77 by Alexandre Oliva Committed by Alexandre Oliva

gofast.h (GOFAST_RENAME_LIBCALLS): Set gt and ge as NULL_RTX.

* config/gofast.h (GOFAST_RENAME_LIBCALLS): Set gt and ge as
NULL_RTX.  Set all HFmode operations as NULL_RTX.
* optabs.c (prepare_float_lib_cmp) <GT, GE, LT, LE>: If libfunc is
NULL_RTX, try reversing the comparison and the operands.

From-SVN: r50422
parent 4e002027
2002-03-07 Alexandre Oliva <aoliva@redhat.com>
* config/gofast.h (GOFAST_RENAME_LIBCALLS): Set gt and ge as
NULL_RTX. Set all HFmode operations as NULL_RTX.
* optabs.c (prepare_float_lib_cmp) <GT, GE, LT, LE>: If libfunc is
NULL_RTX, try reversing the comparison and the operands.
2002-03-06 Ulrich Weigand <uweigand@de.ibm.com>
* genextract.c (walk_rtx): Recurse into MATCH_PAR_DUP.
......
/* US Software GOFAST floating point library support.
Copyright (C) 1994, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1994, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -43,6 +43,11 @@ Boston, MA 02111-1307, USA. */
neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \
} while (0)
/* GCC does not use fpcmp/dpcmp for gt or ge because its own
FP-emulation library returns +1 for both > and unord. So we leave
gt and ge unset, such that, instead of fpcmp(a,b) >[=], we generate
fpcmp(b,a) <[=] 0, which is unambiguous. For unord libfuncs, we
use our own functions, since GOFAST doesn't supply them. */
#define GOFAST_RENAME_LIBCALLS \
add_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpadd"); \
add_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpadd"); \
......@@ -58,17 +63,24 @@ Boston, MA 02111-1307, USA. */
extendsfdf2_libfunc = init_one_libfunc ("fptodp"); \
truncdfsf2_libfunc = init_one_libfunc ("dptofp"); \
\
eqhf2_libfunc = NULL_RTX; \
nehf2_libfunc = NULL_RTX; \
gthf2_libfunc = NULL_RTX; \
gehf2_libfunc = NULL_RTX; \
lthf2_libfunc = NULL_RTX; \
lehf2_libfunc = NULL_RTX; \
\
eqsf2_libfunc = init_one_libfunc ("fpcmp"); \
nesf2_libfunc = init_one_libfunc ("fpcmp"); \
gtsf2_libfunc = init_one_libfunc ("fpcmp"); \
gesf2_libfunc = init_one_libfunc ("fpcmp"); \
gtsf2_libfunc = NULL_RTX; \
gesf2_libfunc = NULL_RTX; \
ltsf2_libfunc = init_one_libfunc ("fpcmp"); \
lesf2_libfunc = init_one_libfunc ("fpcmp"); \
\
eqdf2_libfunc = init_one_libfunc ("dpcmp"); \
nedf2_libfunc = init_one_libfunc ("dpcmp"); \
gtdf2_libfunc = init_one_libfunc ("dpcmp"); \
gedf2_libfunc = init_one_libfunc ("dpcmp"); \
gtdf2_libfunc = NULL_RTX; \
gedf2_libfunc = NULL_RTX; \
ltdf2_libfunc = init_one_libfunc ("dpcmp"); \
ledf2_libfunc = init_one_libfunc ("dpcmp"); \
\
......
......@@ -3399,6 +3399,7 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
int *punsignedp;
{
enum rtx_code comparison = *pcomparison;
rtx tmp;
rtx x = *px = protect_from_queue (*px, 0);
rtx y = *py = protect_from_queue (*py, 0);
enum machine_mode mode = GET_MODE (x);
......@@ -3418,18 +3419,42 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
case GT:
libfunc = gthf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LT;
libfunc = lthf2_libfunc;
}
break;
case GE:
libfunc = gehf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LE;
libfunc = lehf2_libfunc;
}
break;
case LT:
libfunc = lthf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GT;
libfunc = gthf2_libfunc;
}
break;
case LE:
libfunc = lehf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GE;
libfunc = gehf2_libfunc;
}
break;
case UNORDERED:
......@@ -3452,18 +3477,42 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
case GT:
libfunc = gtsf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LT;
libfunc = ltsf2_libfunc;
}
break;
case GE:
libfunc = gesf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LE;
libfunc = lesf2_libfunc;
}
break;
case LT:
libfunc = ltsf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GT;
libfunc = gtsf2_libfunc;
}
break;
case LE:
libfunc = lesf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GE;
libfunc = gesf2_libfunc;
}
break;
case UNORDERED:
......@@ -3486,18 +3535,42 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
case GT:
libfunc = gtdf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LT;
libfunc = ltdf2_libfunc;
}
break;
case GE:
libfunc = gedf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LE;
libfunc = ledf2_libfunc;
}
break;
case LT:
libfunc = ltdf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GT;
libfunc = gtdf2_libfunc;
}
break;
case LE:
libfunc = ledf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GE;
libfunc = gedf2_libfunc;
}
break;
case UNORDERED:
......@@ -3520,18 +3593,42 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
case GT:
libfunc = gtxf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LT;
libfunc = ltxf2_libfunc;
}
break;
case GE:
libfunc = gexf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LE;
libfunc = lexf2_libfunc;
}
break;
case LT:
libfunc = ltxf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GT;
libfunc = gtxf2_libfunc;
}
break;
case LE:
libfunc = lexf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GE;
libfunc = gexf2_libfunc;
}
break;
case UNORDERED:
......@@ -3554,18 +3651,42 @@ prepare_float_lib_cmp (px, py, pcomparison, pmode, punsignedp)
case GT:
libfunc = gttf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LT;
libfunc = lttf2_libfunc;
}
break;
case GE:
libfunc = getf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = LE;
libfunc = letf2_libfunc;
}
break;
case LT:
libfunc = lttf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GT;
libfunc = gttf2_libfunc;
}
break;
case LE:
libfunc = letf2_libfunc;
if (libfunc == NULL_RTX)
{
tmp = x; x = y; y = tmp;
*pcomparison = GE;
libfunc = getf2_libfunc;
}
break;
case UNORDERED:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment