public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50281] New: result registers are overwritten giving incorrect result
@ 2011-09-03 0:52 NickParker at Eaton dot com
2011-09-03 1:07 ` [Bug inline-asm/50281] " pinskia at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 0:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
Bug #: 50281
Summary: result registers are overwritten giving incorrect
result
Classification: Unclassified
Product: gcc
Version: 4.3.3
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: NickParker@Eaton.com
Application code
bool8_t testMaths(void)
{
uint32_t result1_u4;
uint32_t result2_u4;
int32_t result1_s4;
int32_t result2_s4;
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
// Multiplying U3s
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
result1_u4 = MulU3U3S3(16777215L,100L); // should be around 100
PutImmediateString(ECU_COMMS,"\r\nmulu3u3s3 : [ ");
PrintINT4(ECU_COMMS, 16777215L, 'D',0);
PutImmediateString(ECU_COMMS," ] x [");
PrintINT4(ECU_COMMS, 100L, 'D',0);
PutImmediateString(ECU_COMMS," ] = [");
PrintINT4(ECU_COMMS, result1_u4, 'D',0);
PutImmediateString(ECU_COMMS," ]");
.
.
.
.
}
/***************************************************************************
* MulU3U3S3()
* ------------
* Function: Multiplies two unsigned 24bit max values,
* then shifts left by 2^24
***************************************************************************/
uint32_t MulU3U3S3(uint32_t a_u4, uint32_t b_u4)
{
uint32_t answer;
asm volatile
(
"push r0" "\n\t"
"push r1" "\n\t"
"clr r20" "\n\t" // zero register
// 0 byte shifts
"mul %A1,%A2" "\n\t" // a1a2
"mov r2,r0" "\n\t"
"mov r3,r1" "\n\t"
// 1 byte shifts
"mul %A1,%B2" "\n\t"
"add r3,r0" "\n\t"
"adc r4,r1" "\n\t"
"adc r5,r20" "\n\t"
"mul %A2,%B1" "\n\t"
"add r3,r0" "\n\t"
"adc r4,r1" "\n\t"
"adc r5,r20" "\n\t"
// 2 byte shifts
"mul %A1,%C2" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r20" "\n\t"
"mul %A2,%C1" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r20" "\n\t"
"mul %B2,%B1" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r20" "\n\t"
// 3 byte shifts
"mul %B1,%C2" "\n\t"
"add r5,r0" "\n\t"
"adc r6,r1" "\n\t"
"adc r7,r20" "\n\t"
"mul %B2,%C1" "\n\t"
"add r5,r0" "\n\t"
"adc r6,r1" "\n\t"
"adc r7,r20" "\n\t"
// 4 byte shifts
"mul %C2,%C1" "\n\t"
"add r6,r0" "\n\t"
"adc r7,r1" "\n\t"
"mov %A0,r5" "\n\t"
"mov %B0,r6" "\n\t"
"mov %C0,r7" "\n\t"
"clr %D0" "\n\t"
//"adc %G0,r20" "\n\t"
"pop r1" "\n\t"
"pop r0" "\n\t"
: "=&r" (answer)
: "r" (a_u4), "r" (b_u4)
: "r2","r3","r4","r5","r6","r7","r20"
);
return (answer);
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug inline-asm/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
@ 2011-09-03 1:07 ` pinskia at gcc dot gnu.org
2011-09-03 1:09 ` [Bug c/50281] " NickParker at Eaton dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-03 1:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |inline-asm
Severity|major |normal
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
2011-09-03 1:07 ` [Bug inline-asm/50281] " pinskia at gcc dot gnu.org
@ 2011-09-03 1:09 ` NickParker at Eaton dot com
2011-09-03 1:11 ` [Bug target/50281] " pinskia at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 1:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
NickParker at Eaton dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|inline-asm |c
Severity|normal |major
--- Comment #1 from NickParker at Eaton dot com 2011-09-03 01:09:21 UTC ---
top level function to test mulu3u3s3 function and print result
-----------------------------------------------------------------------------
932 .LM119:
933 0478 6FEF ldi r22,lo8(16777215)
934 047a 7FEF ldi r23,hi8(16777215)
935 047c 8FEF ldi r24,hlo8(16777215)
936 047e 90E0 ldi r25,hhi8(16777215)
937 0480 24E6 ldi r18,lo8(100)
938 0482 30E0 ldi r19,hi8(100)
939 0484 40E0 ldi r20,hlo8(100)
940 0486 50E0 ldi r21,hhi8(100)
941 0488 0E94 0000 call MulU3U3S3
942 048c 6B01 movw r12,r22
943 048e 7C01 movw r14,r24
944 .LVL128:
945 .LM120:
946 0490 80E0 ldi r24,lo8(0)
947 0492 60E0 ldi r22,lo8(__c.2370)
948 0494 70E0 ldi r23,hi8(__c.2370)
949 0496 0E94 0000 call PutFlashString
950 .LM121:
951 049a 80E0 ldi r24,lo8(0)
952 049c 4FEF ldi r20,lo8(16777215)
953 049e 5FEF ldi r21,hi8(16777215)
954 04a0 6FEF ldi r22,hlo8(16777215)
955 04a2 70E0 ldi r23,hhi8(16777215)
956 04a4 24E4 ldi r18,lo8(68)
957 04a6 0E94 0000 call PrintINT4
958 .LM122:
959 04aa 80E0 ldi r24,lo8(0)
960 04ac 60E0 ldi r22,lo8(__c.2372)
961 04ae 70E0 ldi r23,hi8(__c.2372)
962 04b0 0E94 0000 call PutFlashString
963 .LM123:
964 04b4 80E0 ldi r24,lo8(0)
965 04b6 44E6 ldi r20,lo8(100)
966 04b8 50E0 ldi r21,hi8(100)
967 04ba 60E0 ldi r22,hlo8(100)
968 04bc 70E0 ldi r23,hhi8(100)
969 04be 24E4 ldi r18,lo8(68)
970 04c0 0E94 0000 call PrintINT4
971 .LM124:
972 04c4 80E0 ldi r24,lo8(0)
973 04c6 60E0 ldi r22,lo8(__c.2374)
974 04c8 70E0 ldi r23,hi8(__c.2374)
975 04ca 0E94 0000 call PutFlashString
976 .LM125:
977 04ce 80E0 ldi r24,lo8(0)
978 04d0 B701 movw r22,r14
979 04d2 A601 movw r20,r12
980 04d4 24E4 ldi r18,lo8(68)
981 04d6 0E94 0000 call PrintINT4
982 .LM126:
983 04da 80E0 ldi r24,lo8(0)
984 04dc 60E0 ldi r22,lo8(__c.2376)
985 04de 70E0 ldi r23,hi8(__c.2376)
986 04e0 0E94 0000 call PutFlashString
---------------------maths code ------------------------------------
259 .global MulU3U3S3
261 MulU3U3S3:
262 .LFB8:
263 .LM19:
264 .LVL22:
265 00ee 2F92 push r2
266 00f0 3F92 push r3
267 00f2 4F92 push r4
268 00f4 5F92 push r5
269 00f6 6F92 push r6
270 00f8 7F92 push r7
271 00fa AF92 push r10
272 00fc EF92 push r14
273 00fe FF92 push r15
274 0100 0F93 push r16
275 0102 1F93 push r17
276 /* prologue: function */
277 /* frame size = 0 */
278 .LM20:
279 0104 7901 movw r14,r18
280 0106 8A01 movw r16,r20
281 /* #APP */
282 ; 324 "maths_mul.c" 1
283 0108 0F92 push r0
284 010a 1F92 push r1
285 010c AF92 push r10
286 010e AA24 clr r10
287 0110 6E9D mul r22,r14
288 0112 202C mov r2,r0
289 0114 312C mov r3,r1
290 0116 6F9D mul r22,r15
291 0118 300C add r3,r0
292 011a 411C adc r4,r1
293 011c 5A1C adc r5,r10
294 011e E79E mul r14,r23
295 0120 300C add r3,r0
296 0122 411C adc r4,r1
297 0124 5A1C adc r5,r10
298 0126 609F mul r22,r16
299 0128 400C add r4,r0
300 012a 511C adc r5,r1
301 012c 6A1C adc r6,r10
302 012e E89E mul r14,r24
303 0130 400C add r4,r0
304 0132 511C adc r5,r1
305 0134 6A1C adc r6,r10
306 0136 F79E mul r15,r23
307 0138 400C add r4,r0
308 013a 511C adc r5,r1
309 013c 6A1C adc r6,r10
310 013e 709F mul r23,r16
311 0140 500C add r5,r0
312 0142 611C adc r6,r1
313 0144 7A1C adc r7,r10
314 0146 F89E mul r15,r24
315 0148 500C add r5,r0
316 014a 611C adc r6,r1
317 014c 7A1C adc r7,r10
318 014e 089F mul r16,r24
319 0150 600C add r6,r0
320 0152 711C adc r7,r1
321 0154 252D mov r18,r5
322 0156 362D mov r19,r6
323 0158 472D mov r20,r7
324 015a 5527 clr r21
325 015c AF90 pop r10
326 015e 1F90 pop r1
327 0160 0F90 pop r0
328
329 ; 0 "" 2
330 .LVL23:
331 .LM21:
332 /* #NOAPP */
333 0162 B901 movw r22,r18
334 .LVL24:
335 0164 CA01 movw r24,r20
336 /* epilogue start */
337 0166 1F91 pop r17
338 0168 0F91 pop r16
339 016a FF90 pop r15
340 016c EF90 pop r14
341 016e AF90 pop r10
342 0170 7F90 pop r7
343 0172 6F90 pop r6
344 0174 5F90 pop r5
345 0176 4F90 pop r4
346 0178 3F90 pop r3
347 017a 2F90 pop r2
348 017c 0895 ret
-----used to print result but seems to munch it -------------------
3612 .global PrintINT4
3614 PrintINT4:
3615 .LFB24:
3616 .LM496:
3617 .LVL353:
3618 0f74 CF92 push r12
3619 0f76 DF92 push r13
3620 0f78 EF92 push r14
3621 0f7a FF92 push r15
3622 0f7c 0F93 push r16
3623 .LVL354:
3624 0f7e 1F93 push r17
3625 /* prologue: function */
3626 /* frame size = 0 */
3627 0f80 182F mov r17,r24
3628 0f82 6A01 movw r12,r20
3629 0f84 7B01 movw r14,r22
3630 .LM497:
3631 0f86 2434 cpi r18,lo8(68)
3632 0f88 01F0 breq .L395
3633 .LVL355:
3634 0f8a 2834 cpi r18,lo8(72)
3635 0f8c 01F0 breq .L417
3636 .LM498:
3637 0f8e 202F mov r18,r16
3638 .LVL356:
3639 0f90 0E94 0000 call PrintU4F
3640 /* epilogue start */
3641 .LM499:
3642 0f94 1F91 pop r17
3643 .LVL357:
3644 0f96 0F91 pop r16
3645 .LVL358:
3646 0f98 FF90 pop r15
3647 0f9a EF90 pop r14
3648 0f9c DF90 pop r13
3649 0f9e CF90 pop r12
3650 .LVL359:
3651 0fa0 0895 ret
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
2011-09-03 1:07 ` [Bug inline-asm/50281] " pinskia at gcc dot gnu.org
2011-09-03 1:09 ` [Bug c/50281] " NickParker at Eaton dot com
@ 2011-09-03 1:11 ` pinskia at gcc dot gnu.org
2011-09-03 1:13 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-03 1:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |target
Severity|major |normal
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (2 preceding siblings ...)
2011-09-03 1:11 ` [Bug target/50281] " pinskia at gcc dot gnu.org
@ 2011-09-03 1:13 ` pinskia at gcc dot gnu.org
2011-09-03 1:29 ` NickParker at Eaton dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-03 1:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-09-03 01:13:00 UTC ---
I think your inline-asm is broken.
You have:
: "=&r" (answer)
: "r" (a_u4), "r" (b_u4)
: "r2","r3","r4","r5","r6","r7","r20"
But you modify %1 and %2 which causes what you are seeing and GCC thinks your
inline-asm does not modify those registers.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (3 preceding siblings ...)
2011-09-03 1:13 ` pinskia at gcc dot gnu.org
@ 2011-09-03 1:29 ` NickParker at Eaton dot com
2011-09-03 1:30 ` NickParker at Eaton dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 1:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #3 from NickParker at Eaton dot com 2011-09-03 01:28:57 UTC ---
The final printed calculation result of MulU3U3S3() is wrong, because two of
the four result registers are incorrect and have been overwritten.
"mulu3u3s3 : [ +0016777215 ] x [+0000000100 ] = [+0010502615 ]"
I am wondering if the CPU is running out of registers?
Because I have found stepping through that the calcualtion is actually working
correctly
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (4 preceding siblings ...)
2011-09-03 1:29 ` NickParker at Eaton dot com
@ 2011-09-03 1:30 ` NickParker at Eaton dot com
2011-09-03 1:32 ` NickParker at Eaton dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 1:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #4 from NickParker at Eaton dot com 2011-09-03 01:30:26 UTC ---
Hi Andrew,
Can you please explain what you mean by %1 and %2. Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (5 preceding siblings ...)
2011-09-03 1:30 ` NickParker at Eaton dot com
@ 2011-09-03 1:32 ` NickParker at Eaton dot com
2011-09-03 1:39 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 1:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #5 from NickParker at Eaton dot com 2011-09-03 01:32:20 UTC ---
Sorry. I pasted a broken version. Before. Code below works.
uint32_t MulU3U3S3(uint32_t a_u4, uint32_t b_u4)
{
//uint32_t answer;
asm volatile
(
"push r0" "\n\t"
"push r1" "\n\t"
"push r10" "\n\t"
"clr r10" "\n\t" // zero register
// 0 byte shifts
"mul %A1,%A2" "\n\t" // a1a2
"mov r2,r0" "\n\t"
"mov r3,r1" "\n\t"
// 1 byte shifts
"mul %A1,%B2" "\n\t"
"add r3,r0" "\n\t"
"adc r4,r1" "\n\t"
"adc r5,r10" "\n\t"
"mul %A2,%B1" "\n\t"
"add r3,r0" "\n\t"
"adc r4,r1" "\n\t"
"adc r5,r10" "\n\t"
// 2 byte shifts
"mul %A1,%C2" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r10" "\n\t"
"mul %A2,%C1" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r10" "\n\t"
"mul %B2,%B1" "\n\t"
"add r4,r0" "\n\t"
"adc r5,r1" "\n\t"
"adc r6,r10" "\n\t"
// 3 byte shifts
"mul %B1,%C2" "\n\t"
"add r5,r0" "\n\t"
"adc r6,r1" "\n\t"
"adc r7,r10" "\n\t"
"mul %B2,%C1" "\n\t"
"add r5,r0" "\n\t"
"adc r6,r1" "\n\t"
"adc r7,r10" "\n\t"
// 4 byte shifts
"mul %C2,%C1" "\n\t"
"add r6,r0" "\n\t"
"adc r7,r1" "\n\t"
"mov %A0,r5" "\n\t"
"mov %B0,r6" "\n\t"
"mov %C0,r7" "\n\t"
"clr %D0" "\n\t"
//"adc %G0,r20" "\n\t"
"pop r10" "\n\t"
"pop r1" "\n\t"
"pop r0" "\n\t"
: "=&r" (answer)
: "r" (a_u4), "r" (b_u4)
: "r2","r3","r4","r5","r6","r7","r10"
);
return (answer);
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (6 preceding siblings ...)
2011-09-03 1:32 ` NickParker at Eaton dot com
@ 2011-09-03 1:39 ` pinskia at gcc dot gnu.org
2011-09-03 4:45 ` NickParker at Eaton dot com
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-03 1:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-09-03 01:38:44 UTC ---
Oh the real issue is that the : "r" (a_u4), "r" (b_u4)
Those two arguments could be in r0 or r1. Also the generated asm does not
correspond to the source you gave as there is an extra push/pop r10.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (7 preceding siblings ...)
2011-09-03 1:39 ` pinskia at gcc dot gnu.org
@ 2011-09-03 4:45 ` NickParker at Eaton dot com
2011-09-03 4:47 ` NickParker at Eaton dot com
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 4:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #7 from NickParker at Eaton dot com 2011-09-03 04:45:08 UTC ---
Please ignore the r10/r20 guff I was experimenting. I later realised the
muls3s3u3 code gives the right answer, the problem occurs later on somehow
Nick.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (8 preceding siblings ...)
2011-09-03 4:45 ` NickParker at Eaton dot com
@ 2011-09-03 4:47 ` NickParker at Eaton dot com
2011-09-03 8:50 ` rguenth at gcc dot gnu.org
2011-09-04 21:22 ` NickParker at Eaton dot com
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-03 4:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #8 from NickParker at Eaton dot com 2011-09-03 04:46:45 UTC ---
Please ignore the r10/r20 guff I was experimenting. I later realised the
muls3s3u3 code gives the right answer, the problem occurs later on somehow the
registers where the results are are getting walked on.
Nick.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (9 preceding siblings ...)
2011-09-03 4:47 ` NickParker at Eaton dot com
@ 2011-09-03 8:50 ` rguenth at gcc dot gnu.org
2011-09-04 21:22 ` NickParker at Eaton dot com
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-03 8:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-03 08:50:27 UTC ---
bogus asm
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/50281] result registers are overwritten giving incorrect result
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
` (10 preceding siblings ...)
2011-09-03 8:50 ` rguenth at gcc dot gnu.org
@ 2011-09-04 21:22 ` NickParker at Eaton dot com
11 siblings, 0 replies; 13+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-04 21:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50281
--- Comment #10 from NickParker at Eaton dot com 2011-09-04 21:22:30 UTC ---
Richard, 'bogus' isnt a technical term I'm familiar with - I'm not entirely
sure
what you mean, however, I have found the problem with my ASM code.
If you'll notice I am adding partial products to r4,r5,r6,r7 without them ever
being initialised. What was missing was initialistion of the temporary result
registers r4,r5,r6,r7 where I am generating my result.
After adding these initialisatons, and also a few "movw's" for a few less
cycles in a couple of places, the code now works correctly.
Thanks for your input and sorry that I made a mess of reporting this bug, which
was nothing to do with the compiler.
Thanks, Nick.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-09-04 21:22 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-03 0:52 [Bug c/50281] New: result registers are overwritten giving incorrect result NickParker at Eaton dot com
2011-09-03 1:07 ` [Bug inline-asm/50281] " pinskia at gcc dot gnu.org
2011-09-03 1:09 ` [Bug c/50281] " NickParker at Eaton dot com
2011-09-03 1:11 ` [Bug target/50281] " pinskia at gcc dot gnu.org
2011-09-03 1:13 ` pinskia at gcc dot gnu.org
2011-09-03 1:29 ` NickParker at Eaton dot com
2011-09-03 1:30 ` NickParker at Eaton dot com
2011-09-03 1:32 ` NickParker at Eaton dot com
2011-09-03 1:39 ` pinskia at gcc dot gnu.org
2011-09-03 4:45 ` NickParker at Eaton dot com
2011-09-03 4:47 ` NickParker at Eaton dot com
2011-09-03 8:50 ` rguenth at gcc dot gnu.org
2011-09-04 21:22 ` NickParker at Eaton dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).