On May  8, 2024, "Kewen.Lin" <li...@linux.ibm.com> wrote:

>>> How about the generic one "longdouble64"?  I did a grep and found it has one
>>> use, I'd expect it can work here. :)
>> 
>> ... since this and longdouble128 exist, maybe we can fix it and leave
>> them all alone, despite the interface oddity.
>> 
> ... personally I'm inclined to drop this 64 bit one. :)

Some of the asm opcodes expected by pr79004 depend on
-mlong-double-128 to be output.  E.g., without this flag, the
conditions of patterns @extenddf<mode>2 and extendsf<mode>2 do not
hold, and so GCC resorts to libcalls instead of even trying
rs6000_expand_float128_convert.

Perhaps the conditions are too strict, and they could enable the use
of conversion insns involving __ieee128/_Float128 even with 64-bit
long doubles.

For now, xfail the opcodes that are not available on longdouble64.

While at that, drop long_double_64bit, since it's broken and sort of
redundant.

Regstrapped on x86_64-linux-gnu, also tested with gcc-13 on ppc64-vx7r2.
Ok to install?


for  gcc/testsuite/ChangeLog

        PR target/105359
        * gcc.target/powerpc/pr79004.c: Xfail opcodes not available on
        longdouble64.
        * lib/target-supports.exp
        (check_effective_target_long_double_64bit): Drop.
        (add_options_for_long_double_64bit): Likewise.
---
 gcc/testsuite/gcc.target/powerpc/pr79004.c |   14 +++++----
 gcc/testsuite/lib/target-supports.exp      |   43 ----------------------------
 2 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr79004.c 
b/gcc/testsuite/gcc.target/powerpc/pr79004.c
index caf1f6c1eefe4..2cb8bf4bc14bc 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79004.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79004.c
@@ -100,10 +100,12 @@ void to_uns_short_store_n (TYPE a, unsigned short *p, 
long n) { p[n] = (unsigned
 void to_uns_int_store_n (TYPE a, unsigned int *p, long n) { p[n] = (unsigned 
int)a; }
 void to_uns_long_store_n (TYPE a, unsigned long *p, long n) { p[n] = (unsigned 
long)a; }
 
-/* { dg-final { scan-assembler-not {\mbl __}       } } */
-/* { dg-final { scan-assembler     {\mxscvdpqp\M}  } } */
-/* { dg-final { scan-assembler     {\mxscvqpdp\M}  } } */
-/* { dg-final { scan-assembler     {\mxscvqpdpo\M} } } */
+/* On targets with 64-bit long double, some opcodes to deal with __float128 are
+   disabled, see PR target/105359.  */
+/* { dg-final { scan-assembler-not {\mbl __}       { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler     {\mxscvdpqp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler     {\mxscvqpdp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler     {\mxscvqpdpo\M} { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler     {\mxscvqpsdz\M} } } */
 /* { dg-final { scan-assembler     {\mxscvqpswz\M} } } */
 /* { dg-final { scan-assembler     {\mxscvsdqp\M}  } } */
@@ -111,7 +113,7 @@ void to_uns_long_store_n (TYPE a, unsigned long *p, long n) 
{ p[n] = (unsigned l
 /* { dg-final { scan-assembler     {\mlxsd\M}      } } */
 /* { dg-final { scan-assembler     {\mlxsiwax\M}   } } */
 /* { dg-final { scan-assembler     {\mlxsiwzx\M}   } } */
-/* { dg-final { scan-assembler     {\mlxssp\M}     } } */
+/* { dg-final { scan-assembler     {\mlxssp\M}     { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler     {\mstxsd\M}     } } */
 /* { dg-final { scan-assembler     {\mstxsiwx\M}   } } */
-/* { dg-final { scan-assembler     {\mstxssp\M}    } } */
+/* { dg-final { scan-assembler     {\mstxssp\M}    { xfail longdouble64 } } } 
*/
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ec9baa4f32a30..dc7d4f2b5f39e 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2930,49 +2930,6 @@ proc add_options_for_long_double_ieee128 { flags } {
     return "$flags"
 }
 
-# Check if GCC and GLIBC supports explicitly specifying that the long double
-# format uses the IEEE 64-bit.  Under little endian PowerPC Linux, you need
-# GLIBC 2.32 or later to be able to use a different long double format for
-# running a program than the system default.
-
-proc check_effective_target_long_double_64bit { } {
-    return [check_runtime_nocache long_double_64bit {
-       #include <string.h>
-       #include <stdio.h>
-       /* use volatile to prevent optimization.  */
-       volatile double a = 3.0;
-       volatile long double one = 1.0L;
-       volatile long double two = 2.0L;
-       volatile long double b;
-       char buffer[20];
-       int main()
-       {
-         double a2;
-         long double b2;
-         if (sizeof (long double) != 8)
-           return 1;
-         b = one + two;
-         /* eliminate removing volatile cast warning.  */
-         a2 = a;
-         b2 = b;
-         if (memcmp (&a2, &b2, 16) != 0)
-           return 1;
-         sprintf (buffer, "%lg", b);
-         return strcmp (buffer, "3") != 0;
-       }
-    }  [add_options_for_ppc_long_double_override_64bit ""]]
-}
-
-# Return the appropriate options to specify that long double uses the IEEE
-# 64-bit format on PowerPC.
-
-proc add_options_for_long_double_64bit { flags } {
-    if { [istarget powerpc*-*-*] } {
-       return "$flags -mlong-double-64"
-    }
-    return "$flags"
-}
-
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.
 

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

Reply via email to