Patchwork : [PATCH, reginfo.c, i386.c] Backport fix for PR58139 to 4.8

login
register
mail settings
Submitter Peter Bergner
Date Jan. 16, 2014, 2:58 p.m.
Message ID <1389884322.5729.794.camel@otta>
Download mbox | patch
Permalink /patch/311745/
State New
Headers show

Comments

Peter Bergner - Jan. 16, 2014, 2:58 p.m.
On Thu, 2014-01-16 at 13:49 +0100, Uros Bizjak wrote:
> On Thu, Jan 16, 2014 at 1:39 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> > We were already testing for OImode, so do you want me to
> > remove the redundant compare and make the code look like
> > the following instead?
> 
> Yes, just use [1] from mainline.
> 
> [1] http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00954.html

Ok, here is what I ended up committing.  Thanks!

Peter


	Backport from mainline
	2014-01-15  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.c (ix86_hard_regno_mode_ok): Use
	VALID_AVX256_REG_OR_OI_MODE.

	2013-09-05  Peter Bergner  <bergner@vnet.ibm.com>

	PR target/58139
	* reginfo.c (choose_hard_reg_mode): Scan through all mode classes
	looking for widest mode.

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 206661)
+++ config/i386/i386.c	(working copy)
@@ -33933,10 +33933,10 @@  ix86_hard_regno_mode_ok (int regno, enum
     {
       /* We implement the move patterns for all vector modes into and
 	 out of SSE registers, even when no operation instructions
-	 are available.  OImode move is available only when AVX is
-	 enabled.  */
-      return ((TARGET_AVX && mode == OImode)
-	      || VALID_AVX256_REG_MODE (mode)
+	 are available.  OImode and AVX modes are available only when
+	 AVX is enabled.  */
+      return ((TARGET_AVX
+	       && VALID_AVX256_REG_OR_OI_MODE (mode))
 	      || VALID_SSE_REG_MODE (mode)
 	      || VALID_SSE2_REG_MODE (mode)
 	      || VALID_MMX_REG_MODE (mode)
Index: reginfo.c
===================================================================
--- reginfo.c	(revision 206661)
+++ reginfo.c	(working copy)
@@ -620,40 +620,35 @@  choose_hard_reg_mode (unsigned int regno
        mode = GET_MODE_WIDER_MODE (mode))
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
 	&& HARD_REGNO_MODE_OK (regno, mode)
-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
+	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
+	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
       found_mode = mode;

-  if (found_mode != VOIDmode)
-    return found_mode;
-
   for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
        mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
 	&& HARD_REGNO_MODE_OK (regno, mode)
-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
+	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
+	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
       found_mode = mode;

-  if (found_mode != VOIDmode)
-    return found_mode;
-
   for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
        mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
 	&& HARD_REGNO_MODE_OK (regno, mode)
-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
+	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
+	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
       found_mode = mode;

-  if (found_mode != VOIDmode)
-    return found_mode;
-
   for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
        mode != VOIDmode;
        mode = GET_MODE_WIDER_MODE (mode))
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
 	&& HARD_REGNO_MODE_OK (regno, mode)
-	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
+	&& (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
+	&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
       found_mode = mode;

   if (found_mode != VOIDmode)