diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 02:57:13 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 02:57:13 +0000 |
commit | c81364d2018ff50913cff48129266e96b8a48b2a (patch) | |
tree | c46be953c6b103efd2f345a73b6bd870fa3efa72 /gcc | |
parent | 8294332eb8b7831a28a71da73442bc1742979fad (diff) | |
download | gcc-c81364d2018ff50913cff48129266e96b8a48b2a.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50422 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/gofast.h | 22 | ||||
-rw-r--r-- | gcc/optabs.c | 121 |
3 files changed, 145 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea31da8016b..fa565f77dbd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/gcc/config/gofast.h b/gcc/config/gofast.h index 4c3c0ea9ae8..84e9018784f 100644 --- a/gcc/config/gofast.h +++ b/gcc/config/gofast.h @@ -1,5 +1,5 @@ /* 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"); \ \ diff --git a/gcc/optabs.c b/gcc/optabs.c index 0db33ca0667..94927b9b2fe 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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: |