Mail Archives: cygwin/2001/04/12/13:16:41
If you think you have a gcc code generation bug then you should report
the problem to gcc-bugs AT gcc DOT gnu DOT org.
cgf
On Thu, Apr 12, 2001 at 08:57:50AM -0400, Robert Blenis wrote:
>
>I'm using a ppc-elf cross compiler on Window 2000, and think there is a bug
>in the recent gcc compilers (2.95.2 and 2.95.3), that was not present in gcc
>2.90.29 (egcs-1.0.3). Below is a section of the code and resulting
>assembler output for gcc 2.90.29 and gcc 2.95.2. In either case, if I
>replace the line "dSdx = 2*A*x;" with a function call to do the equivalent,
>the function call assembly does the right thing for both versions, but when
>in a large function, gcc 2.95.2 generates bad code. I tried looking at the
>source for gcc but am new to it and did not know where to look. Let me know
>what other information is needed.
>
>And here are the flags passed to gcc:
>-Wall -ansi -B
>c:/dvt/bin/ppc-elf/2.95.2/ -DUSE_ECONOCR -mcpu=860 -mmultiple -DDVT -DDVT_RT
>OS -DDVT_600 -DENABLE_DECIMAL_MODE -DMARK_IMAGE -O2 -fno-exceptions -I
>c:/dvt/include -I c:/dvt/DVTLib/include -I ../600 -I ../ppc -I ../net -I
>../Libraries -I ../AB_Enet -I ../AB_Enet/Ported -I ../AB_Enet/Msg -I .. -I
>../sensors -I ../dvtrtos -I ../ImageProc -I ../Terminals -I ../Script -I
>../Libraries -DDEBUG -DDEBUG_MALLOC -DTOSHIBA_ROIBOT_DRIVER -Wa,-ahls=.lst -
>pipe -DNEW_SERIAL_DRIVER
>
>The options used to build/configure gcc were (going from memory):
>../gcc-2.90.29/configure --target=ppc-elf --prefix=/tools-ppc -with-headers=
>/usr/include --enable-languages=c,c++
>
>and same for gcc-2.95.2 (and 2.95.3)
>
>I'm reporting this to cygwin since I built the compiler with the cygwin
>sources, but I also reported the bug to gcc-bugs AT gcc DOT gnu DOT org.
>
>
>///////// Source code (prim.c)
>#define INT64 long long
>#define INT32 int
>
> INT64 x, y, dSdx, dSdy;
>
>
> /* ... lots of other code ... */
>
>
> DbgPrint(TRACE_OF," ------- maxnumpnts = %ld\n\r", (INT32)maxnumpnts);
>
> /* get starting octant */
> x = (INT64)start->X;
> y = (INT64)start->Y;
>#if 1
> dSdx = 2*A*x; /* the code for this line is being generated incorrectly!
>*/
>#else
> dSdx = FuzzyMath(A,x);
>#endif
>
> dSdy = 2;
> octant = _GetOctant( dSdx, dSdy);
>
>
>///////// output from gcc 2.90.29
>
> 1434 1228 48000001 bl DbgPrint
> 1435 122c A81B0000 lha 0,0(27)
> 1436 1230 9001003C stw 0,60(1)
> 1437 1234 7C00FE70 srawi 0,0,31
> 1438 1238 90010038 stw 0,56(1)
> 1439 123c 81C10038 lwz 14,56(1)
> 1440 1240 81E1003C lwz 15,60(1)
> 1441 1244 38A00000 li 5,0
> 1442 1248 38C00002 li 6,2
> 1443 124c 7DD27378 mr 18,14 /* copy A (r14,r15) into (r18,r19) */
> 1444 1250 7DF37B78 mr 19,15 /* ... */
> 1445 1254 7D4F9814 addc 10,15,19 /* multiply A by 2 (using original A
>and copy of A) */
> 1446 1258 7D2E9114 adde 9,14,18 /* and store result in r9,r10 */
> 1447 125c 7E7F5016 mulhwu 19,31,10
> 1448 1260 7E9F51D6 mullw 20,31,10
> 1449 1264 7C1F49D6 mullw 0,31,9
> 1450 1268 7D2AF1D6 mullw 9,10,30
> 1451 126c 92610090 stw 19,144(1)
> 1452 1270 92810094 stw 20,148(1)
> 1453 1274 82810090 lwz 20,144(1)
> 1454 1278 7E940214 add 20,20,0
> 1455 127c 92810090 stw 20,144(1)
> 1456 1280 7E95A378 mr 21,20
> 1457 1284 7EB54A14 add 21,21,9
> 1458 1288 92A10090 stw 21,144(1)
> 1459 128c 80610090 lwz 3,144(1)
> 1460 1290 80810094 lwz 4,148(1)
> 1461 1294 48004029 bl _GetOctant
>
>
>
>///////// output from gcc 2.95.2-2
>
> 1435 127c 48000001 bl DbgPrint
> 1436 1280 A8150000 lha 0,0(21)
> 1437 1284 8101002C lwz 8,44(1)
> 1438 1288 7C030378 mr 3,0
> 1439 128c 7C00FE70 srawi 0,0,31
> 1440 1290 9061003C stw 3,60(1)
> 1441 1294 90010038 stw 0,56(1)
> 1442 1298 80810038 lwz 4,56(1)
> 1443 129c 80A1003C lwz 5,60(1)
> 1444 12a0 7D0B4378 mr 11,8
> 1445 12a4 7CA62B78 mr 6,5 /* copy A (r4,r5) into (r5,r6) */
> 1446 12a8 7C852378 mr 5,4 /* ... */
> 1447 12ac 7D453014 addc 10,5,6 /* multiply A by 2 (using original A and
>copy of A) */
> 1448 12b0 7D242914 adde 9,4,5 /* and store result in r9,r10 */
> /* the problem is the addc 10,5,6 adds r5 and r6, but */
> /* r5 has just been replaced by the contents of r4! */
> 1449 12b4 7CC85016 mulhwu 6,8,10
> 1450 12b8 7CE851D6 mullw 7,8,10
> 1451 12bc 81810028 lwz 12,40(1)
> 1452 12c0 7C0B49D6 mullw 0,11,9
> 1453 12c4 90C10080 stw 6,128(1)
> 1454 12c8 90E10084 stw 7,132(1)
> 1455 12cc 7D6A61D6 mullw 11,10,12
> 1456 12d0 7CC60214 add 6,6,0
> 1457 12d4 7CCE3378 mr 14,6
> 1458 12d8 7DCE5A14 add 14,14,11
> 1459 12dc 90C10080 stw 6,128(1)
> 1460 12e0 91C10080 stw 14,128(1)
> 1461 12e4 80610080 lwz 3,128(1)
> 1462 12e8 80810084 lwz 4,132(1)
> 1463 12ec 38A00000 li 5,0
> 1464 12f0 38C00002 li 6,2
> 1465 12f4 48003DD1 bl _GetOctant
>
>
>Robert Blenis
>DVT Corporation
>R&D Engineering Manager
>770-449-4960
>robert DOT blenis AT dvtsensors DOT com
>
>
>--
>Want to unsubscribe from this list?
>Check out: http://cygwin.com/ml/#unsubscribe-simple
--
cgf AT cygnus DOT com Red Hat, Inc.
http://sources.redhat.com/ http://www.redhat.com/
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -