Allow VOIDmode argument to ix86_copy_addr_to_reg (PR target/60693)

Submitted by Jakub Jelinek on March 28, 2014, 3:19 p.m.

Details

Message ID 20140328151934.GL1817@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 28, 2014, 3:19 p.m.
Hi!

Before ix86_copy_addr_to_reg has been added, we've been using
copy_addr_to_reg, which handles VOIDmode values just fine.
But this new function just ICEs on those.  As the function
has been added for adding SUBREGs to TLS addresses, those will
never retunring CONST_INTs, so just using copy_addr_to_reg
is IMHO the right thing and restores previous behavior.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2014-03-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/60693
	* config/i386/i386.c (ix86_copy_addr_to_reg): Call copy_addr_to_reg
	also if addr has VOIDmode.

	* gcc.target/i386/pr60693.c: New test.


	Jakub

Comments

Uros Bizjak March 28, 2014, 7:05 p.m.
On Fri, Mar 28, 2014 at 4:19 PM, Jakub Jelinek <jakub@redhat.com> wrote:

> Before ix86_copy_addr_to_reg has been added, we've been using
> copy_addr_to_reg, which handles VOIDmode values just fine.
> But this new function just ICEs on those.  As the function
> has been added for adding SUBREGs to TLS addresses, those will
> never retunring CONST_INTs, so just using copy_addr_to_reg
> is IMHO the right thing and restores previous behavior.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2014-03-28  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/60693
>         * config/i386/i386.c (ix86_copy_addr_to_reg): Call copy_addr_to_reg
>         also if addr has VOIDmode.
>
>         * gcc.target/i386/pr60693.c: New test.

OK.

Thanks,
Uros.

Patch hide | download patch | download mbox

--- gcc/config/i386/i386.c.jj	2014-03-20 17:05:21.000000000 +0100
+++ gcc/config/i386/i386.c	2014-03-28 12:04:59.695679145 +0100
@@ -22755,7 +22755,7 @@  counter_mode (rtx count_exp)
 static rtx
 ix86_copy_addr_to_reg (rtx addr)
 {
-  if (GET_MODE (addr) == Pmode)
+  if (GET_MODE (addr) == Pmode || GET_MODE (addr) == VOIDmode)
     return copy_addr_to_reg (addr);
   else
     {
--- gcc/testsuite/gcc.target/i386/pr60693.c.jj	2014-03-28 12:08:00.078711929 +0100
+++ gcc/testsuite/gcc.target/i386/pr60693.c	2014-03-28 12:07:31.000000000 +0100
@@ -0,0 +1,13 @@ 
+/* PR target/60693 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void bar (char *);
+
+void
+foo (void)
+{
+  char buf[4096];
+  __builtin_memcpy (buf, (void *) 0x8000, 4096);
+  bar (buf);
+}