This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] SH: Rename ashlhi3 insn


Joern RENNECKE <joern.rennecke@st.com> wrote:
> No, without the ashlhi3 pattern, the insn will hardly be useed at all.  
> I suggest to rename the
> insn to suppress the gen_* function generation (i.e. "*ashlhi3_n"), and 
> add an ashlhi3
> expander, which FAILS if operand 2 or 0 don't match, and uses 
> copy_to_mode_reg if
> operand 1 doesn't match.  

Like this?

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 20:47:15.196914893 +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 || operands[0] != operands[1])
+    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" "")


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]