This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Universality of nop
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "Paul_Koning at Dell dot com" <Paul_Koning at Dell dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, "christian at cmd dot nu" <christian at cmd dot nu>, "heshamelmatary at gmail dot com" <heshamelmatary at gmail dot com>
- Date: Wed, 20 Aug 2014 14:45:18 -0500
- Subject: Re: Universality of nop
- Authentication-results: sourceware.org; auth=none
- References: <53F4F786 dot 1010809 at oarcorp dot com> <2F9D3218-3619-472A-90EC-EC478A440D4F at dell dot com>
On 8/20/2014 2:38 PM, Paul_Koning@Dell.com wrote:
> On Aug 20, 2014, at 3:31 PM, Joel Sherrill <joel.sherrill@OARcorp.com> wrote:
>
>> Hi
>>
>> In getting RTEMS and tests to build for the or1k, Hesham ran into
>> test which had inline assembly for "nop". or1k does not have nop
>> defined. Interestingly, this has not been a problem on the 17 other
>> architectures we build RTEMS for.
>>
>> Should all targets have a nop instruction? Or did we just get lucky
>> 17 times? :)
> Do you mean “an instruction that does not touch the system state in a way that matters”? Or do you mean “an instruction like that, whose assembly language mnemonic is NOP”?
Well in this case, I mean the actual mnemonic NOP. I realize you can
always do
something like "mov register to same register" and do nothing. And the x86
has nop-like instructions of varying lengths.
> I don’t think it makes sense to count on the no operation instruction to be called “nop”. I can think of at least a couple of machines (thought not RTEMS targets) where there is no such mnemonic. It’s probably true that for every machine you can find something that has the behavior you want, but it might not have the same name. (It might be “skip” or “jfcl”, or “no” for example.)
I think it is likely always true. I was hoping for either the
architecture itself used nop
or binutils decided it would always provide nop as a pseudo-mnemonic.
In the event binutils wants a target to always accept a nop mnemonic,
then that
would be a bug in the new or1k gas support.
> You might have one of your platform header files define a macro which is “suitable asm for NOP”. Or the name of the no operation instruction, whichever is more convenient.
Yeah. I realized we could do that but had trouble believing we had 17 other
architectures which actually defined nop. That's like playing black 17
times in
roulette. :)
Unless someone else speaks up to the contrary, just conditionalize the code
Hesham. We can discuss over on rtems mailing lists whether we want to
put this
somewhere more appropriate than in the middle of a test.
Thanks Paul
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985