public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115629] Inefficient if-convert of masked conditionals Date: Tue, 02 Jul 2024 19:33:28 +0000 [thread overview] Message-ID: <bug-115629-4-Z4lbDXUs1O@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-115629-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115629 Richard Sandiford <rsandifo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #8 from Richard Sandiford <rsandifo at gcc dot gnu.org> --- Perhaps I'm missing the point, but I think one of the issues here is that we (still) don't model that MASK_LOAD sets inactive elements to zero. Inactive elements are currently undefined instead. (I think Robin mentioned that assuming zero is problematic for RVV, so we might need an explicit MASK_LOAD argument for inactive elements, like for COND_ADD etc.) So quoting the IL in comment 4: # loop_mask_63 = PHI <next_mask_95(10), max_mask_94(20)> vect__4.10_64 = .MASK_LOAD (vectp_a.8_53, 32B, loop_mask_63); mask__31.11_66 = vect__4.10_64 != { 0, ... }; mask__56.12_67 = ~mask__31.11_66; vec_mask_and_70 = mask__56.12_67 & loop_mask_63; vect__7.15_71 = .MASK_LOAD (vectp_c.13_68, 32B, vec_mask_and_70); mask__22.16_73 = vect__7.15_71 == { 0, ... }; mask__34.17_75 = vec_mask_and_70 & mask__22.16_73; I think this and... vect_iftmp.20_78 = .MASK_LOAD (vectp_d.18_76, 32B, mask__34.17_75); vect__61.21_79 = vect__4.10_64 | vect__7.15_71; mask__35.22_81 = vect__61.21_79 != { 0, ... }; vec_mask_and_84 = mask__35.22_81 & loop_mask_63; ...this have to be kept until we model inactive elements. vect_iftmp.25_85 = .MASK_LOAD (vectp_b.23_82, 32B, vec_mask_and_84); _86 = mask__34.17_75 & loop_mask_63; This one is really curious though :) Why does the code think that the loop mask is needed here? Does the code think the mask is needed for correctness, or is the scalar_cond_masked_set optimisation misfiring? vect_iftmp.26_87 = VEC_COND_EXPR <_86, vect_iftmp.20_78, vect_iftmp.25_85>; .MASK_STORE (vectp_res.27_88, 32B, loop_mask_63, vect_iftmp.26_87);
next prev parent reply other threads:[~2024-07-02 19:33 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-25 5:44 [Bug tree-optimization/115629] New: " tnfchris at gcc dot gnu.org 2024-06-25 5:47 ` [Bug tree-optimization/115629] " pinskia at gcc dot gnu.org 2024-06-25 9:41 ` rguenth at gcc dot gnu.org 2024-06-26 16:53 ` cvs-commit at gcc dot gnu.org 2024-06-26 16:55 ` rguenth at gcc dot gnu.org 2024-07-01 10:10 ` tnfchris at gcc dot gnu.org 2024-07-01 12:27 ` rguenther at suse dot de 2024-07-01 19:33 ` tnfchris at gcc dot gnu.org 2024-07-02 7:03 ` rguenth at gcc dot gnu.org 2024-07-02 19:33 ` rsandifo at gcc dot gnu.org [this message] 2024-07-03 7:27 ` 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-115629-4-Z4lbDXUs1O@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).