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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Fix powerpc inline fegetround


Hi!

GCC 4.1 seems to be optimizing more aggressively and on powerpc32
in test-i{float,double,ldoubl} happens to move over inlined
fegetround () across fesetround call (not inlined), which results
in not the saved, but the new rounding mode being restored, so many tests
fail.  The following patch fixes that, make check is clean again.

2006-02-03  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/powerpc/fpu/bits/fenvinline.h (fegetround): Make asm
	volatile.

--- libc/sysdeps/powerpc/fpu/bits/fenvinline.h.jj	2001-07-06 06:56:02.000000000 +0200
+++ libc/sysdeps/powerpc/fpu/bits/fenvinline.h	2006-02-03 23:12:18.000000000 +0100
@@ -1,5 +1,6 @@
 /* Inline floating-point environment handling functions for powerpc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,8 +23,9 @@
 /* Inline definition for fegetround.  */
 # define fegetround() \
   (__extension__  ({ int __fegetround_result;				      \
-		     __asm__ ("mcrfs 7,7 ; mfcr %0"			      \
-			     : "=r"(__fegetround_result) : : "cr7");	      \
+		     __asm__ __volatile__				      \
+		       ("mcrfs 7,7 ; mfcr %0"				      \
+			: "=r"(__fegetround_result) : : "cr7");		      \
 		     __fegetround_result & 3; }))
 
 /* The weird 'i#*X' constraints on the following suppress a gcc

	Jakub


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