On 07/08/2011 06:55 AM, Dirk Zimoch wrote:
Till Straumann wrote:
Certainly, both CPUs support the mandatory PPC UISA instruction set.
Hence, if you compile code with -mcpu=powerpc then it should execute
on either of the CPUs.
However, the 604 e.g., implements fsqrt/fsrqts (FP square-root in
hardware) which are enabled when you compile with
-mdouble-float/-msingle-float (or implicitly when you use -mcpu=604)
There may be other optional instructions that the 604 has and the
603 does not and which you may want to use if you have a 604.
Does that mean that sqrt() is slower on a ppc604 when I use
vxWorks-ppc32 because the hardware square root is not used?
Dirk
I don't know how vxWorks-ppc32 was compiled but I would assume so,
yes.
T.
PS:
#include <math.h>
double
test(double x)
{
return sqrt(x);
}
Compiling with -mpowerpc-gpopt (note that even though the
gcc manual says that this option is automatically enabled
based on -mcpu=xxx this seems not to be true for all
CPUs that actually implement HW fsqrt):
test:
fsqrt 0,1
fcmpu 7,0,0
mflr 0
stwu 1,-8(1)
stw 0,12(1)
beq- 7,.L2
bl sqrt
fmr 0,1
.L2:
lwz 0,12(1)
fmr 1,0
addi 1,1,8
mtlr 0
blr
The math library routine is still invoked but only
in the case of fsqrt producing NaN - I guess in
order to handle the error in a standard way.
Compiling with -mpowerpc yields:
test:
mflr 0
stwu 1,-16(1)
stw 0,20(1)
bl sqrt
lwz 0,20(1)
addi 1,1,16
mtlr 0
blr
- References:
- PPC603 / PPC604 differences? Dirk Zimoch
- Re: PPC603 / PPC604 differences? Andrew Johnson
- Re: PPC603 / PPC604 differences? Till Straumann
- Re: PPC603 / PPC604 differences? Dirk Zimoch
- Navigate by Date:
- Prev:
Re: PPC603 / PPC604 differences? Dirk Zimoch
- Next:
Pcas is a Python binding to portable channel access server Wang Xiaoqiang
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: PPC603 / PPC604 differences? Dirk Zimoch
- Next:
AreaDetector CBF file writing plugin emma.shepherd
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|