Commit cb33eb17 by Kazu Hirata Committed by Kazu Hirata

h8300.c (get_shift_alg): Clean up.

	* config/h8300/h8300.c (get_shift_alg): Clean up.  Return the
	algorithm through the shift_info structure.
	(emit_a_shift): Update the use of get_shift_alg.

From-SVN: r46553
parent c0b1738d
2001-10-26 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.c (get_shift_alg): Clean up. Return the
algorithm through the shift_info structure.
(emit_a_shift): Update the use of get_shift_alg.
2001-10-27 Daniel Berlin <dan@cgsoftware.com> 2001-10-27 Daniel Berlin <dan@cgsoftware.com>
* sched-rgn.c: Remove bitset typedef. * sched-rgn.c: Remove bitset typedef.
......
...@@ -2178,7 +2178,7 @@ struct shift_info { ...@@ -2178,7 +2178,7 @@ struct shift_info {
int cc_valid_p; int cc_valid_p;
}; };
static enum shift_alg get_shift_alg PARAMS ((enum shift_type, static void get_shift_alg PARAMS ((enum shift_type,
enum shift_mode, int, enum shift_mode, int,
struct shift_info *)); struct shift_info *));
...@@ -2195,20 +2195,20 @@ static enum shift_alg get_shift_alg PARAMS ((enum shift_type, ...@@ -2195,20 +2195,20 @@ static enum shift_alg get_shift_alg PARAMS ((enum shift_type,
WARNING: The constraints on insns shiftbyn_QI/HI/SI assume shifts of WARNING: The constraints on insns shiftbyn_QI/HI/SI assume shifts of
1,2,3,4 will be inlined (1,2 for SI). */ 1,2,3,4 will be inlined (1,2 for SI). */
static enum shift_alg static void
get_shift_alg (shift_type, shift_mode, count, info) get_shift_alg (shift_type, shift_mode, count, info)
enum shift_type shift_type; enum shift_type shift_type;
enum shift_mode shift_mode; enum shift_mode shift_mode;
int count; int count;
struct shift_info *info; struct shift_info *info;
{ {
/* In case we end up with SHIFT_SPECIAL, initialize REMAINDER to 0. */
info->remainder = 0;
/* Assume either SHIFT_LOOP or SHIFT_INLINE. /* Assume either SHIFT_LOOP or SHIFT_INLINE.
It is up to the caller to know that looping clobbers cc. */ It is up to the caller to know that looping clobbers cc. */
info->shift1 = shift_one[cpu_type][shift_type][shift_mode].assembler; info->shift1 = shift_one[cpu_type][shift_type][shift_mode].assembler;
if (TARGET_H8300S)
info->shift2 = shift_two[shift_type][shift_mode].assembler; info->shift2 = shift_two[shift_type][shift_mode].assembler;
else
info->shift2 = NULL;
info->cc_valid_p = shift_one[cpu_type][shift_type][shift_mode].cc_valid; info->cc_valid_p = shift_one[cpu_type][shift_type][shift_mode].cc_valid;
/* Now look for cases we want to optimize. */ /* Now look for cases we want to optimize. */
...@@ -2217,75 +2217,67 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2217,75 +2217,67 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case QIshift: case QIshift:
if (count <= 4) if (count <= 4)
return SHIFT_INLINE; goto return_shift_inline;
else else
{ {
/* Shift by 5/6 are only 3 insns on the H8/S, so it's just as /* Shift by 5/6 are only 3 insns on the H8/S, so it's just as
fast as SHIFT_ROT_AND, plus CC is valid. */ fast as SHIFT_ROT_AND, plus CC is valid. */
if (TARGET_H8300S && count <= 6) if (TARGET_H8300S && count <= 6)
return SHIFT_INLINE; goto return_shift_inline;
/* For ASHIFTRT by 7 bits, the sign bit is simply replicated /* For ASHIFTRT by 7 bits, the sign bit is simply replicated
through the entire value. */ through the entire value. */
if (shift_type == SHIFT_ASHIFTRT && count == 7) if (shift_type == SHIFT_ASHIFTRT && count == 7)
{ {
info->special = "shll\t%X0\n\tsubx\t%X0,%X0"; info->special = "shll\t%X0\n\tsubx\t%X0,%X0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
/* Other ASHIFTRTs are too much of a pain. */ /* Other ASHIFTRTs are too much of a pain. */
if (shift_type == SHIFT_ASHIFTRT) if (shift_type == SHIFT_ASHIFTRT)
return SHIFT_LOOP; goto return_shift_loop;
/* Other shifts by 5, 6, or 7 bits use SHIFT_ROT_AND. */ /* Other shifts by 5, 6, or 7 bits use SHIFT_ROT_AND. */
info->shift1 = rotate_one[cpu_type][shift_type][shift_mode]; info->shift1 = rotate_one[cpu_type][shift_type][shift_mode];
if (TARGET_H8300S)
info->shift2 = rotate_two[shift_type][shift_mode]; info->shift2 = rotate_two[shift_type][shift_mode];
info->cc_valid_p = 0; goto return_shift_rot_and;
return SHIFT_ROT_AND;
} }
case HIshift: case HIshift:
if (count <= 4) if (count <= 4)
return SHIFT_INLINE; goto return_shift_inline;
else if (TARGET_H8300S && count <= 7) else if (TARGET_H8300S && count <= 7)
return SHIFT_INLINE; goto return_shift_inline;
else if (count == 7) else if (count == 7)
{ {
if (shift_type == SHIFT_ASHIFT && TARGET_H8300) if (shift_type == SHIFT_ASHIFT && TARGET_H8300)
{ {
info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.b\t%t0\n\trotr.b\t%s0\n\tand.b\t#0x80,%s0"; info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.b\t%t0\n\trotr.b\t%s0\n\tand.b\t#0x80,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
if (shift_type == SHIFT_ASHIFT && TARGET_H8300H) if (shift_type == SHIFT_ASHIFT && TARGET_H8300H)
{ {
info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.w\t%T0\n\tand.b\t#0x80,%s0"; info->special = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.w\t%T0\n\tand.b\t#0x80,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300) if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300)
{ {
info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\trotl.b\t%t0\n\tand.b\t#0x01,%t0"; info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\trotl.b\t%t0\n\tand.b\t#0x01,%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300H) if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300H)
{ {
info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.w\t%T0\n\tand.b\t#0x01,%t0"; info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.w\t%T0\n\tand.b\t#0x01,%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
if (shift_type == SHIFT_ASHIFTRT) if (shift_type == SHIFT_ASHIFTRT)
{ {
info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\tsubx\t%t0,%t0"; info->special = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\tsubx\t%t0,%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 8) else if (count == 8)
...@@ -2294,19 +2286,16 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2294,19 +2286,16 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.b\t%t0,%s0\n\tshll\t%t0\n\tsubx\t%t0,%t0"; info->special = "mov.b\t%t0,%s0\n\tshll\t%t0\n\tsubx\t%t0,%t0";
else else
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 9) else if (count == 9)
...@@ -2315,19 +2304,16 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2315,19 +2304,16 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0";
else else
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 10) else if (count == 10)
...@@ -2339,15 +2325,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2339,15 +2325,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0";
else else
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0";
else else
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0";
...@@ -2355,8 +2339,7 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2355,8 +2339,7 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0";
else if (TARGET_H8300S) else if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 11) else if (count == 11)
...@@ -2368,15 +2351,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2368,15 +2351,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t%t0";
else else
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t%s0";
else else
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
...@@ -2384,8 +2365,7 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2384,8 +2365,7 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
else if (TARGET_H8300S) else if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 12) else if (count == 12)
...@@ -2397,15 +2377,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2397,15 +2377,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t#2,%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t#2,%t0";
else else
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t#2,%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t#2,%s0";
else else
info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
...@@ -2413,8 +2391,7 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2413,8 +2391,7 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
else if (TARGET_H8300S) else if (TARGET_H8300S)
info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t#2,%s0"; info->special = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t#2,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if ((!TARGET_H8300 && (count == 13 || count == 14)) else if ((!TARGET_H8300 && (count == 13 || count == 14))
...@@ -2423,43 +2400,35 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2423,43 +2400,35 @@ get_shift_alg (shift_type, shift_mode, count, info)
if (count == 15 && shift_type == SHIFT_ASHIFTRT) if (count == 15 && shift_type == SHIFT_ASHIFTRT)
{ {
info->special = "shll\t%t0\n\tsubx\t%t0,%t0\n\tmov.b\t%t0,%s0"; info->special = "shll\t%t0\n\tsubx\t%t0,%t0\n\tmov.b\t%t0,%s0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
else if (shift_type != SHIFT_ASHIFTRT) else if (shift_type != SHIFT_ASHIFTRT)
{ {
info->shift1 = rotate_one[cpu_type][shift_type][shift_mode]; info->shift1 = rotate_one[cpu_type][shift_type][shift_mode];
if (TARGET_H8300S)
info->shift2 = rotate_two[shift_type][shift_mode]; info->shift2 = rotate_two[shift_type][shift_mode];
else goto return_shift_rot_and;
info->shift2 = NULL;
info->cc_valid_p = 0;
return SHIFT_ROT_AND;
} }
} }
break; break;
case SIshift: case SIshift:
if (count <= (TARGET_H8300 ? 2 : 4)) if (count <= (TARGET_H8300 ? 2 : 4))
return SHIFT_INLINE; goto return_shift_inline;
else if (TARGET_H8300S && count <= 10) else if (TARGET_H8300S && count <= 10)
return SHIFT_INLINE; goto return_shift_inline;
else if (count == 8 && TARGET_H8300) else if (count == 8 && TARGET_H8300)
{ {
switch (shift_type) switch (shift_type)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.b\t%y0,%z0\n\tmov.b\t%x0,%y0\n\tmov.b\t%w0,%x0\n\tsub.b\t%w0,%w0"; info->special = "mov.b\t%y0,%z0\n\tmov.b\t%x0,%y0\n\tmov.b\t%w0,%x0\n\tsub.b\t%w0,%w0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tsub.b\t%z0,%z0"; info->special = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tsub.b\t%z0,%z0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
info->special = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tshll\t%z0\n\tsubx\t%z0,%z0"; info->special = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tshll\t%z0\n\tsubx\t%z0,%z0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 8 && !TARGET_H8300) else if (count == 8 && !TARGET_H8300)
...@@ -2468,16 +2437,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2468,16 +2437,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.w\t%e0,%f4\n\tmov.b\t%s4,%t4\n\tmov.b\t%t0,%s4\n\tmov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tmov.w\t%f4,%e0"; info->special = "mov.w\t%e0,%f4\n\tmov.b\t%s4,%t4\n\tmov.b\t%t0,%s4\n\tmov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tmov.w\t%f4,%e0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.w\t%e0,%f4\n\tmov.b\t%t0,%s0\n\tmov.b\t%s4,%t0\n\tmov.b\t%t4,%s4\n\textu.w\t%f4\n\tmov.w\t%f4,%e0"; info->special = "mov.w\t%e0,%f4\n\tmov.b\t%t0,%s0\n\tmov.b\t%s4,%t0\n\tmov.b\t%t4,%s4\n\textu.w\t%f4\n\tmov.w\t%f4,%e0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
info->special = "mov.w\t%e0,%f4\n\tmov.b\t%t0,%s0\n\tmov.b\t%s4,%t0\n\tmov.b\t%t4,%s4\n\texts.w\t%f4\n\tmov.w\t%f4,%e0"; info->special = "mov.w\t%e0,%f4\n\tmov.b\t%t0,%s0\n\tmov.b\t%s4,%t0\n\tmov.b\t%t4,%s4\n\texts.w\t%f4\n\tmov.w\t%f4,%e0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 16) else if (count == 16)
...@@ -2486,19 +2452,16 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2486,19 +2452,16 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300) if (TARGET_H8300)
info->special = "mov.w\t%e0,%f0\n\tshll\t%z0\n\tsubx\t%z0,%z0\n\tmov.b\t%z0,%y0"; info->special = "mov.w\t%e0,%f0\n\tshll\t%z0\n\tsubx\t%z0,%z0\n\tmov.b\t%z0,%y0";
else else
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 17 && !TARGET_H8300) else if (count == 17 && !TARGET_H8300)
...@@ -2507,16 +2470,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2507,16 +2470,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 18 && !TARGET_H8300) else if (count == 18 && !TARGET_H8300)
...@@ -2528,22 +2488,19 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2528,22 +2488,19 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0";
else else
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0";
else else
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0";
else else
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 19 && !TARGET_H8300) else if (count == 19 && !TARGET_H8300)
...@@ -2555,22 +2512,19 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2555,22 +2512,19 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t%S0";
else else
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0\n\tshll.l\t%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0\n\tshll.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t%S0";
else else
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0\n\tshlr.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0\n\tshlr.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
if (TARGET_H8300S) if (TARGET_H8300S)
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t%S0";
else else
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 20 && TARGET_H8300S) else if (count == 20 && TARGET_H8300S)
...@@ -2579,16 +2533,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2579,16 +2533,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t#2,%S0"; info->special = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t#2,%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t#2,%S0"; info->special = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t#2,%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t#2,%S0"; info->special = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t#2,%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count == 24 && !TARGET_H8300) else if (count == 24 && !TARGET_H8300)
...@@ -2597,33 +2548,26 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2597,33 +2548,26 @@ get_shift_alg (shift_type, shift_mode, count, info)
{ {
case SHIFT_ASHIFT: case SHIFT_ASHIFT:
info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tmov.w\t%f0,%e0\n\tsub.w\t%f0,%f0"; info->special = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tmov.w\t%f0,%e0\n\tsub.w\t%f0,%f0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_LSHIFTRT: case SHIFT_LSHIFTRT:
info->special = "mov.w\t%e0,%f0\n\tmov.b\t%t0,%s0\n\textu.w\t%f0\n\textu.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tmov.b\t%t0,%s0\n\textu.w\t%f0\n\textu.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
case SHIFT_ASHIFTRT: case SHIFT_ASHIFTRT:
info->special = "mov.w\t%e0,%f0\n\tmov.b\t%t0,%s0\n\texts.w\t%f0\n\texts.l\t%S0"; info->special = "mov.w\t%e0,%f0\n\tmov.b\t%t0,%s0\n\texts.w\t%f0\n\texts.l\t%S0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
} }
else if (count >= 28 && count <= 30 && !TARGET_H8300) else if (count >= 28 && count <= 30 && !TARGET_H8300)
{ {
if (shift_type == SHIFT_ASHIFTRT) if (shift_type == SHIFT_ASHIFTRT)
{ {
return SHIFT_LOOP; goto return_shift_loop;
} }
else else
{ {
info->shift1 = rotate_one[cpu_type][shift_type][shift_mode]; info->shift1 = rotate_one[cpu_type][shift_type][shift_mode];
if (TARGET_H8300S)
info->shift2 = rotate_two[shift_type][shift_mode]; info->shift2 = rotate_two[shift_type][shift_mode];
else goto return_shift_rot_and;
info->shift2 = NULL;
info->cc_valid_p = 0;
return SHIFT_ROT_AND;
} }
} }
else if (count == 31) else if (count == 31)
...@@ -2634,8 +2578,7 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2634,8 +2578,7 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "shll\t%z0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0"; info->special = "shll\t%z0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
else else
info->special = "shll\t%e0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0"; info->special = "shll\t%e0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
else else
{ {
...@@ -2645,18 +2588,13 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2645,18 +2588,13 @@ get_shift_alg (shift_type, shift_mode, count, info)
info->special = "sub.w\t%e0,%e0\n\tshlr\t%w0\n\tmov.w\t%e0,%f0\n\trotxr\t%z0"; info->special = "sub.w\t%e0,%e0\n\tshlr\t%w0\n\tmov.w\t%e0,%f0\n\trotxr\t%z0";
else else
info->special = "sub.w\t%f0,%f0\n\tshll\t%z0\n\tmov.w\t%f0,%e0\n\trotxl\t%w0"; info->special = "sub.w\t%f0,%f0\n\tshll\t%z0\n\tmov.w\t%f0,%e0\n\trotxl\t%w0";
info->cc_valid_p = 0; goto return_shift_special;
return SHIFT_SPECIAL;
} }
else else
{ {
info->shift1 = rotate_one[cpu_type][shift_type][shift_mode]; info->shift1 = rotate_one[cpu_type][shift_type][shift_mode];
if (TARGET_H8300S)
info->shift2 = rotate_two[shift_type][shift_mode]; info->shift2 = rotate_two[shift_type][shift_mode];
else goto return_shift_rot_and;
info->shift2 = NULL;
info->cc_valid_p = 0;
return SHIFT_ROT_AND;
} }
} }
} }
...@@ -2666,8 +2604,29 @@ get_shift_alg (shift_type, shift_mode, count, info) ...@@ -2666,8 +2604,29 @@ get_shift_alg (shift_type, shift_mode, count, info)
abort (); abort ();
} }
return_shift_loop:
/* No fancy method is available. Just loop. */ /* No fancy method is available. Just loop. */
return SHIFT_LOOP; info->alg = SHIFT_LOOP;
goto end;
return_shift_inline:
info->remainder = count;
info->alg = SHIFT_INLINE;
goto end;
return_shift_special:
info->cc_valid_p = 0;
info->alg = SHIFT_SPECIAL;
goto end;
return_shift_rot_and:
info->cc_valid_p = 0;
info->alg = SHIFT_ROT_AND;
goto end;
end:
if (!TARGET_H8300S)
info->shift2 = NULL;
} }
/* Emit the assembler code for doing shifts. */ /* Emit the assembler code for doing shifts. */
...@@ -2737,7 +2696,6 @@ emit_a_shift (insn, operands) ...@@ -2737,7 +2696,6 @@ emit_a_shift (insn, operands)
else else
{ {
int n = INTVAL (operands[2]); int n = INTVAL (operands[2]);
enum shift_alg alg;
/* If the count is negative, make it 0. */ /* If the count is negative, make it 0. */
if (n < 0) if (n < 0)
...@@ -2748,11 +2706,17 @@ emit_a_shift (insn, operands) ...@@ -2748,11 +2706,17 @@ emit_a_shift (insn, operands)
else if ((unsigned int) n > GET_MODE_BITSIZE (mode)) else if ((unsigned int) n > GET_MODE_BITSIZE (mode))
n = GET_MODE_BITSIZE (mode); n = GET_MODE_BITSIZE (mode);
alg = get_shift_alg (shift_type, shift_mode, n, &info); get_shift_alg (shift_type, shift_mode, n, &info);
switch (alg) switch (info.alg)
{ {
case SHIFT_SPECIAL:
output_asm_insn (info.special, operands);
/* Fall through. */
case SHIFT_INLINE: case SHIFT_INLINE:
n = info.remainder;
/* Emit two bit shifts first. */ /* Emit two bit shifts first. */
while (n > 1 && info.shift2 != NULL) while (n > 1 && info.shift2 != NULL)
{ {
...@@ -2834,10 +2798,6 @@ emit_a_shift (insn, operands) ...@@ -2834,10 +2798,6 @@ emit_a_shift (insn, operands)
return ""; return "";
} }
case SHIFT_SPECIAL:
output_asm_insn (info.special, operands);
return "";
case SHIFT_LOOP: case SHIFT_LOOP:
/* A loop to shift by a "large" constant value. /* A loop to shift by a "large" constant value.
If we have shift-by-2 insns, use them. */ If we have shift-by-2 insns, use them. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment