mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-13 19:37:33 +08:00
h8300.c (get_shift_alg): Remove the variable alg.
* h8300.c (get_shift_alg): Remove the variable alg. (emit_a_shift): Rearrange code to improve readability. * h8300.md (movsi_h8300hs): Rearrange code to improve readability. From-SVN: r35375
This commit is contained in:
parent
6fffb55cd7
commit
b5eaf9ba59
@ -5,6 +5,11 @@
|
||||
|
||||
2000-07-31 Kazu Hirata <kazu@hxi.com>
|
||||
|
||||
* h8300.c (get_shift_alg): Remove the variable alg.
|
||||
(emit_a_shift): Rearrange code to improve readability.
|
||||
|
||||
* h8300.md (movsi_h8300hs): Rearrange code to improve readability.
|
||||
|
||||
* h8300.h (MODES_TIEABLE_P): Accept a combination of QImode and
|
||||
HImode on all architectures and a combination of HImode and SImode
|
||||
on H8/300H and H8/S.
|
||||
|
@ -2055,8 +2055,6 @@ get_shift_alg (cpu, shift_type, mode, count, assembler_p,
|
||||
const char **assembler2_p;
|
||||
int *cc_valid_p;
|
||||
{
|
||||
/* The default is to loop. */
|
||||
enum shift_alg alg = SHIFT_LOOP;
|
||||
enum shift_mode shift_mode;
|
||||
|
||||
/* We don't handle negative shifts or shifts greater than the word size,
|
||||
@ -2544,7 +2542,8 @@ get_shift_alg (cpu, shift_type, mode, count, assembler_p,
|
||||
abort ();
|
||||
}
|
||||
|
||||
return alg;
|
||||
/* No fancy method is available. Just loop. */
|
||||
return SHIFT_LOOP;
|
||||
}
|
||||
|
||||
/* Emit the assembler code for doing shifts. */
|
||||
@ -2605,6 +2604,14 @@ emit_a_shift (insn, operands)
|
||||
/* Get the assembler code to do one shift. */
|
||||
get_shift_alg (cpu_type, shift_type, mode, 1, &assembler,
|
||||
&assembler2, &cc_valid);
|
||||
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
fprintf (asm_out_file, ".Lle%d:\n", loopend_lab);
|
||||
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2655,6 +2662,7 @@ emit_a_shift (insn, operands)
|
||||
? ((1 << (GET_MODE_BITSIZE (mode) - n)) - 1) << n
|
||||
: (1 << (GET_MODE_BITSIZE (mode) - n)) - 1);
|
||||
char insn_buf[200];
|
||||
|
||||
/* Not all possibilities of rotate are supported. They shouldn't
|
||||
be generated, but let's watch for 'em. */
|
||||
if (assembler == 0)
|
||||
@ -2705,44 +2713,40 @@ emit_a_shift (insn, operands)
|
||||
output_asm_insn (insn_buf, operands);
|
||||
return "";
|
||||
}
|
||||
|
||||
case SHIFT_SPECIAL:
|
||||
output_asm_insn (assembler, operands);
|
||||
return "";
|
||||
}
|
||||
|
||||
/* A loop to shift by a "large" constant value.
|
||||
If we have shift-by-2 insns, use them. */
|
||||
if (assembler2 != NULL)
|
||||
{
|
||||
fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n / 2,
|
||||
names_big[REGNO (operands[4])]);
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler2, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
if (n % 2)
|
||||
output_asm_insn (assembler, operands);
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n,
|
||||
names_big[REGNO (operands[4])]);
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
case SHIFT_LOOP:
|
||||
/* A loop to shift by a "large" constant value.
|
||||
If we have shift-by-2 insns, use them. */
|
||||
if (assembler2 != NULL)
|
||||
{
|
||||
fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n / 2,
|
||||
names_big[REGNO (operands[4])]);
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler2, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
if (n % 2)
|
||||
output_asm_insn (assembler, operands);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n,
|
||||
names_big[REGNO (operands[4])]);
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
}
|
||||
return "";
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
|
||||
output_asm_insn (assembler, operands);
|
||||
output_asm_insn ("add #0xff,%X4", operands);
|
||||
fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
|
||||
fprintf (asm_out_file, ".Lle%d:\n", loopend_lab);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/* Fix the operands of a gen_xxx so that it could become a bit
|
||||
|
@ -411,38 +411,42 @@
|
||||
|| register_operand (operands[1], SImode))"
|
||||
"*
|
||||
{
|
||||
if (which_alternative == 0)
|
||||
return \"sub.l %S0,%S0\";
|
||||
if (which_alternative == 6)
|
||||
return \"clrmac\";
|
||||
if (which_alternative == 7)
|
||||
return \"clrmac\;ldmac %1,macl\";
|
||||
if (which_alternative == 8)
|
||||
return \"stmac macl,%0\";
|
||||
if (GET_CODE (operands[1]) == CONST_INT)
|
||||
switch (which_alternative)
|
||||
{
|
||||
int val = INTVAL (operands[1]);
|
||||
|
||||
/* Look for constants which can be made by adding an 8-bit
|
||||
number to zero in one of the two low bytes. */
|
||||
if (val == (val & 0xff))
|
||||
case 0:
|
||||
return \"sub.l %S0,%S0\";
|
||||
case 6:
|
||||
return \"clrmac\";
|
||||
case 7:
|
||||
return \"clrmac\;ldmac %1,macl\";
|
||||
case 8:
|
||||
return \"stmac macl,%0\";
|
||||
default:
|
||||
if (GET_CODE (operands[1]) == CONST_INT)
|
||||
{
|
||||
operands[1] = GEN_INT ((char)val & 0xff);
|
||||
return \"sub.l %S0,%S0\;add.b %1,%w0\";
|
||||
}
|
||||
int val = INTVAL (operands[1]);
|
||||
|
||||
/* Look for constants which can be made by adding an 8-bit
|
||||
number to zero in one of the two low bytes. */
|
||||
if (val == (val & 0xff))
|
||||
{
|
||||
operands[1] = GEN_INT ((char)val & 0xff);
|
||||
return \"sub.l %S0,%S0\;add.b %1,%w0\";
|
||||
}
|
||||
|
||||
if (val == (val & 0xff00))
|
||||
{
|
||||
operands[1] = GEN_INT ((char)(val >> 8) & 0xff);
|
||||
return \"sub.l %S0,%S0\;add.b %1,%x0\";
|
||||
}
|
||||
if (val == (val & 0xff00))
|
||||
{
|
||||
operands[1] = GEN_INT ((char)(val >> 8) & 0xff);
|
||||
return \"sub.l %S0,%S0\;add.b %1,%x0\";
|
||||
}
|
||||
|
||||
/* Now look for small negative numbers. We can subtract them
|
||||
from zero to get the desired constant. */
|
||||
if (val == -4 || val == -2 || val == -1)
|
||||
{
|
||||
operands[1] = GEN_INT (-INTVAL (operands[1]));
|
||||
return \"sub.l %S0,%S0\;subs %1,%S0\";
|
||||
/* Now look for small negative numbers. We can subtract them
|
||||
from zero to get the desired constant. */
|
||||
if (val == -4 || val == -2 || val == -1)
|
||||
{
|
||||
operands[1] = GEN_INT (-INTVAL (operands[1]));
|
||||
return \"sub.l %S0,%S0\;subs %1,%S0\";
|
||||
}
|
||||
}
|
||||
}
|
||||
return \"mov.l %S1,%S0\";
|
||||
|
Loading…
Reference in New Issue
Block a user