public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114252] New: Introducing bswapsi reduces code performance Date: Wed, 06 Mar 2024 10:01:32 +0000 [thread overview] Message-ID: <bug-114252-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114252 Bug ID: 114252 Summary: Introducing bswapsi reduces code performance Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gjl at gcc dot gnu.org Target Milestone: --- Created attachment 57628 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57628&action=edit GNU-C test case typedef __UINT8_TYPE__ uint8_t; typedef __UINT32_TYPE__ uint32_t; typedef uint8_t __attribute__((vector_size(4))) v4u8_t; uint32_t func1 (const uint8_t *buf) { v4u8_t v4 = { buf[1], buf[0], buf[3], buf[2] }; return (uint32_t) v4; } Compile the code with $ avr-gcc code.c -S -Os -dp with v13 the result is: func1: mov r30,r24 ; 37 [c=4 l=1] movqi_insn/0 mov r31,r25 ; 38 [c=4 l=1] movqi_insn/0 ldd r22,Z+1 ; 39 [c=4 l=1] movqi_insn/3 ld r23,Z ; 40 [c=4 l=1] movqi_insn/3 ldd r24,Z+3 ; 41 [c=4 l=1] movqi_insn/3 ldd r25,Z+2 ; 42 [c=4 l=1] movqi_insn/3 /* epilogue start */ ret ; 45 [c=0 l=1] return which is good code: insn 37, 38 move the address to pointer register Z, and then follow 4 loads, one for each byte. When compiled with v14 however: func1: mov r30,r24 ; 23 [c=4 l=2] *movhi/0 mov r31,r25 ld r22,Z ; 24 [c=16 l=4] *movsi/2 ldd r23,Z+1 ldd r24,Z+2 ldd r25,Z+3 rcall __bswapsi2 ; 25 [c=16 l=1] *bswapsi2.libgcc mov r31,r23 ; 32 [c=4 l=1] movqi_insn/0 mov r23,r25 ; 33 [c=4 l=1] movqi_insn/0 mov r25,r31 ; 34 [c=4 l=1] movqi_insn/0 mov r31,r22 ; 35 [c=4 l=1] movqi_insn/0 mov r22,r24 ; 36 [c=4 l=1] movqi_insn/0 mov r24,r31 ; 37 [c=4 l=1] movqi_insn/0 /* epilogue start */ ret ; 40 [c=0 l=1] return Target: avr Configured with: ../../source/gcc-master/configure --target=avr --disable-nls --with-dwarf2 --with-gnu-as --with-gnu-ld --disable-shared --enable-languages=c,c++ Thread model: single Supported LTO compression algorithms: zlib gcc version 14.0.1 20240303 (experimental) (GCC)
next reply other threads:[~2024-03-06 10:01 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-06 10:01 gjl at gcc dot gnu.org [this message] 2024-03-06 11:55 ` [Bug target/114252] " rguenth at gcc dot gnu.org 2024-03-06 11:59 ` rguenth at gcc dot gnu.org 2024-03-06 12:15 ` gjl at gcc dot gnu.org 2024-03-06 12:37 ` rguenth at gcc dot gnu.org 2024-03-06 16:12 ` gjl at gcc dot gnu.org 2024-03-06 17:18 ` rguenther at suse dot de 2024-03-07 7:45 ` rguenth at gcc dot gnu.org 2024-03-07 8:45 ` gjl at gcc dot gnu.org 2024-03-07 9:05 ` gjl at gcc dot gnu.org 2024-03-07 9:14 ` rguenth at gcc dot gnu.org 2024-03-07 9:42 ` rguenth at gcc dot gnu.org 2024-03-07 10:47 ` gjl at gcc dot gnu.org 2024-03-07 10:56 ` rguenth at gcc dot gnu.org 2024-03-07 14:12 ` gjl at gcc dot gnu.org 2024-03-07 15:02 ` pinskia at gcc dot gnu.org 2024-03-07 17:52 ` rguenther at suse dot de
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-114252-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).