public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111500] New: [arm-none-eabi-gcc] / suboptimal optimization
@ 2023-09-20 14:55 gnu.arne at wgboome dot org
  2023-09-20 16:16 ` [Bug target/111500] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gnu.arne at wgboome dot org @ 2023-09-20 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111500

            Bug ID: 111500
           Summary: [arm-none-eabi-gcc] / suboptimal optimization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gnu.arne at wgboome dot org
  Target Milestone: ---

Hi!

For my STM32G030K6T I need thumb2 machine code.
arm-none-eabi-gcc can convert my C code quite nicely.

When I inspected the resulting disassembled machine code, I found some funny
artifacts.
Is it worth making&sending minimal source code and/or that corresponding
"preprocessed file *.i*"?
I mean: Is somebody able/willing to do something about it?

Here are the 4 artifacts (when using "-O3 -g"):
1.
a "subs r2, #1" instruction is followed by a "cmp r2, #0 / bne.n" instruction,
although the "subs" already leaves the zero flag properly, doesn't it?
2.
a "b.n" instruction jumps to a "bx lr" instruction, although both have the same
length... i mean: instead of "b.n" it could have written "bx lr"...
3.
a "uxth r2, r2" is followed by a "strh r2, [r3]", although "strh" doesn't look
at the high half-word of r2, does it?
4.
when i use single bits in a struct (e. g.: "struct A { int a:1; int b:7; }"),
gcc reserves 16 bytes on the stack and sometimes writes into this area, without
ever reading from there... when i do it myself with "struct A { int ab; }" and
"if (S.ab&128)..." and "if (S.ab&127)..." then it doesnt touch the stack...

Thx.

Bye.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-09-25 10:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 14:55 [Bug c/111500] New: [arm-none-eabi-gcc] / suboptimal optimization gnu.arne at wgboome dot org
2023-09-20 16:16 ` [Bug target/111500] " pinskia at gcc dot gnu.org
2023-09-20 19:14 ` gnu.arne at wgboome dot org
2023-09-25  4:46 ` cptarse-luke at yahoo dot com
2023-09-25  4:52 ` cptarse-luke at yahoo dot com
2023-09-25  6:43 ` [Bug target/111500] [arm-none-eabi-gcc] / suboptimal optimization / subs followed by cmp (et alii) pinskia at gcc dot gnu.org
2023-09-25  6:48 ` pinskia at gcc dot gnu.org
2023-09-25  6:52 ` pinskia at gcc dot gnu.org
2023-09-25  6:53 ` pinskia at gcc dot gnu.org
2023-09-25  7:09 ` cptarse-luke at yahoo dot com
2023-09-25  7:28 ` cptarse-luke at yahoo dot com
2023-09-25 10:45 ` cptarse-luke at yahoo dot com

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).