This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Xstormy16 byte loads
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: Geoff Keating <geoffk at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 6 Feb 2002 17:48:16 +0000 (GMT)
- Subject: Xstormy16 byte loads
- References: <Pine.LNX.4.33.0202052141100.11782-100000@host140.cambridge.redhat.com><200202052215.g15MFpE26398@desire.geoffk.org>
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)])])
+
;; ::::::::::::::::::::