public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/56766] New: Fails to combine (vec_select (vec_concat ...)) to (vec_merge ...)
@ 2013-03-28 14:52 rguenth at gcc dot gnu.org
  2013-04-02  8:08 ` [Bug rtl-optimization/56766] " rguenth at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-28 14:52 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56766
           Summary: Fails to combine (vec_select (vec_concat ...)) to
                    (vec_merge ...)
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org
                CC: rth@gcc.gnu.org
            Target: x86_64-*-*


With a patch to vectorize the pattern that should lead to the use of

(define_insn "sse3_addsubv2df3"
  [(set (match_operand:V2DF 0 "register_operand" "=x,x")
        (vec_merge:V2DF
          (plus:V2DF
            (match_operand:V2DF 1 "register_operand" "0,x")
            (match_operand:V2DF 2 "nonimmediate_operand" "xm,xm"))
          (minus:V2DF (match_dup 1) (match_dup 2))
          (const_int 2)))]
  "TARGET_SSE3"

this instruction fails to be generated because the GIMPLE

  vect_var_.9_15 = vect_var_.5_22 + vect_var_.8_18;
  vect_var_.10_14 = vect_var_.5_22 - vect_var_.8_18;
  _2 = VEC_PERM_EXPR <vect_var_.9_15, vect_var_.10_14, { 0, 3 }>;

is expanded to

(insn 24 23 25 (set (reg:V2DF 80 [ vect_var_.9 ])
        (plus:V2DF (reg:V2DF 76 [ vect_var_.5 ])
            (reg:V2DF 75 [ vect_var_.8 ]))) t.c:7 -1
     (nil))

(insn 25 24 27 (set (reg:V2DF 81 [ vect_var_.10 ])
        (minus:V2DF (reg:V2DF 76 [ vect_var_.5 ])
            (reg:V2DF 75 [ vect_var_.8 ]))) t.c:7 -1
     (nil))

(insn 27 25 28 (set (reg:V2DF 82 [ D.1768 ])
        (vec_select:V2DF (vec_concat:V4DF (reg:V2DF 80 [ vect_var_.9 ])
                (reg:V2DF 81 [ vect_var_.10 ]))
            (parallel [
                    (const_int 0 [0])
                    (const_int 3 [0x3])
                ]))) t.c:7 -1
     (nil))

which does not match the pattern in the i386 backend.

The question is what should be the canonical form?  Definitely vec_merge
is redundant and can always be replaced with (vec_select (vec_concat ...)).

Testcase w/o my vectorizer hack (compile with -O -msse3):

typedef double v2df __attribute__((vector_size(16)));
typedef long long v2di __attribute__((vector_size(16)));
v2df foo (v2df x, v2df y)
{
  v2df tem1 = x + y;
  v2df tem2 = x - y;
  return __builtin_shuffle (tem1, tem2, (v2di) { 0, 3 });
}

VEC_MERGE is not used very often ...


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

end of thread, other threads:[~2015-06-16 17:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 14:52 [Bug rtl-optimization/56766] New: Fails to combine (vec_select (vec_concat ...)) to (vec_merge ...) rguenth at gcc dot gnu.org
2013-04-02  8:08 ` [Bug rtl-optimization/56766] " rguenth at gcc dot gnu.org
2013-05-09 12:41 ` glisse at gcc dot gnu.org
2015-05-12 14:20 ` rguenth at gcc dot gnu.org
2015-06-10 11:21 ` rguenth at gcc dot gnu.org
2015-06-11  9:26 ` ubizjak at gmail dot com
2015-06-11  9:39 ` ubizjak at gmail dot com
2015-06-11 10:28 ` rguenth at gcc dot gnu.org
2015-06-11 10:30 ` rguenth at gcc dot gnu.org
2015-06-11 10:33 ` rguenth at gcc dot gnu.org
2015-06-11 11:12 ` ubizjak at gmail dot com
2015-06-11 12:03 ` ubizjak at gmail dot com
2015-06-11 12:32 ` rguenther at suse dot de
2015-06-11 13:03 ` ubizjak at gmail dot com
2015-06-11 13:47 ` rguenther at suse dot de
2015-06-11 15:08 ` segher at gcc dot gnu.org
2015-06-12  6:24 ` ubizjak at gmail dot com
2015-06-16 10:43 ` rguenther at suse dot de
2015-06-16 15:33 ` ubizjak at gmail dot com
2015-06-16 17:41 ` ubizjak at gmail 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).