]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Restrict xssqrtqp operands to Vector Registers (bug 21941)
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Mon, 7 Aug 2017 12:14:14 +0000 (09:14 -0300)
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Thu, 10 Aug 2017 19:10:21 +0000 (16:10 -0300)
POWER ISA 3.0 introduces the xssqrtqp instructions, which expects
operands to be in Vector Registers (Altivec/VMX), even though this
instruction belongs to the Vector-Scalar Instruction Set.

In GCC's Extended Assembly for POWER, the 'wq' register constraint is
provided for use with IEEE 754 128-bit floating-point values.  However,
this constraint does not limit the register allocation to Vector
Registers (Altivec/VMX) and could assign a Vector-Scalar Register (VSX)
to the operands of the instruction.

This patch changes the register constraint used in sqrtf128 from 'wq' to
'v', in order to request a Vector Register (Altivec/VMX) for use with
the xssqrtqp instruction.

Tested for powerpc64le and --with-cpu=power9.

[BZ #21941]
* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
xssqrtqp requires operands to be in Vector Registers
(Altivec/VMX), replace the register constraint 'wq' with 'v'.
* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
(__ieee754_sqrtf128): Likewise.

ChangeLog
sysdeps/powerpc/fpu/math_private.h
sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c

index e5e36a40e6f8a39e4471b15032b20a2101b7993e..50db77f49ae8fd31d8707ef24abd506b83ad7de4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-08-10  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+
+       [BZ #21941]
+       * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
+       xssqrtqp requires operands to be in Vector Registers
+       (Altivec/VMX), replace the register constraint 'wq' with 'v'.
+       * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
+       (__ieee754_sqrtf128): Likewise.
+
 2017-08-10  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * sysdeps/aarch64/memcmp.S (memcmp):
index d8fd4923ac136af305f75b0c4a130bcc9ca6bc6e..396fd0562eda2f64bc5858a8e90b94cf5028f28b 100644 (file)
@@ -30,7 +30,7 @@ extern __always_inline _Float128
 __ieee754_sqrtf128 (_Float128 __x)
 {
   _Float128 __z;
-  asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x));
+  asm ("xssqrtqp %0,%1" : "=v" (__z) : "v" (__x));
   return __z;
 }
 #endif
index 769d3f8922013d4f975f792f3707b2baacf1b28b..59fd8269f52434f959b3642201fec27011e13c83 100644 (file)
@@ -30,7 +30,7 @@ __float128
 __ieee754_sqrtf128 (__float128 a)
 {
   __float128 z;
-  asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a));
+  asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a));
   return z;
 }
 strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)