aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Cox <coxs@gnu.org>1996-05-06 21:01:51 +0000
committerStan Cox <coxs@gnu.org>1996-05-06 21:01:51 +0000
commit462da2af3d07b8e67cbf296744326dd7ba49772b (patch)
tree8eb91183daaccdceae0385cee2f980a54d496f38
parent17c1a44f7551462e48911ff83394ea9f828f0d00 (diff)
downloadgcc-462da2af3d07b8e67cbf296744326dd7ba49772b.zip
gcc-462da2af3d07b8e67cbf296744326dd7ba49772b.tar.gz
gcc-462da2af3d07b8e67cbf296744326dd7ba49772b.tar.bz2
(final_scan_insn): Modify conditional moves whose cc is nonstandard.
From-SVN: r11943
-rw-r--r--gcc/final.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 4de4e12..47d4644 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1869,12 +1869,29 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
}
/* Make same adjustments to instructions that examine the
- condition codes without jumping (if this machine has them). */
+ condition codes without jumping and instructions that
+ handle conditional moves (if this machine has either one). */
if (cc_status.flags != 0
&& GET_CODE (body) == SET)
{
- switch (GET_CODE (SET_SRC (body)))
+ rtx cond_rtx, then_rtx, else_rtx;
+
+ if (GET_CODE (insn) != JUMP_INSN
+ && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE)
+ {
+ cond_rtx = XEXP (SET_SRC (body), 0);
+ then_rtx = XEXP (SET_SRC (body), 1);
+ else_rtx = XEXP (SET_SRC (body), 2);
+ }
+ else
+ {
+ cond_rtx = SET_SRC (body);
+ then_rtx = const_true_rtx;
+ else_rtx = const0_rtx;
+ }
+
+ switch (GET_CODE (cond_rtx))
{
case GTU:
case GT:
@@ -1888,18 +1905,26 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
case NE:
{
register int result;
- if (XEXP (SET_SRC (body), 0) != cc0_rtx)
+ if (XEXP (cond_rtx, 0) != cc0_rtx)
break;
- result = alter_cond (SET_SRC (body));
+ result = alter_cond (cond_rtx);
if (result == 1)
- validate_change (insn, &SET_SRC (body), const_true_rtx, 0);
+ validate_change (insn, &SET_SRC (body), then_rtx, 0);
else if (result == -1)
- validate_change (insn, &SET_SRC (body), const0_rtx, 0);
+ validate_change (insn, &SET_SRC (body), else_rtx, 0);
else if (result == 2)
INSN_CODE (insn) = -1;
+ if (SET_DEST (body) == SET_SRC (body))
+ {
+ PUT_CODE (insn, NOTE);
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ NOTE_SOURCE_FILE (insn) = 0;
+ break;
+ }
}
}
}
+
#endif
/* Do machine-specific peephole optimizations if desired. */