aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@gcc.gnu.org>2005-05-09 21:57:47 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2005-05-09 21:57:47 +0000
commite3d97bde61135c9962234fdb1eed22a059709ca0 (patch)
tree4b2e0f1f35528780bd52b010317e1adcacf16da2
parent71a4f307bd76b74e824acd45c6579932325da6c6 (diff)
downloadgcc-e3d97bde61135c9962234fdb1eed22a059709ca0.zip
gcc-e3d97bde61135c9962234fdb1eed22a059709ca0.tar.gz
gcc-e3d97bde61135c9962234fdb1eed22a059709ca0.tar.bz2
Revert previous (not the patch described).
From-SVN: r99473
-rw-r--r--gcc/config/arm/arm.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index aaa9daa..1743980 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -1531,8 +1531,8 @@ use_return_insn (int iscond, rtx sibling)
int
const_ok_for_arm (HOST_WIDE_INT i)
{
- int lowbit;
-
+ unsigned HOST_WIDE_INT mask = ~(unsigned HOST_WIDE_INT)0xFF;
+
/* For machines with >32 bit HOST_WIDE_INT, the bits above bit 31 must
be all zero, or all one. */
if ((i & ~(unsigned HOST_WIDE_INT) 0xffffffff) != 0
@@ -1541,24 +1541,19 @@ const_ok_for_arm (HOST_WIDE_INT i)
& ~(unsigned HOST_WIDE_INT) 0xffffffff)))
return FALSE;
- i &= (unsigned HOST_WIDE_INT) 0xffffffff;
-
- /* Fast return for 0 and small values. We must do this for zero, since
- the code below can't handle that one case. */
- if ((i & ~(unsigned HOST_WIDE_INT) 0xff) == 0)
+ /* Fast return for 0 and powers of 2 */
+ if ((i & (i - 1)) == 0)
return TRUE;
- /* Get the number of trailing zeros, rounded down to the nearest even
- number. */
- lowbit = (ffs ((int) i) - 1) & ~1;
-
- if ((i & ~(((unsigned HOST_WIDE_INT) 0xff) << lowbit)) == 0)
- return TRUE;
- else if (lowbit <= 4
- && ((i & ~0xc000003f) == 0
- || (i & ~0xf000000f) == 0
- || (i & ~0xfc000003) == 0))
- return TRUE;
+ do
+ {
+ if ((i & mask & (unsigned HOST_WIDE_INT) 0xffffffff) == 0)
+ return TRUE;
+ mask =
+ (mask << 2) | ((mask & (unsigned HOST_WIDE_INT) 0xffffffff)
+ >> (32 - 2)) | ~(unsigned HOST_WIDE_INT) 0xffffffff;
+ }
+ while (mask != ~(unsigned HOST_WIDE_INT) 0xFF);
return FALSE;
}