[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers

2009-12-30 Thread hjl dot tools at gmail dot com


--- Comment #11 from hjl dot tools at gmail dot com  2009-12-30 15:50 
---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01208.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2009-
   ||12/msg01208.html


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



[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers

2009-12-29 Thread hjl dot tools at gmail dot com


--- Comment #7 from hjl dot tools at gmail dot com  2009-12-29 21:40 ---
Here is a testcase in C:

[...@gnu-6 tmp]$ cat y.c
unsigned int foo[] __attribute__ ((aligned(16))) =
{
  0x8000, 1, 0xa000, 2,
  3, 0xd000, 0xf000, 0xe000
};
unsigned int bar[] __attribute__ ((aligned(16))) =
{
  4, 0xb000, 5, 0xc000,
  0xd000, 6, 7, 8
};

unsigned int val[] =
{
  0x8000, 0xb000, 0xa000, 0xc000,
  0xd000, 0xd000, 0xf000, 0xe000
};

extern void abort ();

void
 ()
{
  int i;

  for (i = 0; i  8; i++)
foo[i] = foo[i]  bar [i] ? bar [i] : foo[i];
}

int
main ()
{
  int i;

   ();
  for (i = 0; i  8; i++)
if (val[i] != foo[i])
  abort ();

  return 0;
}
[...@gnu-6 tmp]$ gcc /tmp/y.c -O2 -ftree-vectorize
[...@gnu-6 tmp]$ ./a.out 
Aborted (core dumped)
[...@gnu-6 tmp]$ 


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 GCC target triplet||x86
Summary|g++ -O -ftree-vectorize   |Vectorizer produces
   |produces incorrect results  |incorrect results on max of
   |for less-than operator  |signed intergers


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



[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers

2009-12-29 Thread hjl dot tools at gmail dot com


--- Comment #8 from hjl dot tools at gmail dot com  2009-12-29 23:50 ---
Created an attachment (id=19420)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19420action=view)
A patch

I don't see how we can easily check unsigned underflow in vector
integer subtraction. This patch simply disables it.


-- 


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



[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers

2009-12-29 Thread hjl dot tools at gmail dot com


--- Comment #9 from hjl dot tools at gmail dot com  2009-12-30 04:47 ---
Hi Richard, the code in question is added by

http://gcc.gnu.org/ml/gcc-patches/2005-06/msg02185.html

I don't quite understand how it can properly handle unsigned V4SI
underflow in V4SI vector subtraction.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||rth at gcc dot gnu dot org


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



[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers

2009-12-29 Thread hjl dot tools at gmail dot com


--- Comment #10 from hjl dot tools at gmail dot com  2009-12-30 04:49 
---
Created an attachment (id=19422)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19422action=view)
An updated patch

I am testing this patch now.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

  Attachment #19420|0   |1
is obsolete||


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