From 0c791c59386785c32eb3cff33466ab4576ca75b5 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Mon, 9 Oct 2017 00:36:36 +0200 Subject: [PATCH] rs6000: Update conditional jump patterns, no more (pc) (label_ref) 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_internal[234] patterns. * config/rs6000/rs6000.md: Delete second conditional branch pattern. Delete second conditional return pattern. (ctr_internal2): Delete this second bdnz pattern. (ctr_internal3): Rename to ctr_internal2. (ctr_internal4): Delete this second bdz pattern. From-SVN: r253531 --- gcc/ChangeLog | 13 +++++ gcc/config/rs6000/rs6000-string.c | 4 +- gcc/config/rs6000/rs6000.c | 6 +-- gcc/config/rs6000/rs6000.md | 81 +------------------------------ 4 files changed, 17 insertions(+), 87 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index baf6a6d96bd..72921639424 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2017-10-08 Segher Boessenkool + + * 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_internal[234] patterns. + * config/rs6000/rs6000.md: Delete second conditional branch pattern. + Delete second conditional return pattern. + (ctr_internal2): Delete this second bdnz pattern. + (ctr_internal3): Rename to ctr_internal2. + (ctr_internal4): Delete this second bdz pattern. + 2017-10-08 Eric Botcazou * tree-outof-ssa.h (ssaexpand): Add partitions_for_undefined_values. diff --git a/gcc/config/rs6000/rs6000-string.c b/gcc/config/rs6000/rs6000-string.c index 19463c98687..8c2a93e3d91 100644 --- a/gcc/config/rs6000/rs6000-string.c +++ b/gcc/config/rs6000/rs6000-string.c @@ -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; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b903f47ee27..104f2edb167 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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; diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d8767dee05c..e3132c2082f 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12626,37 +12626,6 @@ [(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 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 @@ -12933,33 +12902,9 @@ [(set_attr "type" "branch") (set_attr "length" "*,16,20,20")]) -(define_insn "ctr_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_internal3" +(define_insn "ctr_internal2" [(set (pc) (if_then_else (eq (match_operand:P 1 "register_operand" "c,*b,*b,*b") (const_int 1)) @@ -12983,30 +12928,6 @@ [(set_attr "type" "branch") (set_attr "length" "*,16,20,20")]) -(define_insn "ctr_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 -- 2.30.2