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]

Xstormy16 byte loads


We're generating inefficient code for byte loads:

signed test ()
{
  extern unsigned char c;

  return c;
}

generates

test:
	mov.w r7,#c
	mov.b r2,(r7)
	shl r2,#8
	shr r2,#8
	ret

I added a zero_extendqihi2 pattern.

test:
        mov.w r7,#c
        mov.b r2, (r7)
        ret

No c-torture regressions.  OK?

Andrew.

2002-02-06  Andrew Haley  <aph@cambridge.redhat.com>

	* config/stormy16/stormy16.md (zero_extendqihi2): New.

Index: stormy16.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.md,v
retrieving revision 1.8
diff -p -2 -c -r1.8 stormy16.md
*** stormy16.md	2002/02/01 15:20:16	1.8
--- stormy16.md	2002/02/06 17:39:20
***************
*** 225,228 ****
--- 225,240 ----
    "cbw %0")
  
+ (define_insn "zero_extendqihi2"
+   [(set (match_operand:HI                 0 "register_operand" 	   "=e,r")
+ 	(zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m,0")))]
+   ""
+   "@
+    mov.b %0, %1
+    shl %0,#8\n\tshr %0,#8"
+   [(set_attr "psw_operand" "nop")
+    (set_attr_alternative "length" 
+ 	     [(const_int 2)
+ 	      (const_int 4)])])
+ 
  
  ;; ::::::::::::::::::::


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