aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2006-11-14 23:25:43 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2006-11-14 23:25:43 +0000
commita41a56b62d0638791b57ee160dd16fe144e2b49b (patch)
tree07b49d656bca875286894404e9122b058e2a2a0e /gcc/expr.c
parent75dc0b383db8e50ab0c11ac25b09f3538106a3f0 (diff)
downloadgcc-a41a56b62d0638791b57ee160dd16fe144e2b49b.zip
gcc-a41a56b62d0638791b57ee160dd16fe144e2b49b.tar.gz
gcc-a41a56b62d0638791b57ee160dd16fe144e2b49b.tar.bz2
expmed.c (emit_store_flag_1): New function.
* expmed.c (emit_store_flag_1): New function. (emit_store_flag): Call it. If we can't find a suitable scc insn, try a cstore insn. * expr.c (do_store_flag): If we can't find a scc insn, try cstore. Use do_compare_rtx_and_jump. * arm.h (BRANCH_COST): Increase to 2 on Thumb. * arm.md (cstoresi4): New define_expand. (cstoresi_eq0_thumb, cstoresi_ne0_thumb): Likewise. (cstoresi_eq0_thumb_insn, cstore_ne0_thumb_insn): New patterns. (cstoresi_nltu_thumb, thumb_addsi3_addgeu): New patterns. From-SVN: r118829
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dc5f844..7462788 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9155,6 +9155,17 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode, int only_cheap)
return 0;
icode = setcc_gen_code[(int) code];
+
+ if (icode == CODE_FOR_nothing)
+ {
+ enum machine_mode wmode;
+
+ for (wmode = operand_mode;
+ icode == CODE_FOR_nothing && wmode != VOIDmode;
+ wmode = GET_MODE_WIDER_MODE (wmode))
+ icode = cstore_optab->handlers[(int) wmode].insn_code;
+ }
+
if (icode == CODE_FOR_nothing
|| (only_cheap && insn_data[(int) icode].operand[0].mode != mode))
{
@@ -9200,25 +9211,10 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode, int only_cheap)
target = gen_reg_rtx (GET_MODE (target));
emit_move_insn (target, invert ? const0_rtx : const1_rtx);
- result = compare_from_rtx (op0, op1, code, unsignedp,
- operand_mode, NULL_RTX);
- if (GET_CODE (result) == CONST_INT)
- return (((result == const0_rtx && ! invert)
- || (result != const0_rtx && invert))
- ? const0_rtx : const1_rtx);
-
- /* The code of RESULT may not match CODE if compare_from_rtx
- decided to swap its operands and reverse the original code.
-
- We know that compare_from_rtx returns either a CONST_INT or
- a new comparison code, so it is safe to just extract the
- code from RESULT. */
- code = GET_CODE (result);
-
label = gen_label_rtx ();
- gcc_assert (bcc_gen_fctn[(int) code]);
-
- emit_jump_insn ((*bcc_gen_fctn[(int) code]) (label));
+ do_compare_rtx_and_jump (op0, op1, code, unsignedp, operand_mode, NULL_RTX,
+ NULL_RTX, label);
+
emit_move_insn (target, invert ? const1_rtx : const0_rtx);
emit_label (label);