diff options
author | J"orn Rennecke <joern.rennecke@superh.com> | 2002-07-07 19:56:31 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2002-07-07 20:56:31 +0100 |
commit | c8cc4417e4b05d1ca1ef51a9bf38c1af29c29c55 (patch) | |
tree | cddb5430d2a41537bd2c501dfd5c34fcc336ccca /gcc | |
parent | 78abea278bf8ce0d6cf3735e5306f2644abbc643 (diff) | |
download | gcc-c8cc4417e4b05d1ca1ef51a9bf38c1af29c29c55.zip gcc-c8cc4417e4b05d1ca1ef51a9bf38c1af29c29c55.tar.gz gcc-c8cc4417e4b05d1ca1ef51a9bf38c1af29c29c55.tar.bz2 |
sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''.
* sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''.
(PREDICATE_CODES): Add entries for equality_comparison_operator,
greater_comparison_operator and less_comparison_operator.
* sh.c (print_operand): Add '\'' code. Make 'o' handle
more operators.
(equality_comparison_operator): New function.
(greater_comparison_operator, less_comparison_operator): Likewise.
* sh.md (beq_media_i): Disable generator function generation.
Use match_operator to handle a whole class of comparisons. Add
modifier in output template to provide branch prediction. Add type.
(bgt_media_i, ble_media_i): Likewise. Allow zero operands.
(bne_media_i, bge_media_i, bgtu_media_i, bgeu_media_i): Delete.
(blt_media_i, bleu_media_i, bltu_media_i): Likewise.
(bgt, blt, ble, bge, bgtu, bltu, bgeu, bleu): Allow zero operands.
From-SVN: r55305
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 66 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 5 | ||||
-rw-r--r-- | gcc/config/sh/sh.md | 143 |
4 files changed, 134 insertions, 97 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a1b683..b14bb37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +Sun Jul 7 20:38:38 2002 J"orn Rennecke <joern.rennecke@superh.com> + + * sh.h (PRINT_OPERAND_PUNCT_VALID_P): Allow '\''. + (PREDICATE_CODES): Add entries for equality_comparison_operator, + greater_comparison_operator and less_comparison_operator. + * sh.c (print_operand): Add '\'' code. Make 'o' handle + more operators. + (equality_comparison_operator): New function. + (greater_comparison_operator, less_comparison_operator): Likewise. + * sh.md (beq_media_i): Disable generator function generation. + Use match_operator to handle a whole class of comparisons. Add + modifier in output template to provide branch prediction. Add type. + (bgt_media_i, ble_media_i): Likewise. Allow zero operands. + (bne_media_i, bge_media_i, bgtu_media_i, bgeu_media_i): Delete. + (blt_media_i, bleu_media_i, bltu_media_i): Likewise. + (bgt, blt, ble, bge, bgtu, bltu, bgeu, bleu): Allow zero operands. + 2002-07-07 Hans-Peter Nilsson <hp@bitrange.com> Emit MMIX function prologue and epilogue as rtl. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 1acdc96..bca5fe3 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -325,6 +325,7 @@ print_operand_address (stream, x) ',' print LOCAL_LABEL_PREFIX '@' print trap, rte or rts depending upon pragma interruptness '#' output a nop if there is nothing to put in the delay slot + ''' print likelyhood suffix (/u for unlikely). 'O' print a constant without the # 'R' print the LSW of a dp value - changes if in little endian 'S' print the MSW of a dp value - changes if in little endian @@ -364,6 +365,14 @@ print_operand (stream, x, code) if (dbr_sequence_length () == 0) fprintf (stream, "\n\tnop"); break; + case '\'': + { + rtx note = find_reg_note (current_output_insn, REG_BR_PROB, 0); + + if (note && INTVAL (XEXP (note, 0)) * 2 < REG_BR_PROB_BASE) + fputs ("/u", stream); + break; + } case 'O': x = mark_constant_pool_use (x); output_addr_const (stream, x); @@ -398,6 +407,12 @@ print_operand (stream, x, code) case MINUS: fputs ("sub", stream); break; case MULT: fputs ("mul", stream); break; case DIV: fputs ("div", stream); break; + case EQ: fputs ("eq", stream); break; + case NE: fputs ("ne", stream); break; + case GT: case LT: fputs ("gt", stream); break; + case GE: case LE: fputs ("ge", stream); break; + case GTU: case LTU: fputs ("gtu", stream); break; + case GEU: case LEU: fputs ("geu", stream); break; default: break; } @@ -443,7 +458,7 @@ print_operand (stream, x, code) goto default_output; case 'u': if (GET_CODE (x) == CONST_INT) - { + { fprintf ((stream), "%u", (unsigned) INTVAL (x) & (0x10000 - 1)); break; } @@ -6139,6 +6154,51 @@ binary_float_operator (op, mode) return 0; } +int +equality_comparison_operator (op, mode) + rtx op; + enum machine_mode mode; +{ + return ((mode == VOIDmode || GET_MODE (op) == mode) + && (GET_CODE (op) == EQ || GET_CODE (op) == NE)); +} + +int greater_comparison_operator (op, mode) + rtx op; + enum machine_mode mode; +{ + if (mode != VOIDmode && GET_MODE (op) == mode) + return 0; + switch (GET_CODE (op)) + { + case GT: + case GE: + case GTU: + case GEU: + return 1; + default: + return 0; + } +} + +int less_comparison_operator (op, mode) + rtx op; + enum machine_mode mode; +{ + if (mode != VOIDmode && GET_MODE (op) == mode) + return 0; + switch (GET_CODE (op)) + { + case LT: + case LE: + case LTU: + case LEU: + return 1; + default: + return 0; + } +} + /* Accept pseudos and branch target registers. */ int target_reg_operand (op, mode) @@ -6251,12 +6311,12 @@ sh_rep_vec (v, mode) for (i -= 2 ; i >= 0; i -= 2) if (! rtx_equal_p (XVECEXP (v, 0, i + 1), x) || ! rtx_equal_p (XVECEXP (v, 0, i), y)) - return 0; + return 0; } else for (; i >= 0; i--) if (XVECEXP (v, 0, i) != x) - return 0; + return 0; return 1; } diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 1a25849..91d81e1 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -3105,7 +3105,7 @@ while (0) #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ ((CHAR) == '.' || (CHAR) == '#' || (CHAR) == '@' || (CHAR) == ',' \ - || (CHAR) == '$') + || (CHAR) == '$'|| (CHAR) == '\'') /* Recognize machine-specific patterns that may appear within constants. Used for PIC-specific UNSPECs. */ @@ -3234,6 +3234,7 @@ extern int rtx_equal_function_value_matters; {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_VECTOR}}, \ {"binary_float_operator", {PLUS, MULT}}, \ {"commutative_float_operator", {PLUS, MULT}}, \ + {"equality_comparison_operator", {EQ,NE}}, \ {"extend_reg_operand", {SUBREG, REG, TRUNCATE}}, \ {"extend_reg_or_0_operand", {SUBREG, REG, TRUNCATE, CONST_INT}}, \ {"fp_arith_reg_operand", {SUBREG, REG}}, \ @@ -3241,6 +3242,8 @@ extern int rtx_equal_function_value_matters; {"fpul_operand", {REG}}, \ {"general_movsrc_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, MEM}}, \ {"general_movdst_operand", {SUBREG, REG, MEM}}, \ + {"greater_comparison_operator", {GT,GE,GTU,GEU}}, \ + {"less_comparison_operator", {LT,LE,LTU,LEU}}, \ {"logical_operand", {SUBREG, REG, CONST_INT}}, \ {"mextr_bit_offset", {CONST_INT}}, \ {"noncommutative_float_operator", {MINUS, DIV}}, \ diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 0894f9f..4acce0d 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -4707,16 +4707,18 @@ "TARGET_SHMEDIA" "") -(define_insn "beq_media_i" +(define_insn "*beq_media_i" [(set (pc) - (if_then_else (eq (match_operand:DI 1 "arith_reg_operand" "r,r") - (match_operand:DI 2 "arith_operand" "r,O")) + (if_then_else (match_operator 3 "equality_comparison_operator" + [(match_operand:DI 1 "arith_reg_operand" "r,r") + (match_operand:DI 2 "arith_operand" "r,O")]) (match_operand:DI 0 "target_operand" "b,b") (pc)))] "TARGET_SHMEDIA" "@ - beq %1, %2, %0 - beqi %1, %2, %0") + b%o3%' %1, %2, %0 + b%o3i%' %1, %2, %0" + [(set_attr "type" "cbranch_media")]) (define_expand "bne_media" [(set (pc) @@ -4727,17 +4729,6 @@ "TARGET_SHMEDIA" "") -(define_insn "bne_media_i" - [(set (pc) - (if_then_else (ne (match_operand:DI 1 "arith_reg_operand" "r,r") - (match_operand:DI 2 "arith_operand" "r,O")) - (match_operand:DI 0 "target_operand" "b,b") - (pc)))] - "TARGET_SHMEDIA" - "@ - bne %1, %2, %0 - bnei %1, %2, %0") - (define_expand "bgt_media" [(set (pc) (if_then_else (gt (match_operand:DI 1 "arith_reg_operand" "r") @@ -4747,15 +4738,6 @@ "TARGET_SHMEDIA" "") -(define_insn "bgt_media_i" - [(set (pc) - (if_then_else (gt (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bgt %1, %2, %0") - (define_expand "bge_media" [(set (pc) (if_then_else (ge (match_operand:DI 1 "arith_reg_operand" "r") @@ -4765,15 +4747,6 @@ "TARGET_SHMEDIA" "") -(define_insn "bge_media_i" - [(set (pc) - (if_then_else (ge (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bge %1, %2, %0") - (define_expand "bgtu_media" [(set (pc) (if_then_else (gtu (match_operand:DI 1 "arith_reg_operand" "r") @@ -4783,15 +4756,6 @@ "TARGET_SHMEDIA" "") -(define_insn "bgtu_media_i" - [(set (pc) - (if_then_else (gtu (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bgtu %1, %2, %0") - (define_expand "bgeu_media" [(set (pc) (if_then_else (geu (match_operand:DI 1 "arith_reg_operand" "r") @@ -4801,51 +4765,28 @@ "TARGET_SHMEDIA" "") -(define_insn "bgeu_media_i" +(define_insn "*bgt_media_i" [(set (pc) - (if_then_else (geu (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) + (if_then_else (match_operator 3 "greater_comparison_operator" + [(match_operand:DI 1 "arith_reg_or_0_operand" "rN") + (match_operand:DI 2 "arith_reg_or_0_operand" "rN")]) (match_operand:DI 0 "target_operand" "b") (pc)))] "TARGET_SHMEDIA" - "bgeu %1, %2, %0") + "b%o3%' %N1, %N2, %0" + [(set_attr "type" "cbranch_media")]) ;; These are only needed to make invert_jump() happy. (define_insn "*ble_media_i" [(set (pc) - (if_then_else (le (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bge %2, %1, %0") - -(define_insn "*blt_media_i" - [(set (pc) - (if_then_else (lt (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bgt %2, %1, %0") - -(define_insn "*bleu_media_i" - [(set (pc) - (if_then_else (leu (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) - (match_operand:DI 0 "target_operand" "b") - (pc)))] - "TARGET_SHMEDIA" - "bgeu %2, %1, %0") - -(define_insn "*bltu_media_i" - [(set (pc) - (if_then_else (ltu (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:DI 2 "arith_reg_operand" "r")) + (if_then_else (match_operator 3 "less_comparison_operator" + [(match_operand:DI 1 "arith_reg_operand" "rN") + (match_operand:DI 2 "arith_reg_operand" "rN")]) (match_operand:DI 0 "target_operand" "b") (pc)))] "TARGET_SHMEDIA" - "bgtu %2, %1, %0") + "b%o3%' %N2, %N1, %0" + [(set_attr "type" "cbranch_media")]) (define_expand "beq" [(set (pc) @@ -4922,8 +4863,10 @@ DONE; } - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgt_media (operands[0], sh_compare_op0, sh_compare_op1)); DONE; @@ -4951,8 +4894,10 @@ DONE; } - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgt_media (operands[0], sh_compare_op1, sh_compare_op0)); DONE; @@ -4988,8 +4933,10 @@ DONE; } - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bge_media (operands[0], sh_compare_op1, sh_compare_op0)); DONE; @@ -5027,8 +4974,10 @@ DONE; } - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bge_media (operands[0], sh_compare_op0, sh_compare_op1)); DONE; @@ -5057,8 +5006,10 @@ { if (TARGET_SHMEDIA) { - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgtu_media (operands[0], sh_compare_op0, sh_compare_op1)); DONE; @@ -5077,8 +5028,10 @@ { if (TARGET_SHMEDIA) { - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgtu_media (operands[0], sh_compare_op1, sh_compare_op0)); DONE; @@ -5097,8 +5050,10 @@ { if (TARGET_SHMEDIA) { - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgeu_media (operands[0], sh_compare_op0, sh_compare_op1)); DONE; @@ -5117,8 +5072,10 @@ { if (TARGET_SHMEDIA) { - sh_compare_op0 = force_reg (DImode, sh_compare_op0); - sh_compare_op1 = force_reg (DImode, sh_compare_op1); + if (sh_compare_op0 != const0_rtx) + sh_compare_op0 = force_reg (DImode, sh_compare_op0); + if (sh_compare_op1 != const0_rtx) + sh_compare_op1 = force_reg (DImode, sh_compare_op1); emit_jump_insn (gen_bgeu_media (operands[0], sh_compare_op1, sh_compare_op0)); DONE; |