aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2003-01-15 17:32:38 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-01-15 17:32:38 +0000
commit9ee0a4426da5d2664a2bf75b4fb7e36dded7f230 (patch)
treec62a976a42c04eee74b528e74a2cf9263b1298d3 /gcc/optabs.c
parente3981aabf2789a22086f81899a1bf8e8d090b020 (diff)
downloadgcc-9ee0a4426da5d2664a2bf75b4fb7e36dded7f230.zip
gcc-9ee0a4426da5d2664a2bf75b4fb7e36dded7f230.tar.gz
gcc-9ee0a4426da5d2664a2bf75b4fb7e36dded7f230.tar.bz2
re PR middle-end/9009 (floating-point negate and abs optimizations incorrect for ARM)
PR middle-end/9009 * optabs.c (expand_unop): When manipulating the FP sign bit using integer operations, account for targets with different integer and FP word orders. (expand_abs): Likewise. From-SVN: r61335
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index d8c058e..38cc7e7 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1,6 +1,6 @@
/* Expand the basic unary and binary arithmetic operations, for GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@@ -2530,6 +2530,14 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
HOST_WIDE_INT hi, lo;
rtx last = get_last_insn ();
+ /* Handle targets with different FP word orders. */
+ if (FLOAT_WORDS_BIG_ENDIAN != WORDS_BIG_ENDIAN)
+ {
+ int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
+ int word = nwords - (bitpos / BITS_PER_WORD) - 1;
+ bitpos = word * BITS_PER_WORD + bitpos % BITS_PER_WORD;
+ }
+
if (bitpos < HOST_BITS_PER_WIDE_INT)
{
hi = 0;
@@ -2675,6 +2683,14 @@ expand_abs (mode, op0, target, result_unsignedp, safe)
HOST_WIDE_INT hi, lo;
rtx last = get_last_insn ();
+ /* Handle targets with different FP word orders. */
+ if (FLOAT_WORDS_BIG_ENDIAN != WORDS_BIG_ENDIAN)
+ {
+ int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
+ int word = nwords - (bitpos / BITS_PER_WORD) - 1;
+ bitpos = word * BITS_PER_WORD + bitpos % BITS_PER_WORD;
+ }
+
if (bitpos < HOST_BITS_PER_WIDE_INT)
{
hi = 0;