diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-08 05:13:35 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-09-08 05:13:35 +0000 |
commit | b18b881f5efc6f01cae50b3d9e54aef07d0e4bd0 (patch) | |
tree | 5264998229135efa266d0c973c08fd1f3c382417 /gcc/config | |
parent | 11016d990ffd1700d901f6a0c79582030e0f5182 (diff) | |
download | gcc-b18b881f5efc6f01cae50b3d9e54aef07d0e4bd0.tar.gz |
* alpha.h (alpha_compare): New.
(alpha_compare_op0, alpha_compare_op1, alpha_compare_fp_p): Remove.
* alpha.c: Likewise for the definitions.
(alpha_emit_conditional_branch): Update for alpha_compare.
(alpha_emit_conditional_move): Likewise.
* alpha.md (cmpdf, cmpdi): Likewise.
(setcc patterns): Likewise. Zero alpha_compare after use.
(sne): Optimize (x != 0) into (0U < x).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29183 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/alpha/alpha.c | 28 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.h | 9 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.md | 76 |
3 files changed, 70 insertions, 43 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 37699ca5d50..fbc1ebc395d 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -77,8 +77,7 @@ const char *alpha_mlat_string; /* -mmemory-latency= */ /* Save information from a "cmpxx" operation until the branch or scc is emitted. */ -rtx alpha_compare_op0, alpha_compare_op1; -int alpha_compare_fp_p; +struct alpha_compare alpha_compare; /* Non-zero if inside of a function, because the Alpha asm can't handle .files inside of functions. */ @@ -1355,7 +1354,7 @@ alpha_emit_conditional_branch (code) { enum rtx_code cmp_code, branch_code; enum machine_mode cmp_mode, branch_mode = VOIDmode; - rtx op0 = alpha_compare_op0, op1 = alpha_compare_op1; + rtx op0 = alpha_compare.op0, op1 = alpha_compare.op1; rtx tem; /* The general case: fold the comparison code to the types of compares @@ -1374,7 +1373,7 @@ alpha_emit_conditional_branch (code) case GE: case GT: case GEU: case GTU: /* For FP, we swap them, for INT, we reverse them. */ - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) { cmp_code = swap_condition (code); branch_code = NE; @@ -1391,7 +1390,7 @@ alpha_emit_conditional_branch (code) abort (); } - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) { cmp_mode = DFmode; if (flag_fast_math) @@ -1457,6 +1456,9 @@ alpha_emit_conditional_branch (code) emit_move_insn (tem, gen_rtx_fmt_ee (cmp_code, cmp_mode, op0, op1)); } + /* Zero the operands. */ + memset (&alpha_compare, 0, sizeof (alpha_compare)); + /* Return the branch comparison. */ return gen_rtx_fmt_ee (branch_code, branch_mode, tem, CONST0_RTX (cmp_mode)); } @@ -1475,21 +1477,25 @@ alpha_emit_conditional_move (cmp, mode) { enum rtx_code code = GET_CODE (cmp); enum rtx_code cmov_code = NE; - rtx op0 = alpha_compare_op0; - rtx op1 = alpha_compare_op1; + rtx op0 = alpha_compare.op0; + rtx op1 = alpha_compare.op1; + int fp_p = alpha_compare.fp_p; enum machine_mode cmp_mode = (GET_MODE (op0) == VOIDmode ? DImode : GET_MODE (op0)); - enum machine_mode cmp_op_mode = alpha_compare_fp_p ? DFmode : DImode; + enum machine_mode cmp_op_mode = fp_p ? DFmode : DImode; enum machine_mode cmov_mode = VOIDmode; rtx tem; - if (alpha_compare_fp_p != FLOAT_MODE_P (mode)) + /* Zero the operands. */ + memset (&alpha_compare, 0, sizeof (alpha_compare)); + + if (fp_p != FLOAT_MODE_P (mode)) return 0; /* We may be able to use a conditional move directly. This avoids emitting spurious compares. */ if (signed_comparison_operator (cmp, cmp_op_mode) - && (!alpha_compare_fp_p || flag_fast_math) + && (!fp_p || flag_fast_math) && (op0 == CONST0_RTX (cmp_mode) || op1 == CONST0_RTX (cmp_mode))) return gen_rtx_fmt_ee (code, VOIDmode, op0, op1); @@ -1525,7 +1531,7 @@ alpha_emit_conditional_move (cmp, mode) /* ??? We mark the branch mode to be CCmode to prevent the compare and cmov from being combined, since the compare insn follows IEEE rules that the cmov does not. */ - if (alpha_compare_fp_p && !flag_fast_math) + if (fp_p && !flag_fast_math) cmov_mode = CCmode; tem = gen_reg_rtx (cmp_op_mode); diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index a18ad5fd25f..db9dec936d0 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1197,8 +1197,13 @@ extern struct rtx_def *alpha_emit_conditional_move (); stored from the compare operation. Note that we can't use "rtx" here since it hasn't been defined! */ -extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1; -extern int alpha_compare_fp_p; +struct alpha_compare +{ + struct rtx_def *op0, *op1; + int fp_p; +}; + +extern struct alpha_compare alpha_compare; /* Machine specific function data. */ diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 456642f050d..8bdb39689d1 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -2916,9 +2916,9 @@ "TARGET_FP" " { - alpha_compare_op0 = operands[0]; - alpha_compare_op1 = operands[1]; - alpha_compare_fp_p = 1; + alpha_compare.op0 = operands[0]; + alpha_compare.op1 = operands[1]; + alpha_compare.fp_p = 1; DONE; }") @@ -2928,9 +2928,9 @@ "" " { - alpha_compare_op0 = operands[0]; - alpha_compare_op1 = operands[1]; - alpha_compare_fp_p = 0; + alpha_compare.op0 = operands[0]; + alpha_compare.op1 = operands[1]; + alpha_compare.fp_p = 0; DONE; }") @@ -3020,10 +3020,11 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1); + operands[1] = gen_rtx_EQ (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sne" @@ -3033,10 +3034,17 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1); + if (alpha_compare.op1 == const0_rtx) + { + emit_insn (gen_sgtu (operands[0])); + DONE; + } + + operands[1] = gen_rtx_EQ (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "slt" @@ -3045,10 +3053,11 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LT (DImode, alpha_compare_op0, alpha_compare_op1); + operands[1] = gen_rtx_LT (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sle" @@ -3057,10 +3066,11 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LE (DImode, alpha_compare_op0, alpha_compare_op1); + operands[1] = gen_rtx_LE (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sgt" @@ -3069,11 +3079,12 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); + operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare.op1), + alpha_compare.op0); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sge" @@ -3082,11 +3093,12 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); + operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare.op1), + alpha_compare.op0); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sltu" @@ -3095,10 +3107,11 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LTU (DImode, alpha_compare_op0, alpha_compare_op1); + operands[1] = gen_rtx_LTU (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sleu" @@ -3107,10 +3120,11 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LEU (DImode, alpha_compare_op0, alpha_compare_op1); + operands[1] = gen_rtx_LEU (DImode, alpha_compare.op0, alpha_compare.op1); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sgtu" @@ -3119,11 +3133,12 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); + operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare.op1), + alpha_compare.op0); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") (define_expand "sgeu" @@ -3132,11 +3147,12 @@ "" " { - if (alpha_compare_fp_p) + if (alpha_compare.fp_p) FAIL; - operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); + operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare.op1), + alpha_compare.op0); + alpha_compare.op0 = alpha_compare.op1 = NULL_RTX; }") ;; These are the main define_expand's used to make conditional moves. |