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 rtl-optimization/53533] [10/11/12/13 regression] vectorization causes loop unrolling test slowdown as measured by Adobe's C++Benchmark Date: Mon, 30 May 2022 06:40:57 +0000 [thread overview] Message-ID: <bug-53533-4-KzygkUOOwB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53533-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53533 --- Comment #45 from Hongtao.liu <crazylht at gmail dot com> --- A reduced testcase. int a[256]; int b[256]; void foo (void) { int i; for (i = 0; i < 256; ++i) { int tmp = a[i] + 12345; tmp *= 914237; tmp += 12332; tmp *= 914237; tmp += 12332; tmp *= 914237; tmp -= 13; tmp *= 8000; b[i] = tmp; } } GCC now simply pmulld to pslld + padd + psub, the vectorizer cost model looks fine, but for scalar version, it's extraly optimized in pass_combine from 4 * mult + 3 * add to 1 * mult + 2 * add which is not taken in count by vectorizer. The vectorized version is not simplified later. mov eax, DWORD PTR a[rdx] add rdx, 4 add eax, 12345 imul eax, eax, -1564285888 sub eax, 333519936 mov DWORD PTR b[rdx-4], eax cmp rdx, 1024 jne .L2 I'm wondering could Gimple also simplify tmp *= 914237; tmp += 12332; tmp *= 914237; tmp += 12332; tmp *= 914237; tmp -= 13; tmp *= 8000; to tmp *= -1564285888; tmp -= 333519936; refer to https://godbolt.org/z/qYMYMTxEY Then the vectorized code would be more optimal.
next prev parent reply other threads:[~2022-05-30 6:40 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-31 0:55 [Bug middle-end/53533] New: [4.7 regression] loop unrolling as measured by Adobe's C++Benchmark is twice as slow versus 4.4-4.6 matt at use dot net 2012-05-31 0:58 ` [Bug middle-end/53533] " matt at use dot net 2012-05-31 9:59 ` rguenth at gcc dot gnu.org 2012-06-11 19:56 ` matt at use dot net 2012-06-11 19:57 ` matt at use dot net 2012-06-11 20:02 ` matt at use dot net 2012-06-12 9:54 ` [Bug rtl-optimization/53533] [4.7/4.8 regression] vectorization causes loop unrolling test slowdown as measured by Adobe's C++Benchmark rguenth at gcc dot gnu.org 2012-06-12 10:12 ` rguenth at gcc dot gnu.org 2012-06-12 10:27 ` rguenth at gcc dot gnu.org 2012-06-12 10:39 ` rguenth at gcc dot gnu.org 2012-06-12 11:57 ` rguenth at gcc dot gnu.org 2012-06-12 18:26 ` matt at use dot net 2012-06-12 18:55 ` rth at gcc dot gnu.org 2012-06-13 9:44 ` rguenth at gcc dot gnu.org 2012-06-14 14:39 ` rth at gcc dot gnu.org 2012-06-14 18:02 ` matt at use dot net 2012-06-14 18:39 ` rth at gcc dot gnu.org 2012-06-15 9:04 ` jakub at gcc dot gnu.org 2012-06-15 21:05 ` rth at gcc dot gnu.org 2012-08-10 9:43 ` rguenth at gcc dot gnu.org 2012-08-14 17:26 ` matt at use dot net 2012-08-20 23:53 ` matt at use dot net 2012-09-20 10:27 ` jakub at gcc dot gnu.org 2012-11-29 21:17 ` rth at gcc dot gnu.org 2012-12-03 15:27 ` rguenth at gcc dot gnu.org 2013-04-11 8:00 ` [Bug rtl-optimization/53533] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org 2014-06-12 13:45 ` [Bug rtl-optimization/53533] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org 2014-12-19 13:28 ` [Bug rtl-optimization/53533] [4.8/4.9/5 " jakub at gcc dot gnu.org 2015-05-03 13:00 ` [Bug rtl-optimization/53533] [4.8/4.9/5/6 " trippels at gcc dot gnu.org 2015-05-03 13:01 ` trippels at gcc dot gnu.org 2015-05-04 14:46 ` maltsevm at gmail dot com 2015-05-04 15:00 ` maltsevm at gmail dot com 2015-06-23 8:22 ` rguenth at gcc dot gnu.org 2015-06-26 19:58 ` [Bug rtl-optimization/53533] [4.9/5/6 " jakub at gcc dot gnu.org 2015-06-26 20:29 ` jakub at gcc dot gnu.org 2021-02-23 12:24 ` [Bug rtl-optimization/53533] [8/9/10/11 " rguenth at gcc dot gnu.org 2021-05-14 9:46 ` [Bug rtl-optimization/53533] [9/10/11/12 " jakub at gcc dot gnu.org 2021-06-01 8:05 ` rguenth at gcc dot gnu.org 2022-05-27 9:34 ` [Bug rtl-optimization/53533] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-05-30 6:40 ` crazylht at gmail dot com [this message] 2022-05-30 8:57 ` rguenther at suse dot de 2022-05-30 9:10 ` crazylht at gmail dot com 2022-05-30 9:14 ` rguenther at suse dot de 2022-06-16 1:29 ` cvs-commit at gcc dot gnu.org 2022-06-16 2:31 ` crazylht at gmail dot com 2022-06-28 10:30 ` jakub at gcc dot gnu.org 2023-07-07 10:29 ` [Bug rtl-optimization/53533] [11/12/13/14 " rguenth 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-53533-4-KzygkUOOwB@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: linkBe 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).