This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/RFA] SH: Rename ashlhi3 insn
Alexandre Oliva <aoliva@redhat.com> wrote:
>> + if (GET_CODE (operands[2]) != CONST_INT || operands[0] != operands[1])
>> + FAIL;
>
> I don't think the requirement that operands[0] == operands[1] is
> appropriate. The register allocator could arrange for input and
> output pseudos to be assigned to the same hardware register. If you
> absolutely need this test, add `&& reload_completed', otherwise just
> leave it out.
I've started bootstrap with the revised patch below and will
regtest it. Thanks for your suggestion.
Regards,
kaz
--
* config/sh/sh.md (ashlhi3): Rename to *ashlhi3_n and add a new
ashlhi3 expander.
--- ORIG/gcc/gcc/config/sh/sh.md 2005-01-19 08:56:18.000000000 +0900
+++ LOCAL/gcc/gcc/config/sh/sh.md 2005-03-21 22:08:59.573662764 +0900
@@ -2293,7 +2293,7 @@
FAIL;
}")
-(define_insn "ashlhi3"
+(define_insn "*ashlhi3_n"
[(set (match_operand:HI 0 "arith_reg_operand" "=r")
(ashift:HI (match_operand:HI 1 "arith_reg_operand" "0")
(match_operand:HI 2 "const_int_operand" "n")))
@@ -2308,6 +2308,20 @@
(const_string "6")))
(set_attr "type" "arith")])
+(define_expand "ashlhi3"
+ [(parallel [(set (match_operand:HI 0 "arith_reg_operand" "")
+ (ashift:HI (match_operand:HI 1 "arith_reg_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
+ (clobber (reg:SI T_REG))])]
+ "TARGET_SH1"
+ "
+{
+ if (GET_CODE (operands[2]) != CONST_INT)
+ FAIL;
+ if (!arith_reg_operand (operands[1], HImode))
+ operands[1] = copy_to_mode_reg (HImode, operands[1]);
+}")
+
(define_split
[(set (match_operand:HI 0 "arith_reg_operand" "")
(ashift:HI (match_operand:HI 1 "arith_reg_operand" "")