Skip to Content
Computers as Components, 2nd Edition
book

Computers as Components, 2nd Edition

by Marilyn Wolf
July 2008
Intermediate to advanced
544 pages
16h 52m
English
Morgan Kaufmann
Content preview from Computers as Components, 2nd Edition
244 CHAPTER 5 Program Design and Analysis
1234
y
z
x
w
d
e
c
b
a
Compare the ARM assembly code for the two code fragments. We have written both
assuming that we have only four free registers. In the before version, we do not have to write
out any values, but we must read a and b twice. The after version allows us to retain all values
in registers as long as we need them.
Before version After version
LDR r0,a LDR r0,a
LDR r1,b LDR r1,b
ADD r2,r0,r1 ADD r2,r1,r0
STRr2,w;w=a+b STRr2,w;w=a+b
LDRr r0,c SUB r2,r0,r1
LDR r1,d STR r2,z;z=a–b
ADD r2,r0,r1 LDR r0,c
STRr2,x;x=c+d LDRr1,d
LDR r1,e ADD r2,r1,r0
ADD r0,r1,r2 STR r2,x;x=c+d
STRr0,y;y=x+e LDRr1,e
LDR r0,a ; reload
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computers as Components, 3rd Edition

Computers as Components, 3rd Edition

Marilyn Wolf
Computer System Designs: System-on-Chip

Computer System Designs: System-on-Chip

Michael J. Flynn, Wayne Luk
PC Hardware in a Nutshell, 3rd Edition

PC Hardware in a Nutshell, 3rd Edition

Robert Bruce Thompson, Barbara Fritchman Thompson

Publisher Resources

ISBN: 9780123743978