This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/50106] [ARM] Wrong code with -march=armv5t -mthumb -Os
- From: "sebastian dot huber at embedded-brains dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 20 Oct 2011 11:07:09 +0000
- Subject: [Bug target/50106] [ARM] Wrong code with -march=armv5t -mthumb -Os
- Auto-submitted: auto-generated
- References: <bug-50106-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50106
--- Comment #11 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2011-10-20 11:07:09 UTC ---
Thank you very much. With this change the GCC 4.6.2-RC-20111019 produces now
correct code in this case.
I know understand why the unused volatile registers are saved and restored.
This is to get rid of the arithmetic stack adjustments.
--- test.Os.GCC-4.5.s 2011-10-20 13:04:15.384638860 +0200
+++ test.Os.GCC-4.6.s 2011-10-20 13:04:15.396639237 +0200
@@ -17,32 +17,29 @@
.thumb_func
.type _GetIDS, %function
_GetIDS:
- push {lr}
- ldr r2, .L4
- sub sp, sp, #12
- ldr r2, [r2]
- mov r3, r0
+ push {r0, r1, r2, lr}
+ ldr r3, .L4
ldr r1, .L4+4
- add r0, sp, #4
- cmp r3, r2
+ ldr r3, [r3]
+ cmp r0, r3
bge .L2
- lsl r3, r3, #1
- add r1, r1, r3
+ lsl r0, r0, #1
+ add r1, r1, r0
.L2:
mov r2, #2
+ add r0, sp, #4
bl memcpy
add r3, sp, #4
ldrb r0, [r3, #1]
ldrb r2, [r3]
lsl r0, r0, #8
- add sp, sp, #12
- orr r0, r0, r2
+ orr r0, r2
@ sp needed for prologue
- pop {pc}
+ pop {r1, r2, r3, pc}
.L5:
.align 2
.L4:
.word _LIST_SIZE
.word _List
.size _GetIDS, .-_GetIDS
- .ident "GCC: (GNU) 4.5.4 20111013 (prerelease)"
+ .ident "GCC: (GNU) 4.6.2 20111019 (prerelease)"