The callers of do_jump_by_parts_* had already established
that the modes were MODE_INTs, so this patch passes the
modes down as scalar_int_modes.

2017-07-13  Richard Sandiford  <richard.sandif...@linaro.org>
            Alan Hayward  <alan.hayw...@arm.com>
            David Sherwood  <david.sherw...@arm.com>

gcc/
        * dojump.c (do_jump_by_parts_greater_rtx): Change the type of
        the mode argument to scalar_int_mode.
        (do_jump_by_parts_zero_rtx): Likewise.
        (do_jump_by_parts_equality_rtx): Likewise.
        (do_jump_by_parts_greater): Take a mode argument.
        (do_jump_by_parts_equality): Likewise.
        (do_jump_1): Update calls accordingly.

Index: gcc/dojump.c
===================================================================
--- gcc/dojump.c        2017-07-13 09:18:38.657812970 +0100
+++ gcc/dojump.c        2017-07-13 09:18:50.326871958 +0100
@@ -38,11 +38,12 @@ Software Foundation; either version 3, o
 #include "langhooks.h"
 
 static bool prefer_and_bit_test (machine_mode, int);
-static void do_jump_by_parts_greater (tree, tree, int,
+static void do_jump_by_parts_greater (scalar_int_mode, tree, tree, int,
                                      rtx_code_label *, rtx_code_label *,
                                      profile_probability);
-static void do_jump_by_parts_equality (tree, tree, rtx_code_label *,
-                                      rtx_code_label *, profile_probability);
+static void do_jump_by_parts_equality (scalar_int_mode, tree, tree,
+                                      rtx_code_label *, rtx_code_label *,
+                                      profile_probability);
 static void do_compare_and_jump        (tree, tree, enum rtx_code, enum 
rtx_code,
                                 rtx_code_label *, rtx_code_label *,
                                 profile_probability);
@@ -221,8 +222,8 @@ do_jump_1 (enum tree_code code, tree op0
                   prob.invert ());
        else if (is_int_mode (TYPE_MODE (inner_type), &int_mode)
                 && !can_compare_p (EQ, int_mode, ccp_jump))
-         do_jump_by_parts_equality (op0, op1, if_false_label, if_true_label,
-                                    prob);
+         do_jump_by_parts_equality (int_mode, op0, op1, if_false_label,
+                                    if_true_label, prob);
         else
          do_compare_and_jump (op0, op1, EQ, EQ, if_false_label, if_true_label,
                               prob);
@@ -242,8 +243,8 @@ do_jump_1 (enum tree_code code, tree op0
          do_jump (op0, if_false_label, if_true_label, prob);
        else if (is_int_mode (TYPE_MODE (inner_type), &int_mode)
                 && !can_compare_p (NE, int_mode, ccp_jump))
-         do_jump_by_parts_equality (op0, op1, if_true_label, if_false_label,
-                                    prob.invert ());
+         do_jump_by_parts_equality (int_mode, op0, op1, if_true_label,
+                                    if_false_label, prob.invert ());
         else
          do_compare_and_jump (op0, op1, NE, NE, if_false_label, if_true_label,
                               prob);
@@ -254,7 +255,7 @@ do_jump_1 (enum tree_code code, tree op0
       mode = TYPE_MODE (TREE_TYPE (op0));
       if (is_int_mode (mode, &int_mode)
          && ! can_compare_p (LT, int_mode, ccp_jump))
-       do_jump_by_parts_greater (op0, op1, 1, if_false_label,
+       do_jump_by_parts_greater (int_mode, op0, op1, 1, if_false_label,
                                  if_true_label, prob);
       else
        do_compare_and_jump (op0, op1, LT, LTU, if_false_label, if_true_label,
@@ -265,8 +266,8 @@ do_jump_1 (enum tree_code code, tree op0
       mode = TYPE_MODE (TREE_TYPE (op0));
       if (is_int_mode (mode, &int_mode)
          && ! can_compare_p (LE, int_mode, ccp_jump))
-       do_jump_by_parts_greater (op0, op1, 0, if_true_label, if_false_label,
-                                 prob.invert ());
+       do_jump_by_parts_greater (int_mode, op0, op1, 0, if_true_label,
+                                 if_false_label, prob.invert ());
       else
        do_compare_and_jump (op0, op1, LE, LEU, if_false_label, if_true_label,
                             prob);
@@ -276,7 +277,7 @@ do_jump_1 (enum tree_code code, tree op0
       mode = TYPE_MODE (TREE_TYPE (op0));
       if (is_int_mode (mode, &int_mode)
          && ! can_compare_p (GT, int_mode, ccp_jump))
-       do_jump_by_parts_greater (op0, op1, 0, if_false_label,
+       do_jump_by_parts_greater (int_mode, op0, op1, 0, if_false_label,
                                  if_true_label, prob);
       else
        do_compare_and_jump (op0, op1, GT, GTU, if_false_label, if_true_label,
@@ -287,8 +288,8 @@ do_jump_1 (enum tree_code code, tree op0
       mode = TYPE_MODE (TREE_TYPE (op0));
       if (is_int_mode (mode, &int_mode)
          && ! can_compare_p (GE, int_mode, ccp_jump))
-       do_jump_by_parts_greater (op0, op1, 1, if_true_label, if_false_label,
-                                 prob.invert ());
+       do_jump_by_parts_greater (int_mode, op0, op1, 1, if_true_label,
+                                 if_false_label, prob.invert ());
       else
        do_compare_and_jump (op0, op1, GE, GEU, if_false_label, if_true_label,
                             prob);
@@ -667,7 +668,7 @@ do_jump (tree exp, rtx_code_label *if_fa
    Jump to IF_TRUE_LABEL if OP0 is greater, IF_FALSE_LABEL otherwise.  */
 
 static void
-do_jump_by_parts_greater_rtx (machine_mode mode, int unsignedp, rtx op0,
+do_jump_by_parts_greater_rtx (scalar_int_mode mode, int unsignedp, rtx op0,
                              rtx op1, rtx_code_label *if_false_label,
                              rtx_code_label *if_true_label,
                              profile_probability prob)
@@ -743,17 +744,16 @@ do_jump_by_parts_greater_rtx (machine_mo
 /* Given a comparison expression EXP for values too wide to be compared
    with one insn, test the comparison and jump to the appropriate label.
    The code of EXP is ignored; we always test GT if SWAP is 0,
-   and LT if SWAP is 1.  */
+   and LT if SWAP is 1.  MODE is the mode of the two operands.  */
 
 static void
-do_jump_by_parts_greater (tree treeop0, tree treeop1, int swap,
-                         rtx_code_label *if_false_label,
+do_jump_by_parts_greater (scalar_int_mode mode, tree treeop0, tree treeop1,
+                         int swap, rtx_code_label *if_false_label,
                          rtx_code_label *if_true_label,
                          profile_probability prob)
 {
   rtx op0 = expand_normal (swap ? treeop1 : treeop0);
   rtx op1 = expand_normal (swap ? treeop0 : treeop1);
-  machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0));
   int unsignedp = TYPE_UNSIGNED (TREE_TYPE (treeop0));
 
   do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label,
@@ -766,7 +766,7 @@ do_jump_by_parts_greater (tree treeop0,
    to indicate drop through.  */
 
 static void
-do_jump_by_parts_zero_rtx (machine_mode mode, rtx op0,
+do_jump_by_parts_zero_rtx (scalar_int_mode mode, rtx op0,
                           rtx_code_label *if_false_label,
                           rtx_code_label *if_true_label,
                           profile_probability prob)
@@ -817,7 +817,7 @@ do_jump_by_parts_zero_rtx (machine_mode
    to indicate drop through.  */
 
 static void
-do_jump_by_parts_equality_rtx (machine_mode mode, rtx op0, rtx op1,
+do_jump_by_parts_equality_rtx (scalar_int_mode mode, rtx op0, rtx op1,
                               rtx_code_label *if_false_label,
                               rtx_code_label *if_true_label,
                               profile_probability prob)
@@ -855,17 +855,17 @@ do_jump_by_parts_equality_rtx (machine_m
 }
 
 /* Given an EQ_EXPR expression EXP for values too wide to be compared
-   with one insn, test the comparison and jump to the appropriate label.  */
+   with one insn, test the comparison and jump to the appropriate label.
+   MODE is the mode of the two operands.  */
 
 static void
-do_jump_by_parts_equality (tree treeop0, tree treeop1,
+do_jump_by_parts_equality (scalar_int_mode mode, tree treeop0, tree treeop1,
                           rtx_code_label *if_false_label,
                           rtx_code_label *if_true_label,
                           profile_probability prob)
 {
   rtx op0 = expand_normal (treeop0);
   rtx op1 = expand_normal (treeop1);
-  machine_mode mode = TYPE_MODE (TREE_TYPE (treeop0));
   do_jump_by_parts_equality_rtx (mode, op0, op1, if_false_label,
                                 if_true_label, prob);
 }

Reply via email to