aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2007-06-14 22:15:13 +0200
committerUros Bizjak <uros@gcc.gnu.org>2007-06-14 22:15:13 +0200
commit4962b6794346846231f86815740f5f0ba9d18ba3 (patch)
treedaf219772eeff44a6bd303c27332f6af34291627
parent97943b3c8bb6b315b4b5e676077459e20ac15bf8 (diff)
downloadgcc-4962b6794346846231f86815740f5f0ba9d18ba3.zip
gcc-4962b6794346846231f86815740f5f0ba9d18ba3.tar.gz
gcc-4962b6794346846231f86815740f5f0ba9d18ba3.tar.bz2
re PR target/32268 (Wrong comparison results for __float128 operands)
PR target/32268 * config/i386/sfp-machine.c (CMPtype): New define. (mach stubs): Use CMPtype instead of int as a return type. testsuite/ChangeLog: PR target/32268 * gcc.target/i386/pr32268.c: New test. From-SVN: r125720
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/sfp-machine.h8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr32268.c32
4 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae3eb37..037e51c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2007-06-14 Uros Bizjak <ubizjak@gmail.com>
+ PR target/32268
+ * config/i386/sfp-machine.c (CMPtype): New define.
+ (mach stubs): Use CMPtype instead of int as a return type.
+
+2007-06-14 Uros Bizjak <ubizjak@gmail.com>
+
* config/soft-fp/eqdf2.c, config/soft-fp/eqsf2.c,
config/soft-fp/eqtf2.c, config/soft-fp/gedf2.c,
config/soft-fp/gesf2.c, config/soft-fp/getf2.c,
diff --git a/gcc/config/i386/sfp-machine.h b/gcc/config/i386/sfp-machine.h
index e03ae5f..4609ced 100644
--- a/gcc/config/i386/sfp-machine.h
+++ b/gcc/config/i386/sfp-machine.h
@@ -8,6 +8,10 @@ typedef unsigned int UTItype __attribute__((mode(TI)));
#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
+/* The type of the result of a floating point comparison.
+ This must match `word_mode' in GCC for the target. */
+#define CMPtype long
+
#define _FP_MUL_MEAT_Q(R,X,Y) \
_FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
@@ -129,9 +133,9 @@ struct fenv
/* Define ALIASNAME as a strong alias for NAME. */
#if defined __MACH__
/* Mach-O doesn't support aliasing. If these functions ever return
- anything but int we need to revisit this... */
+ anything but CMPtype we need to revisit this... */
#define strong_alias(name, aliasname) \
- int aliasname (TFtype a, TFtype b) { return name(a, b); }
+ CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
#else
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6711c6a..fdd9582 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/32268
+ * gcc.target/i386/pr32268.c: New test.
+
2007-06-14 H.J. Lu <hongjiu.lu@intel.com>
* gcc.dg/dfp/fe-convert-1.c: Expect FE_OVERFLOW when converting
diff --git a/gcc/testsuite/gcc.target/i386/pr32268.c b/gcc/testsuite/gcc.target/i386/pr32268.c
new file mode 100644
index 0000000..203bae8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr32268.c
@@ -0,0 +1,32 @@
+/* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && lp64 } } } */
+/* { dg-options "-O2" } */
+
+extern void abort(void);
+
+int test_lt(__float128 x, __float128 y)
+{
+ return x < y;
+}
+
+int test_gt (__float128 x, __float128 y)
+{
+ return x > y;
+}
+
+int main()
+{
+ __float128 a = 0.0;
+ __float128 b = 1.0;
+
+ int r;
+
+ r = test_lt (a, b);
+ if (r != ((double) a < (double) b))
+ abort();
+
+ r = test_gt (a, b);
+ if (r != ((double) a > (double) b))
+ abort();
+
+ return 0;
+}