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

2014-02-16 Thread Bill Schmidt
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  wschm...@linux.vnet.ibm.com

* config/rs6000/vsx.md (vsx_xxpermdi_mode): Handle little
endian targets.


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;
 })
 




Re: [PATCH, rs6000] Fix powerpc64le-linux bootstrap failure with -mcpu=power8

2014-02-16 Thread David Edelsohn
On Sun, Feb 16, 2014 at 11:18 AM, Bill Schmidt
wschm...@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  wschm...@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