public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/110588] New: btl (on x86_64) not always generated @ 2023-07-07 10:02 pinskia at gcc dot gnu.org 2023-07-08 21:12 ` [Bug target/110588] " roger at nextmovesoftware dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-07-07 10:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110588 Bug ID: 110588 Summary: btl (on x86_64) not always generated Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: x86_64-linux-gnu Take C+ code (since I am too lazy to figure out the types): ``` unsigned char clr1_bb (unsigned char x, int y) { return (x & (1<<y)) == 0; } unsigned char clr1_bb1 (unsigned char x, int y) { auto _1 = (int) x; auto _2 = _1 >> y; auto _3 = _2 & 1; auto _8 = (unsigned char) _3; auto _6 = _8 ^ 1; return _6; } unsigned char clr1_bb2 (unsigned char x, int y) { auto _1 = (int) x; auto _2 = _1 >> y; auto _3 = _2 & 1; auto _6 = _3 ^ 1; auto _8 = (unsigned char) _6; return _6; } ``` Right now clr1_bb and clr1_bb2 produce the btl/setnc but clr1_bb1 does not. Note I noticed this while working on PR 110539 (I changed my patch to put the cast after the ^1 rather than before so this is not blocking that patch). ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/110588] btl (on x86_64) not always generated 2023-07-07 10:02 [Bug target/110588] New: btl (on x86_64) not always generated pinskia at gcc dot gnu.org @ 2023-07-08 21:12 ` roger at nextmovesoftware dot com 2023-07-09 8:08 ` ubizjak at gmail dot com ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: roger at nextmovesoftware dot com @ 2023-07-08 21:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110588 Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roger at nextmovesoftware dot com Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com Last reconfirmed| |2023-07-08 --- Comment #1 from Roger Sayle <roger at nextmovesoftware dot com> --- Thanks Andrew. I have a patch (a define_split in i386.md) that's currently bootstrapping and regression testing. But perhaps this should also be fixed at the tree-level by match.pd canonicalizing ((T)(x & C)) ^ C to (T)((~x) & C) when T is not wider than X and X is not wider than WORD_MODE. It's tricky to compare the costs of integer operations in different precisions, but WORD_MODE (and int) operations are (typically) always cheap (and I believe unary operations are preferred over binary operations (with immediate constants)). ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/110588] btl (on x86_64) not always generated 2023-07-07 10:02 [Bug target/110588] New: btl (on x86_64) not always generated pinskia at gcc dot gnu.org 2023-07-08 21:12 ` [Bug target/110588] " roger at nextmovesoftware dot com @ 2023-07-09 8:08 ` ubizjak at gmail dot com 2023-07-14 17:22 ` cvs-commit at gcc dot gnu.org 2023-07-23 5:06 ` roger at nextmovesoftware dot com 3 siblings, 0 replies; 5+ messages in thread From: ubizjak at gmail dot com @ 2023-07-09 8:08 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110588 Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=107671 --- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> --- Similar missed optimization is reported in PR107671. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/110588] btl (on x86_64) not always generated 2023-07-07 10:02 [Bug target/110588] New: btl (on x86_64) not always generated pinskia at gcc dot gnu.org 2023-07-08 21:12 ` [Bug target/110588] " roger at nextmovesoftware dot com 2023-07-09 8:08 ` ubizjak at gmail dot com @ 2023-07-14 17:22 ` cvs-commit at gcc dot gnu.org 2023-07-23 5:06 ` roger at nextmovesoftware dot com 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-07-14 17:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110588 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>: https://gcc.gnu.org/g:43a0a5cd57eefd5a5bbead606ec4f6959af31802 commit r14-2528-g43a0a5cd57eefd5a5bbead606ec4f6959af31802 Author: Roger Sayle <roger@nextmovesoftware.com> Date: Fri Jul 14 18:21:56 2023 +0100 PR target/110588: Add *bt<mode>_setncqi_2 to generate btl on x86. This patch resolves PR target/110588 to catch another case in combine where the i386 backend should be generating a btl instruction. This adds another define_insn_and_split to recognize the RTL representation for this case. I also noticed that two related define_insn_and_split weren't using the preferred string style for single statement preparation-statements, so I've reformatted these to be consistent in style with the new one. 2023-07-14 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/110588 * config/i386/i386.md (*bt<mode>_setcqi): Prefer string form preparation statement over braces for a single statement. (*bt<mode>_setncqi): Likewise. (*bt<mode>_setncqi_2): New define_insn_and_split. gcc/testsuite/ChangeLog PR target/110588 * gcc.target/i386/pr110588.c: New test case. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/110588] btl (on x86_64) not always generated 2023-07-07 10:02 [Bug target/110588] New: btl (on x86_64) not always generated pinskia at gcc dot gnu.org ` (2 preceding siblings ...) 2023-07-14 17:22 ` cvs-commit at gcc dot gnu.org @ 2023-07-23 5:06 ` roger at nextmovesoftware dot com 3 siblings, 0 replies; 5+ messages in thread From: roger at nextmovesoftware dot com @ 2023-07-23 5:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110588 Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #4 from Roger Sayle <roger at nextmovesoftware dot com> --- This is now fixed on mainline for GCC 14. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-23 5:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-07-07 10:02 [Bug target/110588] New: btl (on x86_64) not always generated pinskia at gcc dot gnu.org 2023-07-08 21:12 ` [Bug target/110588] " roger at nextmovesoftware dot com 2023-07-09 8:08 ` ubizjak at gmail dot com 2023-07-14 17:22 ` cvs-commit at gcc dot gnu.org 2023-07-23 5:06 ` roger at nextmovesoftware dot com
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).