-Os results in less size but more executing time compared with -O2 and -Os vs. -os
Hi all,
two questions as follows:
1) I find that compile option -Os results in less size but more executing time compared with -O2, the test data is like :
armcc_o2 0xa6d0 + 0x84 13.6k
gcc_o2 0x6e39 + 0x7d 16.7k
gcc_os 0xa141 + 0x86 11.8k
i'd like to know why the elf with more instructions consume less time, and whether the result is reasonable?
2)I used -o2/os as compile option, today i use -O2/Os, it is OK:
00000bf6 <copy_info>:
bf6: f9b1 3000 ldrsh.w r3, [r1]
bfa: f9b1 1002 ldrsh.w r1, [r1, #2]
bfe: 8003 strh r3, [r0, #0]
c00: 8041 strh r1, [r0, #2]
c02: 4770 bx lr
while i use -o2/os, it results in:
00000dc0 <copy_info>:
dc0: b480 push {r7}
dc2: b083 sub sp, #12
dc4: af00 add r7, sp, #0
dc6: 6078 str r0, [r7, #4]
dc8: 6039 str r1, [r7, #0]
dca: 683b ldr r3, [r7, #0]
dcc: f9b3 2000 ldrsh.w r2, [r3]
dd0: 687b ldr r3, [r7, #4]
dd2: 801a strh r2, [r3, #0]
dd4: 683b ldr r3, [r7, #0]
dd6: f9b3 2002 ldrsh.w r2, [r3, #2]
dda: 687b ldr r3, [r7, #4]
ddc: 805a strh r2, [r3, #2]
dde: bf00 nop
de0: 370c adds r7, #12
de2: 46bd mov sp, r7
de4: bc80 pop {r7}
de6: 4770 bx lr
so, what's fxxxing difference between lowercase 'o' and uppercase 'O'??
if the lowercase 'o' is useless, why doesn't the compiler warn us?
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Thomas Preud'homme
- Solved:
- Last query:
- Last reply: