public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111770] New: predicated loads inactive lane values not modelled Date: Wed, 11 Oct 2023 12:38:18 +0000 [thread overview] Message-ID: <bug-111770-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111770 Bug ID: 111770 Summary: predicated loads inactive lane values not modelled Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tnfchris at gcc dot gnu.org Target Milestone: --- For this example: int foo(int n, char *a, char *b) { int sum = 0; for (int i = 0; i < n; ++i) { sum += a[i] * b[i]; } return sum; } we generate with -O3 -march=armv8-a+sve .L3: ld1b z29.b, p7/z, [x1, x3] ld1b z31.b, p7/z, [x2, x3] add x3, x3, x4 sel z31.b, p7, z31.b, z28.b whilelo p7.b, w3, w0 udot z30.s, z29.b, z31.b b.any .L3 uaddv d30, p6, z30.s fmov w0, s30 ret Which is pretty good, but we completely ruin it with the SEL. In gimple this is: vect__7.12_81 = .MASK_LOAD (_21, 8B, loop_mask_77); masked_op1_82 = .VCOND_MASK (loop_mask_77, vect__7.12_81, { 0, ... }); vect_patt_33.13_83 = DOT_PROD_EXPR <vect__3.9_78, masked_op1_82, vect_sum_19.6_74>; The missed optimization here is that we don't model what happens with predicated operations that zero inactive lanes. i.e. in this case .MASK_LOAD will zero the unactive lanes, so the .VCOND_MASK is completely superfluous. I'm not entirely sure how we should go about fixing this generally.
next reply other threads:[~2023-10-11 12:38 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-11 12:38 tnfchris at gcc dot gnu.org [this message] 2023-10-11 12:58 ` [Bug tree-optimization/111770] " rguenth at gcc dot gnu.org 2024-02-21 17:14 ` acoplan at gcc dot gnu.org 2024-02-22 8:10 ` rguenth at gcc dot gnu.org 2024-02-22 11:10 ` acoplan at gcc dot gnu.org 2024-02-22 13:16 ` rguenth at gcc dot gnu.org 2024-02-22 17:11 ` jsm28 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-111770-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).