rs6000.c (altivec_expand_vec_perm_const): Reverse two operands for little-endian.
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Tue, 23 Jul 2013 22:36:04 +0000 (22:36 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Tue, 23 Jul 2013 22:36:04 +0000 (22:36 +0000)
2013-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
    Anton Blanchard <anton@au1.ibm.com>

* config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
two operands for little-endian.

Co-Authored-By: Anton Blanchard <anton@au1.ibm.com>
From-SVN: r201195

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 20b6b53..9b8d018 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+           Anton Blanchard <anton@au1.ibm.com>
+
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
+       two operands for little-endian.
+
 2013-07-23  Steve Ellcey  <sellcey@mips.com>
 
        * config/mips/mips.c (mips_case_values_threshold): New.
index 7729188..a3c9c98 100644 (file)
@@ -28520,7 +28520,10 @@ altivec_expand_vec_perm_const (rtx operands[4])
          enum machine_mode omode = insn_data[icode].operand[0].mode;
          enum machine_mode imode = insn_data[icode].operand[1].mode;
 
-         if (swapped)
+          /* For little-endian, the two input operands must be swapped
+             (or swapped back) to ensure proper right-to-left numbering
+             from 0 to 2N-1.  */
+         if (swapped ^ !BYTES_BIG_ENDIAN)
            x = op0, op0 = op1, op1 = x;
          if (imode != V16QImode)
            {