public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "law at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102756] New: [12 Regression] Vectorizer change creates poor code for c-c++-common/torture/vector-compare-2.c Date: Fri, 15 Oct 2021 00:16:14 +0000 [thread overview] Message-ID: <bug-102756-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102756 Bug ID: 102756 Summary: [12 Regression] Vectorizer change creates poor code for c-c++-common/torture/vector-compare-2.c Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- The visium-elf port is a bit broken in that any code which calls abort will fail to link. This has turned out to be useful in that it has pointed out cases where the quality of our code generation has suffered. The change to turn on the vectorizer by default at -O2 is yet another example. c-c++-common/torture/vector-compare-2.c before the vectorizer change compiled down to this code at -O2: .file "j.c" .text .align 4 .p2align 8 .global foo .type foo, @function foo: moviu r9,65535 movil r9,65533 write.l (r1),r9 write.l 1(r1),r9 write.l 2(r1),r9 bra tr,r21,r0 ;return write.l 3(r1),r9 .size foo, .-foo .section .text.startup,"ax",@progbits .align 4 .p2align 8 .global main .type main, @function main: bra tr,r21,r0 ;return moviq r1,0 ;movsi r J .size main, .-main .ident "GCC: (GNU) 12.0.0 20211008 (experimental)" Of particular note "main" does _not_ call abort. The optimizers have figured everything out and realized that it should never abort. After enabling the vectorizer at -O2 we get: .file "j.c" .text .align 4 .p2align 8 .global foo .type foo, @function foo: moviu r9,65535 movil r9,65533 write.l (r1),r9 write.l 1(r1),r9 write.l 2(r1),r9 bra tr,r21,r0 ;return write.l 3(r1),r9 .size foo, .-foo .section .text.startup,"ax",@progbits .align 4 .p2align 8 .global main .type main, @function main: subi sp,36 moviq r10,23 ;movsi r J write.l (sp),fp move.l fp,sp ;stack_save add.l r8,fp,r10 lsr.l r8,r8,4 asl.l r8,r8,4 moviu r9,65535 write.l 1(sp),r21 movil r9,65533 write.l (r8),r9 write.l 1(r8),r9 write.l 2(r8),r9 write.l 3(r8),r9 move.l r10,r8 moviq r8,16 ;movsi r J add.l r7,r10,r8 .L5: read.l r8,(r10) cmp.l r8,r9 brr ne,.L8 addi r10,4 cmp.l r10,r7 brr ne,.L5 moviq r1,0 ;movsi r J read.l fp,(sp) read.l r21,1(sp) bra tr,r21,r0 ;return addi sp,36 ;stack pop .L8: moviu r10,%u abort movil r10,%l abort bra tr,r10,r21 nop ;call .size main, .-main .ident "GCC: (GNU) 12.0.0 20211008 (experimental)" Note how there's a call to abort starting at the label .L8. And more generally the code in "main" is considerably larger and more complex. This is a code quality regression.
next reply other threads:[~2021-10-15 0:16 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-15 0:16 law at gcc dot gnu.org [this message] 2021-10-15 0:29 ` [Bug tree-optimization/102756] [12 Regression] Complete unrolling is too senative to PRE; c-c++-common/torture/vector-compare-2.c pinskia at gcc dot gnu.org 2021-10-15 0:29 ` pinskia at gcc dot gnu.org 2021-10-15 6:25 ` rguenth at gcc dot gnu.org 2021-10-15 14:44 ` law at gcc dot gnu.org 2021-11-17 16:28 ` law at gcc dot gnu.org 2021-11-17 16:29 ` law at gcc dot gnu.org 2022-01-19 8:22 ` rguenth at gcc dot gnu.org 2022-05-06 8:31 ` [Bug tree-optimization/102756] [12/13 " jakub at gcc dot gnu.org 2022-07-26 13:23 ` rguenth at gcc dot gnu.org 2023-05-08 12:22 ` [Bug tree-optimization/102756] [12/13/14 " rguenth at gcc dot gnu.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-102756-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).