linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* 'bx lr' vs 'mov pc,lr'
@ 2009-09-13 21:55 Felipe Contreras
  2009-09-13 22:15 ` Daniel Silverstone
  2009-09-13 22:58 ` Russell King - ARM Linux
  0 siblings, 2 replies; 11+ messages in thread
From: Felipe Contreras @ 2009-09-13 21:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
the place, but I can't find out what's the reason.

-- 
Felipe Contreras

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 21:55 'bx lr' vs 'mov pc,lr' Felipe Contreras
@ 2009-09-13 22:15 ` Daniel Silverstone
  2009-09-13 22:56   ` Felipe Contreras
  2009-09-13 22:58 ` Russell King - ARM Linux
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Silverstone @ 2009-09-13 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
> the place, but I can't find out what's the reason.

I'd guess at the reason being that not all ARM processors whose ports use
arch/arm/lib/delay.S support the bx instruction, whereas the 'mov pc, lr'
instruction is universally supported.

D.

-- 
Daniel Silverstone                              http://www.simtec.co.uk/

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 22:15 ` Daniel Silverstone
@ 2009-09-13 22:56   ` Felipe Contreras
  2009-09-13 23:01     ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Felipe Contreras @ 2009-09-13 22:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 1:15 AM, Daniel Silverstone
<dsilvers@simtec.co.uk> wrote:
> On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
>> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
>> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
>> the place, but I can't find out what's the reason.
>
> I'd guess at the reason being that not all ARM processors whose ports use
> arch/arm/lib/delay.S support the bx instruction, whereas the 'mov pc, lr'
> instruction is universally supported.

Are there really processors that don't support 'bx'? Can you give some examples?

-- 
Felipe Contreras

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 21:55 'bx lr' vs 'mov pc,lr' Felipe Contreras
  2009-09-13 22:15 ` Daniel Silverstone
@ 2009-09-13 22:58 ` Russell King - ARM Linux
  2009-09-14  0:11   ` Felipe Contreras
  1 sibling, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2009-09-13 22:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
> the place, but I can't find out what's the reason.

Why do you want bx?  bx isn't available on older CPUs.

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 22:56   ` Felipe Contreras
@ 2009-09-13 23:01     ` Russell King - ARM Linux
  2009-09-14  0:11       ` Felipe Contreras
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2009-09-13 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 01:56:16AM +0300, Felipe Contreras wrote:
> On Mon, Sep 14, 2009 at 1:15 AM, Daniel Silverstone
> <dsilvers@simtec.co.uk> wrote:
> > On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
> >> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
> >> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
> >> the place, but I can't find out what's the reason.
> >
> > I'd guess at the reason being that not all ARM processors whose ports use
> > arch/arm/lib/delay.S support the bx instruction, whereas the 'mov pc, lr'
> > instruction is universally supported.
> 
> Are there really processors that don't support 'bx'? Can you give some examples?

Any ARMv3 CPU and any ARMv4 which doesn't support Thumb.  Eg, StrongARM.

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 22:58 ` Russell King - ARM Linux
@ 2009-09-14  0:11   ` Felipe Contreras
  2009-09-14  0:20     ` Jamie Lokier
  0 siblings, 1 reply; 11+ messages in thread
From: Felipe Contreras @ 2009-09-14  0:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 1:58 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
>> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
>> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
>> the place, but I can't find out what's the reason.
>
> Why do you want bx? ?bx isn't available on older CPUs.

Isn't it faster? I don't know if it would make sense to try it on newer CPUs.

-- 
Felipe Contreras

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-13 23:01     ` Russell King - ARM Linux
@ 2009-09-14  0:11       ` Felipe Contreras
  0 siblings, 0 replies; 11+ messages in thread
From: Felipe Contreras @ 2009-09-14  0:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 2:01 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Mon, Sep 14, 2009 at 01:56:16AM +0300, Felipe Contreras wrote:
>> On Mon, Sep 14, 2009 at 1:15 AM, Daniel Silverstone
>> <dsilvers@simtec.co.uk> wrote:
>> > On Mon, Sep 14, 2009 at 12:55:24AM +0300, Felipe Contreras wrote:
>> >> I noticed that in 'arch/arm/lib/delay.S' we are using 'mov pc, lr'
>> >> instead of 'bx lr'. Why? It looks like 'mov pc, lr' is used all over
>> >> the place, but I can't find out what's the reason.
>> >
>> > I'd guess at the reason being that not all ARM processors whose ports use
>> > arch/arm/lib/delay.S support the bx instruction, whereas the 'mov pc, lr'
>> > instruction is universally supported.
>>
>> Are there really processors that don't support 'bx'? Can you give some examples?
>
> Any ARMv3 CPU and any ARMv4 which doesn't support Thumb. ?Eg, StrongARM.

