how to cionvert slow code to fasr code

Status
Not open for further replies.

Maharshi

Newbie level 3
Joined
Apr 26, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,328
I want to perform
a=b+c
d=e-f

my code is

Code:
LW Rb,b
LW Rc,c
ADD Ra,Rb,Rc
SW a,Ra
LW Re,e
LW Rf,f
SUB Rd,Re,Rf
SW d,Rd

I want to convert above slow code to fast code.
What should I do?
 

which controller you are using??
 

My general experience is that you seldom gain much from optimising such things, first hit the algorithm this is almost always where the big wins are, then only if the profiler indicates that such code is a major hotspot should you eveb think about optimising it.

Time to hit the processor manuals to see what pipeline and parallel execution tricks you can play, iff after thinking about the algorithm carefully you still need to tune this tiny snippet (The surrounding code is likely to still be in the pipelne so you will need to consider at least a few instructions either side (Probably the loop preamble and postamble, this is in a tighr loop, correct?).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…