aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1993-03-10 10:31:14 -0700
committerJeff Law <law@gcc.gnu.org>1993-03-10 10:31:14 -0700
commit08cddb03ae279dcab585a53833729e00e13e8645 (patch)
tree23f04eaae8062e156ea7e0d1ba889b950dc78feb
parentd39079455511dc88645e70e8fb05a3cd8eea6bff (diff)
downloadgcc-08cddb03ae279dcab585a53833729e00e13e8645.zip
gcc-08cddb03ae279dcab585a53833729e00e13e8645.tar.gz
gcc-08cddb03ae279dcab585a53833729e00e13e8645.tar.bz2
* pa.md (add reg and large int): New define_splits for the combiner.
From-SVN: r3695
-rw-r--r--gcc/config/pa/pa.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 1b59820..a2b6595 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -1681,6 +1681,62 @@
""
"uaddcm %2,%1,%0")
+;; define_splits to optimize cases of adding a constant integer
+;; to a register when the constant does not fit in 14 bits. */
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (plus:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")))
+ (clobber (match_operand:SI 4 "register_operand" ""))]
+ "! cint_ok_for_move (INTVAL (operands[2]))
+ && VAL_14_BITS_P (INTVAL (operands[2]) / 2)"
+ [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
+ (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
+ "
+{
+ int val = INTVAL (operands[2]);
+ int low = (val < 0) ? -0x2000 : 0x1fff;
+ int rest = val - low;
+
+ operands[2] = GEN_INT (rest);
+ operands[3] = GEN_INT (low);
+}")
+
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (plus:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "const_int_operand" "")))
+ (clobber (match_operand:SI 4 "register_operand" ""))]
+ "! cint_ok_for_move (INTVAL (operands[2]))"
+ [(set (match_dup 4) (match_dup 2))
+ (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
+ (match_dup 1)))]
+ "
+{
+ int intval = INTVAL (operands[2]);
+
+ /* Try diving the constant by 2, then 4, and finally 8 to see
+ if we can get a constant which can be loaded into a register
+ in a single instruction (cint_ok_for_move). */
+ if (intval % 2 == 0 && cint_ok_for_move (intval / 2))
+ {
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 2);
+ operands[3] = GEN_INT (2);
+ }
+ else if (intval % 4 == 0 && cint_ok_for_move (intval / 4))
+ {
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 4);
+ operands[3] = GEN_INT (4);
+ }
+ else if (intval % 8 == 0 && cint_ok_for_move (intval / 8))
+ {
+ operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
+ operands[3] = GEN_INT (8);
+ }
+ else
+ FAIL;
+}")
+
(define_insn "addsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(plus:SI (match_operand:SI 1 "register_operand" "%r,r")