Comparing Modern x86 and ARM Assembly Language

CS 641 Lecture, Dr. Lawlor

First, a quick recap of the world's major current CPU architectures (plus MIPS).

x86 32-bit
x86 64-bit
ARM PowerPC MIPS
Classification
CISC (variable length)
RISC (4 byte instructions)
Register Count
8
16
16
32
32
Return Value Register
eax
rax
r0
%r3
$2
First argument
[esp+4]
rdi
r0
%r3
$4
Second argument
[esp+8]
rsi
r1
%r4
$5
Function call
call
call
bl
bl
jalr
Function return
ret
ret
bx lr
blr
jr $31
Stack pointer
esp
rsp
sp
%r1
$29
Constants 5 or $5 5 or $5 #5 5
5
Assembly comment
;
;
@
#
#
Load constant
mov
mov
mov
li
li
Memory Load
mov
mov
ldr
lwz
lw
Memory Store
mov
mov
str
stw
sw
Created by:
Intel
AMD
Acorn
IBM
Stanford
  creation year:
1970's
2003
1983
1990's
1980's
Used inside:
All mainstream PCs,
original xBox
iPhone,
iPad, ...
PS3,
xBox 360,
old Macs
NU64,
old SGI

Comparing performance of equivalent assembly language sequences, you can work out that:
ARM:
mov r4, #1000 @ counter

mov r0, #7
start:
add r0,r0, #7

sub r4,r4,#1
cmp r4,#0
bge start

bx lr

(Try this in NetRun now!)

The same code, for x86:
mov ecx, 1000 ; counter

mov eax,7
start:
add eax, 7

sub ecx,1
cmp ecx,0
jge start
ret

(Try this in NetRun now!)

Overall, x86 is much faster; but both the Atom and Q6600 are clocked 4x faster, and use exponentially more power.  My ARM system uses 3W for everything; my Atom takes about 30W, and my desktop is nearly 100W!