This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]