> Trust the compiler NO !
:-) -------------------------------------------------------------------- $ gcc -O3 -S test.c $ cat test.s .file "test.c" .text .p2align 4,,15 .globl uint32_read_unaligned .type uint32_read_unaligned, @function uint32_read_unaligned: pushl %ebp movl %esp, %ebp subl $16, %esp movl 8(%ebp), %eax movl (%eax), %eax leave ret .size uint32_read_unaligned, .-uint32_read_unaligned .ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5" .section .note.GNU-stack,"",@progbits ----------------------------------------------------------------------------------------- $ mips-linux-gcc -O3 -S test.c $ cat test.s .file 1 "test.c" .section .mdebug.abi32 .previous .abicalls .text .align 2 .globl uint32_read_unaligned .ent uint32_read_unaligned .type uint32_read_unaligned, @function uint32_read_unaligned: .frame $sp,24,$31 # vars= 8, regs= 1/0, args= 0, extra= 8 .mask 0x10000000,-8 .fmask 0x00000000,0 .set noreorder .cpload $25 .set reorder subu $sp,$sp,24 .cprestore 0 lwl $2,0($4) lwr $2,3($4) swl $2,8($sp) swr $2,11($sp) lw $2,8($sp) sw $28,16($sp) .set noreorder .set nomacro j $31 addu $sp,$sp,24 .set macro .set reorder .end uint32_read_unaligned .ident "GCC: (GNU) 3.3.6" ----------------------------------------------------------------------------------------- $ mips-linux-gnu-gcc -O3 -S test.c $ cat test.s .file 1 "test.c" .section .mdebug.abi32 .previous .gnu_attribute 4, 1 .abicalls .option pic0 .text .align 2 .globl uint32_read_unaligned .ent uint32_read_unaligned .type uint32_read_unaligned, @function uint32_read_unaligned: .set nomips16 .frame $sp,8,$31 # vars= 8, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro lwl $2,0($4) addiu $sp,$sp,-8 addiu $sp,$sp,8 j $31 lwr $2,3($4) .set macro .set reorder .end uint32_read_unaligned .ident "GCC: (Sourcery G++ Lite 4.3-154) 4.3.3" ----------------------------------------------------------------------------------------- $ arm-none-eabi-gcc -O3 -S test.c $ cat test.s .cpu arm7tdmi .fpu softvfp .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 1 .eabi_attribute 30, 2 .eabi_attribute 18, 4 .file "test.c" .text .align 2 .global uint32_read_unaligned .type uint32_read_unaligned, %function uint32_read_unaligned: @ Function supports interworking. @ args = 0, pretend = 0, frame = 8 @ frame_needed = 0, uses_anonymous_args = 0 str lr, [sp, #-4]! sub sp, sp, #12 mov r1, r0 mov r2, #4 add r0, sp, #4 bl memcpy ldr r0, [sp, #4] add sp, sp, #12 ldr lr, [sp], #4 bx lr .size uint32_read_unaligned, .-uint32_read_unaligned .ident "GCC: (GNU) 4.5.1" _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development