rs6000: Update conditional jump patterns, no more (pc) (label_ref)
authorSegher Boessenkool <segher@kernel.crashing.org>
Sun, 8 Oct 2017 22:36:36 +0000 (00:36 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Sun, 8 Oct 2017 22:36:36 +0000 (00:36 +0200)
Currently we have two patterns for every conditional jump: one jumping
if some condition is met, and the other jumping if it is not met.  We
don't need that second form because all our conditions have an opposite
already, and the generic code can deal with that just fine.

This patch deletes that second form.  We generated it directly in one
case; adjusted here.

* config/rs6000/rs6000-string.c (expand_strncmp_align_check): Invert
a conditional jump (and the compare for it) so that pc_rtx is the
last operand.
* config/rs6000/rs6000.c (rs6000_legitimate_combined_insn): Adjust
for the deleted and renamed ctr<mode>_internal[234] patterns.
* config/rs6000/rs6000.md: Delete second conditional branch pattern.
Delete second conditional return pattern.
(ctr<mode>_internal2): Delete this second bdnz pattern.
(ctr<mode>_internal3): Rename to ctr<mode>_internal2.
(ctr<mode>_internal4): Delete this second bdz pattern.

From-SVN: r253531

gcc/ChangeLog
gcc/config/rs6000/rs6000-string.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md

index baf6a6d..7292163 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-08  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       * config/rs6000/rs6000-string.c (expand_strncmp_align_check): Invert
+       a conditional jump (and the compare for it) so that pc_rtx is the
+       last operand.
+       * config/rs6000/rs6000.c (rs6000_legitimate_combined_insn): Adjust
+       for the deleted and renamed ctr<mode>_internal[234] patterns.
+       * config/rs6000/rs6000.md: Delete second conditional branch pattern.
+       Delete second conditional return pattern.
+       (ctr<mode>_internal2): Delete this second bdnz pattern.
+       (ctr<mode>_internal3): Rename to ctr<mode>_internal2.
+       (ctr<mode>_internal4): Delete this second bdz pattern.
+
 2017-10-08  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-outof-ssa.h (ssaexpand): Add partitions_for_undefined_values.
index 19463c9..8c2a93e 100644 (file)
@@ -674,10 +674,10 @@ expand_strncmp_align_check (rtx strncmp_label, rtx src, HOST_WIDE_INT bytes)
   emit_move_insn (cond, gen_rtx_COMPARE (CCmode, src_check,
                                         GEN_INT (4096 - bytes)));
 
-  rtx cmp_rtx = gen_rtx_LT (VOIDmode, cond, const0_rtx);
+  rtx cmp_rtx = gen_rtx_GE (VOIDmode, cond, const0_rtx);
 
   rtx ifelse = gen_rtx_IF_THEN_ELSE (VOIDmode, cmp_rtx,
-                                    pc_rtx, lab_ref);
+                                    lab_ref, pc_rtx);
   rtx j = emit_jump_insn (gen_rtx_SET (pc_rtx, ifelse));
   JUMP_LABEL (j) = strncmp_label;
   LABEL_NUSES (strncmp_label) += 1;
index b903f47..104f2ed 100644 (file)
@@ -9051,11 +9051,7 @@ rs6000_legitimate_combined_insn (rtx_insn *insn)
       && (icode == CODE_FOR_ctrsi_internal1
          || icode == CODE_FOR_ctrdi_internal1
          || icode == CODE_FOR_ctrsi_internal2
-         || icode == CODE_FOR_ctrdi_internal2
-         || icode == CODE_FOR_ctrsi_internal3
-         || icode == CODE_FOR_ctrdi_internal3
-         || icode == CODE_FOR_ctrsi_internal4
-         || icode == CODE_FOR_ctrdi_internal4))
+         || icode == CODE_FOR_ctrdi_internal2))
     return false;
 
   return true;
index d8767de..e3132c2 100644 (file)
   [(set_attr "type" "jmpreg")
    (set_attr "length" "4")])
 
-(define_insn ""
-  [(set (pc)
-       (if_then_else (match_operator 1 "branch_comparison_operator"
-                                     [(match_operand 2
-                                                     "cc_reg_operand" "y")
-                                      (const_int 0)])
-                     (pc)
-                     (label_ref (match_operand 0 "" ""))))]
-  ""
-  "*
-{
-  return output_cbranch (operands[1], \"%l0\", 1, insn);
-}"
-  [(set_attr "type" "branch")])
-
-(define_insn ""
-  [(set (pc)
-       (if_then_else (match_operator 0 "branch_comparison_operator"
-                                     [(match_operand 1
-                                                     "cc_reg_operand" "y")
-                                      (const_int 0)])
-                     (pc)
-                     (any_return)))]
-  "<return_pred>"
-  "*
-{
-  return output_cbranch (operands[0], NULL, 1, insn);
-}"
-  [(set_attr "type" "jmpreg")
-   (set_attr "length" "4")])
-
 ;; Logic on condition register values.
 
 ; This pattern matches things like
   [(set_attr "type" "branch")
    (set_attr "length" "*,16,20,20")])
 
-(define_insn "ctr<mode>_internal2"
-  [(set (pc)
-       (if_then_else (ne (match_operand:P 1 "register_operand" "c,*b,*b,*b")
-                         (const_int 1))
-                     (pc)
-                     (label_ref (match_operand 0 "" ""))))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wi*c*l")
-       (plus:P (match_dup 1)
-                (const_int -1)))
-   (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
-   (clobber (match_scratch:P 4 "=X,X,&r,r"))]
-  ""
-  "*
-{
-  if (which_alternative != 0)
-    return \"#\";
-  else if (get_attr_length (insn) == 4)
-    return \"bdz %l0\";
-  else
-    return \"bdnz $+8\;b %l0\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "*,16,20,20")])
-
 ;; Similar but use EQ
 
-(define_insn "ctr<mode>_internal3"
+(define_insn "ctr<mode>_internal2"
   [(set (pc)
        (if_then_else (eq (match_operand:P 1 "register_operand" "c,*b,*b,*b")
                          (const_int 1))
   [(set_attr "type" "branch")
    (set_attr "length" "*,16,20,20")])
 
-(define_insn "ctr<mode>_internal4"
-  [(set (pc)
-       (if_then_else (eq (match_operand:P 1 "register_operand" "c,*b,*b,*b")
-                         (const_int 1))
-                     (pc)
-                     (label_ref (match_operand 0 "" ""))))
-   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*wi*c*l")
-       (plus:P (match_dup 1)
-                (const_int -1)))
-   (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
-   (clobber (match_scratch:P 4 "=X,X,&r,r"))]
-  ""
-  "*
-{
-  if (which_alternative != 0)
-    return \"#\";
-  else if (get_attr_length (insn) == 4)
-    return \"bdnz %l0\";
-  else
-    return \"bdz $+8\;b %l0\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "*,16,20,20")])
-
 ;; Now the splitters if we could not allocate the CTR register
 
 (define_split