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]

[patch] i386.md: Revive a dead pattern, *movqi_insv_2.


Hi,

Attached is a patch to revive a dead pattern, *movqi_insv_2.

AFAICT, *movqi_insv_2 in i386.md has been practically disabled by my
earilier patch to the combiner

  http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01901.html

which tries to remove unnecessary AND in a field assignment.

Removing AND from *movqi_insv_2 allows it to trigger with the
following code.

int bar (void);

int
foo (int b)
{
  int a = bar ();
  a = (a & ~0xff00) | (b & 0xff00);
  return a;
}

If you think of this problem as a performance regression due to my
earilier patch, this patch may be OK for 3.4.  If you think of this as
an optimization, I am happy to wait for 3.5.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2003-12-31  Kazu Hirata  <kazu@cs.umass.edu>

	* config/i386/i386.md (*movqi_insv_2): Remove AND in the
	set source.

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.496
diff -u -r1.496 i386.md
--- i386.md	30 Dec 2003 23:05:12 -0000	1.496
+++ i386.md	31 Dec 2003 00:44:02 -0000
@@ -1777,9 +1777,8 @@
   [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "+Q")
 			 (const_int 8)
 			 (const_int 8))
-	(and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
-			     (const_int 8))
-		(const_int 255)))]
+	(lshiftrt:SI (match_operand:SI 1 "register_operand" "Q")
+		     (const_int 8)))]
   ""
   "mov{b}\t{%h1, %h0|%h0, %h1}"
   [(set_attr "type" "imov")


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