public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nico at cam dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/15089] [3.4/3.5 Regression] [tree-ssa] local register variable with a specified register is bad Date: Wed, 23 Jun 2004 19:50:00 -0000 [thread overview] Message-ID: <20040623191517.10026.qmail@sourceware.org> (raw) In-Reply-To: <20040423040422.15089.nico@cam.org> ------- Additional Comments From nico at cam dot org 2004-06-23 19:15 ------- Subject: Re: [3.4/3.5 Regression] [tree-ssa] local register variable with a specified register is bad > Therefore, closing this as INVALID. I beg to disagree here. Let's analyse the quoted manual: Local register variables in specific registers do not reserve the registers. The compiler's data flow analysis is capable of determining where the specified registers contain live values, and where they are available for other uses. This is perfectly sensible, although the current behavior doesn't correspond to this, ence this bug report. The inline asm constitute a precise point of use which is not respected. Stores into local register variables may be deleted when they appear to be dead according to dataflow analysis. This is also perfectly fine, but that's not the case here since the misassigned register is actually defined to be an input operand to the inline assembly. It therefore can't be dead. References to local register variables may be deleted or moved or simplified. I still don't see how this sentence could mean "any other register can be used", otherwise this feature would be completely non sense since no register specification could ever be relied upon which is completely useless. When the manual says "References to local register variables may be deleted or moved or simplified", that means the "reference" can be reordered or discarded with regards to other operations which is again perfectly fine, but that doesn't mean the compiler may decide to use another register for the actual reference at all. > When __l is used in the asm, the writer of the bugzilla report expects > to see register "r0". Indeed! That's the expected result of the feature. > However, the value happens to be hanging around > in a different register so GCC uses that other register instead of > "r0". Similarly for uses of __i. The behavior of the compiler is > precisely what I would expect." This is of course the expected behavior when there is _no_ register specification for a given variable, which is absolutely not the case here. And yet the value happens to be defined by a constant right before being used as follows: l = 100; { register unsigned long long __l asm("r0") = l; register unsigned long long __r asm("r2"); asm ( "..." _ "=r" (__r) : "r" (__l) ); l = __r; } So there is no reason gcc would have used another register than the one we asked it to, especially since the original l value has no life passed the assignment to __l. And incidentally, when the proposed patch for this bug is applied then that's exactly what happens. Now let's suppose we rework the test case a bit so __l becomes an output as well as an input to the inline asm, and that both l and __l are referenced after the inline asm. Then gcc doesn't have the choice to copy the value of l into a separate register. Even in this case the selected register doesn't respect the register specification, even if that specification is changed to a completely unused register like, say, r8 instead of r0. And to further justify the proposed patch: all this is dependent on the presence of a surrounding loop. If the loop is removed from the code, it's then impossible to make the test case fail. I'm therefore asking for this bug to be reopened and the proposed fix applied. The reasons for marking this bug as invalid, are, IMHO, themselves invalid. This is a documented feature that has always worked perfectly fine in the past, and which has existing bodies of code relying on the documented behavior for legitimate purposes. Thank you. Nicolas -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15089
next prev parent reply other threads:[~2004-06-23 19:15 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-04-23 4:30 [Bug inline-asm/15089] New: " nico at cam dot org 2004-04-23 4:56 ` [Bug inline-asm/15089] " nico at cam dot org 2004-04-23 4:56 ` nico at cam dot org 2004-04-23 6:28 ` nico at cam dot org 2004-04-28 23:54 ` pb at gcc dot gnu dot org 2004-04-29 0:15 ` pb at gcc dot gnu dot org 2004-04-29 18:00 ` nico at cam dot org 2004-04-29 19:23 ` pb at gcc dot gnu dot org 2004-05-05 13:48 ` pb at gcc dot gnu dot org 2004-05-07 3:19 ` [Bug optimization/15089] [3.3./4/3.5 Regression] [tree-ssa] " pinskia at gcc dot gnu dot org 2004-05-17 10:41 ` [Bug tree-optimization/15089] [3.4/3.5 " gdr at gcc dot gnu dot org 2004-06-12 22:56 ` mmitchel at gcc dot gnu dot org 2004-06-23 2:34 ` mmitchel at gcc dot gnu dot org 2004-06-23 18:18 ` ian at wasabisystems dot com 2004-06-23 19:50 ` nico at cam dot org [this message] 2004-06-23 22:11 ` mark at codesourcery dot com 2004-06-23 22:52 ` rth at gcc dot gnu dot org 2004-06-25 21:48 ` cvs-commit at gcc dot gnu dot org 2004-06-25 21:49 ` cvs-commit at gcc dot gnu dot org 2004-06-25 21:55 ` mmitchel at gcc dot gnu dot org 2004-09-27 8:32 ` [Bug tree-optimization/15089] [3.4/4.0 " bonzini at gcc dot gnu dot org 2004-09-29 2:50 ` cvs-commit at gcc dot gnu dot org 2004-10-28 13:31 ` pinskia at gcc dot gnu dot org 2004-11-27 0:44 ` [Bug tree-optimization/15089] " pinskia at gcc dot gnu dot org 2005-03-31 21:36 ` rth at gcc dot gnu dot 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=20040623191517.10026.qmail@sourceware.org \ --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).