Re: Do "nops" add to the latency of a program?
- From: "William J. Leary Jr." <spamtrap@xxxxxxxxxx>
- Date: Wed, 25 Oct 2006 09:10:22 -0400
"Trev" <spamtrap@xxxxxxxxxx> wrote in message
news:1161762646.213676.217050@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
William J. Leary Jr. wrote:
"Trev" <spamtrap@xxxxxxxxxx> wrote in message
news:1161699912.543439.125810@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,
My compiled program has had a few nops put in the listing, and I've
noted a few places where nops could be used, eg:
push 5
pop edi
cmp eda, edi
which I can shorten to cmp eda, 5.
What's "EDA" by the way? I don't recall running into that one before.
Sorry, got my names a bit muddled.
No problem.
Thanks for your replies by the way,
I was just wondering why extraneous operations were put in the listing.
I think I know now. (Still a lot
to learn!)
Well, there's one other reason I haven't seen mentioned. History. The above
sequence may have originally had other instructions in it which, over time,
were removed by the developer. Like this:
push 5
call adjust_parameter ; Adjusts value, if it's out of range for this pass
pop edi
cmp edx, edi
But later on discovered that the adjust_parameter function wasn't necessary and
removed it and the call. But he or she may not have noticed that the remainder
of the sequence was no longer necessary.
Another reason can be experience. If the operation on an earlier version of
the CPU could only be done in a round-about way, they might still code the
round about way even if newer ones can do it more directly. I find myself
doing this second from time to time. I did a lot of 8086 assembler
programming. As I started working on later versions, but not a LOT of
programmingon them, even when I was in .386 mode, I often remembered, almost by
reflex, the limitations of the 8086 and did round-about things when a direct
approach was available.
- Bill
.
- References:
- Re: Do "nops" add to the latency of a program?
- From: William J. Leary Jr.
- Re: Do "nops" add to the latency of a program?
- From: Trev
- Re: Do "nops" add to the latency of a program?
- Prev by Date: Re: How interrupts work (x86 vs. C64)
- Next by Date: Re: how to decide the value of SF
- Previous by thread: Re: Do "nops" add to the latency of a program?
- Next by thread: free Intel Disassembler for download
- Index(es):
Relevant Pages
|