public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56790] New: VEC_COND_EXPR not constant folded
@ 2013-03-30 23:03 glisse at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-03-30 23:03 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/56790] VEC_COND_EXPR not constant folded
  2013-03-30 23:03 [Bug tree-optimization/56790] New: VEC_COND_EXPR not constant folded glisse at gcc dot gnu.org
@ 2013-04-02  9:10 ` rguenth at gcc dot gnu.org
  2013-04-12 14:02 ` glisse at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-02  9:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56790

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-02
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-02 09:10:14 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/56790] VEC_COND_EXPR not constant folded
  2013-03-30 23:03 [Bug tree-optimization/56790] New: VEC_COND_EXPR not constant folded glisse at gcc dot gnu.org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-04-12 14:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56790

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> 2013-04-12 14:02:17 UTC ---
r197395 | glisse | 2013-04-03 11:49:44 +0200 (Wed, 03 Apr 2013) | 10 lines

2013-04-03  Marc Glisse  <marc.glisse@inria.fr>

        PR tree-optimization/56790
gcc/
        * fold-const.c (fold_ternary_loc) <VEC_COND_EXPR>: Add constant
folding.

gcc/testsuite/
        * g++.dg/ext/pr56790-1.C: New testcase.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-12 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-30 23:03 [Bug tree-optimization/56790] New: VEC_COND_EXPR not constant folded glisse at gcc dot gnu.org
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

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).