flat assembler
Message board for the users of flat assembler.

Index > Main > point of nop?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
vid wrote:
revolution: I think sooner, during or early after pipelining was introduced, so that "xchg eax, eax" doesn't mark EAX as modified. But I never cared too much about optimization stuff, maybe generic xchg pipeline-optimization handling is smart enough not to cause problems with this?
You might be right. But philosophically speaking there would be very little return to the designers to optimise nop decoding. I remember that AMD went to great lengths in their first AMD64 manual to explain that nop was now a "true" nop that did not update EAX (and thus would not zero the high order RAX bits). That said to me that x86-64 forced them to start decoding 0x90 as a true nop. Of course Intel may have followed a different path and decided to optimise nop earlier.

But I've yet to see any properly optimised code that uses nops in the critical loop, so optimisation of nop is kind of wasted effort for the CPU makers. And indeed some programs actually want nop to be unoptimised and use up time so as to create a delay.
Post 24 Nov 2010, 00:17
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
a standardised delay nop can be a fun thing.

for exemple, if intel decide to create a time instruction.

for example:
1 nop = 50 nanoseconds 0.01%

or somethin else.
and then, no matter the time needed by others parts of code. this 50 nanosecond delay (20MHz fixed clock) will be very fun for many purposes.

and if nop can use rep prefix? lol.
and rep can use an argument (operand)

Code:
rep 45 nop
    
Post 24 Nov 2010, 00:37
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 709
Location: Adelaide
sinsi
"rep nop" is now the "pause" instruction.
Post 24 Nov 2010, 00:54
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3050
Location: vpcmipstrm
bitRAKE
Modern NOP only consumes decode resources of the processor - it must be optimized in some way for that to happen. Even in the latest processors NOP is used for timing. Albeit rare cases where it is needed.
Quote:
Using an instruction with operand-size prefix and modr/m that starts at offset 14, add a NOP before the instruction or re-schedule the instructions to change the 0x66-prefix instruction alignment.
Post 24 Nov 2010, 06:51
View user's profile Send private message Visit poster's website Reply with quote
nop



Joined: 01 Sep 2008
Posts: 165
Location: right here left there
nop
its nice of you all to talk so much about me but i believe i have some more uses that nobody has really mentioned yet Cool
Post 01 Dec 2010, 00:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.