This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Be careful with special permute masks for little endian, take 2
- 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, 22 Oct 2013 10:22:40 -0400
- Subject: Re: [PATCH, rs6000] Be careful with special permute masks for little endian, take 2
- Authentication-results: sourceware.org; auth=none
- References: <1382400200 dot 6275 dot 170 dot camel at gnopaine>
On Mon, Oct 21, 2013 at 8:03 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> Hi,
>
> This is a revision of my earlier patch on the subject, expanded to catch
> a few more cases and with some attendant test-case adjustments:
>
> In altivec_expand_vec_perm_const, we look for special masks that match
> the behavior of specific instructions, so we can use those instructions
> rather than load a constant control vector and perform a permute. Some
> of the masks must be treated differently for little endian mode.
>
> The masks that represent merge-high and merge-low operations have
> reversed meanings in little-endian, because of the reversed ordering of
> the vector elements.
>
> The masks that represent vector-pack operations remain correct when the
> mode of the input operands matches the natural mode of the instruction,
> but not otherwise. This is because the pack instructions always select
> the rightmost, low-order bits of the vector element. There are cases
> where we use this, for example, with a V8SI vector matching a vpkuwum
> mask in order to select the odd-numbered elements of the vector. In
> little endian mode, this instruction will get us the even-numbered
> elements instead. There is no alternative instruction with the desired
> behavior, so I've just disabled use of those masks for little endian
> when the mode isn't natural.
>
> This requires adjusting the altivec-perm-1.c test case. The vector pack
> tests are moved to a new altivec-perm-3.c test, which is restricted to
> big-endian targets.
>
> These changes fix 49 failures in the test suite for little endian mode
> (9 vector failures left to go!). Bootstrapped and tested on
> powerpc64{,le}-unknown-linux-gnu with no new failures. Is this ok for
> trunk?
>
> Thanks,
> Bill
>
>
> gcc:
>
> 2013-10-21 Bill Schmidt <wschmidt@vnet.ibm.com>
>
> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
> meaning of merge-high and merge-low masks for little endian; avoid
> use of vector-pack masks for little endian for mismatched modes.
>
> gcc/testsuite:
>
> 2013-10-21 Bill Schmidt <wschmidt@vnet.ibm.com>
>
> * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack
> tests into...
> * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is
> restricted to big-endian targets.
Okay.
Thanks, David