From 925cf7ab585f432e5297e373aadaf3da078bd75a Mon Sep 17 00:00:00 2001 From: drow Date: Sun, 17 Nov 2002 22:33:31 +0000 Subject: [PATCH] * sh.c (gen_shl_and): Don't create a zero_extend if the operand is not an arith_reg_operand. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59201 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/sh/sh.c | 28 +++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6434f60..f27dedb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-11-17 Daniel Jacobowitz + + * sh.c (gen_shl_and): Don't create a zero_extend if the operand + is not an arith_reg_operand. + 2002-11-17 Graham Stott * real.c (real_to_decimal): Fix buffer overrun when buffer size diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index d2cc471..0ce5e06 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -1823,11 +1823,16 @@ gen_shl_and (dest, left_rtx, mask_rtx, source) if (first < 0) { + enum machine_mode mode + = ((mask << right) <= 0xff) ? QImode : HImode; + rtx lowpart = gen_lowpart (mode, source); + + if (no_new_pseudos && ! TARGET_SHMEDIA + && ! arith_reg_operand (lowpart, mode)) + return -1; emit_insn ((mask << right) <= 0xff - ? gen_zero_extendqisi2(dest, - gen_lowpart (QImode, source)) - : gen_zero_extendhisi2(dest, - gen_lowpart (HImode, source))); + ? gen_zero_extendqisi2(dest, lowpart) + : gen_zero_extendhisi2(dest, lowpart)); source = dest; } if (source != dest) @@ -1846,9 +1851,18 @@ gen_shl_and (dest, left_rtx, mask_rtx, source) mask <<= first; } if (first >= 0) - emit_insn (mask <= 0xff - ? gen_zero_extendqisi2(dest, gen_lowpart (QImode, dest)) - : gen_zero_extendhisi2(dest, gen_lowpart (HImode, dest))); + { + enum machine_mode mode = (mask <= 0xff) ? QImode : HImode; + rtx lowpart = gen_lowpart (mode, dest); + + if (no_new_pseudos && ! TARGET_SHMEDIA + && ! arith_reg_operand (lowpart, mode)) + return -1; + emit_insn (mask <= 0xff + ? gen_zero_extendqisi2(dest, lowpart) + : gen_zero_extendhisi2(dest, lowpart)); + } + if (total_shift > 0) { operands[2] = GEN_INT (total_shift); -- 2.7.4