(i386-linux x sh-elf) stack slot address calculated repeatedly

Toshiyasu Morita tm@netcom.com
Wed Jun 28 16:49:00 GMT 2000


version: CVS
   host: i386-linux
 target: sh-elf
options: -O2 -m4-single-only -ml -S -g

I'm seeing a lot of problems with stack-related addressing.
The compiler is calculating the addresses of stack slots repeatedly
instead of extending the lifetime of the previous calculation.

Here's several samples culled from imdecode.i in the stress-1.14
testsuite at:

ftp://shell14.ba.best.com/pub.t/tm2/stress-1.14.tar.gz

Here's the relevant sections:

...
48019:./imdecode.i  ****     { MagickWarning( CorruptImageWarning , "XWD header size is too small" , image ->filename); Dest
 173359                 .LM11936:
 173360 1cf6a 40E1              mov     #64,r1		<- here
 173361 1cf6c FC7F              add     #-4,r15
 173362 1cf6e 3CD5              mov.l   .L11476,r5
 173363 1cf70 EC31              add     r14,r1		<- here
 173364 1cf72 5D94              mov.w   .L11472,r4
 173365 1cf74 1D56              mov.l   @(52,r1),r6
 173366 1cf76 33D1              mov.l   .L11466,r1
 173367 1cf78 0B41              jsr     @r1
 173368 1cf7a 1076              add     #16,r6
 173369 1cf7c 33D1              mov.l   .L11469,r1
 173370 1cf7e 40E2              mov     #64,r2		<- here
 173371 1cf80 EC32              add     r14,r2		<- here
 173372 1cf82 89A6              bra     .L11460
 173373 1cf84 2D54              mov.l   @(52,r2),r4
...
48066:./imdecode.i  ****       for (i=0; i < (int) header.ncolors; i++)
 173699                 .LM11993:
 173700 1d160 7CE7              mov     #124,r7		<- here
 173701 1d162 00EC              mov     #0,r12
 173702 1d164 EC37              add     r14,r7		<- here
 173703 1d166 7457              mov.l   @(16,r7),r7
 173704 1d168 7351              mov.l   @(12,r7),r1
 173705 1d16a 133C              cmp/ge  r1,r12
 173706 1d16c 428D              bt.s    .L11605
 173707 1d16e 7CE0              mov     #124,r0		<- here
 173708 1d170 E362              mov     r14,r2
 173709 1d172 EC30              add     r14,r0		<- here
 173710 1d174 025B              mov.l   @(8,r0),r11
 173711 1d176 6472              add     #100,r2
 173712 1d178 025A              mov.l   @(8,r0),r10
 173713 1d17a 0259              mov.l   @(8,r0),r9
 173714 1d17c 0A7B              add     #10,r11
 173715 1d17e 0258              mov.l   @(8,r0),r8
 173716 1d180 087A              add     #8,r10
 173717 1d182 025D              mov.l   @(8,r0),r13
 173718 1d184 0679              add     #6,r9
 173719 1d186 0478              add     #4,r8
...
 174442                 .L11593:
 174443 1d564 7CE2              mov     #124,r2		<- here
 174444 1d566 EC30              add     r14,r0
 174445 1d568 40E7              mov     #64,r7
 174446 1d56a EC32              add     r14,r2		<- here
 174447 1d56c 0351              mov.l   @(12,r0),r1
 174448 1d56e EC37              add     r14,r7
 174449 1d570 2A52              mov.l   @(40,r2),r2
 174450 1d572 8290              mov.w   .L11514,r0
 174451 1d574 4071              add     #64,r1
 174452 1d576 2B63              neg     r2,r3
 174453 1d578 7CE2              mov     #124,r2		<- here
 174454 1d57a EC30              add     r14,r0
 174455 1d57c EC32              add     r14,r2		<- here
 174456 1d57e 1710              mov.l   r1,@(28,r0)
 174457 1d580 3B12              mov.l   r3,@(44,r2)
 174458 1d582 06E1              mov     #6,r1
 174459 1d584 7A93              mov.w   .L11515,r3
 174460 1d586 7D50              mov.l   @(52,r7),r0
 174461 1d588 3C30              add     r3,r0
 174462 1d58a 0E12              mov.l   r0,@(56,r2)
 174463 1d58c 2152              mov.l   @(4,r2),r2
 174464 1d58e 0CE0              mov     #12,r0
 174465 1d590 7393              mov.w   .L11514,r3
 174466 1d592 1702              mul.l   r1,r2
 174467 1d594 EC33              add     r14,r3
 174468 1d596 1A07              sts     macl,r7
 174469 1d598 7CE1              mov     #124,r1		<- here
 174470 1d59a 7913              mov.l   r7,@(36,r3)
 174471 1d59c EC31              add     r14,r1		<- here
 174472 1d59e 0702              mul.l   r0,r2
 174473 1d5a0 1851              mov.l   @(32,r1),r1
 174474 1d5a2 1B62              neg     r1,r2
 174475 1d5a4 1A0C              sts     macl,r12
 174476 1d5a6 7CE1              mov     #124,r1		<- here
 174477 1d5a8 EC31              add     r14,r1		<- here
 174478 1d5aa 2C11              mov.l   r2,@(48,r1)
 174479 1d5ac 1652              mov.l   @(24,r1),r2
 174480 1d5ae 2B62              neg     r2,r2
 174481 1d5b0 2D11              mov.l   r2,@(52,r1)
 174482                 .L11395:
...
48180:./imdecode.i  ****           {
48181:./imdecode.i  ****             pixel= ((*(( ximage )->f.get_pixel))(( ximage ), ( x ), ( y ))) ;
 174485 1d5b2 6293              mov.w   .L11514,r3
 174486 1d5b4 7CE7              mov     #124,r7		<- here
 174487 1d5b6 40E0              mov     #64,r0
 174488 1d5b8 EC37              add     r14,r7		<- here
 174489 1d5ba EC30              add     r14,r0
 174490 1d5bc 7354              mov.l   @(12,r7),r4
 174491 1d5be EC33              add     r14,r3
 174492 1d5c0 0F55              mov.l   @(60,r0),r5
 174493 1d5c2 FC7F              add     #-4,r15
 174494 1d5c4 3753              mov.l   @(28,r3),r3
 174495 1d5c6 3251              mov.l   @(8,r3),r1
 174496 1d5c8 0B41              jsr     @r1
 174497 1d5ca 0E56              mov.l   @(56,r0),r6
48182:./imdecode.i  ****             index=(unsigned short) ((pixel >> red_shift) & red_mask);
 174500 1d5cc 7CE3              mov     #124,r3		<- here
 174501 1d5ce 7CE7              mov     #124,r7		<- here
 174502 1d5d0 EC33              add     r14,r3		<- here
 174505 1d5d2 0362              mov     r0,r2
 174508 1d5d4 3B53              mov.l   @(44,r3),r3
 174509 1d5d6 EC37              add     r14,r7		<- here
 174510 1d5d8 2361              mov     r2,r1
 174511 1d5da 7957              mov.l   @(36,r7),r7
 174512 1d5dc 3D41              shld    r3,r1
48183:./imdecode.i  ****             red= (((unsigned int) ( colors[index].red )) >> 8) ;
 174515 1d5de 0CE0              mov     #12,r0
 174516 1d5e0 7CE3              mov     #124,r3		<- here
 174519 1d5e2 7921              and     r7,r1
 174520 1d5e4 1D69              extu.w  r1,r9
48184:./imdecode.i  ****             index=(unsigned short) ((pixel >> green_shift) & green_mask);
 174523 1d5e6 7CE7              mov     #124,r7		<- here
 174526 1d5e8 EC33              add     r14,r3		<- here
 174527 1d5ea 0709              mul.l   r0,r9
 174528 1d5ec 3253              mov.l   @(8,r3),r3
 174531 1d5ee EC37              add     r14,r7		<- here
 174532 1d5f0 7C57              mov.l   @(48,r7),r7
...
 174899 1d7f2 7CE0              mov     #124,r0		<- here
 174900 1d7f4 EC30              add     r14,r0		<- here
 174901 1d7f6 0651              mov.l   @(24,r0),r1
 174902 1d7f8 1A0C              sts     macl,r12
 174903 1d7fa 5F90              mov.w   .L11525,r0
 174904 1d7fc 1B61              neg     r1,r1
 174905 1d7fe EC30              add     r14,r0
 174906 1d800 1110              mov.l   r1,@(4,r0)
 174907                 .L11412:
48220:./imdecode.i  ****           {
48221:./imdecode.i  ****             pixel= ((*(( ximage )->f.get_pixel))(( ximage ), ( x ), ( y ))) ;
 174909                 .LM12167:
 174910 1d802 5B92              mov.w   .L11525,r2
 174911 1d804 7CE3              mov     #124,r3		<- here
 174912 1d806 40E7              mov     #64,r7
 174913 1d808 EC33              add     r14,r3		<- here
 174914 1d80a EC37              add     r14,r7
 174915 1d80c 3354              mov.l   @(12,r3),r4
 174916 1d80e EC32              add     r14,r2
 174917 1d810 7F55              mov.l   @(60,r7),r5
 174918 1d812 FC7F              add     #-4,r15
 174919 1d814 2752              mov.l   @(28,r2),r2
 174920 1d816 2251              mov.l   @(8,r2),r1
 174921 1d818 0B41              jsr     @r1
 174922 1d81a 7E56              mov.l   @(56,r7),r6
 174923 1d81c 0362              mov     r0,r2
48222:./imdecode.i  ****             color=(pixel >> red_shift) & red_mask;
 174925                 .LM12168:
 174926 1d81e 7CE3              mov     #124,r3		<- here
 174927 1d820 7CE0              mov     #124,r0
 174928 1d822 EC33              add     r14,r3		<- here
 174929 1d824 2361              mov     r2,r1
 174930 1d826 EC30              add     r14,r0
 174931 1d828 3953              mov.l   @(36,r3),r3
48223:./imdecode.i  ****             red= (((unsigned int) ( (color*65535L)/red_mask )) >> 8) ;
48224:./imdecode.i  ****             color=(pixel >> green_shift) & green_mask;
48225:./imdecode.i  ****             green= (((unsigned int) ( (color*65535L)/green_mask )) >> 8) ;
48226:./imdecode.i  ****             color=(pixel >> blue_shift) & blue_mask;
48227:./imdecode.i  ****             blue= (((unsigned int) ( (color*65535L)/blue_mask )) >> 8) ;
48228:./imdecode.i  ****             if ((red == q->red) && (green == q->green) && (blue == q->blue) &&
 174934 1d82a 047F              add     #4,r15
 174937 1d82c 0F50              mov.l   @(60,r0),r0


Toshi



More information about the Gcc-bugs mailing list