This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300.c: Optimize AND more.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 30 Dec 2002 16:08:56 -0500 (EST)
- Subject: [patch] h8300.c: Optimize AND more.
Hi,
Attached is a patch to optimize AND more.
Without this patch 'extu.w e?' is used only when ANDing with either
0x00ff00ff or 0x00ffff00. The patch detects more cases where
'extu.w e?' can be used. Specifically, all of the following constants
are eligible:
0x00ff??ff
0x00ffff??
0x00ff0000
0x00ffffff
Tested on h8300 port. Committed.
Kazu Hirata
2002-12-30 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (output_logical_op): Use extu.w in more
cases.
(compute_logical_op_length): Update to reflect the change in
output_logical_op.
(compute_logical_op_cc): Likewise.
Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.188
diff -u -r1.188 h8300.c
--- h8300.c 30 Dec 2002 15:28:31 -0000 1.188
+++ h8300.c 30 Dec 2002 20:59:43 -0000
@@ -2152,8 +2152,10 @@
&& ((det & 0xffff0000) != 0)
&& (code == IOR || det != 0xffffff00)
&& (code == IOR || det != 0xffff00ff)
- && (code != AND || det != 0xff00ff00)
- && (code != AND || det != 0xff0000ff))
+ && !(code == AND
+ && (det == 0xff00ffff
+ || (det & 0xffff00ff) == 0xff000000
+ || (det & 0xffffff00) == 0xff000000)))
{
sprintf (insn_buf, "%s.l\t%%S2,%%S0", opname);
output_asm_insn (insn_buf, operands);
@@ -2285,8 +2287,10 @@
&& ((det & 0xffff0000) != 0)
&& (code == IOR || det != 0xffffff00)
&& (code == IOR || det != 0xffff00ff)
- && (code != AND || det != 0xff00ff00)
- && (code != AND || det != 0xff0000ff))
+ && !(code == AND
+ && (det == 0xff00ffff
+ || (det & 0xffff00ff) == 0xff000000
+ || (det & 0xffffff00) == 0xff000000)))
{
if (REG_P (operands[2]))
length += 4;
@@ -2392,8 +2396,10 @@
&& ((det & 0xffff0000) != 0)
&& (code == IOR || det != 0xffffff00)
&& (code == IOR || det != 0xffff00ff)
- && (code != AND || det != 0xff00ff00)
- && (code != AND || det != 0xff0000ff))
+ && !(code == AND
+ && (det == 0xff00ffff
+ || (det & 0xffff00ff) == 0xff000000
+ || (det & 0xffffff00) == 0xff000000)))
{
cc = CC_SET_ZNV;
}