This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][ARM] Don't reject valid Thumb2 constants
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Oct 2010 17:09:34 +0100
- Subject: [PATCH][ARM] Don't reject valid Thumb2 constants
Thumb2 permits any shifted 8 bit constant, or repeated patterns of the
form 0xXYXYXYXY, 0x00XY00XY, or 0xXY00XY00. For some reason this last
form is not detected - presumably a simple omission?
The attached patch fixes the problem.
Andrew
2010-10-27 Andrew Stubbs <ams@codesourcery.com>
gcc/
* config/arm/arm.c (const_ok_for_arm): Support 0xXY00XY00 pattern
constants in thumb2.
---
src/gcc-mainline/gcc/config/arm/arm.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/gcc-mainline/gcc/config/arm/arm.c b/src/gcc-mainline/gcc/config/arm/arm.c
index 3bcd1a9..f0ed338 100644
--- a/src/gcc-mainline/gcc/config/arm/arm.c
+++ b/src/gcc-mainline/gcc/config/arm/arm.c
@@ -2351,11 +2351,17 @@ const_ok_for_arm (HOST_WIDE_INT i)
{
HOST_WIDE_INT v;
- /* Allow repeated pattern. */
+ /* Allow repeated patterns 0x00XY00XY or 0xXYXYXYXY. */
v = i & 0xff;
v |= v << 16;
if (i == v || i == (v | (v << 8)))
return TRUE;
+
+ /* Allow repeated pattern 0xXY00XY00. */
+ v = i & 0xff00;
+ v |= v << 16;
+ if (i == v)
+ return TRUE;
}
return FALSE;