summaryrefslogtreecommitdiff
path: root/gcc/dojump.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-22 02:13:14 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-22 02:13:14 +0000
commitfd8dde7b703f2e3692353bcb8cacd3bc6b231bba (patch)
tree05ddf96549bce68cc32e473dbd251104e629c9b7 /gcc/dojump.c
parent235d035184b552f2e400cf661626a82c19c69759 (diff)
downloadgcc-fd8dde7b703f2e3692353bcb8cacd3bc6b231bba.tar.gz
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. * gcc.dg/pr18520-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dojump.c')
-rw-r--r--gcc/dojump.c25
1 files changed, 15 insertions, 10 deletions
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);