public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chen Gang <xili_gchen_5257@hotmail.com>
To: Jeff Law <law@redhat.com>, bernds@codesourcery.com
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
Date: Fri, 27 Mar 2015 00:05:00 -0000	[thread overview]
Message-ID: <BLU436-SMTP54E724354B094F919100DB9090@phx.gbl> (raw)

For misalignment memory access, c6x gcc will cause issue, so need remove
"clobber (match_scratch ...)" which will be symmetric with "movmisalign
<mode>_load", then pass compiling and generate correct assembly code.

The related issue:

  [root@localhost c6x]# cat test.i
  int oxu_driver_init(void)
  {
   *(volatile unsigned int *)(-1) = *(unsigned int *)(-1);
  }

  [root@localhost c6x]# /upstream/release-c6x/libexec/gcc/tic6x-gchen-elf/5.0.0/cc1 -Os test.i
   oxu_driver_init
  test.i: In function 'oxu_driver_init':
  test.i:4:1: error: unrecognizable insn:
   }
   ^
  (insn 9 8 12 2 (set (mem/v:SI (reg/f:SI 77) [1 MEM[(volatile unsigned int *)4294967295B]+0 S4 A8])
          (unspec:SI [
                  (reg:SI 73 [ D.1542 ])
              ] UNSPEC_MISALIGNED_ACCESS)) test.i:3 -1
       (nil))
  test.i:4:1: internal compiler error: in extract_insn, at recog.c:2343
  0x9f8645 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
          ../../gcc-c6x/gcc/rtl-error.c:110
  0x9f8679 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
          ../../gcc-c6x/gcc/rtl-error.c:118
  0x9ce127 extract_insn(rtx_insn*)
          ../../gcc-c6x/gcc/recog.c:2343
  0x7c759b instantiate_virtual_regs_in_insn
          ../../gcc-c6x/gcc/function.c:1598
  0x7c759b instantiate_virtual_regs
          ../../gcc-c6x/gcc/function.c:1966
  0x7c759b execute
          ../../gcc-c6x/gcc/function.c:2015
  Please submit a full bug report,

Related output after fix (I guess it is OK, please check):

        .file   "test.i"
        .c6xabi_attribute Tag_ABI_array_object_alignment, 0
        .c6xabi_attribute Tag_ABI_array_object_align_expected, 0
        .c6xabi_attribute Tag_ABI_stack_align_needed, 0
        .c6xabi_attribute Tag_ABI_stack_align_preserved, 0
        .c6xabi_attribute Tag_ABI_conformance, "1.0"
  .text;
        .align  2
        .global oxu_driver_init
        .type   oxu_driver_init, @function
  oxu_driver_init:
                mvk     .d1     11, A4
                ldnw    .d1t1   *A4, A3
                nop     4
                stnw    .d1t1   A3, *A4
                ret     .s2     B3
                nop     5
        .size   oxu_driver_init, .-oxu_driver_init
        .ident  "GCC: (GNU) 5.0.0 20150321 (experimental)"



2015-03-27  Chen Gang  <gang.chen.5i5j@gmail.com>

	* config/c6x/c6x.md (movmisalign<mode>_store): Remove "clobber
	(match_scratch ...)".
---
 gcc/config/c6x/c6x.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md
index 892aac4..6a3157f 100644
--- a/gcc/config/c6x/c6x.md
+++ b/gcc/config/c6x/c6x.md
@@ -785,8 +785,7 @@
 (define_insn_and_split "movmisalign<mode>_store"
   [(set (match_operand:SIDIVM 0 "memory_operand" "=W,Q,T,Q,T")
 	(unspec:SIDIVM [(match_operand:SIDIVM 1 "register_operand" "r,a,b,b,a")]
-		       UNSPEC_MISALIGNED_ACCESS))
-   (clobber (match_scratch:SI 2 "=r,X,X,X,X"))]
+		       UNSPEC_MISALIGNED_ACCESS))]
   "TARGET_INSNS_64"
   "@
    #
-- 
1.9.3

             reply	other threads:[~2015-03-27  0:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  0:05 Chen Gang [this message]
2015-03-27  0:18 ` Chen Gang
2015-03-27 13:04 ` Bernd Schmidt
2015-03-28  1:32   ` Chen Gang
2015-03-28  6:24     ` Chen Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU436-SMTP54E724354B094F919100DB9090@phx.gbl \
    --to=xili_gchen_5257@hotmail.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).