public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/59710] New: Nios2: Missing gprel optimization
@ 2014-01-07 11:02 sebastian.huber@embedded-brains.de
2014-11-26 1:48 ` [Bug target/59710] " sandra at codesourcery dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2014-01-07 11:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
Bug ID: 59710
Summary: Nios2: Missing gprel optimization
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: sebastian.huber@embedded-brains.de
The compiler doesn't generate gprel load/store operations for variables
external to the translation unit (this is unlike the PowerPC target for
example). Consider the following test case:
gprel-ok.c:
int iii;
int jjj = 456;
void gprel_ok(void)
{
iii = 123;
jjj = 789;
}
gprel-not-ok.c:
extern int iii;
extern int jjj;
void gprel_not_ok(void)
{
iii = 123;
jjj = 789;
}
nios2-elf-gcc -O2 -fno-common -S gprel-ok.c
nios2-elf-gcc -O2 -fno-common -S gprel-not-ok.c
gprel-ok.s:
.file "gprel-ok.c"
.section .text
.align 2
.global gprel_ok
.type gprel_ok, @function
gprel_ok:
movi r2, 123
stw r2, %gprel(iii)(gp)
movi r2, 789
stw r2, %gprel(jjj)(gp)
ret
.size gprel_ok, .-gprel_ok
.global jjj
.section .sdata,"aws",@progbits
.align 2
.type jjj, @object
.size jjj, 4
jjj:
.long 456
.global iii
.section .sbss,"aws",@nobits
.align 2
.type iii, @object
.size iii, 4
iii:
.zero 4
.ident "GCC: (GNU) 4.9.0 20140103 (experimental)"
gprel-not-ok.s:
.file "gprel-not-ok.c"
.section .text
.align 2
.global gprel_not_ok
.type gprel_not_ok, @function
gprel_not_ok:
movi r3, 123
movhi r2, %hiadj(iii)
addi r2, r2, %lo(iii)
stw r3, 0(r2)
movi r3, 789
movhi r2, %hiadj(jjj)
addi r2, r2, %lo(jjj)
stw r3, 0(r2)
ret
.size gprel_not_ok, .-gprel_not_ok
.ident "GCC: (GNU) 4.9.0 20140103 (experimental)"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
@ 2014-11-26 1:48 ` sandra at codesourcery dot com
2015-01-16 0:44 ` sandra at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sandra at codesourcery dot com @ 2014-11-26 1:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
Sandra Loosemore <sandra at codesourcery dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandra at codesourcery dot com
--- Comment #1 from Sandra Loosemore <sandra at codesourcery dot com> ---
I'm working on a patch that will fix this by adding some additional choices for
-mgpopt.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
2014-11-26 1:48 ` [Bug target/59710] " sandra at codesourcery dot com
@ 2015-01-16 0:44 ` sandra at gcc dot gnu.org
2015-01-16 9:32 ` sebastian.huber@embedded-brains.de
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sandra at gcc dot gnu.org @ 2015-01-16 0:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
--- Comment #2 from sandra at gcc dot gnu.org ---
Author: sandra
Date: Fri Jan 16 00:43:24 2015
New Revision: 219700
URL: https://gcc.gnu.org/viewcvs?rev=219700&root=gcc&view=rev
Log:
2015-01-15 Sandra Loosemore <sandra@codesourcery.com>
PR target/59710
gcc/
* doc/invoke.texi (Option Summary): Document new Nios II
-mgpopt= syntax.
(Nios II Options): Likewise.
* config/nios2/nios2.opt: Add -mgpopt= option support.
Modify existing -mgpopt and -mno-gpopt options to be aliases.
* config/nios2/nios2-opts.h (enum nios2_gpopt_type): New.
* config/nios2/nios2.c (nios2_option_override): Adjust
-mgpopt defaulting.
(nios2_in_small_data_p): Return true for explicit small data
sections even with -G0.
(nios2_symbol_ref_in_small_data_p): Adjust to handle new -mgpopt=
option choices.
gcc/testsuite/
* gcc.target/nios2/gpopt-all.c: New test case.
* gcc.target/nios2/gpopt-local.c: New test case.
* gcc.target/nios2/gpopt-global.c: New test case.
* gcc.target/nios2/gpopt-data.c: New test case.
* gcc.target/nios2/gpopt-none.c: New test case.
Added:
trunk/gcc/testsuite/gcc.target/nios2/gpopt-all.c
trunk/gcc/testsuite/gcc.target/nios2/gpopt-data.c
trunk/gcc/testsuite/gcc.target/nios2/gpopt-global.c
trunk/gcc/testsuite/gcc.target/nios2/gpopt-local.c
trunk/gcc/testsuite/gcc.target/nios2/gpopt-none.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/nios2/nios2-opts.h
trunk/gcc/config/nios2/nios2.c
trunk/gcc/config/nios2/nios2.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
2014-11-26 1:48 ` [Bug target/59710] " sandra at codesourcery dot com
2015-01-16 0:44 ` sandra at gcc dot gnu.org
@ 2015-01-16 9:32 ` sebastian.huber@embedded-brains.de
2015-01-16 18:34 ` sandra at codesourcery dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2015-01-16 9:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
Sebastian Huber <sebastian.huber@embedded-brains.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |5.0
--- Comment #3 from Sebastian Huber <sebastian.huber@embedded-brains.de> ---
Thanks, this fixes the problem in case the new -mgpot=global option is used. Do
you plan to back port this to GCC 4.9? If not, then can you please adjust the
target milestone and close the PR.
nios2-elf-gcc -O2 -mgpopt=global -fno-common -S gprel-ok.c && cat gprel-ok.s
.file "gprel-ok.c"
.section .text
.align 2
.global gprel_ok
.type gprel_ok, @function
gprel_ok:
movi r2, 123
stw r2, %gprel(iii)(gp)
movi r2, 789
stw r2, %gprel(jjj)(gp)
ret
.size gprel_ok, .-gprel_ok
.global jjj
.section .sdata,"aws",@progbits
.align 2
.type jjj, @object
.size jjj, 4
jjj:
.long 456
.global iii
.section .sbss,"aws",@nobits
.align 2
.type iii, @object
.size iii, 4
iii:
.zero 4
.ident "GCC: (GNU) 5.0.0 20150116 (experimental)"
nios2-elf-gcc -O2 -mgpopt=global -fno-common -S gprel-not-ok.c && cat
gprel-not-ok.s
.file "gprel-not-ok.c"
.section .text
.align 2
.global gprel_not_ok
.type gprel_not_ok, @function
gprel_not_ok:
movi r2, 123
stw r2, %gprel(iii)(gp)
movi r2, 789
stw r2, %gprel(jjj)(gp)
ret
.size gprel_not_ok, .-gprel_not_ok
.ident "GCC: (GNU) 5.0.0 20150116 (experimental)"
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
` (2 preceding siblings ...)
2015-01-16 9:32 ` sebastian.huber@embedded-brains.de
@ 2015-01-16 18:34 ` sandra at codesourcery dot com
2015-01-16 19:04 ` joseph at codesourcery dot com
2015-01-16 19:14 ` sandra at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: sandra at codesourcery dot com @ 2015-01-16 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
--- Comment #4 from Sandra Loosemore <sandra at codesourcery dot com> ---
I'm thinking this isn't an appropriate kind of patch to backport to 4.9 -- it's
a fix for a missed optimization and not a serious bug (wrong code or ICE).
Maybe I'm being exceptionally dense here, but I can't figure out how to close
an issue or adjust milestones in bugzilla -- all I get when I click on "Status"
is a page with an explanation of what the different statuses mean. Maybe I
lack appropriate admin powers to do that?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
` (3 preceding siblings ...)
2015-01-16 18:34 ` sandra at codesourcery dot com
@ 2015-01-16 19:04 ` joseph at codesourcery dot com
2015-01-16 19:14 ` sandra at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2015-01-16 19:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
You need to use Bugzilla with your @gcc.gnu.org address to have rights to
modify bugs. @gcc.gnu.org accounts should have such rights automatically,
though overseers should be able to grant them to other accounts.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/59710] Nios2: Missing gprel optimization
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
` (4 preceding siblings ...)
2015-01-16 19:04 ` joseph at codesourcery dot com
@ 2015-01-16 19:14 ` sandra at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: sandra at gcc dot gnu.org @ 2015-01-16 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
sandra at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |sandra at gcc dot gnu.org
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #6 from sandra at gcc dot gnu.org ---
Aha, the magic buttons appear! Thanks, Joseph.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-16 19:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-07 11:02 [Bug target/59710] New: Nios2: Missing gprel optimization sebastian.huber@embedded-brains.de
2014-11-26 1:48 ` [Bug target/59710] " sandra at codesourcery dot com
2015-01-16 0:44 ` sandra at gcc dot gnu.org
2015-01-16 9:32 ` sebastian.huber@embedded-brains.de
2015-01-16 18:34 ` sandra at codesourcery dot com
2015-01-16 19:04 ` joseph at codesourcery dot com
2015-01-16 19:14 ` sandra 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).