alpha.h (alpha_compare): New.
authorRichard Henderson <rth@cygnus.com>
Wed, 8 Sep 1999 05:13:35 +0000 (22:13 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 8 Sep 1999 05:13:35 +0000 (22:13 -0700)
        * 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

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/alpha/alpha.md

index c5a8b174cdadd6ab778193a1545d825ba607e07b..fd51818869b7592ccf1dd1aa2d3a7a478146f182 100644 (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.
index 37699ca5d50422ab0450b2e69e81cdb6bda5fd8c..fbc1ebc395d1ba49ad17ad81a962353757e7e5f9 100644 (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);
index a18ad5fd25fa863d65ab5a27159fe31029f91583..db9dec936d0204b1a42d84db674e49d92916dc59 100644 (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.  */
 
index 456642f050d5fc024f72d1d2e5ce431e85f08689..8bdb39689d1bb3ee03a0d76fb025b66e35c18c12 100644 (file)
   "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;
 }")
 
   ""
   "
 {
-  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;
 }")
 
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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"
   ""
   "
 {
-  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;
 }")
 \f
 ;; These are the main define_expand's used to make conditional moves.