public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/87555] There is no need for UNSPEC_FMADDSUB
Date: Fri, 18 Jun 2021 06:00:14 +0000	[thread overview]
Message-ID: <bug-87555-4-aeYxnftj43@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-87555-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
With open-code

successfully optimize

__m128d f1(__m128d x, __m128d y, __m128d z){
    __m128d tem = _mm_mul_pd (x,y);
    __m128d tem2 = tem + z;
    __m128d tem3 = tem - z;
    return __builtin_shuffle (tem2, tem3, (__m128i) {0, 3});
}

to

f1:
.LFB5481:
        .cfi_startproc
        vfmsubadd132pd  %xmm1, %xmm2, %xmm0
        ret
        .cfi_endproc


But failed to optimize

__m256d f2(__m256d x, __m256d y, __m256d z){
    __m256d tem = _mm256_mul_pd (x,y);
    __m256d tem2 = tem + z;
    __m256d tem3 = tem - z;
    return __builtin_shuffle (tem2, tem3, (__m256i) {0, 5, 2, 7});
}

since simplify_rtx didn't realize

Failed to match this instruction:
(set (reg:V4SF 88)
    (vec_merge:V4SF (fma:V4SF (reg/v:V4SF 85 [ x ])
            (reg/v:V4SF 86 [ y ])
            (neg:V4SF (reg/v:V4SF 87 [ z ])))
        (fma:V4SF (reg/v:V4SF 85 [ x ])
            (reg/v:V4SF 86 [ y ])
            (reg/v:V4SF 87 [ z ]))
        (const_int 10 [0xa])))

is equal to

(set (reg:V4SF 88)
    (vec_merge:V4SF 
        (fma:V4SF (reg/v:V4SF 85 [ x ])
            (reg/v:V4SF 86 [ y ])
            (reg/v:V4SF 87 [ z ]))
        (fma:V4SF (reg/v:V4SF 85 [ x ])
            (reg/v:V4SF 86 [ y ])
            (neg:V4SF (reg/v:V4SF 87 [ z ])))
        (const_int 5 [0x5])))

later is how our pattern is defined.

So it there any canonical rtx for vec_merge? 
(vec_merge (A B const_int 10) should abviously equal to (vec_merge B A
const_int 5)

  parent reply	other threads:[~2021-06-18  6:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-87555-4@http.gcc.gnu.org/bugzilla/>
2021-06-17 12:07 ` rguenth at gcc dot gnu.org
2021-06-18  1:22 ` crazylht at gmail dot com
2021-06-18  1:57 ` crazylht at gmail dot com
2021-06-18  5:40 ` crazylht at gmail dot com
2021-06-18  6:00 ` crazylht at gmail dot com [this message]
2021-06-18  6:02 ` crazylht at gmail dot com
2021-06-18  6:11 ` crazylht at gmail dot com
2021-06-18  6:34 ` crazylht at gmail dot com
2021-06-18  7:00 ` rguenth at gcc dot gnu.org
2021-06-18  7:09 ` crazylht at gmail dot com
2021-06-18  7:09 ` rguenth at gcc dot gnu.org
2021-06-18  7:11 ` rguenth at gcc dot gnu.org
2021-06-18  7:16 ` crazylht at gmail dot com
2021-06-18  7:32 ` rguenth at gcc dot gnu.org
2021-06-18  7:48 ` crazylht at gmail dot com
2021-06-18 10:29 ` rguenth at gcc dot gnu.org
2021-09-12 23:44 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-87555-4-aeYxnftj43@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).