diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2003-01-21 14:31:29 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2003-01-21 14:31:29 +0000 |
commit | cfedf91bdca924f7ec8a558333d179351a794c2c (patch) | |
tree | 0e79e578c5abe4a295d910025d933e510be02e39 | |
parent | 1f5b3282d93e3c486e1316f76b40110d8dcdd17e (diff) | |
download | gcc-cfedf91bdca924f7ec8a558333d179351a794c2c.zip gcc-cfedf91bdca924f7ec8a558333d179351a794c2c.tar.gz gcc-cfedf91bdca924f7ec8a558333d179351a794c2c.tar.bz2 |
h8300.c (output_plussi): Support H8/300.
* config/h8300/h8300.c (output_plussi): Support H8/300.
(compute_plussi_length): Likewise.
(compute_plussi_cc): Likewise.
* config/h8300/h8300.md (addsi_h8300): Use output_plussi to
output assembly instructions.
From-SVN: r61546
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 39 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.md | 10 |
3 files changed, 46 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae1d7e1..596a5ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-01-21 Kazu Hirata <kazu@cs.umass.edu> + + * config/h8300/h8300.c (output_plussi): Support H8/300. + (compute_plussi_length): Likewise. + (compute_plussi_cc): Likewise. + * config/h8300/h8300.md (addsi_h8300): Use output_plussi to + output assembly instructions. + 2003-01-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * calls.c (fix_unsafe_tree): Prototype. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 3282698..ba1db09 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1900,8 +1900,22 @@ output_plussi (operands) if (TARGET_H8300) { - /* Currently we do not support H8/300 here yet. */ - abort (); + if (GET_CODE (operands[2]) == REG) + return "add.w\t%f2,%f0\n\taddx\t%y2,%y0\n\taddx\t%z2,%z0"; + + if (GET_CODE (operands[2]) == CONST_INT) + { + HOST_WIDE_INT n = INTVAL (operands[2]); + + if ((n & 0xffffff) == 0) + return "add\t%z2,%z0"; + if ((n & 0xffff) == 0) + return "add\t%y2,%y0\n\taddx\t%z2,%z0"; + if ((n & 0xff) == 0) + return "add\t%x2,%x0\n\taddx\t%y2,%y0\n\taddx\t%z2,%z0"; + } + + return "add\t%w2,%w0\n\taddx\t%x2,%x0\n\taddx\t%y2,%y0\n\taddx\t%z2,%z0"; } else { @@ -1960,8 +1974,22 @@ compute_plussi_length (operands) if (TARGET_H8300) { - /* Currently we do not support H8/300 here yet. */ - abort (); + if (GET_CODE (operands[2]) == REG) + return 6; + + if (GET_CODE (operands[2]) == CONST_INT) + { + HOST_WIDE_INT n = INTVAL (operands[2]); + + if ((n & 0xffffff) == 0) + return 2; + if ((n & 0xffff) == 0) + return 4; + if ((n & 0xff) == 0) + return 6; + } + + return 8; } else { @@ -2015,8 +2043,7 @@ compute_plussi_cc (operands) if (TARGET_H8300) { - /* Currently we do not support H8/300 here yet. */ - abort (); + return CC_CLOBBER; } else { diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 7c1ab21..2ccbf04 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -859,11 +859,11 @@ (plus:SI (match_operand:SI 1 "register_operand" "%0,0") (match_operand:SI 2 "nonmemory_operand" "n,r")))] "TARGET_H8300" - "@ - add %w2,%w0\;addx %x2,%x0\;addx %y2,%y0\;addx %z2,%z0 - add.w %f2,%f0\;addx %y2,%y0\;addx %z2,%z0" - [(set_attr "length" "8,6") - (set_attr "cc" "clobber,clobber")]) + "* return output_plussi (operands);" + [(set (attr "length") + (symbol_ref "compute_plussi_length (operands)")) + (set (attr "cc") + (symbol_ref "compute_plussi_cc (operands)"))]) (define_insn "addsi_h8300h" [(set (match_operand:SI 0 "register_operand" "=r,r") |