|
|
5de29b |
# commit 603e84104cdc709c8e7dcbac54b9a585bf8dff78
|
|
|
5de29b |
# Author: Alan Modra <amodra@gmail.com>
|
|
|
5de29b |
# Date: Sat Aug 17 18:29:43 2013 +0930
|
|
|
5de29b |
#
|
|
|
5de29b |
# PowerPC floating point little-endian [9 of 15]
|
|
|
5de29b |
# http://sourceware.org/ml/libc-alpha/2013-07/msg00200.html
|
|
|
5de29b |
#
|
|
|
5de29b |
# This works around the fact that vsx is disabled in current
|
|
|
5de29b |
# little-endian gcc. Also, float constants take 4 bytes in memory
|
|
|
5de29b |
# vs. 16 bytes for vector constants, and we don't need to write one lot
|
|
|
5de29b |
# of masks for double (register format) and another for float (mem
|
|
|
5de29b |
# format).
|
|
|
5de29b |
#
|
|
|
5de29b |
# * sysdeps/powerpc/fpu/s_float_bitwise.h (__float_and_test28): Don't
|
|
|
5de29b |
# use vector int constants.
|
|
|
5de29b |
# (__float_and_test24, __float_and8, __float_get_exp): Likewise.
|
|
|
5de29b |
#
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h
|
|
|
12745e |
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h 2014-05-27 22:37:18.000000000 -0500
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h 2014-05-27 22:37:20.000000000 -0500
|
|
|
5de29b |
@@ -23,18 +23,19 @@
|
|
|
5de29b |
#include <math_private.h>
|
|
|
5de29b |
|
|
|
5de29b |
/* Returns (int)(num & 0x7FFFFFF0 == value) */
|
|
|
5de29b |
-static inline
|
|
|
5de29b |
-int __float_and_test28 (float num, float value)
|
|
|
5de29b |
+static inline int
|
|
|
5de29b |
+__float_and_test28 (float num, float value)
|
|
|
5de29b |
{
|
|
|
5de29b |
float ret;
|
|
|
5de29b |
#ifdef _ARCH_PWR7
|
|
|
5de29b |
- vector int mask = (vector int) {
|
|
|
5de29b |
- 0x7ffffffe, 0x00000000, 0x00000000, 0x0000000
|
|
|
5de29b |
- };
|
|
|
5de29b |
+ union {
|
|
|
5de29b |
+ int i;
|
|
|
5de29b |
+ float f;
|
|
|
5de29b |
+ } mask = { .i = 0x7ffffff0 };
|
|
|
5de29b |
__asm__ (
|
|
|
5de29b |
- /* the 'f' constrain is use on mask because we just need
|
|
|
5de29b |
+ /* the 'f' constraint is used on mask because we just need
|
|
|
5de29b |
* to compare floats, not full vector */
|
|
|
5de29b |
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
|
|
5de29b |
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
|
|
|
5de29b |
);
|
|
|
5de29b |
#else
|
|
|
5de29b |
int32_t inum;
|
|
|
5de29b |
@@ -46,16 +47,17 @@
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
/* Returns (int)(num & 0x7FFFFF00 == value) */
|
|
|
5de29b |
-static inline
|
|
|
5de29b |
-int __float_and_test24 (float num, float value)
|
|
|
5de29b |
+static inline int
|
|
|
5de29b |
+__float_and_test24 (float num, float value)
|
|
|
5de29b |
{
|
|
|
5de29b |
float ret;
|
|
|
5de29b |
#ifdef _ARCH_PWR7
|
|
|
5de29b |
- vector int mask = (vector int) {
|
|
|
5de29b |
- 0x7fffffe0, 0x00000000, 0x00000000, 0x0000000
|
|
|
5de29b |
- };
|
|
|
5de29b |
+ union {
|
|
|
5de29b |
+ int i;
|
|
|
5de29b |
+ float f;
|
|
|
5de29b |
+ } mask = { .i = 0x7fffff00 };
|
|
|
5de29b |
__asm__ (
|
|
|
5de29b |
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
|
|
5de29b |
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
|
|
|
5de29b |
);
|
|
|
5de29b |
#else
|
|
|
5de29b |
int32_t inum;
|
|
|
5de29b |
@@ -67,16 +69,17 @@
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
/* Returns (float)(num & 0x7F800000) */
|
|
|
5de29b |
-static inline
|
|
|
5de29b |
-float __float_and8 (float num)
|
|
|
5de29b |
+static inline float
|
|
|
5de29b |
+__float_and8 (float num)
|
|
|
5de29b |
{
|
|
|
5de29b |
float ret;
|
|
|
5de29b |
#ifdef _ARCH_PWR7
|
|
|
5de29b |
- vector int mask = (vector int) {
|
|
|
5de29b |
- 0x7ff00000, 0x00000000, 0x00000000, 0x00000000
|
|
|
5de29b |
- };
|
|
|
5de29b |
+ union {
|
|
|
5de29b |
+ int i;
|
|
|
5de29b |
+ float f;
|
|
|
5de29b |
+ } mask = { .i = 0x7f800000 };
|
|
|
5de29b |
__asm__ (
|
|
|
5de29b |
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
|
|
5de29b |
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
|
|
|
5de29b |
);
|
|
|
5de29b |
#else
|
|
|
5de29b |
int32_t inum;
|
|
|
5de29b |
@@ -88,17 +91,18 @@
|
|
|
5de29b |
}
|
|
|
5de29b |
|
|
|
5de29b |
/* Returns ((int32_t)(num & 0x7F800000) >> 23) */
|
|
|
5de29b |
-static inline
|
|
|
5de29b |
-int32_t __float_get_exp (float num)
|
|
|
5de29b |
+static inline int32_t
|
|
|
5de29b |
+__float_get_exp (float num)
|
|
|
5de29b |
{
|
|
|
5de29b |
int32_t inum;
|
|
|
5de29b |
#ifdef _ARCH_PWR7
|
|
|
5de29b |
float ret;
|
|
|
5de29b |
- vector int mask = (vector int) {
|
|
|
5de29b |
- 0x7ff00000, 0x00000000, 0x00000000, 0x00000000
|
|
|
5de29b |
- };
|
|
|
5de29b |
+ union {
|
|
|
5de29b |
+ int i;
|
|
|
5de29b |
+ float f;
|
|
|
5de29b |
+ } mask = { .i = 0x7f800000 };
|
|
|
5de29b |
__asm__ (
|
|
|
5de29b |
- "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
|
|
5de29b |
+ "xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask.f)
|
|
|
5de29b |
);
|
|
|
5de29b |
GET_FLOAT_WORD(inum, ret);
|
|
|
5de29b |
#else
|