* [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
@ 2015-03-27 0:05 Chen Gang
2015-03-27 0:18 ` Chen Gang
2015-03-27 13:04 ` Bernd Schmidt
0 siblings, 2 replies; 5+ messages in thread
From: Chen Gang @ 2015-03-27 0:05 UTC (permalink / raw)
To: Jeff Law, bernds; +Cc: gcc-patches List
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
2015-03-27 0:05 [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store" Chen Gang
@ 2015-03-27 0:18 ` Chen Gang
2015-03-27 13:04 ` Bernd Schmidt
1 sibling, 0 replies; 5+ messages in thread
From: Chen Gang @ 2015-03-27 0:18 UTC (permalink / raw)
To: Jeff Law, bernds; +Cc: gcc-patches List
On 3/27/15 08:05, Chen Gang wrote:
> 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);
Oh, sorry, I use 11 instead of -1 for generating the assembly code (-1
and 11 lead the same result).
[...]
> 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)"
>
[...]
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
2015-03-27 0:05 [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store" Chen Gang
2015-03-27 0:18 ` Chen Gang
@ 2015-03-27 13:04 ` Bernd Schmidt
2015-03-28 1:32 ` Chen Gang
1 sibling, 1 reply; 5+ messages in thread
From: Bernd Schmidt @ 2015-03-27 13:04 UTC (permalink / raw)
To: Chen Gang, Jeff Law; +Cc: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
On 03/27/2015 01:05 AM, Chen Gang wrote:
> 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.
>
> * config/c6x/c6x.md (movmisalign<mode>_store): Remove "clobber
> (match_scratch ...)".
No, that just will make the compiler confuse loads and stores. I've
committed the following to fix it (I thought I'd done so a year ago, but
probably it was one of those commit against an out-of-date tree
situations and it didn't go through).
Bernd
[-- Attachment #2: misalign.diff --]
[-- Type: text/x-patch, Size: 789 bytes --]
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8e4b6c1..d5535f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2015-03-27 Bernd Schmidt <bernds@codesourcery.com>
+ * config/c6x/c6x.md (movmisalign<mode>): Use MEM_P, not
+ memory_operand.
+
PR target/65052
* config/c6x/constraints.md (S3): New constraint.
* config/c6x/c6x.md (real_jump): Use it.
diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md
index fafefa6..e957eca 100644
--- a/gcc/config/c6x/c6x.md
+++ b/gcc/config/c6x/c6x.md
@@ -775,7 +775,7 @@
UNSPEC_MISALIGNED_ACCESS))]
"TARGET_INSNS_64"
{
- if (memory_operand (operands[0], <MODE>mode))
+ if (MEM_P (operands[0]))
{
emit_insn (gen_movmisalign<mode>_store (operands[0], operands[1]));
DONE;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
2015-03-27 13:04 ` Bernd Schmidt
@ 2015-03-28 1:32 ` Chen Gang
2015-03-28 6:24 ` Chen Gang
0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang @ 2015-03-28 1:32 UTC (permalink / raw)
To: Bernd Schmidt, Jeff Law; +Cc: gcc-patches List
On 3/27/15 21:03, Bernd Schmidt wrote:
> On 03/27/2015 01:05 AM, Chen Gang wrote:
>> 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.
>>
>
>> * config/c6x/c6x.md (movmisalign<mode>_store): Remove "clobber
>> (match_scratch ...)".
>
> No, that just will make the compiler confuse loads and stores. I've committed the following to fix it (I thought I'd done so a year ago, but probably it was one of those commit against an out-of-date tree situations and it didn't go through).
>
OK, thanks. Your patch is OK to me. And I shall try to find another c6x
patches within this month (2015-03-31).
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store".
2015-03-28 1:32 ` Chen Gang
@ 2015-03-28 6:24 ` Chen Gang
0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang @ 2015-03-28 6:24 UTC (permalink / raw)
To: Bernd Schmidt, Jeff Law; +Cc: gcc-patches List
On 3/28/15 09:32, Chen Gang wrote:
> On 3/27/15 21:03, Bernd Schmidt wrote:
>> On 03/27/2015 01:05 AM, Chen Gang wrote:
>>> 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.
>>>
>>
>>> * config/c6x/c6x.md (movmisalign<mode>_store): Remove "clobber
>>> (match_scratch ...)".
>>
>> No, that just will make the compiler confuse loads and stores. I've committed the following to fix it (I thought I'd done so a year ago, but probably it was one of those commit against an out-of-date tree situations and it didn't go through).
>>
>
> OK, thanks. Your patch is OK to me. And I shall try to find another c6x
> patches within this month (2015-03-31).
>
I have reported the related bug 65510, please continue for it, if I need
to continue, please let me know.
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-28 6:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 0:05 [PATCH] gcc/config/c6x/c6x.md: Remove "clobber (match_scratch ...)" in "movmisalign<mode>_store" Chen Gang
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
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).