diff mbox series

[mid-end] Correct subreg no-op handling for big-endian vec_select.

Message ID 20180619141104.GA28745@arm.com
State New
Headers show
Series [mid-end] Correct subreg no-op handling for big-endian vec_select. | expand

Commit Message

Tamar Christina June 19, 2018, 2:11 p.m. UTC
Hi All,

Previously GCC's no-op detection could would consider something a no-op even when the
mode change is not directly possible.  This caused subregs that shouldn't be removed
to be treated as a no-op and deleted.

Regtested on armeb-none-eabi and no regressions.
Bootstrapped on arm-none-linux-gnueabihf and no issues.

Ok for trunk? and for backport to GCC 8?

Thanks,
Tamar

gcc/
2018-06-19  Tamar Christina  <tamar.christina@arm.com>

	PR target/84711
	* rtlanal.c (set_noop_p): Constrain on mode change,
	include hard-reg-set.h

--

Comments

Tamar Christina June 27, 2018, 8:05 a.m. UTC | #1
Ping.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org <gcc-patches-owner@gcc.gnu.org>
> On Behalf Of Tamar Christina
> Sent: Tuesday, June 19, 2018 15:11
> To: gcc-patches@gcc.gnu.org
> Cc: nd <nd@arm.com>; law@redhat.com; rguenther@suse.de; ian@airs.com
> Subject: [PATCH][GCC][mid-end] Correct subreg no-op handling for big-
> endian vec_select.
> 
> Hi All,
> 
> Previously GCC's no-op detection could would consider something a no-op
> even when the mode change is not directly possible.  This caused subregs
> that shouldn't be removed to be treated as a no-op and deleted.
> 
> Regtested on armeb-none-eabi and no regressions.
> Bootstrapped on arm-none-linux-gnueabihf and no issues.
> 
> Ok for trunk? and for backport to GCC 8?
> 
> Thanks,
> Tamar
> 
> gcc/
> 2018-06-19  Tamar Christina  <tamar.christina@arm.com>
> 
> 	PR target/84711
> 	* rtlanal.c (set_noop_p): Constrain on mode change,
> 	include hard-reg-set.h
> 
> --
Jeff Law June 28, 2018, 3:11 a.m. UTC | #2
On 06/19/2018 08:11 AM, Tamar Christina wrote:
> Hi All,
> 
> Previously GCC's no-op detection could would consider something a no-op even when the
> mode change is not directly possible.  This caused subregs that shouldn't be removed
> to be treated as a no-op and deleted.
> 
> Regtested on armeb-none-eabi and no regressions.
> Bootstrapped on arm-none-linux-gnueabihf and no issues.
> 
> Ok for trunk? and for backport to GCC 8?
> 
> Thanks,
> Tamar
> 
> gcc/
> 2018-06-19  Tamar Christina  <tamar.christina@arm.com>
> 
> 	PR target/84711
> 	* rtlanal.c (set_noop_p): Constrain on mode change,
> 	include hard-reg-set.h
> 
OK.  Though please include a testcase.  I believe you had
big-endian-subreg.c in the original target specific approach to fixing
this problem.  That'd be fine to re-use here.

jeff
Christophe Lyon July 6, 2018, 8:06 a.m. UTC | #3
On Thu, 28 Jun 2018 at 05:11, Jeff Law <law@redhat.com> wrote:
>
> On 06/19/2018 08:11 AM, Tamar Christina wrote:
> > Hi All,
> >
> > Previously GCC's no-op detection could would consider something a no-op even when the
> > mode change is not directly possible.  This caused subregs that shouldn't be removed
> > to be treated as a no-op and deleted.
> >
> > Regtested on armeb-none-eabi and no regressions.
> > Bootstrapped on arm-none-linux-gnueabihf and no issues.
> >
> > Ok for trunk? and for backport to GCC 8?
> >
> > Thanks,
> > Tamar
> >
> > gcc/
> > 2018-06-19  Tamar Christina  <tamar.christina@arm.com>
> >
> >       PR target/84711
> >       * rtlanal.c (set_noop_p): Constrain on mode change,
> >       include hard-reg-set.h
> >
> OK.  Though please include a testcase.  I believe you had
> big-endian-subreg.c in the original target specific approach to fixing
> this problem.  That'd be fine to re-use here.
>

Hi,

It looks like this new test fails on x86_32 (i686-pc-linux-gnu):
/gcc/testsuite/gcc.dg/vect/pr84711.c: In function 'fn1':
/gcc/testsuite/gcc.dg/vect/pr84711.c:8:5: note: The ABI for passing
parameters with 16-byte alignment has changed in GCC 4.6
/gcc/testsuite/gcc.dg/vect/pr84711.c:8:5: warning: SSE vector argument
without SSE enabled changes the ABI [-Wpsabi]
FAIL: gcc.dg/vect/pr84711.c -flto -ffat-lto-objects (test for excess errors)
Excess errors:
/gcc/testsuite/gcc.dg/vect/pr84711.c:8:5: warning: SSE vector argument
without SSE enabled changes the ABI [-Wpsabi]


> jeff
diff mbox series

Patch

diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index ac3662de3ce0c9fcb58a042138f461c538fc1522..7af516378b38e043849cc2e1326a43837856ae4d 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -35,6 +35,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "recog.h"
 #include "addresses.h"
 #include "rtl-iter.h"
+#include "hard-reg-set.h"
 
 /* Forward declarations */
 static void set_of_1 (rtx, const_rtx, void *);
@@ -1620,8 +1621,9 @@  set_noop_p (const_rtx set)
 	if (INTVAL (XVECEXP (par, 0, i)) != c0 + i)
 	  return 0;
       return
-	simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
-			       offset, GET_MODE (dst)) == (int) REGNO (dst);
+	REG_CAN_CHANGE_MODE_P (REGNO (dst), GET_MODE (src0), GET_MODE (dst))
+	&& simplify_subreg_regno (REGNO (src0), GET_MODE (src0),
+				  offset, GET_MODE (dst)) == (int) REGNO (dst);
     }
 
   return (REG_P (src) && REG_P (dst)