public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug optimization/14121] New: use inline assembler register constraints as home register hints @ 2004-02-11 23:56 thomas dot schlichter at web dot de 2004-02-11 23:58 ` [Bug optimization/14121] " thomas dot schlichter at web dot de ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: thomas dot schlichter at web dot de @ 2004-02-11 23:56 UTC (permalink / raw) To: gcc-bugs 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/14121] use inline assembler register constraints as home register hints 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de @ 2004-02-11 23:58 ` thomas dot schlichter at web dot de 2004-02-11 23:59 ` thomas dot schlichter at web dot de ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: thomas dot schlichter at web dot de @ 2004-02-11 23:58 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From thomas dot schlichter at web dot de 2004-02-11 23:57 ------- Created an attachment (id=5729) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5729&action=view) C source test-file compile it with "gcc -O2 -S" -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/14121] use inline assembler register constraints as home register hints 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de 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 ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: thomas dot schlichter at web dot de @ 2004-02-11 23:59 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From thomas dot schlichter at web dot de 2004-02-11 23:59 ------- Created an attachment (id=5730) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5730&action=view) Compile result of gcc 3.4.0 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/14121] use inline assembler register constraints as home register hints 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de 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 4 siblings, 0 replies; 6+ messages in thread From: thomas dot schlichter at web dot de @ 2004-02-12 0:00 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From thomas dot schlichter at web dot de 2004-02-12 00:00 ------- Created an attachment (id=5731) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5731&action=view) Compile result of gcc 2.95.3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/14121] use inline assembler register constraints as home register hints 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de ` (2 preceding siblings ...) 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 4 siblings, 0 replies; 6+ messages in thread From: thomas dot schlichter at web dot de @ 2004-02-12 0:02 UTC (permalink / raw) To: gcc-bugs -- What |Removed |Added ---------------------------------------------------------------------------- Attachment #5730|application/octet-stream |text/plain mime type| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/14121] use inline assembler register constraints as home register hints 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de ` (3 preceding siblings ...) 2004-02-12 0:02 ` thomas dot schlichter at web dot de @ 2004-02-12 2:45 ` pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-02-12 2:45 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-12 02:45 ------- Confirmed. I do not know if register allocator can do this (without graph coloring which is what new-ra does but new ra is not ready yet). -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |pessimizes-code Last reconfirmed|0000-00-00 00:00:00 |2004-02-12 02:45:26 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14121 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-02-12 2:45 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-02-11 23:56 [Bug optimization/14121] New: use inline assembler register constraints as home register hints thomas dot schlichter at web dot de 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
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).