public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36431]  New: The C++ front-end produces some NOP_EXPR for vector types
@ 2008-06-04  0:19 pinskia at gcc dot gnu dot org
  2008-06-04  0:20 ` [Bug c++/36431] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-06-04  0:19 UTC (permalink / raw)
  To: gcc-bugs

While looking into a performance issue in 4.1.1 on PowerPC, I noticed that the
C++ front-end produces a NOP_EXPR for a vector type.  This caused the following
performance testcase to fail:
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-O2" } */

// We should not produce any addi but instead use li for this function as
// the two address expressions should be done correctly.
/* { dg-final { scan-assembler-not "addi" } } */

#include <altivec.h>

typedef vector float SIMD_Vector;
struct g
{
  vector float l[2];
};
vector float f(const struct g &a, const struct g &a1)
{
  SIMD_Vector g0 = vec_splat (a.l[1], 0);
  SIMD_Vector g1 = vec_splat (a.l[1], 1);
  SIMD_Vector g2 = vec_splat (a1.l[1], 1);
  SIMD_Vector g3 = vec_splat (a1.l[1], 2);
  return g0 + g1 + g2 + g3;
}

---- CUT ---

Note on the trunk it works correctly as we prop the &a->l[1] into the indirect
reference during forwprop but the C++ front-end is still produce the weird IR.


-- 
           Summary: The C++ front-end produces some NOP_EXPR for vector
                    types
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc*-*-*


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


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

* [Bug c++/36431] The C++ front-end produces some NOP_EXPR for vector types
  2008-06-04  0:19 [Bug c++/36431] New: The C++ front-end produces some NOP_EXPR for vector types pinskia at gcc dot gnu dot org
  2008-06-04  0:20 ` [Bug c++/36431] " pinskia at gcc dot gnu dot org
@ 2008-06-04  0:20 ` pinskia at gcc dot gnu dot org
  2008-09-25 23:09 ` pinskia at gcc dot gnu dot org
  2010-03-02 18:58 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-06-04  0:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-06-04 00:19 -------
Fix for this bug which I am testing right now:

Index: cp/cvt.c
======================================================
=============
--- cp/cvt.c    (revision 2504)
+++ cp/cvt.c    (working copy)
@@ -642,6 +642,9 @@ ocp_convert (tree type, tree expr, int c
         conversion.  */
       else if (TREE_CODE (type) == COMPLEX_TYPE)
        return fold_if_not_in_template (convert_to_complex (type, e));
+      /* For vector data types, we need to produce a VIEW_CONVERT_EXPR.  */
+      else if (TREE_CODE (type) == VECTOR_TYPE)
+       return fold_if_not_in_template (convert_to_vector (type, e));
       else if (TREE_CODE (e) == TARGET_EXPR)
        {
          /* Don't build a NOP_EXPR of class type.  Instead, change the


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-04 00:19:22
               date|                            |


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


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

* [Bug c++/36431] The C++ front-end produces some NOP_EXPR for vector types
  2008-06-04  0:19 [Bug c++/36431] New: The C++ front-end produces some NOP_EXPR for vector types pinskia at gcc dot gnu dot org
@ 2008-06-04  0:20 ` pinskia at gcc dot gnu dot org
  2008-06-04  0:20 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-06-04  0:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/36431] The C++ front-end produces some NOP_EXPR for vector types
  2008-06-04  0:19 [Bug c++/36431] New: The C++ front-end produces some NOP_EXPR for vector types pinskia at gcc dot gnu dot org
  2008-06-04  0:20 ` [Bug c++/36431] " pinskia at gcc dot gnu dot org
  2008-06-04  0:20 ` pinskia at gcc dot gnu dot org
@ 2008-09-25 23:09 ` pinskia at gcc dot gnu dot org
  2010-03-02 18:58 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-25 23:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-09-25 23:08 -------
Testing the fix right now with the addition assert.


-- 


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


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

* [Bug c++/36431] The C++ front-end produces some NOP_EXPR for vector types
  2008-06-04  0:19 [Bug c++/36431] New: The C++ front-end produces some NOP_EXPR for vector types pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-09-25 23:09 ` pinskia at gcc dot gnu dot org
@ 2010-03-02 18:58 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-02 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2010-03-02 18:58 -------
Even though the C++ front-end produces the NOP_EXPR still, the gimplifier
removes them early on and uses VCE instead.  So this is no longer a missed
optimization.  I am unassigning myself too.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW
           Keywords|missed-optimization         |


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


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

* [Bug c++/36431] The C++ front-end produces some NOP_EXPR for vector types
       [not found] <bug-36431-4@http.gcc.gnu.org/bugzilla/>
@ 2011-11-06 11:31 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-06 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org |
      Known to work|                            |4.6.2, 4.7.0
         Resolution|                            |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-06 11:30:49 UTC ---
In any case, we have been handling VECTOR_TYPE in ocp_convert for some time, I
guess we can close this now.


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

end of thread, other threads:[~2011-11-06 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-04  0:19 [Bug c++/36431] New: The C++ front-end produces some NOP_EXPR for vector types pinskia at gcc dot gnu dot org
2008-06-04  0:20 ` [Bug c++/36431] " pinskia at gcc dot gnu dot org
2008-06-04  0:20 ` pinskia at gcc dot gnu dot org
2008-09-25 23:09 ` pinskia at gcc dot gnu dot org
2010-03-02 18:58 ` pinskia at gcc dot gnu dot org
     [not found] <bug-36431-4@http.gcc.gnu.org/bugzilla/>
2011-11-06 11:31 ` paolo.carlini at oracle dot com

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