public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39068]  New: signed short plus and signed char plus not vectorized
@ 2009-02-01 20:35 dann at godzilla dot ics dot uci dot edu
  2009-02-01 20:50 ` [Bug tree-optimization/39068] " rguenth at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2009-02-01 20:35 UTC (permalink / raw)
  To: gcc-bugs

gcc -march=core2 -O3 -ftree-vectorizer-verbose=6 
for this code: 

#define SIZE 10000
signed short a[SIZE];
signed short b[SIZE];
signed short c[SIZE];

void add()
{
  int i;
  for (i = 0; i < SIZE; ++i)
    a[i] = b[i] + c[i];
}

cannot vectorize the loop:

add_sshort.c:9: note: vect_model_load_cost: aligned.
add_sshort.c:9: note: vect_model_load_cost: inside_cost = 1, outside_cost = 0 .
add_sshort.c:9: note: not vectorized: relevant stmt not supported: D.1580_6 =
(short unsigned int) D.1579_5
add_sshort.c:7: note: vectorized 0 loops in function.

The same happens if the type for a,b and c is "signed char".

But if the type is "unsigned short" or "unsigned char" the loop is vectorized.


-- 
           Summary: signed short plus and signed char plus not vectorized
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
  2009-02-01 20:50 ` [Bug tree-optimization/39068] " rguenth at gcc dot gnu dot org
@ 2009-02-01 20:50 ` rguenth at gcc dot gnu dot org
  2009-02-01 21:06 ` dorit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-01 20:50 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
@ 2009-02-01 20:50 ` rguenth at gcc dot gnu dot org
  2009-02-01 20:50 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-01 20:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-02-01 20:50 -------
*** Bug 39069 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
  2009-02-01 20:50 ` [Bug tree-optimization/39068] " rguenth at gcc dot gnu dot org
  2009-02-01 20:50 ` rguenth at gcc dot gnu dot org
@ 2009-02-01 21:06 ` dorit at gcc dot gnu dot org
  2009-02-02 16:42 ` dann at godzilla dot ics dot uci dot edu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dorit at gcc dot gnu dot org @ 2009-02-01 21:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dorit at gcc dot gnu dot org  2009-02-01 21:06 -------
(reminds me of a couple missed-optimization PRs where vectorization is also
failing due to casts - PR31873 , PR26128 - don't know if this is related)


-- 


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2009-02-01 21:06 ` dorit at gcc dot gnu dot org
@ 2009-02-02 16:42 ` dann at godzilla dot ics dot uci dot edu
  2009-02-06  1:45 ` pinskia at gcc dot gnu dot org
  2009-02-06  1:51 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2009-02-02 16:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dann at godzilla dot ics dot uci dot edu  2009-02-02 16:42 -------
(In reply to comment #2)
> (reminds me of a couple missed-optimization PRs where vectorization is also
> failing due to casts - PR31873 , PR26128 - don't know if this is related)

Are the casts actually needed in this case?  It seems the get introduced very
early on, the .original dump already has:

  a[i] = (short int) ((short unsigned int) b[i] + (short unsigned int) c[i]);


-- 


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2009-02-02 16:42 ` dann at godzilla dot ics dot uci dot edu
@ 2009-02-06  1:45 ` pinskia at gcc dot gnu dot org
  2009-02-06  1:51 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-06  1:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-02-06 01:45 -------
(In reply to comment #3)
> Are the casts actually needed in this case?  It seems the get introduced very
> early on, the .original dump already has:

Yes because char = char + char is really char = (char)((int)char + (int)char);

So this is dup of bug 26128.

*** This bug has been marked as a duplicate of 26128 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug tree-optimization/39068] signed short plus and signed char plus not vectorized
  2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2009-02-06  1:45 ` pinskia at gcc dot gnu dot org
@ 2009-02-06  1:51 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-06  1:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-02-06 01:51 -------
(In reply to comment #4)
> Yes because char = char + char is really char = (char)((int)char + (int)char);

Let me expand on that.  ((char)CHAR_MAX) + 1 is well defined and there is no
overflow that occurs.  Since GCC internally assumes signed integer overflow is
undefined, it has to convert it to be the well defined unsigned integer
version.


-- 


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


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

end of thread, other threads:[~2009-02-06  1:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-01 20:35 [Bug tree-optimization/39068] New: signed short plus and signed char plus not vectorized dann at godzilla dot ics dot uci dot edu
2009-02-01 20:50 ` [Bug tree-optimization/39068] " rguenth at gcc dot gnu dot org
2009-02-01 20:50 ` rguenth at gcc dot gnu dot org
2009-02-01 21:06 ` dorit at gcc dot gnu dot org
2009-02-02 16:42 ` dann at godzilla dot ics dot uci dot edu
2009-02-06  1:45 ` pinskia at gcc dot gnu dot org
2009-02-06  1:51 ` pinskia 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).