Commit 5d6d3339 by Jakub Jelinek Committed by David S. Miller

sparc.c (arith_4096_operand, [...]): New predicates.

	* config/sparc/sparc.c (arith_4096_operand, arith_add_operand,
	arith_double_4096_operand, arith_double_add_operand): New
	predicates.
	* config/sparc/sparc.h (PREDICATE_CODES): Add them, declare them.
	* config/sparc/sparc.md (adddi3, addsi3, subdi3, subsi3): Use
	them to transform add/sub 4096 into add/sub -4096.

From-SVN: r21961
parent 00045f52
Tue Aug 25 05:48:18 1998 Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>
* config/sparc/sparc.c (arith_4096_operand, arith_add_operand,
arith_double_4096_operand, arith_double_add_operand): New
predicates.
* config/sparc/sparc.h (PREDICATE_CODES): Add them, declare them.
* config/sparc/sparc.md (adddi3, addsi3, subdi3, subsi3): Use
them to transform add/sub 4096 into add/sub -4096.
Mon Aug 24 23:31:03 1998 David S. Miller <davem@pierdol.cobaltmicro.com> Mon Aug 24 23:31:03 1998 David S. Miller <davem@pierdol.cobaltmicro.com>
* loop.c (scan_loop): Allocate some slop to handle pseudos * loop.c (scan_loop): Allocate some slop to handle pseudos
......
...@@ -780,6 +780,30 @@ arith_operand (op, mode) ...@@ -780,6 +780,30 @@ arith_operand (op, mode)
return SPARC_SIMM13_P (val); return SPARC_SIMM13_P (val);
} }
/* Return true if OP is a constant 4096 */
int
arith_4096_operand (op, mode)
rtx op;
enum machine_mode mode;
{
int val;
if (GET_CODE (op) != CONST_INT)
return 0;
val = INTVAL (op) & 0xffffffff;
return val == 4096;
}
/* Return true if OP is suitable as second operand for add/sub */
int
arith_add_operand (op, mode)
rtx op;
enum machine_mode mode;
{
return arith_operand (op, mode) || arith_4096_operand (op, mode);
}
/* Return true if OP is a CONST_INT or a CONST_DOUBLE which can fit in the /* Return true if OP is a CONST_INT or a CONST_DOUBLE which can fit in the
immediate field of OR and XOR instructions. Used for 64-bit immediate field of OR and XOR instructions. Used for 64-bit
constant formation patterns. */ constant formation patterns. */
...@@ -879,6 +903,30 @@ arith_double_operand (op, mode) ...@@ -879,6 +903,30 @@ arith_double_operand (op, mode)
&& (CONST_DOUBLE_LOW (op) & 0x1000) == 0)))); && (CONST_DOUBLE_LOW (op) & 0x1000) == 0))));
} }
/* Return true if OP is a constant 4096 for DImode on ARCH64 */
int
arith_double_4096_operand (op, mode)
rtx op;
enum machine_mode mode;
{
return (TARGET_ARCH64 &&
((GET_CODE (op) == CONST_INT && INTVAL (op) == 4096) ||
(GET_CODE (op) == CONST_DOUBLE &&
CONST_DOUBLE_LOW (op) == 4096 &&
CONST_DOUBLE_HIGH (op) == 0)));
}
/* Return true if OP is suitable as second operand for add/sub in DImode */
int
arith_double_add_operand (op, mode)
rtx op;
enum machine_mode mode;
{
return arith_double_operand (op, mode) || arith_double_4096_operand (op, mode);
}
/* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that /* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that
can fit in an 11 bit immediate field. This is an acceptable DImode can fit in an 11 bit immediate field. This is an acceptable DImode
operand for the movcc instructions. */ operand for the movcc instructions. */
......
...@@ -3214,9 +3214,11 @@ do { \ ...@@ -3214,9 +3214,11 @@ do { \
{"cc_arithop", {AND, IOR, XOR}}, \ {"cc_arithop", {AND, IOR, XOR}}, \
{"cc_arithopn", {AND, IOR}}, \ {"cc_arithopn", {AND, IOR}}, \
{"arith_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \ {"arith_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
{"arith_add_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
{"arith11_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \ {"arith11_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
{"arith10_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \ {"arith10_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT}}, \
{"arith_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \ {"arith_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
{"arith_double_add_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}},\
{"arith11_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \ {"arith11_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
{"arith10_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \ {"arith10_double_operand", {SUBREG, REG, CONSTANT_P_RTX, CONST_INT, CONST_DOUBLE}}, \
{"small_int", {CONST_INT, CONSTANT_P_RTX}}, \ {"small_int", {CONST_INT, CONSTANT_P_RTX}}, \
...@@ -3262,7 +3264,11 @@ extern int arith10_operand (); ...@@ -3262,7 +3264,11 @@ extern int arith10_operand ();
extern int arith11_double_operand (); extern int arith11_double_operand ();
extern int arith11_operand (); extern int arith11_operand ();
extern int arith_double_operand (); extern int arith_double_operand ();
extern int arith_double_4096_operand ();
extern int arith_double_add_operand ();
extern int arith_operand (); extern int arith_operand ();
extern int arith_4096_operand ();
extern int arith_add_operand ();
extern int call_operand_address (); extern int call_operand_address ();
extern int input_operand (); extern int input_operand ();
extern int zero_operand (); extern int zero_operand ();
......
...@@ -4534,7 +4534,7 @@ ...@@ -4534,7 +4534,7 @@
(define_expand "adddi3" (define_expand "adddi3"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(plus:DI (match_operand:DI 1 "arith_double_operand" "%r") (plus:DI (match_operand:DI 1 "arith_double_operand" "%r")
(match_operand:DI 2 "arith_double_operand" "rHI")))] (match_operand:DI 2 "arith_double_add_operand" "rHI")))]
"" ""
" "
{ {
...@@ -4548,6 +4548,13 @@ ...@@ -4548,6 +4548,13 @@
gen_rtx_REG (CCmode, SPARC_ICC_REG))))); gen_rtx_REG (CCmode, SPARC_ICC_REG)))));
DONE; DONE;
} }
if (arith_double_4096_operand(operands[2], DImode))
{
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_MINUS (DImode, operands[1],
GEN_INT(-4096))));
DONE;
}
}") }")
(define_insn "adddi3_insn_sp32" (define_insn "adddi3_insn_sp32"
...@@ -4749,7 +4756,23 @@ ...@@ -4749,7 +4756,23 @@
[(set_attr "type" "binary") [(set_attr "type" "binary")
(set_attr "length" "1")]) (set_attr "length" "1")])
(define_insn "addsi3" (define_expand "addsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d")
(plus:SI (match_operand:SI 1 "arith_operand" "%r,d")
(match_operand:SI 2 "arith_add_operand" "rI,d")))]
""
"
{
if (arith_4096_operand(operands[2], DImode))
{
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_MINUS (SImode, operands[1],
GEN_INT(-4096))));
DONE;
}
}")
(define_insn "*addsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d") [(set (match_operand:SI 0 "register_operand" "=r,d")
(plus:SI (match_operand:SI 1 "arith_operand" "%r,d") (plus:SI (match_operand:SI 1 "arith_operand" "%r,d")
(match_operand:SI 2 "arith_operand" "rI,d")))] (match_operand:SI 2 "arith_operand" "rI,d")))]
...@@ -4807,7 +4830,7 @@ ...@@ -4807,7 +4830,7 @@
(define_expand "subdi3" (define_expand "subdi3"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(minus:DI (match_operand:DI 1 "register_operand" "r") (minus:DI (match_operand:DI 1 "register_operand" "r")
(match_operand:DI 2 "arith_double_operand" "rHI")))] (match_operand:DI 2 "arith_double_add_operand" "rHI")))]
"" ""
" "
{ {
...@@ -4821,6 +4844,13 @@ ...@@ -4821,6 +4844,13 @@
gen_rtx_REG (CCmode, SPARC_ICC_REG))))); gen_rtx_REG (CCmode, SPARC_ICC_REG)))));
DONE; DONE;
} }
if (arith_double_4096_operand(operands[2], DImode))
{
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_PLUS (DImode, operands[1],
GEN_INT(-4096))));
DONE;
}
}") }")
(define_insn "*subdi3_sp32" (define_insn "*subdi3_sp32"
...@@ -4925,7 +4955,23 @@ ...@@ -4925,7 +4955,23 @@
[(set_attr "type" "binary") [(set_attr "type" "binary")
(set_attr "length" "1")]) (set_attr "length" "1")])
(define_insn "subsi3" (define_expand "subsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d")
(minus:SI (match_operand:SI 1 "register_operand" "r,d")
(match_operand:SI 2 "arith_add_operand" "rI,d")))]
""
"
{
if (arith_4096_operand(operands[2], DImode))
{
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_PLUS (SImode, operands[1],
GEN_INT(-4096))));
DONE;
}
}")
(define_insn "*subsi3"
[(set (match_operand:SI 0 "register_operand" "=r,d") [(set (match_operand:SI 0 "register_operand" "=r,d")
(minus:SI (match_operand:SI 1 "register_operand" "r,d") (minus:SI (match_operand:SI 1 "register_operand" "r,d")
(match_operand:SI 2 "arith_operand" "rI,d")))] (match_operand:SI 2 "arith_operand" "rI,d")))]
......
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