diff mbox

[rs6000] Fix powerpc64le-linux bootstrap failure with -mcpu=power8

Message ID 1392567538.20991.17.camel@gnopaine
State New
Headers show

Commit Message

Bill Schmidt Feb. 16, 2014, 4:18 p.m. UTC
Hi,

Now that I have Power8 hardware to test on, I've discovered that I
introduced a problem with
http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01547.html that causes a
bootstrap failure when specifying -mcpu=power8.  I moved some logic from
rs6000_expand_vec_perm_const_1 into vsx_xxpermdi2_<mode>_1.  I failed to
notice there is another path into vsx_xxpermdi2_<mode>_1 that is
exercised during the bootstrap.

To avoid the problem, this patch adjusts the code generated along this
other path so that the later transformation will be correct.

Bootstrapped and tested on powerpc64{,le}-unknown-linux-gnu configured
both with -mcpu=power7 and with -mcpu=power8 with no regressions.  The
Power8 LE bootstrap now completes cleanly.  Is this ok for trunk?

Thanks,
Bill


2014-02-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/vsx.md (vsx_xxpermdi_<mode>): Handle little
	endian targets.

Comments

David Edelsohn Feb. 16, 2014, 10:04 p.m. UTC | #1
On Sun, Feb 16, 2014 at 11:18 AM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> Hi,
>
> Now that I have Power8 hardware to test on, I've discovered that I
> introduced a problem with
> http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01547.html that causes a
> bootstrap failure when specifying -mcpu=power8.  I moved some logic from
> rs6000_expand_vec_perm_const_1 into vsx_xxpermdi2_<mode>_1.  I failed to
> notice there is another path into vsx_xxpermdi2_<mode>_1 that is
> exercised during the bootstrap.
>
> To avoid the problem, this patch adjusts the code generated along this
> other path so that the later transformation will be correct.
>
> Bootstrapped and tested on powerpc64{,le}-unknown-linux-gnu configured
> both with -mcpu=power7 and with -mcpu=power8 with no regressions.  The
> Power8 LE bootstrap now completes cleanly.  Is this ok for trunk?
>
> Thanks,
> Bill
>
>
> 2014-02-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
>
>         * config/rs6000/vsx.md (vsx_xxpermdi_<mode>): Handle little
>         endian targets.

I'm not really thrilled with the need to reverse the operands twice, but okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/vsx.md
===================================================================
--- gcc/config/rs6000/vsx.md	(revision 207809)
+++ gcc/config/rs6000/vsx.md	(working copy)
@@ -1621,7 +1621,18 @@ 
 	  op1 = gen_lowpart (V2DImode, op1);
 	}
     }
-  emit_insn (gen (target, op0, op1, perm0, perm1));
+  /* In little endian mode, vsx_xxpermdi2_<mode>_1 will perform a
+     transformation we don't want; it is necessary for
+     rs6000_expand_vec_perm_const_1 but not for this use.  So we
+     prepare for that by reversing the transformation here.  */
+  if (BYTES_BIG_ENDIAN)
+    emit_insn (gen (target, op0, op1, perm0, perm1));
+  else
+    {
+      rtx p0 = GEN_INT (3 - INTVAL (perm1));
+      rtx p1 = GEN_INT (3 - INTVAL (perm0));
+      emit_insn (gen (target, op1, op0, p0, p1));
+    }
   DONE;
 })