diff mbox

patch to fix PR64110

Message ID 548B4C26.10709@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Dec. 12, 2014, 8:12 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64110

The patch was successfully tested and bootstrapped on x86/x86-64.

Committed as rev. 218688.

2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>

         PR target/64110
         * lra-constraints.c (process_alt_operands): Refuse alternative
         when reload pseudo of given class can not hold value of given
         mode.

2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>

         PR target/64110
         * gcc.target/i386/pr64110.c: New.

Comments

Christophe Lyon Dec. 15, 2014, 2:14 p.m. UTC | #1
Hi,

After this commit, GCC build fails for ARM targets:
--target=arm-none-eabi --with-mode=arm --with-cpu=cortex-a9 --with-fpu=neon

/obj-arm-none-eabi/gcc1/./gcc/xgcc -B/obj-arm-none-eabi/gcc1/./gcc/
-B/tools/arm-none-eabi/bin/ -B/tools/arm-none-eabi/lib/ -isystem
/tools/arm-none-eabi/include -isystem /tools/arm-none-eabi/sys-include
   -g -O2 -mfloat-abi=hard -O2  -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include   -fno-inline -g
-DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc
-fno-inline -I. -I. -I../../.././gcc -I/trunk/libgcc -I/trunk/libgcc/.
-I/trunk/libgcc/../gcc -I/trunk/libgcc/../include  -DHAVE_CC_TLS  -o
_mulhelperDQ.o -MT _mulhelperDQ.o -MD -MP -MF _mulhelperDQ.dep
-DL_mulhelper -DDQ_MODE -c /trunk/libgcc/fixed-bit.c
-fvisibility=hidden -DHIDE_EXPORTS
/trunk/libgcc/fixed-bit.c: In function '__gnu_mulhelperdq':
/trunk/libgcc/fixed-bit.c:371:1: error: unable to generate reloads for:
 }
 ^
(insn 55 63 59 2 (set (reg:DI 124 [ D.7630 ])
        (mult:DI (zero_extend:DI (subreg:SI (reg:DI 112 [ D.7628 ]) 4))
            (zero_extend:DI (subreg:SI (reg:DI 111 [ D.7628 ]) 4))))
/trunk/libgcc/fixed-bit.c:307 54 {*umulsidi3_v6}
     (nil))
/trunk/libgcc/fixed-bit.c:371:1: internal compiler error: in
curr_insn_transform, at lra-constraints.c:3383
0x9d4875 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
    /trunk/gcc/rtl-error.c:110
0x904ec4 curr_insn_transform
    /trunk/gcc/lra-constraints.c:3383
0x9057ce lra_constraints(bool)
    /trunk/gcc/lra-constraints.c:4324
0x8f5eb1 lra(_IO_FILE*)
    /trunk/gcc/lra.c:2277
0x8b4959 do_reload
    /trunk/gcc/ira.c:5391
0x8b4959 execute
    /trunk/gcc/ira.c:5561
Please submit a full bug report,

Can you have a look?

Thanks,

Christophe.

On 12 December 2014 at 21:12, Vladimir Makarov <vmakarov@redhat.com> wrote:
> The following patch fixes
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64110
>
> The patch was successfully tested and bootstrapped on x86/x86-64.
>
> Committed as rev. 218688.
>
> 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
>
>         PR target/64110
>         * lra-constraints.c (process_alt_operands): Refuse alternative
>         when reload pseudo of given class can not hold value of given
>         mode.
>
> 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
>
>         PR target/64110
>         * gcc.target/i386/pr64110.c: New.
>
Vladimir Makarov Dec. 15, 2014, 3:27 p.m. UTC | #2
On 2014-12-15 9:14 AM, Christophe Lyon wrote:
> Hi,
>
> After this commit, GCC build fails for ARM targets:
> --target=arm-none-eabi --with-mode=arm --with-cpu=cortex-a9 --with-fpu=neon
>
full bug report,
>
> Can you have a look?
>

Sure.  Sorry for inconvenience.  LRA/reload bug fixing is a complicated 
thing in most cases.
Hale Wang Dec. 16, 2014, 2:16 a.m. UTC | #3
Hi,

