aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@freesoft.cz>1999-04-15 03:38:29 +0200
committerJeff Law <law@gcc.gnu.org>1999-04-14 19:38:29 -0600
commit7c802a406f2c6871310dd5590ba99c2583d7c12a (patch)
tree924505d90d0e8725c6f95b21d1ffb8cafd9b2150
parent6ec6d558ed34e6b31a5b984cf6fb9ead6a6ac7b1 (diff)
downloadgcc-7c802a406f2c6871310dd5590ba99c2583d7c12a.zip
gcc-7c802a406f2c6871310dd5590ba99c2583d7c12a.tar.gz
gcc-7c802a406f2c6871310dd5590ba99c2583d7c12a.tar.bz2
i386.md (QImode add pattern): Support lea instruction.
* i386.md (QImode add pattern): Support lea instruction. (HImode add pattern): Likewise. Co-Authored-By: Jeffrey A Law <law@cygnus.com> From-SVN: r26468
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/config/i386/i386.md49
2 files changed, 46 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 30d9a68..b69eeda 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,9 @@
Thu Apr 15 01:03:21 1999 Jan Hubicka <hubicka@freesoft.cz>
Jeff Law <law@cygnus.com>
+ * i386.md (QImode add pattern): Support lea instruction.
+ (HImode add pattern): Likewise.
+
* i386.md (ashlsi patterns): Call output_ashl instead of output_ashlsi3.
(ashlqi): Use expander, separate LEA and SAL / ADD patterns; call
output_ashl.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 39a06f2..28e35e4 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -3421,12 +3421,30 @@
"IX86_EXPAND_BINARY_OPERATOR (PLUS, HImode, operands);")
(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,?r")
+ (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r")
+ (match_operand:HI 2 "general_operand" "ri,rm,ri")))]
"ix86_binary_operator_ok (PLUS, HImode, operands)"
"*
{
+ if (REG_P (operands[0]) && REG_P (operands[1])
+ && (REG_P (operands[2]) || CONSTANT_P (operands[2]))
+ && REGNO (operands[0]) != REGNO (operands[1]))
+ {
+ if (operands[2] == stack_pointer_rtx)
+ abort ();
+
+ CC_STATUS_INIT;
+ operands[1]
+ = gen_rtx_PLUS (SImode,
+ gen_rtx_REG (SImode, REGNO (operands[1])),
+ (! REG_P (operands[2])
+ ? operands[2]
+ : gen_rtx_REG (SImode, REGNO (operands[2]))));
+ operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
+ return AS2 (lea%L0,%a1,%0);
+ }
+
/* ??? what about offsettable memory references? */
if (!TARGET_PENTIUMPRO /* partial stalls are just too painful to risk. */
&& QI_REG_P (operands[0])
@@ -3488,12 +3506,31 @@
"IX86_EXPAND_BINARY_OPERATOR (PLUS, QImode, operands);")
(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn")))]
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,?q")
+ (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,q")
+ (match_operand:QI 2 "general_operand" "qn,qmn,qn")))]
"ix86_binary_operator_ok (PLUS, QImode, operands)"
"*
{
+ if (REG_P (operands[0]) && REG_P (operands[1])
+ && (REG_P (operands[2]) || CONSTANT_P (operands[2]))
+ && (REGNO (operands[0]) != REGNO (operands[1])
+ || NON_QI_REG_P (operands[1])
+ || (REG_P (operands[2]) && NON_QI_REG_P (operands[2]))))
+ {
+ if (operands[2] == stack_pointer_rtx)
+ abort ();
+
+ CC_STATUS_INIT;
+ operands[1]
+ = gen_rtx_PLUS (SImode,
+ gen_rtx_REG (SImode, REGNO (operands[1])),
+ (! REG_P (operands[2])
+ ? operands[2]
+ : gen_rtx_REG (SImode, REGNO (operands[2]))));
+ operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
+ return AS2 (lea%L0,%a1,%0);
+ }
if (operands[2] == const1_rtx)
return AS1 (inc%B0,%0);