Created
December 29, 2013 02:19
-
-
Save whyrusleeping/8166744 to your computer and use it in GitHub Desktop.
Test of ways of negating a number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.align 2 | |
.global main | |
.type main, %function | |
main: | |
@ args = 0, pretend = 0, frame = 8 | |
@ frame_needed = 1, uses_anonymous_args = 0 | |
@ link register save eliminated. | |
str fp, [sp, #-4]! | |
add fp, sp, #0 | |
sub sp, sp, #12 | |
mov r3, #0 | |
str r3, [fp, #-8] | |
b .L2 | |
.L3: | |
ldr r3, [fp, #-8] | |
rsb r3, r3, #0 | |
str r3, [fp, #-12] | |
ldr r3, [fp, #-8] | |
add r3, r3, #1 | |
str r3, [fp, #-8] | |
.L2: | |
ldr r2, [fp, #-8] | |
movw r3, #38527 | |
movt r3, 152 | |
cmp r2, r3 | |
ble .L3 | |
mov r3, #0 | |
mov r0, r3 | |
add sp, fp, #0 | |
ldmfd sp!, {fp} | |
bx lr | |
.size main, .-main | |
.ident "GCC: (GNU) 4.7.2" | |
.section .note.GNU-stack,"",%progbits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { | |
int i; | |
int b; | |
for (i = 0; i < 10000000; i++) { | |
b = 0 - i; | |
//b = -1 * i; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment