From: Ulrich Weigand Date: Thu, 24 Jun 2004 00:49:07 +0000 (+0000) Subject: s390-protos.h (s390_emit_compare): Add prototype. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6590e19ab7ed5c709611a1d3746d0ae9aefb9221;p=gcc.git s390-protos.h (s390_emit_compare): Add prototype. * config/s390/s390-protos.h (s390_emit_compare): Add prototype. (s390_emit_jump): Likewise. * config/s390/s390.c (s390_emit_compare): New function. (s390_emit_jump): Likewise. * config/s390/s390.md ("beq", "bne", "bgt", "bgtu", "blt", "bltu", "bge", "bgeu", "ble", "bleu", "bunordered", "bordered", "buneq", "bungt", "bunlt", "bunge", "bunle", "bltgt"): Use s390_emit_compare and s390_emit_jump. ("cjump"): Remove, replace by ... ("*cjump_64", "*cjump_31"): ... these insns. Improve length default. ("icjump", "*icjump_64", "*icjump_31"): Likewise. ("trap"): Fix type attribute. ("conditional_trap"): Use s390_emit_compare. ("doloop_si"): Remove, replace by ... ("doloop_si64", "doloop_si31"): ... these new insn_and_split. Merge existing splitter into insn_and_split. Improve length default. ("doloop_di"): Merge with existing splitter into insn_and_split. ("doloop"): Adapt. ("jump"): Convert to expander. Use s390_emit_jump. ("*jump_64", "*jump_31"): New insns. Improve length default. From-SVN: r83574 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 214eec74acf..8656a5f1688 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2004-06-23 Ulrich Weigand + + * config/s390/s390-protos.h (s390_emit_compare): Add prototype. + (s390_emit_jump): Likewise. + * config/s390/s390.c (s390_emit_compare): New function. + (s390_emit_jump): Likewise. + * config/s390/s390.md ("beq", "bne", "bgt", "bgtu", "blt", "bltu", + "bge", "bgeu", "ble", "bleu", "bunordered", "bordered", "buneq", + "bungt", "bunlt", "bunge", "bunle", "bltgt"): Use s390_emit_compare + and s390_emit_jump. + ("cjump"): Remove, replace by ... + ("*cjump_64", "*cjump_31"): ... these insns. Improve length default. + ("icjump", "*icjump_64", "*icjump_31"): Likewise. + ("trap"): Fix type attribute. + ("conditional_trap"): Use s390_emit_compare. + ("doloop_si"): Remove, replace by ... + ("doloop_si64", "doloop_si31"): ... these new insn_and_split. + Merge existing splitter into insn_and_split. Improve length default. + ("doloop_di"): Merge with existing splitter into insn_and_split. + ("doloop"): Adapt. + ("jump"): Convert to expander. Use s390_emit_jump. + ("*jump_64", "*jump_31"): New insns. Improve length default. + 2004-06-23 Wu Yongwei * gthr-win32.h (__GTHREAD_MUTEX_INIT_DEFAULT): Adjust. diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 2362cb66d0a..16faf39fe26 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -52,6 +52,8 @@ extern enum machine_mode s390_tm_ccmode (rtx, rtx, int); extern enum machine_mode s390_select_ccmode (enum rtx_code, rtx, rtx); extern int s390_alc_comparison (rtx op, enum machine_mode mode); extern int s390_slb_comparison (rtx op, enum machine_mode mode); +extern rtx s390_emit_compare (enum rtx_code, rtx, rtx); +extern void s390_emit_jump (rtx, rtx); extern int symbolic_reference_mentioned_p (rtx); extern int tls_symbolic_reference_mentioned_p (rtx); extern int legitimate_la_operand_p (rtx); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index cc48d015629..21cf73e38e2 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -468,6 +468,36 @@ s390_select_ccmode (enum rtx_code code, rtx op0, rtx op1) } } +/* Emit a compare instruction suitable to implement the comparison + OP0 CODE OP1. Return the correct condition RTL to be placed in + the IF_THEN_ELSE of the conditional branch testing the result. */ + +rtx +s390_emit_compare (enum rtx_code code, rtx op0, rtx op1) +{ + enum machine_mode mode = s390_select_ccmode (code, op0, op1); + rtx cc = gen_rtx_REG (mode, CC_REGNUM); + + emit_insn (gen_rtx_SET (VOIDmode, cc, gen_rtx_COMPARE (mode, op0, op1))); + return gen_rtx_fmt_ee (code, VOIDmode, cc, const0_rtx); +} + +/* Emit a jump instruction to TARGET. If COND is NULL_RTX, emit an + unconditional jump, else a conditional jump under condition COND. */ + +void +s390_emit_jump (rtx target, rtx cond) +{ + rtx insn; + + target = gen_rtx_LABEL_REF (VOIDmode, target); + if (cond) + target = gen_rtx_IF_THEN_ELSE (VOIDmode, cond, target, pc_rtx); + + insn = gen_rtx_SET (VOIDmode, pc_rtx, target); + emit_jump_insn (insn); +} + /* Return nonzero if OP is a valid comparison operator for an ALC condition in mode MODE. */ diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index b6ec023ed5f..b907d102cb5 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -6439,203 +6439,165 @@ ;; (define_expand "beq" - [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (eq (reg:CCZ 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (EQ, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bne" - [(set (reg:CCZ 33) (compare:CCZ (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ne (reg:CCZ 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (NE, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bgt" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (gt (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (GT, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bgtu" - [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (gtu (reg:CCU 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (GTU, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "blt" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (lt (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (LT, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bltu" - [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ltu (reg:CCU 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (LTU, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bge" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ge (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (GE, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bgeu" - [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (geu (reg:CCU 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (GEU, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "ble" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (le (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (LE, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bleu" - [(set (reg:CCU 33) (compare:CCU (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (leu (reg:CCU 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (LEU, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bunordered" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (unordered (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (UNORDERED, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bordered" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ordered (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (ORDERED, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "buneq" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (uneq (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") - -(define_expand "bungt" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ungt (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (UNEQ, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bunlt" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (unlt (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (UNLT, s390_compare_op0, s390_compare_op1)); DONE;") -(define_expand "bunge" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (unge (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] +(define_expand "bungt" + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (UNGT, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bunle" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (unle (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] + "" + "s390_emit_jump (operands[0], + s390_emit_compare (UNLE, s390_compare_op0, s390_compare_op1)); DONE;") + +(define_expand "bunge" + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (UNGE, s390_compare_op0, s390_compare_op1)); DONE;") (define_expand "bltgt" - [(set (reg:CCS 33) (compare:CCS (match_dup 1) (match_dup 2))) - (set (pc) - (if_then_else (ltgt (reg:CCS 33) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] + [(match_operand 0 "" "")] "" - "operands[1] = s390_compare_op0; operands[2] = s390_compare_op1;") + "s390_emit_jump (operands[0], + s390_emit_compare (LTGT, s390_compare_op0, s390_compare_op1)); DONE;") ;; ;;- Conditional jump instructions. ;; -(define_insn "cjump" - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" +(define_insn "*cjump_64" + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (label_ref (match_operand 0 "" "")) + (pc)))] + "TARGET_CPU_ZARCH" { if (get_attr_length (insn) == 4) return "j%C1\t%l0"; - else if (TARGET_CPU_ZARCH) + else return "jg%C1\t%l0"; +} + [(set_attr "op_type" "RI") + (set_attr "type" "branch") + (set (attr "length") + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)))]) + +(define_insn "*cjump_31" + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (label_ref (match_operand 0 "" "")) + (pc)))] + "!TARGET_CPU_ZARCH" +{ + if (get_attr_length (insn) == 4) + return "j%C1\t%l0"; else abort (); } [(set_attr "op_type" "RI") (set_attr "type" "branch") (set (attr "length") - (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) - (const_int 4) - (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) - (const_int 6) - (eq (symbol_ref "flag_pic") (const_int 0)) - (const_int 6)] (const_int 8)))]) + (if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 8))))]) (define_insn "*cjump_long" - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) - (match_operand 0 "address_operand" "U") - (pc)))] + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (match_operand 0 "address_operand" "U") + (pc)))] "" { if (get_attr_op_type (insn) == OP_TYPE_RR) @@ -6646,7 +6608,7 @@ [(set (attr "op_type") (if_then_else (match_operand 0 "register_operand" "") (const_string "RR") (const_string "RX"))) - (set_attr "type" "branch") + (set_attr "type" "branch") (set_attr "atype" "agen")]) @@ -6654,37 +6616,53 @@ ;;- Negated conditional jump instructions. ;; -(define_insn "icjump" - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) - (pc) - (label_ref (match_operand 0 "" ""))))] - "" +(define_insn "*icjump_64" + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (pc) + (label_ref (match_operand 0 "" ""))))] + "TARGET_CPU_ZARCH" { if (get_attr_length (insn) == 4) return "j%D1\t%l0"; - else if (TARGET_CPU_ZARCH) + else return "jg%D1\t%l0"; +} + [(set_attr "op_type" "RI") + (set_attr "type" "branch") + (set (attr "length") + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)))]) + +(define_insn "*icjump_31" + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (pc) + (label_ref (match_operand 0 "" ""))))] + "!TARGET_CPU_ZARCH" +{ + if (get_attr_length (insn) == 4) + return "j%D1\t%l0"; else abort (); } [(set_attr "op_type" "RI") (set_attr "type" "branch") (set (attr "length") - (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) - (const_int 4) - (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) - (const_int 6) - (eq (symbol_ref "flag_pic") (const_int 0)) - (const_int 6)] (const_int 8)))]) + (if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 8))))]) (define_insn "*icjump_long" - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) - (pc) - (match_operand 0 "address_operand" "U")))] + [(set (pc) + (if_then_else + (match_operator 1 "comparison_operator" [(reg 33) (const_int 0)]) + (pc) + (match_operand 0 "address_operand" "U")))] "" { if (get_attr_op_type (insn) == OP_TYPE_RR) @@ -6706,24 +6684,17 @@ [(trap_if (const_int 1) (const_int 0))] "" "j\t.+2" - [(set_attr "op_type" "RX") + [(set_attr "op_type" "RI") (set_attr "type" "branch")]) (define_expand "conditional_trap" - [(set (match_dup 2) (match_dup 3)) - (trap_if (match_operator 0 "comparison_operator" - [(match_dup 2) (const_int 0)]) - (match_operand:SI 1 "general_operand" ""))] + [(trap_if (match_operand 0 "comparison_operator" "") + (match_operand 1 "general_operand" ""))] "" { - enum machine_mode ccmode; - - if (operands[1] != const0_rtx) FAIL; - - ccmode = s390_select_ccmode (GET_CODE (operands[0]), - s390_compare_op0, s390_compare_op1); - operands[2] = gen_rtx_REG (ccmode, 33); - operands[3] = gen_rtx_COMPARE (ccmode, s390_compare_op0, s390_compare_op1); + if (operands[1] != const0_rtx) FAIL; + operands[0] = s390_emit_compare (GET_CODE (operands[0]), + s390_compare_op0, s390_compare_op1); }) (define_insn "*trap" @@ -6748,8 +6719,10 @@ (use (match_operand 4 "" ""))] ; label "" { - if (GET_MODE (operands[0]) == SImode) - emit_jump_insn (gen_doloop_si (operands[4], operands[0], operands[0])); + if (GET_MODE (operands[0]) == SImode && !TARGET_CPU_ZARCH) + emit_jump_insn (gen_doloop_si31 (operands[4], operands[0], operands[0])); + else if (GET_MODE (operands[0]) == SImode && TARGET_CPU_ZARCH) + emit_jump_insn (gen_doloop_si64 (operands[4], operands[0], operands[0])); else if (GET_MODE (operands[0]) == DImode && TARGET_64BIT) emit_jump_insn (gen_doloop_di (operands[4], operands[0], operands[0])); else @@ -6758,7 +6731,7 @@ DONE; }) -(define_insn "doloop_si" +(define_insn_and_split "doloop_si64" [(set (pc) (if_then_else (ne (match_operand:SI 1 "register_operand" "d,d") @@ -6769,26 +6742,75 @@ (plus:SI (match_dup 1) (const_int -1))) (clobber (match_scratch:SI 3 "=X,&d")) (clobber (reg:CC 33))] - "" + "TARGET_CPU_ZARCH" { if (which_alternative != 0) return "#"; else if (get_attr_length (insn) == 4) return "brct\t%1,%l0"; - else if (TARGET_CPU_ZARCH) + else return "ahi\t%1,-1\;jgne\t%l0"; +} + "&& reload_completed + && (! REG_P (operands[2]) + || ! rtx_equal_p (operands[1], operands[2]))" + [(set (match_dup 3) (match_dup 1)) + (parallel [(set (reg:CCAN 33) + (compare:CCAN (plus:SI (match_dup 3) (const_int -1)) + (const_int 0))) + (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))]) + (set (match_dup 2) (match_dup 3)) + (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0)) + (label_ref (match_dup 0)) + (pc)))] + "" + [(set_attr "op_type" "RI") + (set_attr "type" "branch") + (set (attr "length") + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 10)))]) + +(define_insn_and_split "doloop_si31" + [(set (pc) + (if_then_else + (ne (match_operand:SI 1 "register_operand" "d,d") + (const_int 1)) + (label_ref (match_operand 0 "" "")) + (pc))) + (set (match_operand:SI 2 "nonimmediate_operand" "=1,?*m*d") + (plus:SI (match_dup 1) (const_int -1))) + (clobber (match_scratch:SI 3 "=X,&d")) + (clobber (reg:CC 33))] + "!TARGET_CPU_ZARCH" +{ + if (which_alternative != 0) + return "#"; + else if (get_attr_length (insn) == 4) + return "brct\t%1,%l0"; else abort (); } + "&& reload_completed + && (! REG_P (operands[2]) + || ! rtx_equal_p (operands[1], operands[2]))" + [(set (match_dup 3) (match_dup 1)) + (parallel [(set (reg:CCAN 33) + (compare:CCAN (plus:SI (match_dup 3) (const_int -1)) + (const_int 0))) + (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))]) + (set (match_dup 2) (match_dup 3)) + (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0)) + (label_ref (match_dup 0)) + (pc)))] + "" [(set_attr "op_type" "RI") (set_attr "type" "branch") (set (attr "length") - (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) - (const_int 4) - (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) - (const_int 10) - (eq (symbol_ref "flag_pic") (const_int 0)) - (const_int 6)] (const_int 8)))]) + (if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 8))))]) (define_insn "*doloop_si_long" [(set (pc) @@ -6801,7 +6823,7 @@ (plus:SI (match_dup 1) (const_int -1))) (clobber (match_scratch:SI 3 "=X,&d")) (clobber (reg:CC 33))] - "" + "!TARGET_CPU_ZARCH" { if (get_attr_op_type (insn) == OP_TYPE_RR) return "bctr\t%1,%0"; @@ -6814,31 +6836,7 @@ (set_attr "type" "branch") (set_attr "atype" "agen")]) -(define_split - [(set (pc) - (if_then_else (ne (match_operand:SI 1 "register_operand" "") - (const_int 1)) - (match_operand 0 "" "") - (pc))) - (set (match_operand:SI 2 "nonimmediate_operand" "") - (plus:SI (match_dup 1) (const_int -1))) - (clobber (match_scratch:SI 3 "")) - (clobber (reg:CC 33))] - "reload_completed - && (! REG_P (operands[2]) - || ! rtx_equal_p (operands[1], operands[2]))" - [(set (match_dup 3) (match_dup 1)) - (parallel [(set (reg:CCAN 33) - (compare:CCAN (plus:SI (match_dup 3) (const_int -1)) - (const_int 0))) - (set (match_dup 3) (plus:SI (match_dup 3) (const_int -1)))]) - (set (match_dup 2) (match_dup 3)) - (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0)) - (match_dup 0) - (pc)))] - "") - -(define_insn "doloop_di" +(define_insn_and_split "doloop_di" [(set (pc) (if_then_else (ne (match_operand:DI 1 "register_operand" "d,d") @@ -6858,23 +6856,7 @@ else return "aghi\t%1,-1\;jgne\t%l0"; } - [(set_attr "op_type" "RI") - (set_attr "type" "branch") - (set (attr "length") - (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) - (const_int 4) (const_int 10)))]) - -(define_split - [(set (pc) - (if_then_else (ne (match_operand:DI 1 "register_operand" "") - (const_int 1)) - (match_operand 0 "" "") - (pc))) - (set (match_operand:DI 2 "nonimmediate_operand" "") - (plus:DI (match_dup 1) (const_int -1))) - (clobber (match_scratch:DI 3 "")) - (clobber (reg:CC 33))] - "reload_completed + "&& reload_completed && (! REG_P (operands[2]) || ! rtx_equal_p (operands[1], operands[2]))" [(set (match_dup 3) (match_dup 1)) @@ -6884,9 +6866,14 @@ (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))]) (set (match_dup 2) (match_dup 3)) (set (pc) (if_then_else (ne (reg:CCAN 33) (const_int 0)) - (match_dup 0) + (label_ref (match_dup 0)) (pc)))] - "") + "" + [(set_attr "op_type" "RI") + (set_attr "type" "branch") + (set (attr "length") + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 10)))]) ;; ;;- Unconditional jump instructions. @@ -6896,26 +6883,43 @@ ; jump instruction pattern(s). ; -(define_insn "jump" - [(set (pc) (label_ref (match_operand 0 "" "")))] +(define_expand "jump" + [(match_operand 0 "" "")] "" + "s390_emit_jump (operands[0], NULL_RTX); DONE;") + +(define_insn "*jump64" + [(set (pc) (label_ref (match_operand 0 "" "")))] + "TARGET_CPU_ZARCH" { if (get_attr_length (insn) == 4) return "j\t%l0"; - else if (TARGET_CPU_ZARCH) + else return "jg\t%l0"; +} + [(set_attr "op_type" "RI") + (set_attr "type" "branch") + (set (attr "length") + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)))]) + +(define_insn "*jump31" + [(set (pc) (label_ref (match_operand 0 "" "")))] + "!TARGET_CPU_ZARCH" +{ + if (get_attr_length (insn) == 4) + return "j\t%l0"; else abort (); } [(set_attr "op_type" "RI") (set_attr "type" "branch") (set (attr "length") - (cond [(lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) - (const_int 4) - (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) - (const_int 6) - (eq (symbol_ref "flag_pic") (const_int 0)) - (const_int 6)] (const_int 8)))]) + (if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 6)) + (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) + (const_int 4) (const_int 8))))]) ; ; indirect-jump instruction pattern(s).