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
This commit is contained in:
Kaz Kojima 2011-12-01 23:01:58 +00:00
parent c2985fe559
commit 9a944f5885
4 changed files with 27 additions and 37 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 }

View File

@ -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));