[Bug target/92140] clang vs gcc optimizing with adc/sbb

2023-05-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |10.0 Status|NEW

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2023-05-07 Thread chfast at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #32 from Paweł Bylica --- For what it's worth, the original code is compiled the same as in Clang since GCC 10. https://godbolt.org/z/vxorYW815

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-11-10 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #31 from Segher Boessenkool --- (In reply to Segher Boessenkool from comment #29) > Does it help the i386 port if we disallow a hard reg dest as well? > RA should be able to handle that just fine as well. I tried this out, and it cre

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-21 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #30 from Uroš Bizjak --- (In reply to Segher Boessenkool from comment #29) > > Does it help the i386 port if we disallow a hard reg dest as well? > RA should be able to handle that just fine as well. I don't know from the top of my h

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-19 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #29 from Segher Boessenkool --- (In reply to Uroš Bizjak from comment #27) > FYI, these constraints were used in the past (when combine was allowed to > propagate hard registers into combined insn) to prevent reload failures, > where

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #28 from Jakub Jelinek --- Author: jakub Date: Sat Oct 19 12:46:57 2019 New Revision: 277203 URL: https://gcc.gnu.org/viewcvs?rev=277203&root=gcc&view=rev Log: PR target/92140 * config/i386/predicates.md (int_nonimmed

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-19 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #27 from Uroš Bizjak --- (In reply to Jakub Jelinek from comment #26) > Created attachment 47070 [details] > gcc10-prereload-splitters.patch > > Updated patch for the pre-reload splitters, which uses a new predicate and > additionall

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Jakub Jelinek changed: What|Removed |Added Attachment #47069|0 |1 is obsolete|

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #25 from Jakub Jelinek --- The define_insn part of define_insn_and_split needs constraints if it is meant to match during or after reload, the patterns are just written with the assumption that they are split before reload. At least

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #24 from Segher Boessenkool --- A dumb question I'm sure, but I don't see it: if the rest of your define_insn doesn't need constraints, why would the match_scratch need some? (A define_split never uses constraints).

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #23 from Jakub Jelinek --- (In reply to Segher Boessenkool from comment #22) > Hrm, I don't see how this is nicer than just adding a scratch in the > pattern? What makes that a worse option? Most of the patterns don't have constrain

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #22 from Segher Boessenkool --- Hrm, I don't see how this is nicer than just adding a scratch in the pattern? What makes that a worse option?

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #21 from Jakub Jelinek --- Created attachment 47069 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47069&action=edit gcc10-prereload-splitters.patch Ah, apparently we already have for ~ 2 years a property to handle this safely.

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #20 from Segher Boessenkool --- Ah, okay. So it is either one or two insns (zero can not be handled, but you can do a noop, a move of a reg to itself, and that will be optimised away just fine). Three insns is not something combine

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #19 from Uroš Bizjak --- (In reply to Segher Boessenkool from comment #18) > (In reply to Uroš Bizjak from comment #15) > > Is it possible to lift the limitation from the combine pass, where the > > combine tries to split the insn, bu

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #18 from Segher Boessenkool --- (In reply to Uroš Bizjak from comment #15) > Is it possible to lift the limitation from the combine pass, where the > combine tries to split the insn, but expects exactly two new insn patterns > to be g

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #17 from Jakub Jelinek --- I've tried to change the patch to use define_split instead of define_insn_and_split, with all of them changed, it creates worse code for f8/f12/f15 (the last one is expected, because we split into 3 instruct

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #16 from Uroš Bizjak --- (In reply to Jakub Jelinek from comment #13) > Created attachment 47067 [details] > gcc10-pr92140.patch > > So what about this version then? I've changed back a couple of > to nonimmediate_operand and remov

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #15 from Uroš Bizjak --- (In reply to Segher Boessenkool from comment #12) > (In reply to Uroš Bizjak from comment #10) > > Regarding reliability of pre-reload splitters, IIRC they should be safe, but > > I'll leave the final verdict

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #14 from Jakub Jelinek --- And as for the define_insn_and_split without constraints that don't expect to be matched post split1, I think we can try to figure out something incrementally and change all of them at once, e.g. a property

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #13 from Jakub Jelinek --- Created attachment 47067 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47067&action=edit gcc10-pr92140.patch So what about this version then? I've changed back a couple of to nonimmediate_operand a

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Segher Boessenkool changed: What|Removed |Added CC||segher at gcc dot gnu.org --- Comme

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #11 from Segher Boessenkool --- If an insn condition uses can_create_pseudo_p, the insn will suddenly stop to match after reload --> kaboom. If your insn always splits ("&& 1"), this means that if any of these: NEXT_PASS (pass_

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #10 from Uroš Bizjak --- (In reply to Jakub Jelinek from comment #9) > Created attachment 47065 [details] > gcc10-pr92140-wip.patch > > If pre-reload splitters are reliable, my patch can be greatly simplified and > using the formatti

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #9 from Jakub Jelinek --- Created attachment 47065 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47065&action=edit gcc10-pr92140-wip.patch If pre-reload splitters are reliable, my patch can be greatly simplified and using the

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #8 from Jakub Jelinek --- Comparing the two patches, your patch handles f1-f4 in /* PR target/92140 */ char c; int v; __attribute__((noipa)) void f1 (void) { v += c != 0; } __attribute__((noipa)) void f2 (void) { v -= c != 0; } __at

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #7 from Uroš Bizjak --- Created attachment 47064 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47064&action=edit Proposed patch with pre-reload splitters Maybe we should use pre-reload splitters as with the attached patch that

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Jakub Jelinek changed: What|Removed |Added Attachment #47062|0 |1 is obsolete|

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #5 from Jakub Jelinek --- The patch adds 144 define_insn and 144 define_split to tmp-mddump.md though, to total 6217 define_insn and 733 define_split. Maybe a better way to deal with it would be to have x86_ne_0_operator and x86_eq_0_

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #4 from Jakub Jelinek --- Created attachment 47062 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47062&action=edit gcc10-pr92140-wip.patch Slightly extended untested patch, which handles all the cases in the testcase at the st

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 --- Comment #3 from Jakub Jelinek --- Untested patch that handles tst1 and tst2 and some more, but doesn't handle tst3 yet and is still missing some patterns. Unfortunately, it can result in quite a lot of define_insn_and_split patterns, while fo

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #2

[Bug target/92140] clang vs gcc optimizing with adc/sbb

2019-10-17 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92140 Uroš Bizjak changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|