public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56873] New: vector shift lowered to scalars
@ 2013-04-08 11:39 glisse at gcc dot gnu.org
  2013-09-14  9:50 ` [Bug middle-end/56873] " glisse at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-04-08 11:39 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56873
           Summary: vector shift lowered to scalars
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org
            Target: x86_64-linux-gnu


#define SIZE 32
typedef long long veci __attribute__((vector_size(SIZE)));

veci f(veci a, veci b){
  return a>>b;
}

Compiling this with -O3 -mxop, the vector lowering pass gives scalar
operations. However, if SIZE is either 16 or 64, I get vector shifts of size
16.


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

* [Bug middle-end/56873] vector shift lowered to scalars
  2013-04-08 11:39 [Bug tree-optimization/56873] New: vector shift lowered to scalars glisse at gcc dot gnu.org
@ 2013-09-14  9:50 ` glisse at gcc dot gnu.org
  2021-07-24  5:31 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-14  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
In the vector lowering pass, we only try to find a smaller vector that supports
the operation if the larger vector is not a supported mode (never mind whether
it supports the operation or not). The fact that the x86 backend says V4DI is
supported seems strange to me, but let's continue. There is no reason why a
target couldn't support some operations on V4DI and more on V2DI, so lowering
still makes sense even from a supported mode. I quickly tried a hack in
tree-vect-generic.c:

  /* For very wide vectors, try using a smaller vector mode.  */
  compute_type = type;
  if (op && (!VECTOR_MODE_P (TYPE_MODE (type))
             || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing))

But we then ICE in expr.c:

                /* Vector CONSTRUCTORs should only be built from smaller
                   vectors in the case of BLKmode vectors.  */
                gcc_assert (TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE);

And removing the assertion later fails with an unrecognizable insn:

(insn 18 17 19 2 (set (reg:V2DI 105)
        (vec_merge:V2DI (vec_duplicate:V2DI (reg:V2DI 102 [ D.2163 ]))
            (reg:V2DI 105)
            (const_int 1 [0x1]))) a.c:5 -1
     (nil))
a.c:6:1: internal compiler error: in extract_insn, at recog.c:2161

(looks like it got confused and lost the V4DI mode)

So this is not a simple tree-vect-generic issue :-(

I don't think we have any front-end or optimization producing a constructor
v4di{v2di,v2di}, but that's more luck than anything else...


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

* [Bug middle-end/56873] vector shift lowered to scalars
  2013-04-08 11:39 [Bug tree-optimization/56873] New: vector shift lowered to scalars glisse at gcc dot gnu.org
  2013-09-14  9:50 ` [Bug middle-end/56873] " glisse at gcc dot gnu.org
@ 2021-07-24  5:31 ` pinskia at gcc dot gnu.org
  2021-07-24  8:19 ` glisse at gcc dot gnu.org
  2021-08-25  3:02 ` [Bug middle-end/56873] vector shift lowered to scalars for -mxop pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-24  5:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56873

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This looks to be fixed in GCC 5.1.

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

* [Bug middle-end/56873] vector shift lowered to scalars
  2013-04-08 11:39 [Bug tree-optimization/56873] New: vector shift lowered to scalars glisse at gcc dot gnu.org
  2013-09-14  9:50 ` [Bug middle-end/56873] " glisse at gcc dot gnu.org
  2021-07-24  5:31 ` pinskia at gcc dot gnu.org
@ 2021-07-24  8:19 ` glisse at gcc dot gnu.org
  2021-08-25  3:02 ` [Bug middle-end/56873] vector shift lowered to scalars for -mxop pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2021-07-24  8:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56873

Marc Glisse <glisse at gcc dot gnu.org> changed:

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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
Indeed, I now get sensible code with -mxop. Not so with -mavx2, but that seems
independent and I filed it as PR 101611.

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

* [Bug middle-end/56873] vector shift lowered to scalars for -mxop
  2013-04-08 11:39 [Bug tree-optimization/56873] New: vector shift lowered to scalars glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-07-24  8:19 ` glisse at gcc dot gnu.org
@ 2021-08-25  3:02 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-25  3:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56873

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0
            Summary|vector shift lowered to     |vector shift lowered to
                   |scalars                     |scalars for -mxop

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

end of thread, other threads:[~2021-08-25  3:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08 11:39 [Bug tree-optimization/56873] New: vector shift lowered to scalars glisse at gcc dot gnu.org
2013-09-14  9:50 ` [Bug middle-end/56873] " glisse at gcc dot gnu.org
2021-07-24  5:31 ` pinskia at gcc dot gnu.org
2021-07-24  8:19 ` glisse at gcc dot gnu.org
2021-08-25  3:02 ` [Bug middle-end/56873] vector shift lowered to scalars for -mxop pinskia at gcc dot gnu.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).