public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/52049] New: SH Target: Inefficient constant address access
@ 2012-01-29 22:45 oleg.endo@t-online.de
2012-01-30 7:15 ` [Bug target/52049] " kkojima at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: oleg.endo@t-online.de @ 2012-01-29 22:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52049
Bug #: 52049
Summary: SH Target: Inefficient constant address access
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: oleg.endo@t-online.de
CC: kkojima@gcc.gnu.org
Target: sh*-*-*
static volatile int* const g_0 = (volatile int*)0x1240;
static volatile int* const g_1 = (volatile int*)0x1244;
static volatile int* const g_2 = (volatile int*)0x1248;
static volatile int* const g_3 = (volatile int*)0x124C;
int test_24 (void)
{
return *g_0 + *g_1 + *g_2 + *g_3;
}
Compiled with -O1:
mov.w .L31,r1
mov.l @r1+,r0
mov.l @r1+,r3
mov.l @r1+,r2
mov.l @r1,r1
add r3,r0
add r2,r0
rts
add r1,r0
.align 1
.L31:
.short 4672
Compiled with -O2, -Os, -O3:
mov.w .L31,r1
mov.l @r1,r0
mov.l @(4,r1),r3
mov.l @(8,r1),r2
add #12,r1 ! why not mov.l @(12,r1),r1 ??
mov.l @r1,r1
add r3,r0
add r2,r0
rts
add r1,r0
.align 1
.L31:
.short 4672
This happens always for the last memory access, if the number of contiguous
accesses is > 2.
When using non-volatile variables:
static int* const h_0 = (int*)0x1240;
static int* const h_1 = (int*)0x1244;
static int* const h_2 = (int*)0x1248;
static int* const h_3 = (int*)0x124C;
int test_25 (void)
{
return *h_0 + *h_1 + *h_2 + *h_3;
}
Compiled with -O1,-O2,-Os,-O3:
mov.w .L33,r1
mov.l @r1+,r0
mov.l @r1,r1
add r1,r0
mov.w .L34,r1
mov.l @r1,r1
add r1,r0
mov.w .L35,r1
mov.l @r1,r1
rts
add r1,r0
.align 1
.L33:
.short 4672
.L34:
.short 4680
.L35:
.short 4684
Better:
mov.w .L31,r1
mov.l @r1+,r0
mov.l @r1+,r3
mov.l @r1+,r2
add r3,r0
mov.l @r1,r1
add r2,r0
rts
add r1,r0
.align 1
.L31:
.short 4672
I'm not sure whether this is actually a problem of the SH back-end or of some
middle-end passes. It happens for all sub-targets and regardless of the
endianess.
Using built-in specs.
COLLECT_GCC=sh-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper
Target: sh-elf
Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp --disable-nls
--disable-werror --enable-lto --with-newlib --with-gnu-as --with-gnu-ld
--with-system-zlib
Thread model: single
gcc version 4.7.0 20120129 (experimental) (GCC)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/52049] SH Target: Inefficient constant address access
2012-01-29 22:45 [Bug target/52049] New: SH Target: Inefficient constant address access oleg.endo@t-online.de
@ 2012-01-30 7:15 ` kkojima at gcc dot gnu.org
2012-02-26 23:41 ` olegendo at gcc dot gnu.org
2015-05-22 13:58 ` olegendo at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: kkojima at gcc dot gnu.org @ 2012-01-30 7:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52049
--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2012-01-30 00:15:16 UTC ---
(In reply to comment #0)
> I'm not sure whether this is actually a problem of the SH back-end or of some
> middle-end passes. It happens for all sub-targets and regardless of the
> endianess.
I've tried these cases on arm/thumb and got similar results
which look not very good. From the rtl dumps, it looks a general
issue with postreload optimization on some targets.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/52049] SH Target: Inefficient constant address access
2012-01-29 22:45 [Bug target/52049] New: SH Target: Inefficient constant address access oleg.endo@t-online.de
2012-01-30 7:15 ` [Bug target/52049] " kkojima at gcc dot gnu.org
@ 2012-02-26 23:41 ` olegendo at gcc dot gnu.org
2015-05-22 13:58 ` olegendo at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-02-26 23:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52049
olegendo at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-26
CC| |olegendo at gcc dot gnu.org
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/52049] SH Target: Inefficient constant address access
2012-01-29 22:45 [Bug target/52049] New: SH Target: Inefficient constant address access oleg.endo@t-online.de
2012-01-30 7:15 ` [Bug target/52049] " kkojima at gcc dot gnu.org
2012-02-26 23:41 ` olegendo at gcc dot gnu.org
@ 2015-05-22 13:58 ` olegendo at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-05-22 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52049
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
There is a GSoC 2015 project which will try to address the AMS problem.
https://www.google-melange.com/gsoc/project/details/google/gsoc2015/erikvarga/5693417237512192
It will be initially for SH. If it works out, it can be generalized so that
other targets can benefit from it, too.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-22 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 22:45 [Bug target/52049] New: SH Target: Inefficient constant address access oleg.endo@t-online.de
2012-01-30 7:15 ` [Bug target/52049] " kkojima at gcc dot gnu.org
2012-02-26 23:41 ` olegendo at gcc dot gnu.org
2015-05-22 13:58 ` olegendo at gcc dot gnu.org
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).