public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pali at kernel dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109317] New: -Os generates bigger code than -O2 on 32-bit ARM Date: Tue, 28 Mar 2023 16:27:11 +0000 [thread overview] Message-ID: <bug-109317-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109317 Bug ID: 109317 Summary: -Os generates bigger code than -O2 on 32-bit ARM Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pali at kernel dot org Target Milestone: --- Target: arm-linux-gnueabi Simple loops like the one in the example below are better optimized for size on 32-bit ARM with -O2 option than -Os option. $ cat test-arm.c char *test1(char *ptr) { while (*ptr != '\0' || *(ptr+1) != '\0') ptr++; ptr++; return ptr; } $ arm-linux-gnueabi-gcc -O2 -c test-arm.c && arm-linux-gnueabi-objdump -d test-arm.o test-arm.o: file format elf32-littlearm Disassembly of section .text: 00000000 <test1>: 0: e5d02000 ldrb r2, [r0] 4: e2800001 add r0, r0, #1 8: e3520000 cmp r2, #0 c: 1afffffb bne 0 <test1> 10: e5d02000 ldrb r2, [r0] 14: e3520000 cmp r2, #0 18: 1afffff8 bne 0 <test1> 1c: e12fff1e bx lr $ arm-linux-gnueabi-gcc -Os -c test-arm.c && arm-linux-gnueabi-objdump -d test-arm.o test-arm.o: file format elf32-littlearm Disassembly of section .text: 00000000 <test1>: 0: e1a03000 mov r3, r0 4: e5d32000 ldrb r2, [r3] 8: e2800001 add r0, r0, #1 c: e3520000 cmp r2, #0 10: 1afffffa bne 0 <test1> 14: e5d02000 ldrb r2, [r0] 18: e3520000 cmp r2, #0 1c: 1afffff7 bne 0 <test1> 20: e12fff1e bx lr $ arm-linux-gnueabi-gcc -v Using built-in specs. COLLECT_GCC=arm-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabi/12/lto-wrapper Target: arm-linux-gnueabi Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv5te --with-float=soft --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-14)
next reply other threads:[~2023-03-28 16:27 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-28 16:27 pali at kernel dot org [this message] 2023-03-29 7:04 ` [Bug target/109317] " rguenth at gcc dot gnu.org 2023-04-22 20:57 ` pali at kernel dot org 2024-03-13 21:47 ` pali at kernel dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109317-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).