This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PowerPC, lroundl bug


Hi.

PowerPC assembler implementations of lroundl and llroundl functions use
cr3 and cr4 (which are non-volatile) without saving them. This brakes
some more complex code which requires those cr fields to be preserved.

[sparky@pepec glibc-2.8]$ find sysdeps/powerpc -name "s_*lround.S" | xargs grep cr3
sysdeps/powerpc/powerpc32/fpu/s_lround.S:	fcmpu	cr3, fp1, fp12	/* x is negative? x < 0.0  */
sysdeps/powerpc/powerpc32/fpu/s_lround.S:	bge	cr3,.Lconvert	/* x is positive so don't negate x.  */
sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S:	fcmpu	cr3,fp1,fp12 /* x is negative? x < 0.0  */
sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S:	bge	cr3,.Lconvert /* x is positive so don't negate x.  */
sysdeps/powerpc/powerpc64/fpu/s_llround.S:	fcmpu	cr3,fp1,fp12	/* x is negative? x < 0.0  */
sysdeps/powerpc/powerpc64/fpu/s_llround.S:	bge	cr3,.Lconvert	/* x is positive so don't negate x.  */

[sparky@pepec glibc-2.8]$ find sysdeps/powerpc -name "s_*lround.S" | xargs grep cr4
sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S:	fcmpu	cr4,fp2,fp9 /* if |x| >= 2^52  */
sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S:	bge-	cr4,.Lnobias /* 2^52 > x < -2^52 just convert with no bias.  */
sysdeps/powerpc/powerpc64/fpu/s_llround.S:	fcmpu	cr4,fp2,fp9	/* if |x| >= 2^52  */
sysdeps/powerpc/powerpc64/fpu/s_llround.S:	bge-	cr4,.Lnobias	/* 2^52 > x < -2^52 just convert with no bias.  */

[sparky@pepec glibc-2.8]$ find sysdeps/powerpc -name "s_*lround.S" | xargs grep mfcr

[sparky@pepec glibc-2.8]$ 


I can post the patch to fix it, but maybe someone should take a deeper
look how the broken code could get into glibc source.


Thanks and bye.


-- 
 ____  Sparky{PI] -- Przemyslaw _  ___  _  _  ........... LANG...Pl..Ca..Es..En
/____) ___  ___  _ _ || Iskra  |  | _ \| |  | : WWW........ppcrcd.pld-linux.org
\____\| -_)'___| ||^'||//\\// <   |  _/| |  | : JID......sparky<at>jabberes.org
(____/||   (_-_|_||  ||\\ ||   |_ |_|  |_| _| : Mail....sparky<at>pld-linux.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]