new_ia32_branch: awkward sequence

Toshiyasu Morita tm@netcom.com
Fri Jul 16 16:31:00 GMT 1999


Here's a sequence from adler32.i compiled with -O2.

GCC generates an add to memory, followed by a read from the
memory location back into a register. This is rather awkward.

1051:adler32.i     ****             buf += 16;
1052:adler32.i     ****             k -= 16;
 107                    .LM10:
 108 0053 83EE10                subl    $16, %esi
 110                    .LM11:
 111 0056 0145FC                addl    %eax, -4(%ebp)	<- here
 112 0059 8B45FC                movl    -4(%ebp), %eax	<- here
 113 005c 01C1                  addl    %eax, %ecx
 114 005e 0FB64301              movzbl  1(%ebx), %eax
 115 0062 0145FC                addl    %eax, -4(%ebp)	<- here
 116 0065 8B45FC                movl    -4(%ebp), %eax	<- here
 117 0068 01C1                  addl    %eax, %ecx
 118 006a 0FB64302              movzbl  2(%ebx), %eax
 119 006e 0145FC                addl    %eax, -4(%ebp)	<- here
 120 0071 8B45FC                movl    -4(%ebp), %eax	<- here
 121 0074 01C1                  addl    %eax, %ecx
 122 0076 0FB64303              movzbl  3(%ebx), %eax
 123 007a 0145FC                addl    %eax, -4(%ebp)	<- here
 124 007d 8B45FC                movl    -4(%ebp), %eax	<- here ... etc
 125 0080 01C1                  addl    %eax, %ecx
 126 0082 0FB64304              movzbl  4(%ebx), %eax
 127 0086 0145FC                addl    %eax, -4(%ebp)
 128 0089 8B45FC                movl    -4(%ebp), %eax
 129 008c 01C1                  addl    %eax, %ecx
 130 008e 0FB64305              movzbl  5(%ebx), %eax
 131 0092 0145FC                addl    %eax, -4(%ebp)
 132 0095 8B45FC                movl    -4(%ebp), %eax
 133 0098 01C1                  addl    %eax, %ecx
 134 009a 0FB64306              movzbl  6(%ebx), %eax
 135 009e 0145FC                addl    %eax, -4(%ebp)
 136 00a1 8B45FC                movl    -4(%ebp), %eax
^LGAS LISTING adler32.s                         page 21



More information about the Gcc-bugs mailing list