From: Kito Cheng <kito.cheng@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Jan Hubicka <hubicka@ucw.cz>,
Richard Sandiford <rsandifo@linux.vnet.ibm.com>,
Eric Botcazou <ebotcazou@adacore.com>,
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Subject: Re: [PATCH] Pass correct memory attributes for build constant
Date: Thu, 26 Jun 2014 03:38:00 -0000 [thread overview]
Message-ID: <CA+yXCZBRyi5FMeStC5-mo619rK+eNGZjxL+UNU=MtE+Gzo2vQA@mail.gmail.com> (raw)
In-Reply-To: <53AB38AB.7040901@redhat.com>
For example in arm-elf-eabi, movmem need word align, otherwise it will
expand a libcall:
And gcc configure with "--target=arm-elf-eabi --disable-nls
--disable-shared --enable-languages=c,c++ --enable-threads=single
--enable-lto --with-newlib"
test.c:
extern bar(unsigned char p[3][2]);
void foo(int i)
{
unsigned char data[3][2] = {{1,1}, {1,0}, {1,1}};
bar(data);
}
Without this patch:
...
.text
.align 2
.global foo
.type foo, %function
foo:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
sub sp, sp, #12
mov r2, #6
ldr r1, .L3
mov r0, sp
bl memcpy @ LC0 has 4 byte align, but arm_gen_movmemqi
can't get right alignment info
mov r0, sp
bl bar
add sp, sp, #12
@ sp needed
ldr lr, [sp], #4
bx lr
.L4:
.align 2
.L3:
.word .LANCHOR0
.size foo, .-foo
.section .rodata
.align 2
.set .LANCHOR0,. + 0
.LC0:
.byte 1
.byte 1
.byte 1
.byte 0
.byte 1
.byte 1
With this patch:
...
foo:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
ldr r3, .L3 @ LC0 has 4 byte align, arm_gen_movmemqi get
right alignment info, so expand it!
ldmia r3, {r0, r1}
sub sp, sp, #12
str r0, [sp]
mov r0, sp
strh r1, [sp, #4] @ movhi
bl bar
add sp, sp, #12
@ sp needed
ldr lr, [sp], #4
bx lr
...
On Thu, Jun 26, 2014 at 5:01 AM, Jeff Law <law@redhat.com> wrote:
> On 06/25/14 09:35, Kito Cheng wrote:
>>
>> Hi all:
>> This patch is fix constant memory's symbol_ref don't have right
>> alignment info since `exp` don't set alignment (and should not set
>> alignment info for `exp`) , use `decl` to set_mem_attributes for
>> right alignment info.
>>
>> ChangLog
>> 2014-06-25 Kito Cheng <kito@0xlab.org>
>>
>> * varasm.c (build_constant_desc): Use decl to set mem
>> attributes since exp don't have correct aligment info.
>
> Do you have a testcase for this?
>
> jeff
>
next prev parent reply other threads:[~2014-06-26 3:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 15:35 Kito Cheng
2014-06-25 21:01 ` Jeff Law
2014-06-26 3:38 ` Kito Cheng [this message]
2014-06-27 22:35 ` Jeff Law
2014-06-28 0:14 ` Jan Hubicka
2014-06-30 6:17 ` Kito Cheng
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='CA+yXCZBRyi5FMeStC5-mo619rK+eNGZjxL+UNU=MtE+Gzo2vQA@mail.gmail.com' \
--to=kito.cheng@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=law@redhat.com \
--cc=ramana.radhakrishnan@arm.com \
--cc=rsandifo@linux.vnet.ibm.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).