public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "already5chosen at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/105617] [12/13 Regression] Slp is maybe too aggressive in some/many cases
Date: Tue, 17 May 2022 09:17:20 +0000 [thread overview]
Message-ID: <bug-105617-4-rzuEkb47Ju@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105617-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105617
--- Comment #11 from Michael_S <already5chosen at yahoo dot com> ---
(In reply to Richard Biener from comment #10)
> (In reply to Hongtao.liu from comment #9)
> > (In reply to Hongtao.liu from comment #8)
> > > (In reply to Hongtao.liu from comment #7)
> > > > Hmm, we have specific code to add scalar->vector(vmovq) cost to vector
> > > > construct, but it seems not to work here, guess it's because &r0,and thought
> > > > it was load not scalar?
> > > Yes, true for as gimple_assign_load_p
> > >
> > >
> > > (gdb) p debug_gimple_stmt (def)
> > > 72# VUSE <.MEM_46>
> > > 73r0.0_20 = r0;
> > It's a load from stack, and finally eliminated in rtl dse1, but here the
> > vectorizer doesn't know.
>
> Yes, it's difficult for the SLP vectorizer to guess whether rN will come
> from memory or not. Some friendlier middle-end representation for
> add-with-carry might be nice - the x86 backend could for example fold
> __builtin_ia32_addcarryx_u64 to use a _Complex unsinged long long for the
> return, ferrying the carry in __imag. Alternatively we could devise
> some special GIMPLE_ASM kind ferrying RTL and not assembly so the
> backend could fold it directly to RTL on GIMPLE with asm constraints
> doing the plumbing ... (we'd need some match-scratch and RTL expansion
> would still need to allocate the actual pseudos).
>
> <bb 2> [local count: 1073741824]:
> _1 = *srcB_17(D);
> _2 = *srcA_18(D);
> _30 = __builtin_ia32_addcarryx_u64 (0, _2, _1, &r0);
> _3 = MEM[(const uint64_t *)srcB_17(D) + 8B];
> _4 = MEM[(const uint64_t *)srcA_18(D) + 8B];
> _5 = (int) _30;
> _29 = __builtin_ia32_addcarryx_u64 (_5, _4, _3, &r1);
> _6 = MEM[(const uint64_t *)srcB_17(D) + 16B];
> _7 = MEM[(const uint64_t *)srcA_18(D) + 16B];
> _8 = (int) _29;
> _28 = __builtin_ia32_addcarryx_u64 (_8, _7, _6, &r2);
> _9 = MEM[(const uint64_t *)srcB_17(D) + 24B];
> _10 = MEM[(const uint64_t *)srcA_18(D) + 24B];
> _11 = (int) _28;
> __builtin_ia32_addcarryx_u64 (_11, _10, _9, &r3);
> r0.0_12 = r0;
> r1.1_13 = r1;
> _36 = {r0.0_12, r1.1_13};
> r2.2_14 = r2;
> r3.3_15 = r3;
> _37 = {r2.2_14, r3.3_15};
> vectp.9_35 = dst_19(D);
> MEM <vector(2) long unsigned int> [(uint64_t *)vectp.9_35] = _36;
> vectp.9_39 = vectp.9_35 + 16;
> MEM <vector(2) long unsigned int> [(uint64_t *)vectp.9_39] = _37;
>
> so for the situation at hand I don't see any reasonable way out that
> doesn't have the chance of regressing things in other places (like
> treat loads from non-indexed auto variables specially or so). The
> only real solution is to find a GIMPLE representation for
> __builtin_ia32_addcarryx_u64 that doesn't force the alternate output
> to memory.
How about simple heuristic: "Never auto-vectorize integer code unless in inner
loop"?
It would be optimal >80% of time and even in cases where it's sub-optimal the
impact is likely single-digit per cents. On the other hand, the impact of
mistake in the opposit direction (i.e. over-vectorization) is often quite
large.
next prev parent reply other threads:[~2022-05-17 9:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 12:08 [Bug target/105617] New: Regression in code generation for _addcarry_u64() already5chosen at yahoo dot com
2022-05-16 12:13 ` [Bug target/105617] [12/13 regressi] Slp is maybe too aggressive in some/many cases pinskia at gcc dot gnu.org
2022-05-16 12:14 ` pinskia at gcc dot gnu.org
2022-05-16 12:15 ` rguenth at gcc dot gnu.org
2022-05-16 12:38 ` [Bug target/105617] [12/13 Regression] " already5chosen at yahoo dot com
2022-05-16 13:02 ` already5chosen at yahoo dot com
2022-05-16 14:08 ` already5chosen at yahoo dot com
2022-05-17 2:47 ` crazylht at gmail dot com
2022-05-17 3:29 ` crazylht at gmail dot com
2022-05-17 3:37 ` crazylht at gmail dot com
2022-05-17 6:48 ` rguenth at gcc dot gnu.org
2022-05-17 9:17 ` already5chosen at yahoo dot com [this message]
2022-05-17 9:25 ` already5chosen at yahoo dot com
2022-05-19 8:05 ` crazylht at gmail dot com
2022-07-26 11:22 ` rguenth at gcc dot gnu.org
2022-07-26 11:22 ` rguenth at gcc dot gnu.org
2022-07-29 13:21 ` already5chosen at yahoo dot com
2023-05-08 12:24 ` [Bug target/105617] [12/13/14 " rguenth at gcc dot gnu.org
2023-06-01 7:58 ` slash.tmp at free dot fr
2023-06-07 23:16 ` already5chosen at yahoo dot com
2023-06-13 14:54 ` slash.tmp at free dot fr
2023-06-16 14:56 ` already5chosen at yahoo dot com
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-105617-4-rzuEkb47Ju@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).