Commit c8cc4417 by J"orn Rennecke Committed by Joern Rennecke

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
parent 78abea27
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.
......
......@@ -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;
}
......@@ -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)
......
......@@ -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}}, \
......
......@@ -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,7 +4863,9 @@
DONE;
}
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));
......@@ -4951,7 +4894,9 @@
DONE;
}
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));
......@@ -4988,7 +4933,9 @@
DONE;
}
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));
......@@ -5027,7 +4974,9 @@
DONE;
}
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));
......@@ -5057,7 +5006,9 @@
{
if (TARGET_SHMEDIA)
{
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));
......@@ -5077,7 +5028,9 @@
{
if (TARGET_SHMEDIA)
{
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));
......@@ -5097,7 +5050,9 @@
{
if (TARGET_SHMEDIA)
{
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));
......@@ -5117,7 +5072,9 @@
{
if (TARGET_SHMEDIA)
{
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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment