Linux MIPS Architecture development
 help / color / mirror / Atom feed
* GCC 3.4.5 and mftc0
@ 2007-12-14  9:49 Mikael Starvik
  2007-12-14  9:49 ` Mikael Starvik
  2007-12-14 16:26 ` Ralf Baechle
  0 siblings, 2 replies; 5+ messages in thread
From: Mikael Starvik @ 2007-12-14  9:49 UTC (permalink / raw)
  To: linux-mips

mftc0() is implemented as
 
 .word ...
  move %0, $1

With at least gcc 3.4.5 the move is implemented as an addu %0, $1, $0.
But in the MIPS sumulator this fails and %0 gets the value 0xffffffff.
Implementing this as a or %0, $1, $0 instead gives the expected result.

Any suggestions where the problem is and what the correct solution is?

After fixing this my next problem is that IPIs doesn't reach all TCs
correctly (it seams like the code doesn't detect IXMT status correctly,
but I am still investigating). It is likely that it is caused by
something similar to the problem above.

Regards
/Mikael

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

* GCC 3.4.5 and mftc0
  2007-12-14  9:49 GCC 3.4.5 and mftc0 Mikael Starvik
@ 2007-12-14  9:49 ` Mikael Starvik
  2007-12-14 16:26 ` Ralf Baechle
  1 sibling, 0 replies; 5+ messages in thread
From: Mikael Starvik @ 2007-12-14  9:49 UTC (permalink / raw)
  To: linux-mips

mftc0() is implemented as
 
 .word ...
  move %0, $1

With at least gcc 3.4.5 the move is implemented as an addu %0, $1, $0.
But in the MIPS sumulator this fails and %0 gets the value 0xffffffff.
Implementing this as a or %0, $1, $0 instead gives the expected result.

Any suggestions where the problem is and what the correct solution is?

After fixing this my next problem is that IPIs doesn't reach all TCs
correctly (it seams like the code doesn't detect IXMT status correctly,
but I am still investigating). It is likely that it is caused by
something similar to the problem above.

Regards
/Mikael

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

* Re: GCC 3.4.5 and mftc0
  2007-12-14  9:49 GCC 3.4.5 and mftc0 Mikael Starvik
  2007-12-14  9:49 ` Mikael Starvik
@ 2007-12-14 16:26 ` Ralf Baechle
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2007-12-14 16:26 UTC (permalink / raw)
  To: Mikael Starvik; +Cc: linux-mips

On Fri, Dec 14, 2007 at 10:49:40AM +0100, Mikael Starvik wrote:

> mftc0() is implemented as
>  
>  .word ...
>   move %0, $1
> 
> With at least gcc 3.4.5 the move is implemented as an addu %0, $1, $0.
> But in the MIPS sumulator this fails and %0 gets the value 0xffffffff.
> Implementing this as a or %0, $1, $0 instead gives the expected result.

I wonder what "sumulator" you're using ...

Addu is a perfectly fine implementation of move for 32-bit code.  It's not
for 64-bit code but that's beside the point here.  The or method is also
correct but historically the add instruction has been prefered, also
because some processor - the R4300 afair - processes arithmetic instructions
(add, sub that is not mul / div) faster than logic operations.

> Any suggestions where the problem is and what the correct solution is?

Fix the sumulator.

> After fixing this my next problem is that IPIs doesn't reach all TCs
> correctly (it seams like the code doesn't detect IXMT status correctly,
> but I am still investigating). It is likely that it is caused by
> something similar to the problem above.

The code certainly works on real silicon, so the cause must be something
local to your environment.

Cheers,

  Ralf

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

* RE: GCC 3.4.5 and mftc0
       [not found] <BFECAF9E178F144FAEF2BF4CE739C668056FE63A@exmail1.se.axis.com>
@ 2007-12-17  6:45 ` Mikael Starvik
  2007-12-17  6:45   ` Mikael Starvik
  0 siblings, 1 reply; 5+ messages in thread
From: Mikael Starvik @ 2007-12-17  6:45 UTC (permalink / raw)
  To: 'Ralf Baechle', Mikael Starvik; +Cc: linux-mips

Thanks!

and sorry for the spelling of simulator.

/Mikael

-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org] 
Sent: Friday, December 14, 2007 5:26 PM
To: Mikael Starvik
Cc: linux-mips@linux-mips.org
Subject: Re: GCC 3.4.5 and mftc0


On Fri, Dec 14, 2007 at 10:49:40AM +0100, Mikael Starvik wrote:

> mftc0() is implemented as
>  
>  .word ...
>   move %0, $1
> 
> With at least gcc 3.4.5 the move is implemented as an addu %0, $1, $0.
> But in the MIPS sumulator this fails and %0 gets the value 0xffffffff.
> Implementing this as a or %0, $1, $0 instead gives the expected result.

I wonder what "sumulator" you're using ...

Addu is a perfectly fine implementation of move for 32-bit code.  It's not
for 64-bit code but that's beside the point here.  The or method is also
correct but historically the add instruction has been prefered, also
because some processor - the R4300 afair - processes arithmetic instructions
(add, sub that is not mul / div) faster than logic operations.

> Any suggestions where the problem is and what the correct solution is?

Fix the sumulator.

> After fixing this my next problem is that IPIs doesn't reach all TCs
> correctly (it seams like the code doesn't detect IXMT status correctly,
> but I am still investigating). It is likely that it is caused by
> something similar to the problem above.

The code certainly works on real silicon, so the cause must be something
local to your environment.

Cheers,

  Ralf

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

* RE: GCC 3.4.5 and mftc0
  2007-12-17  6:45 ` Mikael Starvik
@ 2007-12-17  6:45   ` Mikael Starvik
  0 siblings, 0 replies; 5+ messages in thread
From: Mikael Starvik @ 2007-12-17  6:45 UTC (permalink / raw)
  To: 'Ralf Baechle', Mikael Starvik; +Cc: linux-mips

Thanks!

and sorry for the spelling of simulator.

/Mikael

-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org] 
Sent: Friday, December 14, 2007 5:26 PM
To: Mikael Starvik
Cc: linux-mips@linux-mips.org
Subject: Re: GCC 3.4.5 and mftc0


On Fri, Dec 14, 2007 at 10:49:40AM +0100, Mikael Starvik wrote:

> mftc0() is implemented as
>  
>  .word ...
>   move %0, $1
> 
> With at least gcc 3.4.5 the move is implemented as an addu %0, $1, $0.
> But in the MIPS sumulator this fails and %0 gets the value 0xffffffff.
> Implementing this as a or %0, $1, $0 instead gives the expected result.

I wonder what "sumulator" you're using ...

Addu is a perfectly fine implementation of move for 32-bit code.  It's not
for 64-bit code but that's beside the point here.  The or method is also
correct but historically the add instruction has been prefered, also
because some processor - the R4300 afair - processes arithmetic instructions
(add, sub that is not mul / div) faster than logic operations.

> Any suggestions where the problem is and what the correct solution is?

Fix the sumulator.

> After fixing this my next problem is that IPIs doesn't reach all TCs
> correctly (it seams like the code doesn't detect IXMT status correctly,
> but I am still investigating). It is likely that it is caused by
> something similar to the problem above.

The code certainly works on real silicon, so the cause must be something
local to your environment.

Cheers,

  Ralf

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

end of thread, other threads:[~2007-12-17  6:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14  9:49 GCC 3.4.5 and mftc0 Mikael Starvik
2007-12-14  9:49 ` Mikael Starvik
2007-12-14 16:26 ` Ralf Baechle
     [not found] <BFECAF9E178F144FAEF2BF4CE739C668056FE63A@exmail1.se.axis.com>
2007-12-17  6:45 ` Mikael Starvik
2007-12-17  6:45   ` Mikael Starvik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox