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]

Re: [PATCH] PR49799: Don't generate illegal bit field extraction instruction


According to Richard, -march=armv7-a is not required.

So the finally installed is:

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 176910)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2011-07-29  Wei Guozhi  <carrot@google.com>
+
+	PR rtl-optimization/49799
+	* combine.c (make_compound_operation): Check if the bit field is valid
+	before change it to bit field extraction.
+
 2011-07-29  Bernd Schmidt  <bernds@codesourcery.com>

 	PR rtl-optimization/49891
Index: gcc/testsuite/gcc.dg/pr49799.c
===================================================================
--- gcc/testsuite/gcc.dg/pr49799.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr49799.c	(revision 0)
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/49799 */
+/* { dg-do assemble } */
+/* { dg-options "-O2 -w" } */
+
+static __inline int bar(int a)
+{
+    int tmp;
+
+    if (a <= 0) a ^= 0xFFFFFFFF;
+
+    return tmp - 1;
+}
+
+void foo(short *K)
+{
+    short tmp;
+    short *pptr, P[14];
+
+    pptr = P;
+    tmp = bar(*K);
+    *pptr = (*K << tmp) >> 16;
+
+    if (*P < tmp)
+        *K++ = 0;
+}
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 176910)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2011-07-29  Wei Guozhi  <carrot@google.com>
+
+	PR rtl-optimization/49799
+	* gcc.dg/pr49799.c: New test case.
+
 2011-07-22  Sebastian Pop  <sebastian.pop@amd.com>

 	PR middle-end/48648
Index: gcc/combine.c
===================================================================
--- gcc/combine.c	(revision 176910)
+++ gcc/combine.c	(working copy)
@@ -7787,6 +7787,7 @@ make_compound_operation (rtx x, enum rtx
 	  && GET_CODE (lhs) == ASHIFT
 	  && CONST_INT_P (XEXP (lhs, 1))
 	  && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1))
+	  && INTVAL (XEXP (lhs, 1)) >= 0
 	  && INTVAL (rhs) < mode_width)
 	{
 	  new_rtx = make_compound_operation (XEXP (lhs, 0), next_code);

thanks a lot.
Carrot

On Thu, Jul 28, 2011 at 4:47 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jul 28, 2011 at 04:40:53PM +0800, Carrot Wei wrote:
>> ChangeLog:
>> 2011-07-28 ?Wei Guozhi ?<carrot@google.com>
>>
>> ? ? ? ? PR rtl-optimization/49799
>> ? ? ? ? * pr49799.c : New test case.
>
> Space shouldn't be between .c and :. ?And the filename should be
> relative to gcc/testsuite/ dir, so either gcc.target/arm/pr49799.c, or
> better gcc.dg/pr49799.c.
>
> Putting the testcase just into gcc.target/arm means it won't be tested
> on other targets, while there is nothing arm specific about the testcase
> except that you force -march in dg-options for arm.
> You can do that with
> /* PR rtl-optimization/49799 */
> /* { dg-do assemble } */
> /* { dg-options "-O2 -w" } */
> /* { dg-options "-O2 -w -march=armv7-a" { target arm*-*-* } } */
> or similar.
>
> Ok with those changes.
>
> ? ? ? ?Jakub
>


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