public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111580] New: [arm-none-eabi-gcc] / suboptimal optimization / b.n to bx lr
@ 2023-09-25  5:09 cptarse-luke at yahoo dot com
  2023-09-25  6:43 ` [Bug target/111580] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: cptarse-luke at yahoo dot com @ 2023-09-25  5:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111580
           Summary: [arm-none-eabi-gcc] / suboptimal optimization / b.n to
                    bx lr
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cptarse-luke at yahoo dot com
  Target Milestone: ---

it seems like, i should have filed this separately:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111500

i feel like gcc should output a "bx lr" instead of a jump ("b .L1") to a "bx
lr"...

the file "a.i" is:
# 1 "a.c"
# 1 "/tmp//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.c"
int artiBN2BX(int a, int b) {
 if (a<b) return a+b;
 return a*b;
}

this results in this machine code:
> arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/9.3.0/lto-wrapper
Target: arm-none-eabi
Configured with: ../configure --disable-decimal-float --disable-libffi
--disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp
--disable-libstdcxx-pch --disable-libstdc__-v3 --disable-nls --disable-shared
--disable-threads --disable-tls --disable-werror --enable-__cxa_atexit
--enable-c99 --enable-gnu-indirect-function --enable-interwork
--enable-languages=c,c++ --enable-long-long --enable-multilib --enable-plugins
--host= --libdir=/usr/lib --libexecdir=/usr/lib --prefix=/usr
--target=arm-none-eabi --with-gmp --with-gnu-as --with-gnu-ld
--with-headers=/usr/arm-none-eabi/include --with-host-libstdcxx='-static-libgcc
-Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-isl --with-libelf --with-mpc
--with-mpfr --with-multilib-list=rmprofile
--with-native-system-header-dir=/include --with-newlib
--with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/usr/arm-none-eabi
--with-system-zlib
Thread model: single
gcc version 9.3.0 (GCC)
> arm-none-eabi-gcc -save-temps -S a.c -O3 -g -mcpu=cortex-m0plus -mthumb -Wall --specs=nosys.specs -nostdlib -fdata-sections -ffunction-sections -ffreestanding -Winline
> cat a.s
artiBN2BX:
        cmp     r0, r1
        blt     .L5
        muls    r0, r1
.L1:    bx      lr
.L5:    adds    r0, r0, r1
        b       .L1

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

* [Bug target/111580] [arm-none-eabi-gcc] / suboptimal optimization / b.n to bx lr
  2023-09-25  5:09 [Bug target/111580] New: [arm-none-eabi-gcc] / suboptimal optimization / b.n to bx lr cptarse-luke at yahoo dot com
@ 2023-09-25  6:43 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-25  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 40499.

*** This bug has been marked as a duplicate of bug 40499 ***

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25  5:09 [Bug target/111580] New: [arm-none-eabi-gcc] / suboptimal optimization / b.n to bx lr cptarse-luke at yahoo dot com
2023-09-25  6:43 ` [Bug target/111580] " pinskia 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).