diff options
author | Roger Sayle <roger@eyesopen.com> | 2004-02-07 03:00:16 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2004-02-07 03:00:16 +0000 |
commit | 254878eaddab86eae9ec232baedfdc4103cf7ef9 (patch) | |
tree | c2bcedcd0f279c5d93fcb70ec7914ccfd0bf9d4a /gcc/builtins.c | |
parent | b105316055e04324bb2b77497482859ae81367ba (diff) | |
download | gcc-254878eaddab86eae9ec232baedfdc4103cf7ef9.zip gcc-254878eaddab86eae9ec232baedfdc4103cf7ef9.tar.gz gcc-254878eaddab86eae9ec232baedfdc4103cf7ef9.tar.bz2 |
builtins.c (expand_builtin_signbit): Use extract_bit_field instead of gen_highpart or gen_lowpart when...
* builtins.c (expand_builtin_signbit): Use extract_bit_field instead
of gen_highpart or gen_lowpart when the floating point format is
wider than the result mode.
Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com>
From-SVN: r77439
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index b9b057d..48be07b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4986,34 +4986,35 @@ expand_builtin_signbit (tree exp, rtx target) temp = expand_expr (arg, NULL_RTX, VOIDmode, 0); temp = gen_lowpart (imode, temp); - if (GET_MODE_BITSIZE (imode) < GET_MODE_BITSIZE (rmode)) - temp = gen_lowpart (rmode, temp); - else if (GET_MODE_BITSIZE (imode) > GET_MODE_BITSIZE (rmode)) + if (GET_MODE_BITSIZE (imode) > GET_MODE_BITSIZE (rmode)) { - if (bitpos > GET_MODE_BITSIZE (rmode)) + if (BITS_BIG_ENDIAN) + bitpos = GET_MODE_BITSIZE (imode) - 1 - bitpos; + temp = copy_to_mode_reg (imode, temp); + temp = extract_bit_field (temp, 1, bitpos, 1, + NULL_RTX, rmode, rmode, + GET_MODE_SIZE (imode)); + } + else + { + if (GET_MODE_BITSIZE (imode) < GET_MODE_BITSIZE (rmode)) + temp = gen_lowpart (rmode, temp); + if (bitpos < HOST_BITS_PER_WIDE_INT) { - temp = gen_highpart (rmode, temp); - bitpos %= GET_MODE_BITSIZE (rmode); + hi = 0; + lo = (HOST_WIDE_INT) 1 << bitpos; } else - temp = gen_lowpart (rmode, temp); - } + { + hi = (HOST_WIDE_INT) 1 << (bitpos - HOST_BITS_PER_WIDE_INT); + lo = 0; + } - if (bitpos < HOST_BITS_PER_WIDE_INT) - { - hi = 0; - lo = (HOST_WIDE_INT) 1 << bitpos; + temp = force_reg (rmode, temp); + temp = expand_binop (rmode, and_optab, temp, + immed_double_const (lo, hi, rmode), + target, 1, OPTAB_LIB_WIDEN); } - else - { - hi = (HOST_WIDE_INT) 1 << (bitpos - HOST_BITS_PER_WIDE_INT); - lo = 0; - } - - temp = force_reg (rmode, temp); - temp = expand_binop (rmode, and_optab, temp, - immed_double_const (lo, hi, rmode), - target, 1, OPTAB_LIB_WIDEN); return temp; } |