This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Allow VOIDmode argument to ix86_copy_addr_to_reg (PR target/60693)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Mar 2014 16:19:34 +0100
- Subject: [PATCH] Allow VOIDmode argument to ix86_copy_addr_to_reg (PR target/60693)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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.
--- 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);
+}
Jakub