public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int).
@ 2013-10-16 23:05 congh at google dot com
  2013-10-17 12:02 ` [Bug target/58762] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: congh at google dot com @ 2013-10-16 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58762
           Summary: [missed optimization] Vectorizing abs(int).
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: congh at google dot com

pabsd in SSSE3 makes it quite straightforward to vectorize abs(int) operation.
But with only SSE2 available, GCC won't vectorize this operation. GCC
translates the abs(int) operation into three instructions: sar, xor, and sub.
Each of them can be vectorized. So I am wondering why GCC does not vectorize
abs(int) in this way? Are there any platform or safety concerns?


Thank you!

Cong


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

* [Bug target/58762] [missed optimization] Vectorizing abs(int).
  2013-10-16 23:05 [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int) congh at google dot com
@ 2013-10-17 12:02 ` rguenth at gcc dot gnu.org
  2013-10-30 20:01 ` congh at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-17 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-17
          Component|tree-optimization           |target
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The backend simply doesn't implement an expander for abs I think.  The
vectorizer
simply checks if an optab is available for the mode in question.  See
ix86_expand_fp_absneg_operator.


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

* [Bug target/58762] [missed optimization] Vectorizing abs(int).
  2013-10-16 23:05 [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int) congh at google dot com
  2013-10-17 12:02 ` [Bug target/58762] " rguenth at gcc dot gnu.org
@ 2013-10-30 20:01 ` congh at gcc dot gnu.org
  2013-10-31  0:50 ` congh at gcc dot gnu.org
  2014-03-06  2:24 ` congh at google dot com
  3 siblings, 0 replies; 5+ messages in thread
From: congh at gcc dot gnu.org @ 2013-10-30 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from congh at gcc dot gnu.org ---
Author: congh
Date: Wed Oct 30 20:01:47 2013
New Revision: 204229

URL: http://gcc.gnu.org/viewcvs?rev=204229&root=gcc&view=rev
Log:
2013-10-30  Cong Hou  <congh@google.com>

    PR target/58762
    * config/i386/i386-protos.h (ix86_expand_sse2_abs): New function.
    * config/i386/i386.c (ix86_expand_sse2_abs): New function.
    * config/i386/sse.md: Add SSE2 support to abs (8/16/32-bit-int).

2013-10-30  Cong Hou  <congh@google.com>

    * gcc.target/i386/vect-abs-s8.c: New test.
    * gcc.target/i386/vect-abs-s16.c: New test.
    * gcc.target/i386/vect-abs-s32.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/vect-abs-s16.c
    trunk/gcc/testsuite/gcc.target/i386/vect-abs-s32.c
    trunk/gcc/testsuite/gcc.target/i386/vect-abs-s8.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386-protos.h
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/sse.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/58762] [missed optimization] Vectorizing abs(int).
  2013-10-16 23:05 [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int) congh at google dot com
  2013-10-17 12:02 ` [Bug target/58762] " rguenth at gcc dot gnu.org
  2013-10-30 20:01 ` congh at gcc dot gnu.org
@ 2013-10-31  0:50 ` congh at gcc dot gnu.org
  2014-03-06  2:24 ` congh at google dot com
  3 siblings, 0 replies; 5+ messages in thread
From: congh at gcc dot gnu.org @ 2013-10-31  0:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from congh at gcc dot gnu.org ---
Author: congh
Date: Thu Oct 31 00:50:47 2013
New Revision: 204241

URL: http://gcc.gnu.org/viewcvs?rev=204241&root=gcc&view=rev
Log:
2013-10-30  Cong Hou  <congh@google.com>

    Backport from mainline:
    2013-10-30  Cong Hou  <congh@google.com>

    PR target/58762
    * config/i386/i386-protos.h (ix86_expand_sse2_abs): New function.
    * config/i386/i386.c (ix86_expand_sse2_abs): New function.
    * config/i386/sse.md: Add SSE2 support to abs (8/16/32-bit-int).


Modified:
    branches/google/gcc-4_8/gcc/ChangeLog
    branches/google/gcc-4_8/gcc/config/i386/i386-protos.h
    branches/google/gcc-4_8/gcc/config/i386/i386.c
    branches/google/gcc-4_8/gcc/config/i386/sse.md


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

* [Bug target/58762] [missed optimization] Vectorizing abs(int).
  2013-10-16 23:05 [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int) congh at google dot com
                   ` (2 preceding siblings ...)
  2013-10-31  0:50 ` congh at gcc dot gnu.org
@ 2014-03-06  2:24 ` congh at google dot com
  3 siblings, 0 replies; 5+ messages in thread
From: congh at google dot com @ 2014-03-06  2:24 UTC (permalink / raw)
  To: gcc-bugs

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

Cong Hou <congh at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Cong Hou <congh at google dot com> ---
(In reply to Cong Hou from comment #3)
> Author: congh
> Date: Thu Oct 31 00:50:47 2013
> New Revision: 204241
> 
> URL: http://gcc.gnu.org/viewcvs?rev=204241&root=gcc&view=rev
> Log:
> 2013-10-30  Cong Hou  <congh@google.com>
> 
>     Backport from mainline:
>     2013-10-30  Cong Hou  <congh@google.com>
> 
>     PR target/58762
>     * config/i386/i386-protos.h (ix86_expand_sse2_abs): New function.
>     * config/i386/i386.c (ix86_expand_sse2_abs): New function.
>     * config/i386/sse.md: Add SSE2 support to abs (8/16/32-bit-int).
> 
> 
> Modified:
>     branches/google/gcc-4_8/gcc/ChangeLog
>     branches/google/gcc-4_8/gcc/config/i386/i386-protos.h
>     branches/google/gcc-4_8/gcc/config/i386/i386.c
>     branches/google/gcc-4_8/gcc/config/i386/sse.md


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

end of thread, other threads:[~2014-03-06  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 23:05 [Bug tree-optimization/58762] New: [missed optimization] Vectorizing abs(int) congh at google dot com
2013-10-17 12:02 ` [Bug target/58762] " rguenth at gcc dot gnu.org
2013-10-30 20:01 ` congh at gcc dot gnu.org
2013-10-31  0:50 ` congh at gcc dot gnu.org
2014-03-06  2:24 ` congh at google 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).