public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/48128] Excessive code generated for vectorized loop Date: Fri, 27 Aug 2021 05:24:12 +0000 [thread overview] Message-ID: <bug-48128-4-SZq4xu8Btk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-48128-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48128 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.8.0 Status|NEW |RESOLVED Known to work| |4.8.0 Keywords| |ra Resolution|--- |FIXED --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The problem was this RTL: (insn 7 2 25 2 (set (reg:V4SI 65 [ MEM[(int[8] *)&baz] ]) (mem/c:V4SI (symbol_ref:SI ("baz") [flags 0x2] <var_decl 0x7fc7df4971e0 baz>) [2 MEM[(int[8] *)&baz]+0 S16 A256])) /app/example.cpp:19 1080 {*movv4si_internal} (nil)) (insn 25 7 26 2 (set (reg:SI 72) (subreg:SI (reg:V4SI 65 [ MEM[(int[8] *)&baz] ]) 0)) /app/example.cpp:19 -1 (nil)) Which was produced by dse. In GCC 4.8 we produce the same except lra produces: (insn 25 7 26 2 (set (reg:SI 0 ax [72]) (mem/c:SI (symbol_ref:SI ("baz") [flags 0x2] <var_decl 0x7ffb6912d428 baz>) [2 MEM[(int[8] *)&baz]+0 S4 A256])) /app/example.cpp:19 89 {*movsi_internal} (nil)) So this got fixed with the new reload (LRA) :). Note -fno-tree-loop-distribute-patterns is needed otherwise you get a memcpy :). With -mno-sse, the extra register push was gone in GCC 4.6.0. GCC 8 also no longer vectorizers the code based on the cost model of pentium3, you need to add -fno-vect-cost-model. Starting GCC 9, GCC is able to produce for -msse2 case: movd %xmm0, %eax Anyways the original issue is fixed. With the trunk -O3 -m32 -msse GCC produces: foo2(): movdqa baz, %xmm7 movd %xmm7, %eax movaps %xmm7, bar movdqa baz+16, %xmm7 movaps %xmm7, bar+16 ret With -O3 -m32 -msse2: foo2(): movdqa baz, %xmm7 movd %xmm7, %eax movaps %xmm7, bar movdqa baz+16, %xmm7 movaps %xmm7, bar+16 ret The problem is -march=pentium3 causes a loop for the memcpy (tuning).
prev parent reply other threads:[~2021-08-27 5:24 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-03-15 0:02 [Bug rtl-optimization/48128] New: " d.g.gorbachev at gmail dot com 2011-03-15 0:57 ` [Bug rtl-optimization/48128] " pinskia at gcc dot gnu.org 2011-03-15 2:00 ` d.g.gorbachev at gmail dot com 2011-03-15 10:32 ` rguenth at gcc dot gnu.org 2014-06-19 5:35 ` d.g.gorbachev at gmail dot com 2021-08-27 5:24 ` pinskia at gcc dot gnu.org [this message]
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-48128-4-SZq4xu8Btk@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).