public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections. @ 2004-09-01 23:31 msharov at talentg dot com 2004-09-02 5:02 ` [Bug rtl-optimization/17272] " pinskia at gcc dot gnu dot org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: msharov at talentg dot com @ 2004-09-01 23:31 UTC (permalink / raw) To: gcc-bugs When two inline functions with assembly sections are concatenated, a superfluous store is emitted between the two calls. Consider the attached code, where inline functions padd and psub are called in succession from main(). The optimizer correctly recognizes that the first argument is the same for both calls and does not touch %dl once it is set. Then the there is that store between calls even though the compiler should know that both v1 and v2 are local and not volatile, and are not expected to be kept up to date after every instruction. It should also know that the value is overwritten again after only one instruction. Although the extra store is not in itself harmful, removing it would improve performance. ============================================================ inline void padd (const char* p, char* r) { asm ("addb %1, %0" : "=&r"(*r) : "r"(*p), "0"(*r)); } inline void psub (const char* p, char* r) { asm ("subb %1, %0" : "=&r"(*r) : "r"(*p), "0"(*r)); } int main (void) { char v1[8] = "v1"; char v2[8] = "v2"; padd (v1, v2); psub (v1, v2); return (v2[0]); } ============================================================ -O3 -march=athlon-mp ============================================================ main: pushl %ebp movl %esp, %ebp pushl %ebx subl $4, %esp movl .LC1, %eax movzbl .LC0, %edx andl $-16, %esp subl $16, %esp movl %eax, %ebx #APP addb %dl, %bl #NO_APP movb %bl, %al <<< Unneeded #APP subb %dl, %bl #NO_APP movb %bl, %al <<< Overwritten here movl -4(%ebp), %ebx leave movsbl %al,%eax ret ============================================================ -- Summary: Extra store emitted when concatenating inline assembly sections. Product: gcc Version: 3.4.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: msharov at talentg dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: athlon-gnu-linux GCC host triplet: athlon-gnu-linux GCC target triplet: athlon-gnu-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17272 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17272] Extra store emitted when concatenating inline assembly sections. 2004-09-01 23:31 [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections msharov at talentg dot com @ 2004-09-02 5:02 ` pinskia at gcc dot gnu dot org 2004-12-02 2:16 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-09-02 5:02 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-02 05:02 ------- Confirmed, one of the issues is that we not doing SRA on the array which is the inline-asm. This also happens on the mainline. We do produce better code as we don't have one of the arrays in the code anymore. -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|inline-asm |rtl-optimization Ever Confirmed| |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2004-09-02 05:02:32 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17272 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17272] Extra store emitted when concatenating inline assembly sections. 2004-09-01 23:31 [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections msharov at talentg dot com 2004-09-02 5:02 ` [Bug rtl-optimization/17272] " pinskia at gcc dot gnu dot org @ 2004-12-02 2:16 ` pinskia at gcc dot gnu dot org 2005-03-03 2:54 ` pinskia at gcc dot gnu dot org 2005-05-12 17:43 ` [Bug tree-optimization/17272] " pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-12-02 2:16 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |enhancement Last reconfirmed|2004-09-02 05:02:32 |2004-12-02 02:16:02 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17272 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug rtl-optimization/17272] Extra store emitted when concatenating inline assembly sections. 2004-09-01 23:31 [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections msharov at talentg dot com 2004-09-02 5:02 ` [Bug rtl-optimization/17272] " pinskia at gcc dot gnu dot org 2004-12-02 2:16 ` pinskia at gcc dot gnu dot org @ 2005-03-03 2:54 ` pinskia at gcc dot gnu dot org 2005-05-12 17:43 ` [Bug tree-optimization/17272] " pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-03-03 2:54 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- CC| |pinskia at gcc dot gnu dot | |org Last reconfirmed|2004-12-02 02:16:02 |2005-03-03 02:54:36 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17272 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/17272] Extra store emitted when concatenating inline assembly sections. 2004-09-01 23:31 [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections msharov at talentg dot com ` (2 preceding siblings ...) 2005-03-03 2:54 ` pinskia at gcc dot gnu dot org @ 2005-05-12 17:43 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-05-12 17:43 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-12 17:43 ------- I mean on the setting side of the inline-asm. Otherwise we have a ra issue. -- What |Removed |Added ---------------------------------------------------------------------------- Component|rtl-optimization |tree-optimization Keywords| |ra Last reconfirmed|2005-03-03 02:54:36 |2005-05-12 17:43:15 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17272 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-12 17:43 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-09-01 23:31 [Bug inline-asm/17272] New: Extra store emitted when concatenating inline assembly sections msharov at talentg dot com 2004-09-02 5:02 ` [Bug rtl-optimization/17272] " pinskia at gcc dot gnu dot org 2004-12-02 2:16 ` pinskia at gcc dot gnu dot org 2005-03-03 2:54 ` pinskia at gcc dot gnu dot org 2005-05-12 17:43 ` [Bug tree-optimization/17272] " pinskia at gcc dot gnu dot org
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).