public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112361] New: [14 Regression] avx512f-reduce-op-1.c miscompiled since r14-5076 Date: Fri, 03 Nov 2023 07:20:16 +0000 [thread overview] Message-ID: <bug-112361-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112361 Bug ID: 112361 Summary: [14 Regression] avx512f-reduce-op-1.c miscompiled since r14-5076 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Since r14-5076-g01c18f58d37865d5f3bbe93e666183b54ec608c7 I see gcc.target/i386/avx512f-reduce-op-1.c execution failure. Reduced -O2 -mavx512f: __attribute__((noipa)) float foo (void) { float a[16] = { 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4 }; float r3 = 0.0f; for (int i = 0; i < 16; i++) if ((1 << i) & 0xA6BA) r3 = r3 + a[i]; return r3; } int main () { if (foo () != 37.0f) __builtin_abort (); } where before r14-5076 r3 has been correctly computed as 37.0f, but starting with r14-5076 it is 64.0f, i.e. the masking is ignored and all elements are added, not just the ones under the mask. The ifcvt dump has _1 = 42682 >> i_31; _2 = _1 & 1; _24 = _2 != 0; _3 = a[i_31]; _ifc__43 = .COND_ADD (_24, r3_29, _3, r3_29); which I assume is correct, and vect dump shows computation of the mask but then instead of using masked addition and at the end of loop reduction (well, can we vectorize it at all without -ffast-math?) it scalarizes the addition but doesn't actually conditionalize it. Note, with -O2 -mavx512f -ffast-math the .COND_ADD is actually vectorized and so correctly returns 37.0f.
next reply other threads:[~2023-11-03 7:20 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-03 7:20 jakub at gcc dot gnu.org [this message] 2023-11-03 7:20 ` [Bug tree-optimization/112361] " jakub at gcc dot gnu.org 2023-11-03 7:22 ` pinskia at gcc dot gnu.org 2023-11-03 7:51 ` rdapp at gcc dot gnu.org 2023-11-03 8:13 ` rguenth at gcc dot gnu.org 2023-11-03 8:14 ` jakub at gcc dot gnu.org 2023-11-04 5:24 ` pinskia at gcc dot gnu.org 2023-11-06 9:51 ` rdapp at gcc dot gnu.org 2023-11-06 10:06 ` rguenther at suse dot de 2023-11-07 21:38 ` cvs-commit at gcc dot gnu.org 2023-11-08 7:01 ` 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-112361-4@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).