summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-02-14 20:08:39 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-02-14 20:08:39 +0000
commit5a894bc6d5da126acdbfda3c0033218a52af6ce9 (patch)
treec29b256d986d0f06f6c18f5de1ad3725b91cd3e1 /gcc/optabs.c
parent6e55c896e3637213a13829518f86aea3136d5316 (diff)
downloadgcc-5a894bc6d5da126acdbfda3c0033218a52af6ce9.tar.gz
* except.c (start_catch_handler): Use emit_cmp_and_jump_insns.
* explow.c (probe_stack_range): Likewise. * expmed.c (do_cmp_and_jump): Likewise. * expr.c (store_expr, expand_expr, expand_builtin): Likewise. (do_tablejump): Likewise. * stmt.c (expand_expr_stmt, expand_end_case): Likewise. (do_jump_if_equal, emit_case_nodes): Likewise. * optabs.c (emit_cmp_and_jump_insns): Clarify comments. If UNSIGNEDP, then convert comparison to an unsigned code before emitting the jump. (expand_float, expand_fix): Use emit_cmp_and_jump_insns. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25205 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 83235f79ad0..1422793b3f3 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -2941,16 +2941,18 @@ emit_cmp_insn (x, y, comparison, size, mode, unsignedp, align)
constant and Y is not a constant, then the comparison is swapped to
ensure that the comparison RTL has the canonical form.
- MODE is the mode of the inputs (in case they are const_int).
- UNSIGNEDP nonzero says that X and Y are unsigned;
- this matters if they need to be widened.
+ UNSIGNEDP nonzero says that X and Y are unsigned; this matters if they
+ need to be widened by emit_cmp_insn. UNSIGNEDP is also used to select
+ the proper branch condition code.
- If they have mode BLKmode, then SIZE specifies the size of both X and Y,
- and ALIGN specifies the known shared alignment of X and Y.
+ If X and Y have mode BLKmode, then SIZE specifies the size of both X and Y,
+ and ALIGN specifies the known shared alignment of X and Y.
- COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.).
- It is ignored for fixed-point and block comparisons;
- it is used only for floating-point comparisons. */
+ MODE is the mode of the inputs (in case they are const_int).
+
+ COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.). It will
+ be passed unchanged to emit_cmp_insn, then potentially converted into an
+ unsigned variant based on UNSIGNEDP to select a proper jump instruction. */
void
emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
@@ -2978,6 +2980,9 @@ emit_cmp_and_jump_insns (x, y, comparison, size, mode, unsignedp, align, label)
op1 = y;
}
emit_cmp_insn (op0, op1, comparison, size, mode, unsignedp, align);
+
+ if (unsignedp)
+ comparison = unsigned_condition (comparison);
emit_jump_insn ((*bcc_gen_fctn[(int) comparison]) (label));
}
@@ -3701,8 +3706,8 @@ expand_float (to, from, unsignedp)
correct its value by 2**bitwidth. */
do_pending_stack_adjust ();
- emit_cmp_insn (from, const0_rtx, GE, NULL_RTX, GET_MODE (from), 0, 0);
- emit_jump_insn (gen_bge (label));
+ emit_cmp_and_jump_insns (from, const0_rtx, GE, NULL_RTX, GET_MODE (from),
+ 0, 0, label);
/* On SCO 3.2.1, ldexp rejects values outside [0.5, 1).
Rather than setting up a dconst_dot_5, let's hope SCO
@@ -3909,8 +3914,8 @@ expand_fix (to, from, unsignedp)
/* See if we need to do the subtraction. */
do_pending_stack_adjust ();
- emit_cmp_insn (from, limit, GE, NULL_RTX, GET_MODE (from), 0, 0);
- emit_jump_insn (gen_bge (lab1));
+ emit_cmp_and_jump_insns (from, limit, GE, NULL_RTX, GET_MODE (from),
+ 0, 0, lab1);
/* If not, do the signed "fix" and branch around fixup code. */
expand_fix (to, from, 0);