public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45752]  New: [4.5 regression] ICE in ix86_vectorize_builtin_vec_perm_ok
@ 2010-09-22 23:22 y at momonga-linux dot org
  2010-09-23  7:20 ` [Bug target/45752] " hjl dot tools at gmail dot com
  2010-09-23  9:30 ` rguenth at gcc dot gnu dot org
  0 siblings, 2 replies; 5+ messages in thread
From: y at momonga-linux dot org @ 2010-09-22 23:22 UTC (permalink / raw)
  To: gcc-bugs

g++ 4.5-20100916 ICEs with "-O3 -march=pentium4" when using the following code:


template<class T>
void transform(const T *in_points,
               int num_points,
               const float projection_mat[16],
               const float modelview_mat[16],
               float *out_points)
{
  float mat[16];
  int row, col;
  int i;
  const T *in_p;
  float *out_p;

  for (col = 0; col < 4; col++)
    {
      for (row = 0; row < 4; row++)
        {
          mat[col*4+row] = ( projection_mat[0*4+row]*modelview_mat[col*4+0]
                             + projection_mat[1*4+row]*modelview_mat[col*4+1]
                             + projection_mat[2*4+row]*modelview_mat[col*4+2]
                             + projection_mat[3*4+row]*modelview_mat[col*4+3]);
        }
    }

  for (i = 0, in_p = in_points, out_p = out_points; i < num_points;
       i++, in_p += 3, out_p += 3)
    {
      for (row = 0; row < 3; row++)
        {
          out_p[row] = ( mat[0*4+row]*in_p[0] + mat[1*4+row]*in_p[1]
                         + mat[2*4+row]*in_p[2] + mat[3*4+row]);
        }
    }

  if ( (mat[0*4+3] != 0) || (mat[1*4+3] != 0)
       || (mat[0*4+3] != 0) || (mat[1*4+3] != 1) )
    {
      for (i = 0, in_p = in_points, out_p = out_points; i < num_points;
           i++, in_p += 3, out_p += 3)
        {
          float w = ( mat[0*4+3]*in_p[0] + mat[1*4+3]*in_p[1]
                      + mat[2*4+3]*in_p[2] + mat[3*4+3]);
          if (w > 0.0)
            {
              out_p[0] /= w;
              out_p[1] /= w;
              out_p[2] /= w;
            }
          else
            {
              out_p[2] = -static_cast< float >(1.0e+38f);
            }
        }
    }
}
void TransformPoints(double *input,
                     int num_input,
                     const float projection_mat[16],
                     const float modelview_mat[16],
                     float *output)
{
  transform(input, num_input, projection_mat, modelview_mat, 
            output);
}

void TransformPoints(unsigned short *input,
                     int num_input,
                     const float projection_mat[16],
                     const float modelview_mat[16],
                     float *output)
{
  transform(input, num_input, projection_mat, modelview_mat, 
            output);
}


-- 
           Summary: [4.5 regression] ICE in
                    ix86_vectorize_builtin_vec_perm_ok
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: y at momonga-linux dot org


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


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <bug-45752-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2010-10-04 12:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-22 23:22 [Bug c++/45752] New: [4.5 regression] ICE in ix86_vectorize_builtin_vec_perm_ok y at momonga-linux dot org
2010-09-23  7:20 ` [Bug target/45752] " hjl dot tools at gmail dot com
2010-09-23  9:30 ` rguenth at gcc dot gnu dot org
     [not found] <bug-45752-4@http.gcc.gnu.org/bugzilla/>
2010-10-03 10:25 ` irar at il dot ibm.com
2010-10-04 12:40 ` irar at il dot ibm.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).