public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Universality of nop
@ 2014-08-20 19:31 Joel Sherrill
  2014-08-20 19:38 ` Paul_Koning
  2014-08-20 22:13 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 7+ messages in thread
From: Joel Sherrill @ 2014-08-20 19:31 UTC (permalink / raw)
  To: binutils, Christian Svensson, Hesham Moustafa

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? :)

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 19:31 Universality of nop Joel Sherrill
@ 2014-08-20 19:38 ` Paul_Koning
  2014-08-20 19:45   ` Joel Sherrill
  2014-08-20 22:13 ` Hans-Peter Nilsson
  1 sibling, 1 reply; 7+ messages in thread
From: Paul_Koning @ 2014-08-20 19:38 UTC (permalink / raw)
  To: joel.sherrill; +Cc: binutils, christian, heshamelmatary


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”?

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.)

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.

	paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 19:38 ` Paul_Koning
@ 2014-08-20 19:45   ` Joel Sherrill
  2014-08-20 19:56     ` Paul_Koning
  0 siblings, 1 reply; 7+ messages in thread
From: Joel Sherrill @ 2014-08-20 19:45 UTC (permalink / raw)
  To: Paul_Koning; +Cc: binutils, christian, heshamelmatary


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 19:45   ` Joel Sherrill
@ 2014-08-20 19:56     ` Paul_Koning
  0 siblings, 0 replies; 7+ messages in thread
From: Paul_Koning @ 2014-08-20 19:56 UTC (permalink / raw)
  To: joel.sherrill; +Cc: binutils, christian, heshamelmatary


On Aug 20, 2014, at 3:45 PM, Joel Sherrill <joel.sherrill@OARcorp.com> wrote:

> 
> 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.

That would be a pretty reasonable thing to do.  It could at least be a builtin macro.  The only way to get into trouble is if an ISA had “nop” as an opcode that means something other than “do nothing”.  I can’t think of any machine where that applies.

	paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 19:31 Universality of nop Joel Sherrill
  2014-08-20 19:38 ` Paul_Koning
@ 2014-08-20 22:13 ` Hans-Peter Nilsson
  2014-08-20 22:19   ` Hans-Peter Nilsson
  1 sibling, 1 reply; 7+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-20 22:13 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: binutils, Christian Svensson, Hesham Moustafa

On Wed, 20 Aug 2014, Joel Sherrill 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?

No, binutils-hackers don't have (should not claim) that say.
If you want to provide a mostly-universal pseudo-op ".nop",
that'd be fine (mostly, as the target environment should have
first say about its semantics - it may have claimed that
pseudo-op), but introducing an actual universal instruction with
certain semantics is unacceptable.

> Or did we just get lucky
> 17 times? :)

Yes.

brgds, H-P

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 22:13 ` Hans-Peter Nilsson
@ 2014-08-20 22:19   ` Hans-Peter Nilsson
  2014-08-20 22:38     ` Joel Sherrill
  0 siblings, 1 reply; 7+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-20 22:19 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: binutils, Christian Svensson, Hesham Moustafa

On Wed, 20 Aug 2014, Hans-Peter Nilsson wrote:
> On Wed, 20 Aug 2014, Joel Sherrill wrote:
> > Or did we just get lucky
> > 17 times? :)
>
> Yes.

See also gcc/gcc/configure.ac@r214168:4341, selecting a "nop"
for testing gcc_cv_as_dwarf2_debug_line.

brgds, H-P

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Universality of nop
  2014-08-20 22:19   ` Hans-Peter Nilsson
@ 2014-08-20 22:38     ` Joel Sherrill
  0 siblings, 0 replies; 7+ messages in thread
From: Joel Sherrill @ 2014-08-20 22:38 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils, Christian Svensson, Hesham Moustafa


On 8/20/2014 5:18 PM, Hans-Peter Nilsson wrote:
> On Wed, 20 Aug 2014, Hans-Peter Nilsson wrote:
>> On Wed, 20 Aug 2014, Joel Sherrill wrote:
>>> Or did we just get lucky
>>> 17 times? :)
>> Yes.
> See also gcc/gcc/configure.ac@r214168:4341, selecting a "nop"
> for testing gcc_cv_as_dwarf2_debug_line.
Thanks. Hesham and I will check into adapting that for the RTEMS testsuite.
> brgds, H-P

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-20 22:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 19:31 Universality of nop Joel Sherrill
2014-08-20 19:38 ` Paul_Koning
2014-08-20 19:45   ` Joel Sherrill
2014-08-20 19:56     ` Paul_Koning
2014-08-20 22:13 ` Hans-Peter Nilsson
2014-08-20 22:19   ` Hans-Peter Nilsson
2014-08-20 22:38     ` Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).