public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/56790] New: VEC_COND_EXPR not constant folded Date: Sat, 30 Mar 2013 23:03:00 -0000 [thread overview] Message-ID: <bug-56790-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56790 Bug #: 56790 Summary: VEC_COND_EXPR not constant folded Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: glisse@gcc.gnu.org Target: x86_64-linux-gnu #include <x86intrin.h> __m128d f(){ __m128d a={5,7}; __m128d b={11,13}; __m128i m={-1,0}; return m?a:b; } With -msse3 or less, this is lowered to scalar operations and thus to a constant. However, with -msse4 or higher, nothing folds it to a constant, either at tree level or rtl level, and we end up with: pxor %xmm0, %xmm0 pcmpgtq .LC0(%rip), %xmm0 movapd .LC2(%rip), %xmm1 blendvpd %xmm0, .LC1(%rip), %xmm1 movapd %xmm1, %xmm0 The most natural seems to be to add something to fold-const.c, which currently only handles the case where the first argument is all 1s or all 0s. It would be good if the optimization worked when the second and third arguments can be either VECTOR_CST or CONSTRUCTOR, similarly to VEC_PERM_EXPR.
next reply other threads:[~2013-03-30 23:03 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-30 23:03 glisse at gcc dot gnu.org [this message] 2013-04-02 9:10 ` [Bug tree-optimization/56790] " rguenth at gcc dot gnu.org 2013-04-12 14:02 ` glisse 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-56790-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).