Ok. Thanks.

-- 
Felipe Contreras

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-14  0:11   ` Felipe Contreras
@ 2009-09-14  0:20     ` Jamie Lokier
  2009-09-14  1:47       ` Felipe Contreras
  0 siblings, 1 reply; 11+ messages in thread
From: Jamie Lokier @ 2009-09-14  0:20 UTC (permalink / raw)
  To: linux-arm-kernel

Felipe Contreras wrote:
> > Why do you want bx? ?bx isn't available on older CPUs.
> 
> Isn't it faster? I don't know if it would make sense to try it on
> newer CPUs.

That's interesting.  Do you know if it's faster?

-- Jamie

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-14  0:20     ` Jamie Lokier
@ 2009-09-14  1:47       ` Felipe Contreras
  2009-09-14  7:35         ` Uwe Kleine-König
  0 siblings, 1 reply; 11+ messages in thread
From: Felipe Contreras @ 2009-09-14  1:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 3:20 AM, Jamie Lokier <jamie@shareable.org> wrote:
> Felipe Contreras wrote:
>> > Why do you want bx? ?bx isn't available on older CPUs.
>>
>> Isn't it faster? I don't know if it would make sense to try it on
>> newer CPUs.
>
> That's interesting. ?Do you know if it's faster?

Nope, I'm assuming because of this:
http://newsgroups.derkeiler.com/Archive/Comp/comp.sys.arm/2006-04/msg00031.html

-- 
Felipe Contreras

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-14  1:47       ` Felipe Contreras
@ 2009-09-14  7:35         ` Uwe Kleine-König
  2009-09-14 12:59           ` Felipe Contreras
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2009-09-14  7:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2009 at 04:47:35AM +0300, Felipe Contreras wrote:
> On Mon, Sep 14, 2009 at 3:20 AM, Jamie Lokier <jamie@shareable.org> wrote:
> > Felipe Contreras wrote:
> >> > Why do you want bx? ?bx isn't available on older CPUs.
> >>
> >> Isn't it faster? I don't know if it would make sense to try it on
> >> newer CPUs.
> >
> > That's interesting. ?Do you know if it's faster?
> 
> Nope, I'm assuming because of this:
> http://newsgroups.derkeiler.com/Archive/Comp/comp.sys.arm/2006-04/msg00031.html

For ARM9EJ-S the docs can be found at

	http://infocenter.arm.com/help/topic/com.arm.doc.ddi0222b/I1028171.html

.  bx takes 3 cycles, mov (with dest=pc) takes 4 cycles.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* 'bx lr' vs 'mov pc,lr'
  2009-09-14  7:35         ` Uwe Kleine-König
@ 2009-09-14 12:59           ` Felipe Contreras
  0 siblings, 0 replies; 11+ messages in thread
From: Felipe Contreras @ 2009-09-14 12:59 UTC (permalink / raw)
  To: linux-arm-kernel

2009/9/14 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> On Mon, Sep 14, 2009 at 04:47:35AM +0300, Felipe Contreras wrote:
>> On Mon, Sep 14, 2009 at 3:20 AM, Jamie Lokier <jamie@shareable.org> wrote:
>> > Felipe Contreras wrote:
>> >> > Why do you want bx? ?bx isn't available on older CPUs.
>> >>
>> >> Isn't it faster? I don't know if it would make sense to try it on
>> >> newer CPUs.
>> >
>> > That's interesting. ?Do you know if it's faster?
>>
>> Nope, I'm assuming because of this:
>> http://newsgroups.derkeiler.com/Archive/Comp/comp.sys.arm/2006-04/msg00031.html
>
> For ARM9EJ-S the docs can be found at
>
> ? ? ? ?http://infocenter.arm.com/help/topic/com.arm.doc.ddi0222b/I1028171.html
>
> . ?bx takes 3 cycles, mov (with dest=pc) takes 4 cycles.

Couldn't we have a 'return' macro that uses the relevant one?

-- 
Felipe Contreras

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

end of thread, other threads:[~2009-09-14 12:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-13 21:55 'bx lr' vs 'mov pc,lr' Felipe Contreras
2009-09-13 22:15 ` Daniel Silverstone
2009-09-13 22:56   ` Felipe Contreras
2009-09-13 23:01     ` Russell King - ARM Linux
2009-09-14  0:11       ` Felipe Contreras
2009-09-13 22:58 ` Russell King - ARM Linux
2009-09-14  0:11   ` Felipe Contreras
2009-09-14  0:20     ` Jamie Lokier
2009-09-14  1:47       ` Felipe Contreras
2009-09-14  7:35         ` Uwe Kleine-König
2009-09-14 12:59           ` Felipe Contreras

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 NNTP newsgroup(s).