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; 3+ 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] 3+ messages in thread

* [Bug target/45752] [4.5 regression] ICE in ix86_vectorize_builtin_vec_perm_ok
  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 ` hjl dot tools at gmail dot com
  2010-09-23  9:30 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-23  7:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hjl dot tools at gmail dot com  2010-09-23 07:20 -------
It is caused by revision 155584:

http://gcc.gnu.org/ml/gcc-cvs/2010-01/msg00043.html

and fixed by revision 161655:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00006.html

on trunk.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.5.2


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


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

* [Bug target/45752] [4.5 regression] ICE in ix86_vectorize_builtin_vec_perm_ok
  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
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-23  9:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-09-23 09:30 -------
Confirmed.

#2  0x0000000000ec5b41 in ix86_vectorize_builtin_vec_perm_ok (
    vec_type=0x7ffff5a04dc8, mask=0x7ffff5a7d2a0)
    at /space/rguenther/src/svn/gcc-4_5-branch/gcc/config/i386/i386.c:30144
30144     gcc_assert (vec_mask > 0 && vec_mask <= 3);
(gdb) p vec_mask
$1 = 0

1912                      if (!targetm.vectorize.builtin_vec_perm_ok (vectype,
1913                                                                 
mask_vec))
(gdb) call debug_generic_expr (mask_vec)
{ 0xfffffffffffffffffffffffffffffff8, 0xfffffffffffffffffffffffffffffff8,
0xfffffffffffffffffffffffffffffff8, 0xfffffffffffffffffffffffffffffffb,
0xfffffffffffffffffffffffffffffffb, 0xfffffffffffffffffffffffffffffffb,
0xfffffffffffffffffffffffffffffffe, 0xfffffffffffffffffffffffffffffffe }
(gdb) call debug_generic_expr (vectype)
const vector short unsigned int

I don't know why the mask elements are negative, but that's certainly
the problem with extract_vec_perm_cst which requires positive elements.

The problem is surely latent on trunk (no changes in that area).

Ira?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.0 4.5.1
      Known to work|                            |4.4.4 4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-23 09:30:22
               date|                            |


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


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

end of thread, other threads:[~2010-09-23  9:30 UTC | newest]

Thread overview: 3+ 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

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