public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "marcin.krotkiewski at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/60086] suboptimal asm generated for a loop (store/load false aliasing) Date: Thu, 06 Feb 2014 09:34:00 -0000 [thread overview] Message-ID: <bug-60086-4-djCUFTVt21@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-60086-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60086 --- Comment #2 from Marcin Krotkiewski <marcin.krotkiewski at gmail dot com> --- Jakub, thank you for your comments. > GCC right now only handles __restrict on function parameters, so in this > case the aliasing info isn't known. While the loop is versioned for > aliasing at runtime, the info about that is only known during the > vectorizer, therefore e.g. scheduler can hardly know it. Does it mean that __restrict is not necessary in order to have a vectorized code path? I see that if I compile your modified test.c, the loop is vectorized regardless of whether I use __restrict, or not (runtime versioning). On the other hand, using __restrict causes gcc to invoke memset for initialization, while leaving it out results in two paths with a loop. On the interesting side. Your test.c works indeed if compiled with additional -fschedule-insns flag. However, if I now remove the __restrict keyword from function arguments, I do see a vectorized path, but the flag has no effect and instructions are again not reordered. > The pointers to > overaligned memory is something you should generally avoid, > __builtin_assume_aligned is what can be used to tell the compiler about the > alignment instead, overaligned types often actually hurt generated code > instead of improving it. Thanks. Could you suggest what is the preferred way to use it in a portable manner? e.g. make it suitable for icc, which has a __assume_aligned builtin? Should I wrap it in a macro? > And the way you are calling posix_memalign is IMHO > a strict aliasing violation. Could be, gcc des not show a warning with -Wall. Thanks for pointing it out.
next prev parent reply other threads:[~2014-02-06 9:34 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-05 22:41 [Bug rtl-optimization/60086] New: " marcin.krotkiewski at gmail dot com 2014-02-06 8:28 ` [Bug rtl-optimization/60086] " jakub at gcc dot gnu.org 2014-02-06 9:34 ` marcin.krotkiewski at gmail dot com [this message] 2014-02-06 10:10 ` mpolacek at gcc dot gnu.org 2014-02-06 10:22 ` rguenth at gcc dot gnu.org 2014-02-07 8:52 ` abel at gcc dot gnu.org 2014-02-07 8:53 ` abel at gcc dot gnu.org 2014-02-07 14:33 ` amonakov at gcc dot gnu.org 2014-02-07 16:43 ` marcin.krotkiewski at gmail dot com 2014-02-07 17:21 ` amonakov 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-60086-4-djCUFTVt21@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).