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]: builtin_memset support (better mode handling)


Hi,

working on back-end setmem support for S/390 and discussing it offline
with Ulrich, I found my previous patch not doing its job quite
well. Instead of converting the char to the mode of the pattern (usually
SI or DI) it should better convert it to the mode the back-end provided
for the char operand. This way the expander definition receives the
operand in the mode it expects. If no mode is provided, no conversion is
done.

Sucessfully bootstrapped and regtested on s390x and i686.
On i686 libjava/lang.exp/FileHandleGcTest produces arbitrary fails, but even
without the patch. Therefore, I guess that this is unrelated.

Ok for mainline?

2006-07-05  Adrian Straetling  <straetling@de.ibm.com>

	* expr.c: (set_storage_via_setmem): Convert opchar to mode
	defined by back-end.

Index: gcc/expr.c
===================================================================
--- gcc/expr.c.orig	2005-07-01 12:51:42.000000000 +0200
+++ gcc/expr.c	2005-07-04 13:30:48.988821413 +0200
@@ -2611,7 +2611,8 @@ set_storage_via_setmem (rtx object, rtx 
 	  && ((pred = insn_data[(int) code].operand[3].predicate) == 0
 	      || (*pred) (opalign, VOIDmode)))
 	{
-	  rtx opsize,opchar;
+	  rtx opsize, opchar;
+	  enum machine_mode char_mode;
 	  rtx last = get_last_insn ();
 	  rtx pat;
 
@@ -2620,10 +2621,15 @@ set_storage_via_setmem (rtx object, rtx 
 	  if (pred != 0 && ! (*pred) (opsize, mode))
 	    opsize = copy_to_mode_reg (mode, opsize);
 	  
-	  opchar = convert_to_mode (mode, val, 1);
-	  pred = insn_data[(int) code].operand[2].predicate;
-	  if (pred != 0 && ! (*pred) (opchar, mode))
-	    opchar = copy_to_mode_reg (mode, opchar);
+	  opchar = val;
+	  char_mode = insn_data[(int) code].operand[2].mode;
+	  if (char_mode != VOIDmode)
+	    {
+	      opchar = convert_to_mode (char_mode, opchar, 1);
+	      pred = insn_data[(int) code].operand[2].predicate;
+	      if (pred != 0 && ! (*pred) (opchar, char_mode))
+		opchar = copy_to_mode_reg (char_mode, opchar);
+	    }
 
 	  pat = GEN_FCN ((int) code) (object, opsize, opchar, opalign);
 	  if (pat)


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