public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96769] New: -mpure-code produces suboptimal code for immediate generation for thumb-1
@ 2020-08-24 13:25 clyon at gcc dot gnu.org
2020-09-03 8:26 ` [Bug target/96769] " clyon at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-08-24 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96769
Bug ID: 96769
Summary: -mpure-code produces suboptimal code for immediate
generation for thumb-1
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: clyon at gcc dot gnu.org
Target Milestone: ---
As discussed in PR94538, -mpure-code produces switch tables for thumb-1.
int f3 (void) { return 0x11000000; }
int f3_2 (void) { return 0x12345678; }
Compiled with -O2 -mpure-code,
-mcpu=cortex-m0:
f3:
movs r0, #17
@ sp needed
lsls r0, r0, #8
lsls r0, r0, #8
lsls r0, r0, #8
bx lr
f3_2:
movs r0, #18
@ sp needed
lsls r0, r0, #8
adds r0, r0, #52
lsls r0, r0, #8
adds r0, r0, #86
lsls r0, r0, #8
adds r0, r0, #120
bx lr
-mcpu=cortex-m23:
f3:
movs r0, #136
@ sp needed
lsls r0, r0, #21
bx lr
f3_2:
movw r0, #22136
@ sp needed
movt r0, 4660
bx lr
Code for cortex-m23 is OK, but the code for cortex-m0 could be improved for
f3(). For f3_2(), code for cortex-m0 looks OK since that CPU does not have
movw/movt instructions.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/96769] -mpure-code produces suboptimal code for immediate generation for thumb-1
2020-08-24 13:25 [Bug target/96769] New: -mpure-code produces suboptimal code for immediate generation for thumb-1 clyon at gcc dot gnu.org
@ 2020-09-03 8:26 ` clyon at gcc dot gnu.org
2020-09-04 11:49 ` cvs-commit at gcc dot gnu.org
2020-09-04 11:49 ` clyon at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-09-03 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96769
Christophe Lyon <clyon at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2020-09-03
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Patch proposal sent:
https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553196.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/96769] -mpure-code produces suboptimal code for immediate generation for thumb-1
2020-08-24 13:25 [Bug target/96769] New: -mpure-code produces suboptimal code for immediate generation for thumb-1 clyon at gcc dot gnu.org
2020-09-03 8:26 ` [Bug target/96769] " clyon at gcc dot gnu.org
@ 2020-09-04 11:49 ` cvs-commit at gcc dot gnu.org
2020-09-04 11:49 ` clyon at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-04 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96769
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>:
https://gcc.gnu.org/g:2033a63cbd0aab27d3a8450b4a4a5b371d583c85
commit r11-3011-g2033a63cbd0aab27d3a8450b4a4a5b371d583c85
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date: Fri Sep 4 11:48:36 2020 +0000
arm: Improve immediate generation for thumb-1 with -mpurecode [PR96769]
This patch moves the move-immediate splitter after the regular ones so
that it has lower precedence, and updates its constraints.
For
int f3 (void) { return 0x11000000; }
int f3_2 (void) { return 0x12345678; }
we now generate:
* with -O2 -mcpu=cortex-m0 -mpure-code:
f3:
movs r0, #136
lsls r0, r0, #21
bx lr
f3_2:
movs r0, #18
lsls r0, r0, #8
adds r0, r0, #52
lsls r0, r0, #8
adds r0, r0, #86
lsls r0, r0, #8
adds r0, r0, #121
bx lr
* with -O2 -mcpu=cortex-m23 -mpure-code:
f3:
movs r0, #136
lsls r0, r0, #21
bx lr
f3_2:
movw r0, #22136
movt r0, 4660
bx lr
2020-09-04 Christophe Lyon <christophe.lyon@linaro.org>
PR target/96769
gcc/
* config/arm/thumb1.md: Move movsi splitter for
arm_disable_literal_pool after the other movsi splitters.
gcc/testsuite/
* gcc.target/arm/pure-code/pr96769.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/96769] -mpure-code produces suboptimal code for immediate generation for thumb-1
2020-08-24 13:25 [Bug target/96769] New: -mpure-code produces suboptimal code for immediate generation for thumb-1 clyon at gcc dot gnu.org
2020-09-03 8:26 ` [Bug target/96769] " clyon at gcc dot gnu.org
2020-09-04 11:49 ` cvs-commit at gcc dot gnu.org
@ 2020-09-04 11:49 ` clyon at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: clyon at gcc dot gnu.org @ 2020-09-04 11:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96769
Christophe Lyon <clyon at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-04 11:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 13:25 [Bug target/96769] New: -mpure-code produces suboptimal code for immediate generation for thumb-1 clyon at gcc dot gnu.org
2020-09-03 8:26 ` [Bug target/96769] " clyon at gcc dot gnu.org
2020-09-04 11:49 ` cvs-commit at gcc dot gnu.org
2020-09-04 11:49 ` clyon 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).