diff options
author | Nguyen Duy Dat <dat.nguyen.yn@rvc.renesas.com> | 2013-01-09 15:07:08 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2013-01-09 15:07:08 +0000 |
commit | 3cd232b5aafa8b8563d3bbe4b4e240eea6b93036 (patch) | |
tree | 0dbf0b610c223b5dc4566dfded8f297f4a38346e /gcc/config/v850/v850.c | |
parent | 458752def198a1a663152609b4027fe08224b6f8 (diff) | |
download | gcc-3cd232b5aafa8b8563d3bbe4b4e240eea6b93036.zip gcc-3cd232b5aafa8b8563d3bbe4b4e240eea6b93036.tar.gz gcc-3cd232b5aafa8b8563d3bbe4b4e240eea6b93036.tar.bz2 |
v850.md (cbranchsf4): New pattern.
* config/v850/v850.md (cbranchsf4): New pattern.
(cstoresf4): New pattern.
(cbranchdf4): New pattern.
(cstoredf4): New pattern.
(movsicc): Disallow floating point comparisons.
(cmpsf_le_insn): Fix order of operators.
(cmpsf_lt_insn): Likewise.
(cmpsf_eq_insn): Likewise.
(cmpdf_le_insn): Likewise.
(cmpdf_lt_insn): Likewise.
(cmpdf_eq_insn): Likewise.
(cmpsf_ge_insn): Use LE comparison.
(cmpdf_ge_insn): Likewise.
(cmpsf_gt_insn): Use LT comparison.
(cmpdf_gt_insn): Likewise.
(cmpsf_ne_insn): Delete pattern.
(cmpdf_ne_insn): Delete pattern.
* config/v850/v850.c (v850_gen_float_compare): Use
gen_cmpdf_eq_insn for NE comparison.
(v850_float_z_comparison_operator)
(v850_float_nz_comparison_operator): Move from here ...
* config/v850/predicates.md: ... to here. Move GT and GE
comparisons into v850_float_z_comparison_operator.
* config/v850/v850-protos.h (v850_float_z_comparison_operator):
Delete prototype.
(v850_float_nz_comparison_operator): Likewise.
From-SVN: r195053
Diffstat (limited to 'gcc/config/v850/v850.c')
-rw-r--r-- | gcc/config/v850/v850.c | 83 |
1 files changed, 14 insertions, 69 deletions
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index e1570c3..fb855cf 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -898,61 +898,6 @@ output_move_single (rtx * operands) return ""; } -/* Generate comparison code. */ -int -v850_float_z_comparison_operator (rtx op, enum machine_mode mode) -{ - enum rtx_code code = GET_CODE (op); - - if (GET_RTX_CLASS (code) != RTX_COMPARE - && GET_RTX_CLASS (code) != RTX_COMM_COMPARE) - return 0; - - if (mode != GET_MODE (op) && mode != VOIDmode) - return 0; - - if ((GET_CODE (XEXP (op, 0)) != REG - || REGNO (XEXP (op, 0)) != CC_REGNUM) - || XEXP (op, 1) != const0_rtx) - return 0; - - if (GET_MODE (XEXP (op, 0)) == CC_FPU_LTmode) - return code == LT; - if (GET_MODE (XEXP (op, 0)) == CC_FPU_LEmode) - return code == LE; - if (GET_MODE (XEXP (op, 0)) == CC_FPU_EQmode) - return code == EQ; - - return 0; -} - -int -v850_float_nz_comparison_operator (rtx op, enum machine_mode mode) -{ - enum rtx_code code = GET_CODE (op); - - if (GET_RTX_CLASS (code) != RTX_COMPARE - && GET_RTX_CLASS (code) != RTX_COMM_COMPARE) - return 0; - - if (mode != GET_MODE (op) && mode != VOIDmode) - return 0; - - if ((GET_CODE (XEXP (op, 0)) != REG - || REGNO (XEXP (op, 0)) != CC_REGNUM) - || XEXP (op, 1) != const0_rtx) - return 0; - - if (GET_MODE (XEXP (op, 0)) == CC_FPU_GTmode) - return code == GT; - if (GET_MODE (XEXP (op, 0)) == CC_FPU_GEmode) - return code == GE; - if (GET_MODE (XEXP (op, 0)) == CC_FPU_NEmode) - return code == NE; - - return code == GT || code == GE || code == NE; -} - enum machine_mode v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1 ATTRIBUTE_UNUSED) { @@ -973,7 +918,7 @@ v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1 ATTRIBUTE_UNUSED) case NE: return CC_FPU_NEmode; default: - abort (); + gcc_unreachable (); } } return CCmode; @@ -982,7 +927,7 @@ v850_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1 ATTRIBUTE_UNUSED) enum machine_mode v850_gen_float_compare (enum rtx_code cond, enum machine_mode mode ATTRIBUTE_UNUSED, rtx op0, rtx op1) { - if (GET_MODE(op0) == DFmode) + if (GET_MODE (op0) == DFmode) { switch (cond) { @@ -998,17 +943,18 @@ v850_gen_float_compare (enum rtx_code cond, enum machine_mode mode ATTRIBUTE_UNU case GT: emit_insn (gen_cmpdf_gt_insn (op0, op1)); break; + case NE: + /* Note: There is no NE comparison operator. So we + perform an EQ comparison and invert the branch. + See v850_float_nz_comparison for how this is done. */ case EQ: emit_insn (gen_cmpdf_eq_insn (op0, op1)); break; - case NE: - emit_insn (gen_cmpdf_ne_insn (op0, op1)); - break; default: - abort (); + gcc_unreachable (); } } - else if (GET_MODE(v850_compare_op0) == SFmode) + else if (GET_MODE (v850_compare_op0) == SFmode) { switch (cond) { @@ -1024,20 +970,19 @@ v850_gen_float_compare (enum rtx_code cond, enum machine_mode mode ATTRIBUTE_UNU case GT: emit_insn (gen_cmpsf_gt_insn(op0, op1)); break; + case NE: + /* Note: There is no NE comparison operator. So we + perform an EQ comparison and invert the branch. + See v850_float_nz_comparison for how this is done. */ case EQ: emit_insn (gen_cmpsf_eq_insn(op0, op1)); break; - case NE: - emit_insn (gen_cmpsf_ne_insn(op0, op1)); - break; default: - abort (); + gcc_unreachable (); } } else - { - abort (); - } + gcc_unreachable (); return v850_select_cc_mode (cond, op0, op1); } |