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/109154] [13/14 regression] jump threading de-optimizes nested floating point comparisons Date: Fri, 07 Jul 2023 18:10:43 +0000 [thread overview] Message-ID: <bug-109154-4-VAyv4o9Gm3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109154-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109154 --- Comment #59 from Tamar Christina <tnfchris at gcc dot gnu.org> --- I've sent two patches upstream this morning to fix the remaining ifcvt issues: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623848.html https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623849.html This brings us within 5% of GCC-12, but not all the way there, the reason is that since GCC-13 PRE behaves differently. In GCC-12 after PRE we'd have the following CFG: <bb 15> [local count: 623751662]: _16 = distbb_79 * iftmp.1_100; iftmp.8_80 = 1.0e+0 - _16; _160 = chrg_init_75 * iftmp.8_80; <bb 16> [local count: 1057206200]: # iftmp.8_39 = PHI <iftmp.8_80(15), 1.0e+0(14)> # prephitmp_161 = PHI <_160(15), chrg_init_75(14)> if (distbb_79 < iftmp.0_96) goto <bb 17>; [50.00%] else goto <bb 18>; [50.00%] <bb 17> [local count: 528603100]: _164 = ABS_EXPR <prephitmp_161>; _166 = -_164; <bb 18> [local count: 1057206200]: # iftmp.9_40 = PHI <1.0e+0(17), 0.0(16)> # prephitmp_163 = PHI <prephitmp_161(17), 0.0(16)> # prephitmp_167 = PHI <_166(17), 0.0(16)> if (iftmp.2_38 != 0) goto <bb 20>; [50.00%] else goto <bb 19>; [50.00%] <bb 19> [local count: 528603100]: <bb 20> [local count: 1057206200]: # iftmp.10_41 = PHI <prephitmp_167(18), prephitmp_163(19)> That is to say, in both branches we always do the multiply, gimple-isel then correctly turns this into a COND_MUL based on the mask. Since GCC-13 PRE now does some extra optimizations: <bb 15> [local count: 1057206200]: # l_107 = PHI <l_84(21), 0(14)> _13 = lpos_x[l_107]; x_72 = _13 - p_atom$x_81; powmult_73 = x_72 * x_72; distbb_74 = powmult_73 - radij_58; if (distbb_74 >= 0.0) goto <bb 17>; [59.00%] else goto <bb 16>; [41.00%] <bb 16> [local count: 433454538]: _165 = ABS_EXPR <chrg_init_70>; _168 = -_165; goto <bb 19>; [100.00%] <bb 17> [local count: 623751662]: _14 = distbb_74 * iftmp.1_101; iftmp.8_76 = 1.0e+0 - _14; if (distbb_74 < iftmp.0_97) goto <bb 18>; [20.00%] else goto <bb 19>; [80.00%] <bb 18> [local count: 124750334]: _162 = chrg_init_70 * iftmp.8_76; _164 = ABS_EXPR <_162>; _167 = -_164; <bb 19> [local count: 1057206200]: # iftmp.9_38 = PHI <1.0e+0(18), 0.0(17), 1.0e+0(16)> # iftmp.8_102 = PHI <iftmp.8_76(18), iftmp.8_76(17), 1.0e+0(16)> # prephitmp_163 = PHI <_162(18), 0.0(17), chrg_init_70(16)> # prephitmp_169 = PHI <_167(18), 0.0(17), _168(16)> if (iftmp.2_36 != 0) goto <bb 21>; [50.00%] else goto <bb 20>; [50.00%] That is to say, the multiplication is now compleletely skipped in one branch, this should be better for scalar code, but for vector we have to do the multiplication anyway. after ifcvt we end up with: _162 = chrg_init_70 * iftmp.8_76; _164 = ABS_EXPR <_162>; _167 = -_164; _ifc__166 = distbb_74 < iftmp.0_97 ? _167 : 0.0; prephitmp_169 = distbb_74 >= 0.0 ? _ifc__166 : _168; instead of _160 = chrg_init_75 * iftmp.8_80; prephitmp_161 = distbb_79 < 0.0 ? chrg_init_75 : _160; _164 = ABS_EXPR <prephitmp_161>; _166 = -_164; prephitmp_167 = distbb_79 < iftmp.0_96 ? _166 : 0.0; previously we'd make COND_MUL and COND_NEG and so don't need a VCOND in the end, now we select after the multiplication, so we only have a COND_NEG followed by a VCOND. This is obviously worse, but I have no idea how to recover it. Any ideas?
next prev parent reply other threads:[~2023-07-07 18:10 UTC|newest] Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-16 11:57 [Bug tree-optimization/109154] New: [13 regression] aarch64 -mcpu=neoverse-v1 microbude performance regression pgodbole at nvidia dot com 2023-03-16 13:11 ` [Bug tree-optimization/109154] " tnfchris at gcc dot gnu.org 2023-03-16 14:58 ` [Bug target/109154] " rguenth at gcc dot gnu.org 2023-03-16 17:03 ` tnfchris at gcc dot gnu.org 2023-03-16 17:03 ` [Bug target/109154] [13 regression] jump threading with de-optimizes nested floating point comparisons tnfchris at gcc dot gnu.org 2023-03-22 10:20 ` [Bug tree-optimization/109154] [13 regression] jump threading " aldyh at gcc dot gnu.org 2023-03-22 10:29 ` avieira at gcc dot gnu.org 2023-03-22 12:22 ` rguenth at gcc dot gnu.org 2023-03-22 12:42 ` rguenth at gcc dot gnu.org 2023-03-22 13:11 ` aldyh at gcc dot gnu.org 2023-03-22 14:00 ` amacleod at redhat dot com 2023-03-22 14:39 ` aldyh at gcc dot gnu.org 2023-03-27 8:09 ` rguenth at gcc dot gnu.org 2023-03-27 9:30 ` jakub at gcc dot gnu.org 2023-03-27 9:42 ` aldyh at gcc dot gnu.org 2023-03-27 9:44 ` jakub at gcc dot gnu.org 2023-03-27 10:18 ` rguenther at suse dot de 2023-03-27 10:40 ` jakub at gcc dot gnu.org 2023-03-27 10:44 ` jakub at gcc dot gnu.org 2023-03-27 10:54 ` rguenth at gcc dot gnu.org 2023-03-27 10:56 ` jakub at gcc dot gnu.org 2023-03-27 10:59 ` jakub at gcc dot gnu.org 2023-03-27 17:07 ` jakub at gcc dot gnu.org 2023-03-28 8:33 ` rguenth at gcc dot gnu.org 2023-03-28 9:01 ` cvs-commit at gcc dot gnu.org 2023-03-28 10:07 ` tnfchris at gcc dot gnu.org 2023-03-28 10:08 ` tnfchris at gcc dot gnu.org 2023-03-28 12:18 ` jakub at gcc dot gnu.org 2023-03-28 12:25 ` rguenth at gcc dot gnu.org 2023-03-28 12:42 ` rguenth at gcc dot gnu.org 2023-03-28 13:19 ` rguenth at gcc dot gnu.org 2023-03-28 13:44 ` jakub at gcc dot gnu.org 2023-03-28 13:52 ` jakub at gcc dot gnu.org 2023-03-28 15:31 ` amacleod at redhat dot com 2023-03-28 15:40 ` jakub at gcc dot gnu.org 2023-03-28 15:53 ` amacleod at redhat dot com 2023-03-28 15:58 ` jakub at gcc dot gnu.org 2023-03-28 16:42 ` amacleod at redhat dot com 2023-03-28 21:12 ` amacleod at redhat dot com 2023-03-29 6:33 ` cvs-commit at gcc dot gnu.org 2023-03-29 6:38 ` rguenth at gcc dot gnu.org 2023-03-29 22:41 ` amacleod at redhat dot com 2023-03-30 18:17 ` cvs-commit at gcc dot gnu.org 2023-04-05 9:28 ` tnfchris at gcc dot gnu.org 2023-04-05 9:34 ` ktkachov at gcc dot gnu.org 2023-04-11 9:36 ` rguenth at gcc dot gnu.org 2023-04-13 16:54 ` jakub at gcc dot gnu.org 2023-04-13 17:25 ` rguenther at suse dot de 2023-04-13 17:29 ` jakub at gcc dot gnu.org 2023-04-14 18:10 ` jakub at gcc dot gnu.org 2023-04-14 18:14 ` jakub at gcc dot gnu.org 2023-04-14 18:22 ` jakub at gcc dot gnu.org 2023-04-14 19:09 ` jakub at gcc dot gnu.org 2023-04-15 10:10 ` cvs-commit at gcc dot gnu.org 2023-04-17 11:07 ` jakub at gcc dot gnu.org 2023-04-25 18:32 ` [Bug tree-optimization/109154] [13/14 " tnfchris at gcc dot gnu.org 2023-04-25 18:34 ` jakub at gcc dot gnu.org 2023-04-26 6:58 ` rguenth at gcc dot gnu.org 2023-04-26 9:43 ` tnfchris at gcc dot gnu.org 2023-04-26 10:07 ` jakub at gcc dot gnu.org 2023-07-07 18:10 ` tnfchris at gcc dot gnu.org [this message] 2023-07-10 7:15 ` rguenth at gcc dot gnu.org 2023-07-10 10:33 ` tnfchris at gcc dot gnu.org 2023-07-10 10:46 ` rguenth at gcc dot gnu.org 2023-07-10 11:02 ` tnfchris at gcc dot gnu.org 2023-07-10 11:27 ` rguenth at gcc dot gnu.org 2023-07-10 11:49 ` tnfchris at gcc dot gnu.org 2023-07-14 10:22 ` cvs-commit at gcc dot gnu.org 2023-07-14 10:22 ` cvs-commit at gcc dot gnu.org 2023-07-27 9:25 ` rguenth at gcc dot gnu.org 2023-10-02 10:53 ` cvs-commit at gcc dot gnu.org 2023-10-18 8:54 ` cvs-commit at gcc dot gnu.org 2023-10-18 8:54 ` cvs-commit at gcc dot gnu.org 2023-10-18 8:54 ` cvs-commit at gcc dot gnu.org 2023-10-18 8:55 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:20 ` cvs-commit at gcc dot gnu.org 2023-11-09 14:25 ` [Bug tree-optimization/109154] [13 " tnfchris 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-109154-4-VAyv4o9Gm3@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).