* Disabling lwl and lwr instruction generation
@ 2003-03-12 18:05 Ranjan Parthasarathy
2003-03-13 0:43 ` Ralf Baechle
0 siblings, 1 reply; 13+ messages in thread
From: Ranjan Parthasarathy @ 2003-03-12 18:05 UTC (permalink / raw)
To: 'linux-mips@linux-mips.org'
Is there a way to tell gcc to not generate the lwl, lwr instructions?
Thanks
Ranjan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-12 18:05 Disabling lwl and lwr instruction generation Ranjan Parthasarathy
@ 2003-03-13 0:43 ` Ralf Baechle
2003-03-13 0:50 ` Richard Hodges
2003-03-13 0:52 ` Thiemo Seufer
0 siblings, 2 replies; 13+ messages in thread
From: Ralf Baechle @ 2003-03-13 0:43 UTC (permalink / raw)
To: Ranjan Parthasarathy; +Cc: 'linux-mips@linux-mips.org'
On Wed, Mar 12, 2003 at 10:05:20AM -0800, Ranjan Parthasarathy wrote:
> Is there a way to tell gcc to not generate the lwl, lwr instructions?
Gcc will only ever generate these instructions when __attribute__((unaligned))
is used.
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 0:43 ` Ralf Baechle
@ 2003-03-13 0:50 ` Richard Hodges
2003-03-13 1:33 ` Ralf Baechle
2003-03-13 15:07 ` Zhang Fuxin
2003-03-13 0:52 ` Thiemo Seufer
1 sibling, 2 replies; 13+ messages in thread
From: Richard Hodges @ 2003-03-13 0:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Ranjan Parthasarathy, 'linux-mips@linux-mips.org'
On Thu, 13 Mar 2003, Ralf Baechle wrote:
> On Wed, Mar 12, 2003 at 10:05:20AM -0800, Ranjan Parthasarathy wrote:
>
> > Is there a way to tell gcc to not generate the lwl, lwr instructions?
>
> Gcc will only ever generate these instructions when __attribute__((unaligned))
> is used.
I got lwl and lwr from a memcpy() with two void pointers...
I quickly changed those to the (aligned) structure pointers instead, and
then memcpy() changed to ordinary word loads and stores.
So, is somebody starting a toolchain for that new Chinese CPU? :-)
-Richard
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 0:50 ` Richard Hodges
@ 2003-03-13 1:33 ` Ralf Baechle
2003-03-13 15:07 ` Zhang Fuxin
1 sibling, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2003-03-13 1:33 UTC (permalink / raw)
To: Richard Hodges; +Cc: Ranjan Parthasarathy, 'linux-mips@linux-mips.org'
On Wed, Mar 12, 2003 at 04:50:53PM -0800, Richard Hodges wrote:
> I got lwl and lwr from a memcpy() with two void pointers...
>
> I quickly changed those to the (aligned) structure pointers instead, and
> then memcpy() changed to ordinary word loads and stores.
>
> So, is somebody starting a toolchain for that new Chinese CPU? :-)
Wouldn't be the first processor without lwl/lwr instructions. There have
been a few that didn't implement it for silly bean^Wgate counting issues
others have done it for patent and licensing reasons.
(Afair MIPS's patent is about to expire and IBM's prior art patent in the
same area is even way older but that legalese ...)
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 0:50 ` Richard Hodges
2003-03-13 1:33 ` Ralf Baechle
@ 2003-03-13 15:07 ` Zhang Fuxin
1 sibling, 0 replies; 13+ messages in thread
From: Zhang Fuxin @ 2003-03-13 15:07 UTC (permalink / raw)
To: Richard Hodges
Cc: Ralf Baechle, Ranjan Parthasarathy,
'linux-mips@linux-mips.org'
Richard Hodges wrote:
>On Thu, 13 Mar 2003, Ralf Baechle wrote:
>
>
>
>>On Wed, Mar 12, 2003 at 10:05:20AM -0800, Ranjan Parthasarathy wrote:
>>
>>
>>
>>>Is there a way to tell gcc to not generate the lwl, lwr instructions?
>>>
>>>
>>Gcc will only ever generate these instructions when __attribute__((unaligned))
>>is used.
>>
>>
>
>I got lwl and lwr from a memcpy() with two void pointers...
>
>I quickly changed those to the (aligned) structure pointers instead, and
>then memcpy() changed to ordinary word loads and stores.
>
>So, is somebody starting a toolchain for that new Chinese CPU? :-)
>
>
I don't hear about it,but it will happen soon or later:)
We work around lwl/lwr problem by modifying toolchain from H.J. Lu's rh
port.
it seems that gcc will explicitly output lwl/lwr for unaligned block
copy,in other cases it will generate
ulW macros for gas to handle.
>-Richard
>
>
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 0:43 ` Ralf Baechle
2003-03-13 0:50 ` Richard Hodges
@ 2003-03-13 0:52 ` Thiemo Seufer
2003-03-13 1:18 ` Ralf Baechle
1 sibling, 1 reply; 13+ messages in thread
From: Thiemo Seufer @ 2003-03-13 0:52 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Ranjan Parthasarathy, 'linux-mips@linux-mips.org'
Ralf Baechle wrote:
> On Wed, Mar 12, 2003 at 10:05:20AM -0800, Ranjan Parthasarathy wrote:
>
> > Is there a way to tell gcc to not generate the lwl, lwr instructions?
>
> Gcc will only ever generate these instructions when __attribute__((unaligned))
> is used.
Which might be not that obvious, e.g. __attribute__((packed)) can cause such
instructions, too.
Thiemo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 0:52 ` Thiemo Seufer
@ 2003-03-13 1:18 ` Ralf Baechle
0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2003-03-13 1:18 UTC (permalink / raw)
To: Thiemo Seufer; +Cc: Ranjan Parthasarathy, 'linux-mips@linux-mips.org'
On Thu, Mar 13, 2003 at 01:52:03AM +0100, Thiemo Seufer wrote:
> > On Wed, Mar 12, 2003 at 10:05:20AM -0800, Ranjan Parthasarathy wrote:
> >
> > > Is there a way to tell gcc to not generate the lwl, lwr instructions?
> >
> > Gcc will only ever generate these instructions when __attribute__((unaligned))
> > is used.
>
> Which might be not that obvious, e.g. __attribute__((packed)) can cause such
> instructions, too.
Typo - I meant __attribute__((packed)). There is no such thing as
__attribute__((unaligned)).
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: Disabling lwl and lwr instruction generation
@ 2003-03-13 18:00 Ranjan Parthasarathy
2003-03-13 18:00 ` Ranjan Parthasarathy
0 siblings, 1 reply; 13+ messages in thread
From: Ranjan Parthasarathy @ 2003-03-13 18:00 UTC (permalink / raw)
To: Ralf Baechle, Richard Hodges; +Cc: linux-mips
Thanks for all your replies and no I am not working on the chinese processor :-). BTW it would be nice to have a mips option on override cpu options for disabling the lwl,lwr,swl,swr similar to "Cpu has ll/sc".
Thanks
Ranjan
-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Wednesday, March 12, 2003 5:34 PM
To: Richard Hodges
Cc: Ranjan Parthasarathy; 'linux-mips@linux-mips.org'
Subject: Re: Disabling lwl and lwr instruction generation
On Wed, Mar 12, 2003 at 04:50:53PM -0800, Richard Hodges wrote:
> I got lwl and lwr from a memcpy() with two void pointers...
>
> I quickly changed those to the (aligned) structure pointers instead, and
> then memcpy() changed to ordinary word loads and stores.
>
> So, is somebody starting a toolchain for that new Chinese CPU? :-)
Wouldn't be the first processor without lwl/lwr instructions. There have
been a few that didn't implement it for silly bean^Wgate counting issues
others have done it for patent and licensing reasons.
(Afair MIPS's patent is about to expire and IBM's prior art patent in the
same area is even way older but that legalese ...)
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: Disabling lwl and lwr instruction generation
2003-03-13 18:00 Ranjan Parthasarathy
@ 2003-03-13 18:00 ` Ranjan Parthasarathy
0 siblings, 0 replies; 13+ messages in thread
From: Ranjan Parthasarathy @ 2003-03-13 18:00 UTC (permalink / raw)
To: Ralf Baechle, Richard Hodges; +Cc: linux-mips
Thanks for all your replies and no I am not working on the chinese processor :-). BTW it would be nice to have a mips option on override cpu options for disabling the lwl,lwr,swl,swr similar to "Cpu has ll/sc".
Thanks
Ranjan
-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Wednesday, March 12, 2003 5:34 PM
To: Richard Hodges
Cc: Ranjan Parthasarathy; 'linux-mips@linux-mips.org'
Subject: Re: Disabling lwl and lwr instruction generation
On Wed, Mar 12, 2003 at 04:50:53PM -0800, Richard Hodges wrote:
> I got lwl and lwr from a memcpy() with two void pointers...
>
> I quickly changed those to the (aligned) structure pointers instead, and
> then memcpy() changed to ordinary word loads and stores.
>
> So, is somebody starting a toolchain for that new Chinese CPU? :-)
Wouldn't be the first processor without lwl/lwr instructions. There have
been a few that didn't implement it for silly bean^Wgate counting issues
others have done it for patent and licensing reasons.
(Afair MIPS's patent is about to expire and IBM's prior art patent in the
same area is even way older but that legalese ...)
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: Disabling lwl and lwr instruction generation
@ 2003-03-13 18:09 Ranjan Parthasarathy
2003-03-13 18:09 ` Ranjan Parthasarathy
2003-03-13 21:35 ` Ralf Baechle
0 siblings, 2 replies; 13+ messages in thread
From: Ranjan Parthasarathy @ 2003-03-13 18:09 UTC (permalink / raw)
To: Ralf Baechle, Richard Hodges; +Cc: linux-mips
From the gcc sources, the compiler generates the lwl,lwr etc. in the block move code in gcc/config/mips/mips.c ( output_block_move ).
There is an option -mmemcpy which tells gcc to use a memcpy compiled in with the sources for this block move instead of gcc genetrating code. The problem however with this is that arch/mips/lib/memcpy.S is optimized using lwl,lwr,swl,swr. If this can be modified so that lwl,lwr,swl,swr is used if enabled as a kernel option, it might work very well.
Any ideas / suggestions?
Thanks
Ranjan
-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Wednesday, March 12, 2003 5:34 PM
To: Richard Hodges
Cc: Ranjan Parthasarathy; 'linux-mips@linux-mips.org'
Subject: Re: Disabling lwl and lwr instruction generation
On Wed, Mar 12, 2003 at 04:50:53PM -0800, Richard Hodges wrote:
> I got lwl and lwr from a memcpy() with two void pointers...
>
> I quickly changed those to the (aligned) structure pointers instead, and
> then memcpy() changed to ordinary word loads and stores.
>
> So, is somebody starting a toolchain for that new Chinese CPU? :-)
Wouldn't be the first processor without lwl/lwr instructions. There have
been a few that didn't implement it for silly bean^Wgate counting issues
others have done it for patent and licensing reasons.
(Afair MIPS's patent is about to expire and IBM's prior art patent in the
same area is even way older but that legalese ...)
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: Disabling lwl and lwr instruction generation
2003-03-13 18:09 Ranjan Parthasarathy
@ 2003-03-13 18:09 ` Ranjan Parthasarathy
2003-03-13 21:35 ` Ralf Baechle
1 sibling, 0 replies; 13+ messages in thread
From: Ranjan Parthasarathy @ 2003-03-13 18:09 UTC (permalink / raw)
To: Ralf Baechle, Richard Hodges; +Cc: linux-mips
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 18:09 Ranjan Parthasarathy
2003-03-13 18:09 ` Ranjan Parthasarathy
@ 2003-03-13 21:35 ` Ralf Baechle
2003-03-14 0:21 ` Alan Cox
1 sibling, 1 reply; 13+ messages in thread
From: Ralf Baechle @ 2003-03-13 21:35 UTC (permalink / raw)
To: Ranjan Parthasarathy; +Cc: Richard Hodges, linux-mips
On Thu, Mar 13, 2003 at 10:09:03AM -0800, Ranjan Parthasarathy wrote:
> From the gcc sources, the compiler generates the lwl,lwr etc. in the block
> move code in gcc/config/mips/mips.c ( output_block_move ).
>
> There is an option -mmemcpy which tells gcc to use a memcpy compiled in
> with the sources for this block move instead of gcc genetrating code. The
> problem however with this is that arch/mips/lib/memcpy.S is optimized
> using lwl,lwr,swl,swr. If this can be modified so that lwl,lwr,swl,swr
> is used if enabled as a kernel option, it might work very well.
Replace those unaligned copies with a word-wise or even bytewise copying.
Not good for performance but ...
Ralf
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling lwl and lwr instruction generation
2003-03-13 21:35 ` Ralf Baechle
@ 2003-03-14 0:21 ` Alan Cox
0 siblings, 0 replies; 13+ messages in thread
From: Alan Cox @ 2003-03-14 0:21 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Ranjan Parthasarathy, Richard Hodges, linux-mips
On Thu, 2003-03-13 at 21:35, Ralf Baechle wrote:
> Replace those unaligned copies with a word-wise or even bytewise copying.
> Not good for performance but ...
Depends on (src^dest) & 3. Glibc may have the code you need to get it
right, although it will also depend on how smart the cpu cache is - if
you have a write through cache then shift/mask/write in 32/64 chunks
may be fastest
Alan
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2003-03-13 23:12 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-12 18:05 Disabling lwl and lwr instruction generation Ranjan Parthasarathy
2003-03-13 0:43 ` Ralf Baechle
2003-03-13 0:50 ` Richard Hodges
2003-03-13 1:33 ` Ralf Baechle
2003-03-13 15:07 ` Zhang Fuxin
2003-03-13 0:52 ` Thiemo Seufer
2003-03-13 1:18 ` Ralf Baechle
-- strict thread matches above, loose matches on Subject: below --
2003-03-13 18:00 Ranjan Parthasarathy
2003-03-13 18:00 ` Ranjan Parthasarathy
2003-03-13 18:09 Ranjan Parthasarathy
2003-03-13 18:09 ` Ranjan Parthasarathy
2003-03-13 21:35 ` Ralf Baechle
2003-03-14 0:21 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox