This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PowerPC] altivec_expand_vec_perm_const reverses pack pattern arguments in little endian mode
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 23 Jul 2013 14:02:05 -0400
- Subject: Re: [PATCH, PowerPC] altivec_expand_vec_perm_const reverses pack pattern arguments in little endian mode
- References: <1374534309 dot 3633 dot 96 dot camel at gnopaine> <CAGWvnym0zOTbn_7CnqeRVUQf+LsmdyLnSD1oUT6afTHqbw1jhw at mail dot gmail dot com> <1374541766 dot 3633 dot 104 dot camel at gnopaine>
On Mon, Jul 22, 2013 at 9:09 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> OK, currently testing the following. OK if it passes?
>
> Index: gcc/config/rs6000/rs6000.c
> ===================================================================
> --- gcc/config/rs6000/rs6000.c (revision 201149)
> +++ gcc/config/rs6000/rs6000.c (working copy)
> @@ -28518,6 +28518,11 @@ 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;
>
> + /* 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 (!BYTES_BIG_ENDIAN)
> + swapped = !swapped;
> if (swapped)
> x = op0, op0 = op1, op1 = x;
> if (imode != V16QImode)
I would prefer something like
if (swapped ^ ! BYTES_BIG_ENDIAN) ...
to make it more clear that the test only is affecting that specific
swapping of arguments and not the other uses of "swapped" within the
loop, i.e., not the earlier pattern comparison.
Thanks, David