public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "thomas dot schlichter at web dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug optimization/14121] New: use inline assembler register constraints as home register hints Date: Wed, 11 Feb 2004 23:56:00 -0000 [thread overview] Message-ID: <20040211235607.14121.thomas.schlichter@web.de> (raw) Hi, gcc 3.4.0 (and 3.3.1) seems not to use the register constraints of the inline assembler as hints where to place local variables. For example following part of the file bin2dec.c (will provide it later) : int m2 = m; unsigned long c = 0; do { asm("divl\t%2" : "+a"(x[m2]), "+d"(c) : "r"(1000000000)); } while (--m2 >= 0); is translated to following x86 assembler instructions (gcc -O2 -S): movl $1000000000, %ebx .p2align 4,,15 .L3: movl %edi, -20(%ebp) xorl %ecx, %ecx .p2align 4,,15 .L6: movl -20(%ebp), %edx movl (%esi,%edx,4), %eax movl %ecx, %edx #APP divl %ebx #NO_APP movl %edx, %ecx movl -20(%ebp), %edx movl %eax, (%esi,%edx,4) decl %edx movl %edx, -20(%ebp) jns .L6 So the variable "c" seems to be placed in the register "ecx" whereas it is constrained to register "edx". If "c" was placed in "edx" the register "ecx" would become free and could be used for "m2". So this variable would not have to be placed on the stack... gcc 2.95.3 seems to do this placement, but I don't know if it does this coincidental or intentionally... It generates following code (ebx<>m, ecx<>m2, edx<>c, edi<>x): movl %ebx,%ecx xorl %edx,%edx .p2align 2,0x90 .L10: movl (%edi,%ecx,4),%eax movl $1000000000,%esi #APP divl %esi #NO_APP movl %eax,(%edi,%ecx,4) decl %ecx jns .L10 So it would be GREAT if 3.4.0 would do anything like that (plus moving the assignment to esi outside the loop, of course ;-) Best reagrds Thomas Schlichter -- Summary: use inline assembler register constraints as home register hints Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: thomas dot schlichter at web dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121
next reply other threads:[~2004-02-11 23:56 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-02-11 23:56 thomas dot schlichter at web dot de [this message] 2004-02-11 23:58 ` [Bug optimization/14121] " thomas dot schlichter at web dot de 2004-02-11 23:59 ` thomas dot schlichter at web dot de 2004-02-12 0:00 ` thomas dot schlichter at web dot de 2004-02-12 0:02 ` thomas dot schlichter at web dot de 2004-02-12 2:45 ` pinskia 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=20040211235607.14121.thomas.schlichter@web.de \ --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).