This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]