summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dojump.c25
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr18520-1.c11
4 files changed, 38 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e50939b69b6..28c9d083106 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-21 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/18520
+ * dojump.c (compare_from_rtx): Clarify mode argument in function
+ description. Correct order of mode/cmp_mode arguments in call to
+ simplify_relational_operation. Check "tem" for COMPARISON_P.
+
2004-11-21 David Edelsohn <edelsohn@gnu.org>
PR target/17836
diff --git a/gcc/dojump.c b/gcc/dojump.c
index e506684f41d..bcb575c36a1 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -689,9 +689,10 @@ do_jump_by_parts_equality_rtx (rtx op0, rtx if_false_label, rtx if_true_label)
}
/* Generate code for a comparison of OP0 and OP1 with rtx code CODE.
- (including code to compute the values to be compared)
- and set (CC0) according to the result.
- The decision as to signed or unsigned comparison must be made by the caller.
+ MODE is the machine mode of the comparison, not of the result.
+ (including code to compute the values to be compared) and set CC0
+ according to the result. The decision as to signed or unsigned
+ comparison must be made by the caller.
We force a stack adjustment unless there are currently
things pushed on the stack that aren't yet used.
@@ -725,17 +726,21 @@ compare_from_rtx (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
do_pending_stack_adjust ();
code = unsignedp ? unsigned_condition (code) : code;
- if (0 != (tem = simplify_relational_operation (code, mode, VOIDmode,
- op0, op1)))
+ tem = simplify_relational_operation (code, VOIDmode, mode, op0, op1);
+ if (tem)
{
if (CONSTANT_P (tem))
return tem;
- code = GET_CODE (tem);
- mode = GET_MODE (tem);
- op0 = XEXP (tem, 0);
- op1 = XEXP (tem, 1);
- unsignedp = (code == GTU || code == LTU || code == GEU || code == LEU);
+ if (COMPARISON_P (tem))
+ {
+ code = GET_CODE (tem);
+ op0 = XEXP (tem, 0);
+ op1 = XEXP (tem, 1);
+ mode = GET_MODE (op0);
+ unsignedp = (code == GTU || code == LTU
+ || code == GEU || code == LEU);
+ }
}
emit_cmp_insn (op0, op1, code, size, mode, unsignedp);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ef3ca31020f..b9ec394932c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-21 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/18520
+ * gcc.dg/pr18520-1.c: New test case.
+
2004-11-20 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/Wchar-subscripts-1.c, gcc.dg/array-8.c: New tests.
diff --git a/gcc/testsuite/gcc.dg/pr18520-1.c b/gcc/testsuite/gcc.dg/pr18520-1.c
new file mode 100644
index 00000000000..872d3a94620
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr18520-1.c
@@ -0,0 +1,11 @@
+/* PR middle-end/18520 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern int isnan (double __value) __attribute__ ((__const__));
+
+int gsl_isnan (const double x)
+{
+ return isnan(x);
+}
+