about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-08-17 18:33:45 +0930
committerAlan Modra <amodra@gmail.com>2013-10-04 10:37:27 +0930
commitfef13a78ea30d4c26d6bab48d731ebe864ee31b0 (patch)
tree70cd6df48dfa14c09a960187e63e56a53ead0b78
parent76a66d510a3737674563133a420f4fd22da42c1b (diff)
downloadglibc-fef13a78ea30d4c26d6bab48d731ebe864ee31b0.tar.gz
glibc-fef13a78ea30d4c26d6bab48d731ebe864ee31b0.tar.xz
glibc-fef13a78ea30d4c26d6bab48d731ebe864ee31b0.zip
PowerPC floating point little-endian [15 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00206.html

The union loses when little-endian.

	* sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_NOW):
	Don't use a union to pack hi/low value.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/powerpc/powerpc32/power4/hp-timing.h21
2 files changed, 14 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f84a9e4acd..89f51054e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-04  Alan Modra  <amodra@gmail.com>
+
+	* sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_NOW):
+	Don't use a union to pack hi/low value.
+
 2013-10-04  Anton Blanchard <anton@au1.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Correct float constants
diff --git a/sysdeps/powerpc/powerpc32/power4/hp-timing.h b/sysdeps/powerpc/powerpc32/power4/hp-timing.h
index 7d6c96e9e9..4e42374eae 100644
--- a/sysdeps/powerpc/powerpc32/power4/hp-timing.h
+++ b/sysdeps/powerpc/powerpc32/power4/hp-timing.h
@@ -87,18 +87,15 @@ typedef unsigned long long int hp_timing_t;
 
 #define HP_TIMING_NOW(Var)						\
   do {									\
-        union { long long ll; long ii[2]; } _var;			\
-	long tmp;							\
-        __asm__ __volatile__ (						\
-		"1:	mfspr	%0,269;"				\
-		"	mfspr	%1,268;"				\
-		"	mfspr	%2,269;"				\
-		"	cmpw	%0,%2;"					\
-		"	bne	1b;"					\
-		: "=r" (_var.ii[0]), "=r" (_var.ii[1]) , "=r" (tmp)	\
-		: : "cr0"						\
-		);							\
-	Var = _var.ll;							\
+    unsigned int hi, lo, tmp;						\
+    __asm__ __volatile__ ("1:	mfspr	%0,269;"			\
+			  "	mfspr	%1,268;"			\
+			  "	mfspr	%2,269;"			\
+			  "	cmpw	%0,%2;"				\
+			  "	bne	1b;"				\
+			  : "=&r" (hi), "=&r" (lo), "=&r" (tmp)		\
+			  : : "cr0");					\
+    Var = ((hp_timing_t) hi << 32) | lo;				\
   } while (0)