
Originally Posted by
I C everything
Yep... Try to compile the same code for i386 (or x86, as you called) and you'll get:
Code:
section .text
_multiplyByTwo:
fld QWORD [esp+4]
fadd st, st(0)
ret
section .rdata
LC2:
db `double your salary is %.3f\n`, 0
section .text
extern printf
global _main
_main:
push ebp
mov ebp, esp
and esp, -16
sub esp, 16
call ___main
mov DWORD [esp+4], -1030792151
mov DWORD [esp+8], 1087904981
mov DWORD [esp], .LC2
call _printf
xor eax, eax
leave
ret
_multiplyByTwo isn't called by _main and the direct doubled value is pushed before printf. No 'local vars' are pushed!
Let's try with ARM AArch32, shall we?
Code:
.cpu cortex-a53
.arm
.fpu vfp
.section .text
.extern printf
multiplyByTwo:
vadd.f64 d0, d0, d0
bx lr
.global main
main:
push {r4, lr}
movw r0, #:lower16:.LC1
movt r0, #:upper16:.LC1
movw r2, #23593
movt r2, 49807
movw r3, #7381
movt r3, 16600
bl printf
mov r0, #0
pop {r4, pc}
.section .rodata
.LC1:
.ascii "double your salary is %.3f\012\000"
Still... no multiplyByTwo call and still no 'local var' pushing...