Patchwork [ARM] Don't reject valid Thumb2 constants

login
register
mail settings
Submitter Andrew Stubbs
Date Oct. 27, 2010, 4:09 p.m.
Message ID <4CC84EBE.4040007@codesourcery.com>
Download mbox | patch
Permalink /patch/69372/
State New
Headers show

Comments

Andrew Stubbs - Oct. 27, 2010, 4:09 p.m.
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
Richard Earnshaw - Oct. 27, 2010, 4:16 p.m.
On Wed, 2010-10-27 at 17:09 +0100, Andrew Stubbs wrote:
> 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

OK

R.
Andrew Stubbs - Oct. 28, 2010, 12:37 p.m.
On 27/10/10 17:16, Richard Earnshaw wrote:
> OK

Thanks Richard, committed.

Andrew

Patch

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;