alpha.h (alpha_compare): New.

* 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).

From-SVN: r29183
This commit is contained in:
Richard Henderson 1999-09-07 22:13:35 -07:00 committed by Richard Henderson
parent 01439aeea5
commit 6db21c7fb8
4 changed files with 81 additions and 43 deletions

View File

@ -1,3 +1,14 @@
Tue Sep 7 22:09:03 1999 Richard Henderson <rth@cygnus.com>
* 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).
Tue Sep 7 21:55:02 1999 Richard Henderson <rth@cygnus.com>
* alpha.h (alpha_eh_epilogue_sp_ofs): Remove.

View File

@ -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);

View File

@ -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. */

View File

@ -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.