gcc bug? (was bug in gen5200/tod/pcf8563.c)
Wolfram Wadepohl
Wolfram.Wadepohl at ek-automation.com
Tue May 15 05:50:16 UTC 2007
Ingolf Steinbach schrieb:
> I don't know PPC assembly either. But maybe the reason for your
> problem becomes obvious if you compare the assembler code resulting
> from the macro version with the assembler code resulting from the
> inline function version of From_BCD(). Could you post both of them?
Hello,
here is the inline version (output from list windows in TRACE32):
_addr/line__|code_____|label____|mnemonic________________|comment______________________________________________________|
|
| v1 = info[PCF8563_DAY_ADR-PCF8563_SECOND_ADR] &
PCF8563_DAY_MASK;
175| time->day = From_BCD(v1);
SF:000C7D88|5520E13E srwi r0,r9,0x4 ; r0,r9,CS0STR
SF:000C7D8C|1C00000A mulli r0,r0,0x0A ; r0,r0,10
SF:000C7D90|5529073E clrlwi r9,r9,0x1C ; r9,r9,GP_18
SF:000C7D94|7C004A14 add r0,r0,r9
SF:000C7D98|901E0008 stw r0,0x8(r30) ; r0,CS0STP(r30)
SF:000C7D9C|8921000A lbz r9,0x0A(r1) ; r9,10(r1)
SF:000C7DA0|552906BE clrlwi r9,r9,0x1A ; r9,r9,26
|
| v1 = info[PCF8563_HOUR_ADR-PCF8563_SECOND_ADR] &
PCF8563_HOUR_MASK;
178| time->hour = From_BCD(v1);
SF:000C7DA4|5520E13E srwi r0,r9,0x4 ; r0,r9,CS0STR
SF:000C7DA8|1C00000A mulli r0,r0,0x0A ; r0,r0,10
SF:000C7DAC|5529073E clrlwi r9,r9,0x1C ; r9,r9,GP_18
SF:000C7DB0|7C004A14 add r0,r0,r9
SF:000C7DB4|901E000C stw r0,0x0C(r30) ; r0,CS1STR(r30)
SF:000C7DB8|89210009 lbz r9,0x9(r1) ; r9,9(r1)
SF:000C7DBC|5529067E clrlwi r9,r9,0x19 ; r9,r9,25
|
| v1 = info[PCF8563_MINUTE_ADR-PCF8563_SECOND_ADR] &
PCF8563_MINUTE_MASK;
181| time->minute = From_BCD(v1);
SF:000C7DC0|5520E13E srwi r0,r9,0x4 ; r0,r9,CS0STR
SF:000C7DC4|1C00000A mulli r0,r0,0x0A ; r0,r0,10
SF:000C7DC8|5529073E clrlwi r9,r9,0x1C ; r9,r9,GP_18
SF:000C7DCC|7C004A14 add r0,r0,r9
SF:000C7DD0|901E0010 stw r0,0x10(r30) ; r0,CS1STP(r30)
SF:000C7DD4|89210008 lbz r9,0x8(r1) ; r9,info(r1)
and here the macro version:
_addr/line__|code_____|label____|mnemonic________________|comment______________________________________________________|
|
165| v1 = info[PCF8563_DAY_ADR-PCF8563_SECOND_ADR] &
PCF8563_DAY_MASK;
SF:000C6840|8961000B lbz r11,0x0B(r1) ; r11,11(r1)
166| time->day = From_BCD(v1);
SF:000C6844|5569E7BE extrwi r9,r11,0x2,0x1A;
r9,r11,CTRL_PRECHARGE,26
SF:000C6848|1D29000A mulli r9,r9,0x0A ; r9,r9,10
SF:000C684C|556B073E clrlwi r11,r11,0x1C ; r11,r11,GP_18
SF:000C6850|7D295A14 add r9,r9,r11
SF:000C6854|913E0008 stw r9,0x8(r30) ; r9,CS0STP(r30)
|
168| v1 = info[PCF8563_HOUR_ADR-PCF8563_SECOND_ADR] &
PCF8563_HOUR_MASK;
SF:000C6858|8801000A lbz r0,0x0A(r1) ; r0,10(r1)
169| time->hour = From_BCD(v1);
_SF:000C685C|5400077A rlwinm r0,r0,0x0,0x1D,0x1D;_r0,r0,0,29,29
SF:000C6860|901E000C stw r0,0x0C(r30) ; r0,CS1STR(r30)
|
171| v1 = info[PCF8563_MINUTE_ADR-PCF8563_SECOND_ADR] &
PCF8563_MINUTE_MASK;
SF:000C6864|89210009 lbz r9,0x9(r1) ; r9,9(r1)
172| time->minute = From_BCD(v1);
SF:000C6868|5520E77E extrwi r0,r9,0x3,0x19 ; r0,r9,3,25
SF:000C686C|1C00000A mulli r0,r0,0x0A ; r0,r0,10
SF:000C6870|5529073E clrlwi r9,r9,0x1C ; r9,r9,GP_18
SF:000C6874|7C004A14 add r0,r0,r9
SF:000C6878|901E0010 stw r0,0x10(r30) ; r0,CS1STP(r30)
it is obvious that the code generated for line 169 of the macro version
does not do the same computation as the code of the inlined version (line
178). differnces in line numbering because of the function definitions for
inline functions in source file.
my question: is this a misbehaviour of the gcc? i'm using cygwin tools
powerpc-rtems4.7-gcc (GCC) 4.0.1
(RTEMS gcc-4.0.1-20050810/newlib-1.13.0-20050810-4)
--
Schöne Grüße aus Reutlingen
Wolfram Wadepohl
Forschung & Entwicklung
E&K AUTOMATION
Indumat GmbH & Co. KG
Siemensstraße 3
72766 Reutlingen
Deutschland
Tel. +49 7121 514-289
Fax +49 7121 514-299
eMail Wolfram.Wadepohl at ek-automation.com
W.Wadepohl at ieee.org
WWW http://www.ek-automation.com
http://www.indumat.de
Diese Nachricht ist keine geschäftliche Mitteilung i. S. des EHUG.
Bitte senden Sie mir keine Word- oder PowerPoint- (tm Microsoft) Anhänge.
Senden Sie mir einfachen Text, HTML oder PDF.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3210 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.rtems.org/pipermail/users/attachments/20070515/f5b7da4c/attachment-0001.bin>
More information about the users
mailing list