Mail Archives: pgcc/2000/03/07/19:10:03
Pgcc 2.95.2 generates broken code with -fcompare-elim enabled.
I'm using pgcc version pgcc-2.95.2 19991024 (release) on a
GNU/Linux(x86) system.
Code from 186.crafty (a specint2000 benchmark):
/*
enpassant pawns are on either file adjacent to the current file, and
on the same rank.
*/
for (i=0;i<64;i++) mask_eptest[i]=0;
for (i=25;i<31;i++) mask_eptest[i]=Or(set_mask[i-1],set_mask[i+1]);
for (i=33;i<39;i++) mask_eptest[i]=Or(set_mask[i-1],set_mask[i+1]);
mask_eptest[A4]=set_mask[B4];
mask_eptest[H4]=set_mask[G4];
mask_eptest[A5]=set_mask[B5];
mask_eptest[H5]=set_mask[G5];
For the second for loop pgcc generates:
;; mask_eptest: 0x80ae5c0
;; set_mask: 0x81521c0
;; Or(a,b) = (a) | (b)
;; -O3 -g -mcpu=pentiumpro -march=pentiumpro
0x805f695 <InitializePawnMasks+1029>: mov $0xfffffffa,%edi
0x805f69a <InitializePawnMasks+1034>: mov $0xd0,%ecx
0x805f69f <InitializePawnMasks+1039>: mov $0xc0,%edx
0x805f6a4 <InitializePawnMasks+1044>: mov $0xc8,%eax
0x805f6a9 <InitializePawnMasks+1049>: lea 0x0(%esi,1),%esi
0x805f6b0 <InitializePawnMasks+1056>: mov 0x81521c0(%edx),%ebx
0x805f6b6 <InitializePawnMasks+1062>: mov 0x81521c4(%edx),%esi
0x805f6bc <InitializePawnMasks+1068>: or 0x81521c0(%ecx),%ebx
0x805f6c2 <InitializePawnMasks+1074>: or 0x81521c4(%ecx),%esi
0x805f6c8 <InitializePawnMasks+1080>: mov %ebx,0x80ae5c0(%eax)
0x805f6ce <InitializePawnMasks+1086>: mov %esi,0x80ae5c4(%eax)
0x805f6d4 <InitializePawnMasks+1092>: add $0x8,%ecx
0x805f6d7 <InitializePawnMasks+1095>: add $0x8,%edx
0x805f6da <InitializePawnMasks+1098>: add $0x100,%eax
0x805f6df <InitializePawnMasks+1103>: add $0x20,%edi
0x805f6e2 <InitializePawnMasks+1106>:
jne 0x805f6b0 <InitializePawnMasks+1056>
The last add instruction will never generate an equal (zero) result,
so the loop will go on forever.
Code without -fcompare-elim:
;; mask_eptest: 0x80ae580
;; set_mask: 0x8152180
;; -O3 -fno-compare-elim -g -mcpu=pentiumpro -march=pentiumpro
0x805f625 <InitializePawnMasks+1029>: mov $0x19,%edi
0x805f62a <InitializePawnMasks+1034>: mov $0x8152180,%ecx
0x805f62f <InitializePawnMasks+1039>: mov $0xd0,%edx
0x805f634 <InitializePawnMasks+1044>: mov $0xc0,%eax
0x805f639 <InitializePawnMasks+1049>: lea 0x0(%esi,1),%esi
0x805f640 <InitializePawnMasks+1056>: mov (%eax,%ecx,1),%ebx
0x805f643 <InitializePawnMasks+1059>: mov 0x4(%eax,%ecx,1),%esi
0x805f647 <InitializePawnMasks+1063>: or (%edx,%ecx,1),%ebx
0x805f64a <InitializePawnMasks+1066>: or 0x4(%edx,%ecx,1),%esi
0x805f64e <InitializePawnMasks+1070>: mov %ebx,0x80ae580(,%edi,8)
0x805f655 <InitializePawnMasks+1077>: mov %esi,0x80ae584(,%edi,8)
0x805f65c <InitializePawnMasks+1084>: add $0x8,%edx
0x805f65f <InitializePawnMasks+1087>: add $0x8,%eax
0x805f662 <InitializePawnMasks+1090>: inc %edi
0x805f663 <InitializePawnMasks+1091>: cmp $0x1e,%edi
0x805f666 <InitializePawnMasks+1094>:
jle 0x805f640 <InitializePawnMasks+1056>
I'm not a member of any pgcc mailing lists, so please cc all
follow-ups to mch AT virtutech DOT se.
/Magnus
- Raw text -