This commit will cause another GCC build fail for ARM targets. The details are descripted in the following Bugzilla linker:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64323.

Could you help me to have a look?
Thanks,

Hale.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Vladimir Makarov
> Sent: Saturday, December 13, 2014 4:12 AM
> To: GCC Patches
> Subject: patch to fix PR64110
> 
> The following patch fixes
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64110
> 
> The patch was successfully tested and bootstrapped on x86/x86-64.
> 
> Committed as rev. 218688.
> 
> 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
> 
>          PR target/64110
>          * lra-constraints.c (process_alt_operands): Refuse alternative
>          when reload pseudo of given class can not hold value of given
>          mode.
> 
> 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
> 
>          PR target/64110
>          * gcc.target/i386/pr64110.c: New.
Hale Wang Dec. 16, 2014, 11:31 a.m. UTC | #4
This issue is already fixed by your commit  r218760. 
Thanks.

Hale.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Hale Wang
> Sent: Tuesday, December 16, 2014 10:17 AM
> To: 'Vladimir Makarov'; GCC Patches
> Subject: RE: patch to fix PR64110
> 
> Hi,
> 
> This commit will cause another GCC build fail for ARM targets. The details are
> descripted in the following Bugzilla linker:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64323.
> 
> Could you help me to have a look?
> Thanks,
> 
> Hale.
> 
> > -----Original Message-----
> > From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> > owner@gcc.gnu.org] On Behalf Of Vladimir Makarov
> > Sent: Saturday, December 13, 2014 4:12 AM
> > To: GCC Patches
> > Subject: patch to fix PR64110
> >
> > The following patch fixes
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64110
> >
> > The patch was successfully tested and bootstrapped on x86/x86-64.
> >
> > Committed as rev. 218688.
> >
> > 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
> >
> >          PR target/64110
> >          * lra-constraints.c (process_alt_operands): Refuse alternative
> >          when reload pseudo of given class can not hold value of given
> >          mode.
> >
> > 2014-12-12  Vladimir Makarov  <vmakarov@redhat.com>
> >
> >          PR target/64110
> >          * gcc.target/i386/pr64110.c: New.
> 
> 
>
diff mbox

Patch

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 218685)
+++ lra-constraints.c	(working copy)
@@ -2267,6 +2267,29 @@  process_alt_operands (int only_alternati
 		  goto fail;
 		}
 
+	      /* Alternative loses if it required class pseudo can not
+		 hold value of required mode.  Such insns can be
+		 described by insn definitions with mode iterators.
+		 Don't use ira_prohibited_class_mode_regs here as it
+		 is common practice for constraints to use a class
+		 which does not have actually enough regs to hold the
+		 value (e.g. x86 AREG for mode requiring more one
+		 general reg).  */
+	      if (GET_MODE (*curr_id->operand_loc[nop]) != VOIDmode
+		  && ! hard_reg_set_empty_p (this_alternative_set)
+		  && ! HARD_REGNO_MODE_OK (ira_class_hard_regs
+					   [this_alternative][0],
+					   GET_MODE (*curr_id->operand_loc[nop])))
+		{
+		  if (lra_dump_file != NULL)
+		    fprintf
+		      (lra_dump_file,
+		       "            alt=%d: reload pseudo for op %d "
+		       " can not hold the mode value -- refuse\n",
+		       nalt, nop);
+		  goto fail;
+		}
+
 	      /* Check strong discouragement of reload of non-constant
 		 into class THIS_ALTERNATIVE.  */
 	      if (! CONSTANT_P (op) && ! no_regs_p
Index: testsuite/gcc.target/i386/pr64110.c
===================================================================
--- testsuite/gcc.target/i386/pr64110.c	(revision 0)
+++ testsuite/gcc.target/i386/pr64110.c	(working copy)
@@ -0,0 +1,17 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=core-avx2" } */
+
+int foo (void);
+int a;
+short *b;
+
+void
+bar (short x)
+{
+  while (a--)
+    {
+      int i, j = foo ();
+      for (i = 0; i < j; ++i)
+	*b++ = x;
+    }
+}