aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2011-12-01 23:01:58 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2011-12-01 23:01:58 +0000
commit9a944f58851b27df1d68c18c927a826826b7fa0b (patch)
treef5f622789151e37f5432e3c298982ac49ba40635 /gcc
parentc2985fe5596ebf32bbd14e29fa824a33cb2ff232 (diff)
downloadgcc-9a944f58851b27df1d68c18c927a826826b7fa0b.zip
gcc-9a944f58851b27df1d68c18c927a826826b7fa0b.tar.gz
gcc-9a944f58851b27df1d68c18c927a826826b7fa0b.tar.bz2
re PR target/50814 (SH Target: SHAD / SHLD instructions not used on SH2A)
PR target/50814. * config/sh/sh.c (expand_ashiftrt): Handle TARGET_SH2A same as TARGET_SH3. (shl_sext_kind): Likewise. * config/sh/sh.h (SH_DYNAMIC_SHIFT_COST): Likewise. * config/sh/sh.md (ashlsi3_sh2a, ashrsi3_sh2a, lshrsi3_sh2a): Remove. (ashlsi3_std): Handle TARGET_SH2A same as TARGET_SH3. (ashlsi3): Likewise. (ashrsi3_d): Likewise. (lshrsi3_d): Likewise. (lshrsi3): Likewise. From-SVN: r181896
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/config/sh/sh.c4
-rw-r--r--gcc/config/sh/sh.h3
-rw-r--r--gcc/config/sh/sh.md42
4 files changed, 27 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 000fdc0..0a15c03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2011-12-01 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/50814.
+ * config/sh/sh.c (expand_ashiftrt): Handle TARGET_SH2A same as
+ TARGET_SH3.
+ (shl_sext_kind): Likewise.
+ * config/sh/sh.h (SH_DYNAMIC_SHIFT_COST): Likewise.
+ * config/sh/sh.md (ashlsi3_sh2a, ashrsi3_sh2a, lshrsi3_sh2a):
+ Remove.
+ (ashlsi3_std): Handle TARGET_SH2A same as TARGET_SH3.
+ (ashlsi3): Likewise.
+ (ashrsi3_d): Likewise.
+ (lshrsi3_d): Likewise.
+ (lshrsi3): Likewise.
+
2011-12-01 Diego Novillo <dnovillo@google.com>
PR bootstrap/51346
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 870c39f..b9834fb 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -3266,7 +3266,7 @@ expand_ashiftrt (rtx *operands)
char func[18];
int value;
- if (TARGET_SH3)
+ if (TARGET_SH3 || TARGET_SH2A)
{
if (!CONST_INT_P (operands[2]))
{
@@ -3715,7 +3715,7 @@ shl_sext_kind (rtx left_rtx, rtx size_rtx, int *costp)
}
}
}
- if (TARGET_SH3)
+ if (TARGET_SH3 || TARGET_SH2A)
{
/* Try to use a dynamic shift. */
cost = shift_insns[32 - insize] + 1 + SH_DYNAMIC_SHIFT_COST;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 8ab1f10..f873b9d 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -2394,7 +2394,8 @@ extern int current_function_interrupt;
#define ACCUMULATE_OUTGOING_ARGS TARGET_ACCUMULATE_OUTGOING_ARGS
#define SH_DYNAMIC_SHIFT_COST \
- (TARGET_HARD_SH4 ? 1 : TARGET_SH3 ? (optimize_size ? 1 : 2) : 20)
+ (TARGET_HARD_SH4 ? 1 \
+ : (TARGET_SH3 || TARGET_SH2A) ? (optimize_size ? 1 : 2) : 20)
#define NUM_MODES_FOR_MODE_SWITCHING { FP_MODE_NONE }
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index ce66018..b63c857 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -1,6 +1,6 @@
;;- Machine description for Renesas / SuperH SH.
;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; Free Software Foundation, Inc.
;; Contributed by Steve Chamberlain (sac@cygnus.com).
;; Improved by Jim Wilson (wilson@cygnus.com).
@@ -3568,15 +3568,6 @@ label:
;;
;; shift left
-(define_insn "ashlsi3_sh2a"
- [(set (match_operand:SI 0 "arith_reg_dest" "=r")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "arith_reg_operand" "r")))]
- "TARGET_SH2A"
- "shad %2,%0"
- [(set_attr "type" "arith")
- (set_attr "length" "4")])
-
;; This pattern is used by init_expmed for computing the costs of shift
;; insns.
@@ -3585,14 +3576,14 @@ label:
(ashift:SI (match_operand:SI 1 "arith_reg_operand" "0,0,0,0")
(match_operand:SI 2 "nonmemory_operand" "r,M,P27,?ri")))
(clobber (match_scratch:SI 3 "=X,X,X,&r"))]
- "TARGET_SH3
+ "(TARGET_SH3 || TARGET_SH2A)
|| (TARGET_SH1 && satisfies_constraint_P27 (operands[2]))"
"@
shld %2,%0
add %0,%0
shll%O2 %0
#"
- "TARGET_SH3
+ "(TARGET_SH3 || TARGET_SH2A)
&& reload_completed
&& CONST_INT_P (operands[2])
&& ! satisfies_constraint_P27 (operands[2])"
@@ -3671,7 +3662,7 @@ label:
if (CONST_INT_P (operands[2])
&& sh_dynamicalize_shift_p (operands[2]))
operands[2] = force_reg (SImode, operands[2]);
- if (TARGET_SH3)
+ if (TARGET_SH3 || TARGET_SH2A)
{
emit_insn (gen_ashlsi3_std (operands[0], operands[1], operands[2]));
DONE;
@@ -3728,15 +3719,6 @@ label:
; arithmetic shift right
;
-(define_insn "ashrsi3_sh2a"
- [(set (match_operand:SI 0 "arith_reg_dest" "=r")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH2A"
- "shad %2,%0"
- [(set_attr "type" "dyn_shift")
- (set_attr "length" "4")])
-
(define_insn "ashrsi3_k"
[(set (match_operand:SI 0 "arith_reg_dest" "=r")
(ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
@@ -3831,7 +3813,7 @@ label:
[(set (match_operand:SI 0 "arith_reg_dest" "=r")
(ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
(neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH3"
+ "TARGET_SH3 || TARGET_SH2A"
"shad %2,%0"
[(set_attr "type" "dyn_shift")])
@@ -3879,20 +3861,11 @@ label:
;; logical shift right
-(define_insn "lshrsi3_sh2a"
- [(set (match_operand:SI 0 "arith_reg_dest" "=r")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH2A"
- "shld %2,%0"
- [(set_attr "type" "dyn_shift")
- (set_attr "length" "4")])
-
(define_insn "lshrsi3_d"
[(set (match_operand:SI 0 "arith_reg_dest" "=r")
(lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
(neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH3"
+ "TARGET_SH3 || TARGET_SH2A"
"shld %2,%0"
[(set_attr "type" "dyn_shift")])
@@ -3973,7 +3946,8 @@ label:
if (CONST_INT_P (operands[2])
&& sh_dynamicalize_shift_p (operands[2]))
operands[2] = force_reg (SImode, operands[2]);
- if (TARGET_SH3 && arith_reg_operand (operands[2], GET_MODE (operands[2])))
+ if ((TARGET_SH3 || TARGET_SH2A)
+ && arith_reg_operand (operands[2], GET_MODE (operands[2])))
{
rtx count = copy_to_mode_reg (SImode, operands[2]);
emit_insn (gen_negsi2 (count, count));