aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-11-25 12:57:02 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-11-25 12:57:02 +0000
commit9b336fa4475f8536d2d77bc9658b18f6465bd9f4 (patch)
treef028a285e56c08a2bdd4279d3e51e5869f0d94eb
parentcdfc2f2b34c477a3058ccab70eba247f0ad08e95 (diff)
downloadgcc-9b336fa4475f8536d2d77bc9658b18f6465bd9f4.zip
gcc-9b336fa4475f8536d2d77bc9658b18f6465bd9f4.tar.gz
gcc-9b336fa4475f8536d2d77bc9658b18f6465bd9f4.tar.bz2
re PR target/24998 (Build failure: undefined symbol __floatunsitf)
PR middle-end/24998 * config/sparc/sparc.c (sparc_init_libfuncs): Use _Q_utoq and _Q_ulltoq for unsigned conversions from SImode and DImode to TFmode. testsuite: * gcc.dg/torture/fp-int-convert-float.c, gcc.dg/torture/fp-int-convert-double.c, gcc.dg/torture/fp-int-convert-long-double.c, gcc.dg/torture/fp-int-convert-timode.c, gcc.dg/torture/fp-int-convert-float80.c, gcc.dg/torture/fp-int-convert-float80-timode.c, gcc.dg/torture/fp-int-convert-float128.c, gcc.dg/torture/fp-int-convert-float128-timode.c, gcc.dg/torture/fp-int-convert.h: New files. From-SVN: r107502
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sparc/sparc.c2
-rw-r--r--gcc/testsuite/ChangeLog13
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-double.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c22
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float80-timode.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-long-double.c18
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert.h89
12 files changed, 259 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4e4a94a..1f679b1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-25 Joseph S. Myers <joseph@codesourcery.com>
+
+ PR middle-end/24998
+ * config/sparc/sparc.c (sparc_init_libfuncs): Use _Q_utoq and
+ _Q_ulltoq for unsigned conversions from SImode and DImode to
+ TFmode.
+
2005-11-25 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/ppc64-fp.c (__floatunditf): New function.
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 0b18efd..e0ca397 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -7707,12 +7707,14 @@ sparc_init_libfuncs (void)
set_conv_libfunc (sfix_optab, SImode, TFmode, "_Q_qtoi");
set_conv_libfunc (ufix_optab, SImode, TFmode, "_Q_qtou");
set_conv_libfunc (sfloat_optab, TFmode, SImode, "_Q_itoq");
+ set_conv_libfunc (ufloat_optab, TFmode, SImode, "_Q_utoq");
if (DITF_CONVERSION_LIBFUNCS)
{
set_conv_libfunc (sfix_optab, DImode, TFmode, "_Q_qtoll");
set_conv_libfunc (ufix_optab, DImode, TFmode, "_Q_qtoull");
set_conv_libfunc (sfloat_optab, TFmode, DImode, "_Q_lltoq");
+ set_conv_libfunc (ufloat_optab, TFmode, DImode, "_Q_ulltoq");
}
if (SUN_CONVERSION_LIBFUNCS)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 226dc07..1026303 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-25 Joseph S. Myers <joseph@codesourcery.com>
+
+ PR middle-end/24998
+ * gcc.dg/torture/fp-int-convert-float.c,
+ gcc.dg/torture/fp-int-convert-double.c,
+ gcc.dg/torture/fp-int-convert-long-double.c,
+ gcc.dg/torture/fp-int-convert-timode.c,
+ gcc.dg/torture/fp-int-convert-float80.c,
+ gcc.dg/torture/fp-int-convert-float80-timode.c,
+ gcc.dg/torture/fp-int-convert-float128.c,
+ gcc.dg/torture/fp-int-convert-float128-timode.c,
+ gcc.dg/torture/fp-int-convert.h: New files.
+
2005-11-24 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/24989
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-double.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-double.c
new file mode 100644
index 0000000..39ec3cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-double.c
@@ -0,0 +1,18 @@
+/* Test floating-point conversions. Standard types and double. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+#include <float.h>
+#include "fp-int-convert.h"
+
+int
+main (void)
+{
+ TEST_I_F(signed char, unsigned char, double, DBL_MANT_DIG);
+ TEST_I_F(signed short, unsigned short, double, DBL_MANT_DIG);
+ TEST_I_F(signed int, unsigned int, double, DBL_MANT_DIG);
+ TEST_I_F(signed long, unsigned long, double, DBL_MANT_DIG);
+ TEST_I_F(signed long long, unsigned long long, double, DBL_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
new file mode 100644
index 0000000..7fca1df
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
@@ -0,0 +1,18 @@
+/* Test floating-point conversions. Standard types and float. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+#include <float.h>
+#include "fp-int-convert.h"
+
+int
+main (void)
+{
+ TEST_I_F(signed char, unsigned char, float, FLT_MANT_DIG);
+ TEST_I_F(signed short, unsigned short, float, FLT_MANT_DIG);
+ TEST_I_F(signed int, unsigned int, float, FLT_MANT_DIG);
+ TEST_I_F(signed long, unsigned long, float, FLT_MANT_DIG);
+ TEST_I_F(signed long long, unsigned long long, float, FLT_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
new file mode 100644
index 0000000..30250d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
@@ -0,0 +1,18 @@
+/* Test floating-point conversions. __float128 type with TImode. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-xfail-if "" { i?86-*-* x86_64-*-* } { "*" } { "" } } */
+/* { dg-options "" } */
+/* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
+/* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
+
+#include "fp-int-convert.h"
+
+#define FLOAT128_MANT_DIG 113
+
+int
+main (void)
+{
+ TEST_I_F(TItype, UTItype, __float128, FLOAT128_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c
new file mode 100644
index 0000000..a78f686
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c
@@ -0,0 +1,22 @@
+/* Test floating-point conversions. __float128 type. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-xfail-if "" { i?86-*-* x86_64-*-* } { "*" } { "" } } */
+/* { dg-options "" } */
+/* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
+/* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
+
+#include "fp-int-convert.h"
+
+#define FLOAT128_MANT_DIG 113
+
+int
+main (void)
+{
+ TEST_I_F(signed char, unsigned char, __float128, FLOAT128_MANT_DIG);
+ TEST_I_F(signed short, unsigned short, __float128, FLOAT128_MANT_DIG);
+ TEST_I_F(signed int, unsigned int, __float128, FLOAT128_MANT_DIG);
+ TEST_I_F(signed long, unsigned long, __float128, FLOAT128_MANT_DIG);
+ TEST_I_F(signed long long, unsigned long long, __float128, FLOAT128_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80-timode.c
new file mode 100644
index 0000000..e9436ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80-timode.c
@@ -0,0 +1,17 @@
+/* Test floating-point conversions. __float80 type with TImode. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-options "" } */
+/* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
+/* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
+
+#include "fp-int-convert.h"
+
+#define FLOAT80_MANT_DIG 64
+
+int
+main (void)
+{
+ TEST_I_F(TItype, UTItype, __float80, FLOAT80_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c
new file mode 100644
index 0000000..13a9243
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c
@@ -0,0 +1,21 @@
+/* Test floating-point conversions. __float80 type. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-options "" } */
+/* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
+/* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
+
+#include "fp-int-convert.h"
+
+#define FLOAT80_MANT_DIG 64
+
+int
+main (void)
+{
+ TEST_I_F(signed char, unsigned char, __float80, FLOAT80_MANT_DIG);
+ TEST_I_F(signed short, unsigned short, __float80, FLOAT80_MANT_DIG);
+ TEST_I_F(signed int, unsigned int, __float80, FLOAT80_MANT_DIG);
+ TEST_I_F(signed long, unsigned long, __float80, FLOAT80_MANT_DIG);
+ TEST_I_F(signed long long, unsigned long long, __float80, FLOAT80_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-long-double.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-long-double.c
new file mode 100644
index 0000000..bb189a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-long-double.c
@@ -0,0 +1,18 @@
+/* Test floating-point conversions. Standard types and long double. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+#include <float.h>
+#include "fp-int-convert.h"
+
+int
+main (void)
+{
+ TEST_I_F(signed char, unsigned char, long double, LDBL_MANT_DIG);
+ TEST_I_F(signed short, unsigned short, long double, LDBL_MANT_DIG);
+ TEST_I_F(signed int, unsigned int, long double, LDBL_MANT_DIG);
+ TEST_I_F(signed long, unsigned long, long double, LDBL_MANT_DIG);
+ TEST_I_F(signed long long, unsigned long long, long double, LDBL_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
new file mode 100644
index 0000000..11c02a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
@@ -0,0 +1,16 @@
+/* Test floating-point conversions. TImode types. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do run { xfail *-*-* } } */
+/* { dg-options "" } */
+
+#include <float.h>
+#include "fp-int-convert.h"
+
+int
+main (void)
+{
+ TEST_I_F(TItype, UTItype, float, FLT_MANT_DIG);
+ TEST_I_F(TItype, UTItype, double, DBL_MANT_DIG);
+ TEST_I_F(TItype, UTItype, long double, LDBL_MANT_DIG);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h
new file mode 100644
index 0000000..c4cb5fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h
@@ -0,0 +1,89 @@
+/* Test floating-point conversions. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+
+#include <limits.h>
+extern void abort (void);
+extern void exit (int);
+
+/* Not all platforms support TImode integers; logic as in
+ gcc.dg/titype-1.c. */
+#if defined(__LP64__) && !defined(__hppa__)
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+#else
+typedef long TItype;
+typedef unsigned long UTItype;
+#endif
+
+/* TEST_I_F(I, U, F, P) tests conversions between the pair of signed
+ and unsigned integer types I and U and the floating-point type F,
+ where P is the binary precision of the floating point type. We
+ test conversions of the values 0, 1, 0x7...f, 0x8...0, 0xf...f. We
+ also test conversions of values half way inbetween two
+ representable values (rounding both ways), just above half way, and
+ just below half way. */
+#define TEST_I_F(I, U, F, P) \
+do { \
+ TEST_I_F_VAL (I, F, (I)0, 1); \
+ TEST_I_F_VAL (I, F, (I)1, 1); \
+ TEST_I_F_VAL (I, F, (I)(((U)~(U)0) >> 1), P_OK1 (P, I)); \
+ TEST_I_F_VAL (I, F, (I)(U)~(((U)~(U)0) >> 1), 1); \
+ TEST_I_F_VAL (I, F, (I)(U)~(U)0, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL0S (P, I), P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL0S (P, I) + 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL0S (P, I) - 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL1S (P, I), P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL1S (P, I) + 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, HVAL1S (P, I) - 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL0S (P, I), P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL0S (P, I) + 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL0S (P, I) - 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL1S (P, I), P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL1S (P, I) + 1, P_OK (P, I)); \
+ TEST_I_F_VAL (I, F, -HVAL1S (P, I) - 1, P_OK (P, I)); \
+ TEST_I_F_VAL (U, F, (U)0, 1); \
+ TEST_I_F_VAL (U, F, (U)1, 1); \
+ TEST_I_F_VAL (U, F, (U)(((U)~(U)0) >> 1), P_OK1 (P, U)); \
+ TEST_I_F_VAL (U, F, (U)~(((U)~(U)0) >> 1), 1); \
+ TEST_I_F_VAL (U, F, (U)~(U)0, P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL0U (P, U), P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL0U (P, U) + 1, P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL0U (P, U) - 1, P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL1U (P, U), P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL1U (P, U) + 1, P_OK (P, U)); \
+ TEST_I_F_VAL (U, F, HVAL1U (P, U) - 1, P_OK (P, U)); \
+} while (0)
+
+#define P_OK(P, T) ((P) >= sizeof(T) * CHAR_BIT)
+#define P_OK1(P, T) ((P) >= sizeof(T) * CHAR_BIT - 1)
+#define HVAL0U(P, U) (U)(P_OK (P, U) \
+ ? (U)1 \
+ : (((U)1 << (sizeof(U) * CHAR_BIT - 1)) \
+ + ((U)1 << (sizeof(U) * CHAR_BIT - 1 - P))))
+#define HVAL1U(P, U) (U)(P_OK (P, U) \
+ ? (U)1 \
+ : (((U)1 << (sizeof(U) * CHAR_BIT - 1)) \
+ + ((U)3 << (sizeof(U) * CHAR_BIT - 1 - P))))
+#define HVAL0S(P, S) (S)(P_OK1 (P, S) \
+ ? (S)1 \
+ : (((S)1 << (sizeof(S) * CHAR_BIT - 2)) \
+ + ((S)1 << (sizeof(S) * CHAR_BIT - 2 - P))))
+#define HVAL1S(P, S) (S)(P_OK1 (P, S) \
+ ? (S)1 \
+ : (((S)1 << (sizeof(S) * CHAR_BIT - 2)) \
+ + ((S)3 << (sizeof(S) * CHAR_BIT - 2 - P))))
+
+#define TEST_I_F_VAL(IT, FT, VAL, PREC_OK) \
+do { \
+ static volatile IT ivin, ivout; \
+ static volatile FT fv1, fv2; \
+ ivin = (VAL); \
+ fv1 = (VAL); \
+ fv2 = ivin; \
+ ivout = fv2; \
+ if (ivin != (VAL) \
+ || ((PREC_OK) && ivout != ivin) \
+ || ((PREC_OK) && ivout != (VAL)) \
+ || fv1 != (VAL) || fv2 != (VAL) || fv1 != fv2) \
+ abort (); \
+} while (0)