Commit 2d1d245f by Richard Kenner

(notice_update_cc): INCM and DECM set condition codes.

(unsigned_comparison_operator, next_cc_user_is_unsigned): New fcns.

From-SVN: r10191
parent 2a99503a
/* Subroutines for insn-output.c for MIL-STD-1750. /* Subroutines for insn-output.c for MIL-STD-1750.
Copyright (C) 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1994, 1995 Free Software Foundation, Inc.
Contributed by O.M.Kellogg, DASA (okellogg@salyko.cube.net). Contributed by O.M.Kellogg, DASA (kellogg@space.otn.dasa.de)
This file is part of GNU CC. This file is part of GNU CC.
...@@ -52,24 +52,18 @@ notice_update_cc (exp) ...@@ -52,24 +52,18 @@ notice_update_cc (exp)
/* Jumps do not alter the cc's. */ /* Jumps do not alter the cc's. */
if (SET_DEST (exp) == pc_rtx) if (SET_DEST (exp) == pc_rtx)
return; return;
/* Moving register into memory doesn't alter the cc's. /* Moving a register or constant into memory doesn't alter the cc's. */
It may invalidate the RTX's which we remember the cc's came from. */ if (GET_CODE (SET_DEST (exp)) == MEM
if (GET_CODE (SET_DEST (exp)) == MEM) && (src_code == REG || src_code == CONST_INT))
{ return;
if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM)
cc_status.value1 = 0;
if (cc_status.value2 && GET_CODE (cc_status.value2) == MEM)
cc_status.value2 = 0;
return;
}
/* Function calls clobber the cc's. */ /* Function calls clobber the cc's. */
else if (src_code == CALL) if (src_code == CALL)
{ {
CC_STATUS_INIT; CC_STATUS_INIT;
return; return;
} }
/* Emulated longword bit-ops leave cc's incorrect */ /* Emulated longword bit-ops leave cc's incorrect */
else if (GET_MODE (SET_DEST (exp)) == HImode ? if (GET_MODE (SET_DEST (exp)) == HImode ?
src_code == AND || src_code == IOR || src_code == AND || src_code == IOR ||
src_code == XOR || src_code == NOT : 0) src_code == XOR || src_code == NOT : 0)
{ {
...@@ -77,24 +71,17 @@ notice_update_cc (exp) ...@@ -77,24 +71,17 @@ notice_update_cc (exp)
return; return;
} }
/* Tests and compares set the cc's in predictable ways. */ /* Tests and compares set the cc's in predictable ways. */
else if (SET_DEST (exp) == cc0_rtx) if (SET_DEST (exp) == cc0_rtx)
{ {
CC_STATUS_INIT; CC_STATUS_INIT;
cc_status.value1 = SET_SRC (exp); cc_status.value1 = SET_SRC (exp);
return; return;
} }
/* Anything that lands in a reg will set cc_status. */ /* Anything else will set cc_status. */
else if (REG_P (SET_DEST (exp))) cc_status.flags = CC_NO_OVERFLOW;
{ cc_status.value1 = SET_SRC (exp);
cc_status.flags = CC_NO_OVERFLOW; cc_status.value2 = SET_DEST (exp);
cc_status.value1 = SET_SRC (exp); return;
cc_status.value2 = SET_DEST (exp);
return;
}
else
{
CC_STATUS_INIT;
}
} }
else if (GET_CODE (exp) == PARALLEL else if (GET_CODE (exp) == PARALLEL
&& GET_CODE (XVECEXP (exp, 0, 0)) == SET) && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
...@@ -343,6 +330,40 @@ branch_or_jump (condition, targetlabel_number) ...@@ -343,6 +330,40 @@ branch_or_jump (condition, targetlabel_number)
} }
int
unsigned_comparison_operator (insn)
rtx insn;
{
switch (GET_CODE (insn))
{
case GEU:
case GTU:
case LEU:
case LTU:
return 1;
default:
return 0;
}
}
int
next_cc_user_is_unsigned (insn)
rtx insn;
{
if ( !(insn = next_cc0_user (insn)))
abort ();
else if (GET_CODE (insn) == JUMP_INSN
&& GET_CODE (PATTERN (insn)) == SET
&& GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE)
return unsigned_comparison_operator (XEXP (SET_SRC (PATTERN (insn)), 0));
else if (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == SET)
return unsigned_comparison_operator (SET_SRC (PATTERN (insn)));
else
abort ();
}
/* The PRINT_OPERAND and PRINT_OPERAND_ADDRESS macros have been /* The PRINT_OPERAND and PRINT_OPERAND_ADDRESS macros have been
made functions: */ made functions: */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment