public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill Tkachov <kyrylo.tkachov@foss.arm.com>
To: Charles Baylis <charles.baylis@linaro.org>
Cc: Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	 Richard Earnshaw <richard.earnshaw@arm.com>,
	Richard Earnshaw <rearnsha@arm.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>,
	Michael Collison <michael.collison@linaro.org>
Subject: Re: [PATCH 1/2] [ARM] PR68532: Fix up vuzp for big endian
Date: Tue, 09 Feb 2016 17:08:00 -0000	[thread overview]
Message-ID: <56BA1D08.8050800@foss.arm.com> (raw)
In-Reply-To: <CADnVucB=gALNdOEgo9rAq8xjykN6y_BPObLw_x6rEEe2t5C28Q@mail.gmail.com>


On 09/02/16 17:00, Charles Baylis wrote:
> On 8 February 2016 at 11:42, Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> wrote:
>> Hi Charles,
>>
>>
>> On 03/02/16 18:59, charles.baylis@linaro.org wrote:
>>> --- a/gcc/config/arm/arm.c
>>> +++ b/gcc/config/arm/arm.c
>>> @@ -28208,6 +28208,35 @@ arm_expand_vec_perm (rtx target, rtx op0, rtx
>>> op1, rtx sel)
>>>      arm_expand_vec_perm_1 (target, op0, op1, sel);
>>>    }
>>>    +/* map lane ordering between architectural lane order, and GCC lane
>>> order,
>>> +   taking into account ABI.  See comment above output_move_neon for
>>> details.  */
>>> +static int
>>> +neon_endian_lane_map (machine_mode mode, int lane)
>>
>> s/map/Map/
>> New line between comment and function signature.
> Done.
>
>>> +{
>>> +  if (BYTES_BIG_ENDIAN)
>>> +  {
>>> +    int nelems = GET_MODE_NUNITS (mode);
>>> +    /* Reverse lane order.  */
>>> +    lane = (nelems - 1 - lane);
>>> +    /* Reverse D register order, to match ABI.  */
>>> +    if (GET_MODE_SIZE (mode) == 16)
>>> +      lane = lane ^ (nelems / 2);
>>> +  }
>>> +  return lane;
>>> +}
>>> +
>>> +/* some permutations index into pairs of vectors, this is a helper
>>> function
>>> +   to map indexes into those pairs of vectors.  */
>>> +static int
>>> +neon_pair_endian_lane_map (machine_mode mode, int lane)
>>
>> Similarly, s/some/Some/ and new line after comment.
> Done.
>
>>> +{
>>> +  int nelem = GET_MODE_NUNITS (mode);
>>> +  if (BYTES_BIG_ENDIAN)
>>> +    lane =
>>> +      neon_endian_lane_map (mode, lane & (nelem - 1)) + (lane & nelem);
>>> +  return lane;
>>> +}
>>> +
>>>    /* Generate or test for an insn that supports a constant permutation.
>>> */
>>>      /* Recognize patterns for the VUZP insns.  */
>>> @@ -28218,14 +28247,22 @@ arm_evpc_neon_vuzp (struct expand_vec_perm_d *d)
>>>      unsigned int i, odd, mask, nelt = d->nelt;
>>>      rtx out0, out1, in0, in1;
>>>      rtx (*gen)(rtx, rtx, rtx, rtx);
>>> +  int first_elem;
>>> +  int swap;
>>>
>> Just make this a bool.
> As discussed on IRC, this variable does contain an integer. I have
> renamed it as swap_nelt, and changed the test on it below.

This is ok.
Thanks,
Kyrill

> [snip]
>
>>>    @@ -28258,10 +28296,9 @@ arm_evpc_neon_vuzp (struct expand_vec_perm_d
>>> *d)
>>>        in0 = d->op0;
>>>      in1 = d->op1;
>>> -  if (BYTES_BIG_ENDIAN)
>>> +  if (swap)
>>>        {
>>>          std::swap (in0, in1);
>>> -      odd = !odd;
>>>        }
>> remove the braces around the std::swap
> Done. Also changed if (swap) to if (swap_nelt != 0)
>
> [snip]
>
>>> @@ -0,0 +1,24 @@
>>> +/* { dg-options "-O2 -ftree-vectorize -fno-vect-cost-model" } */
>>> +
>>> +#define SIZE 128
>>> +unsigned short _Alignas (16) in[SIZE];
>>> +
>>> +extern void abort (void);
>>> +
>>> +__attribute__ ((noinline)) int
>>> +test (unsigned short sum, unsigned short *in, int x)
>>> +{
>>> +  for (int j = 0; j < SIZE; j += 8)
>>> +    sum += in[j] * x;
>>> +  return sum;
>>> +}
>>> +
>>> +int
>>> +main ()
>>> +{
>>> +  for (int i = 0; i < SIZE; i++)
>>> +    in[i] = i;
>>> +  if (test (0, in, 1) != 960)
>>> +    abort ();
>>
>> AFAIK tests here usually prefer __builtin_abort ();
>> That way you don't have to declare the abort prototype in the beginning.
> Done.
>
> Updated patch attached

  reply	other threads:[~2016-02-09 17:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 18:59 [ARM, PATCH v2 0/2] PR68532: Fix VZIP/VUZP recognition " charles.baylis
2016-02-03 18:59 ` [PATCH 1/2] [ARM] PR68532: Fix up vuzp " charles.baylis
2016-02-08 11:42   ` Kyrill Tkachov
2016-02-09 17:01     ` Charles Baylis
2016-02-09 17:08       ` Kyrill Tkachov [this message]
2016-02-09 18:54         ` Charles Baylis
2016-02-03 18:59 ` [PATCH 2/2] [ARM] PR68532 Fix up vzip recognition " charles.baylis
2016-02-08 11:42   ` Kyrill Tkachov
2016-02-09 17:07     ` Charles Baylis
2016-02-09 18:53       ` Charles Baylis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56BA1D08.8050800@foss.arm.com \
    --to=kyrylo.tkachov@foss.arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=charles.baylis@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=michael.collison@linaro.org \
    --cc=rearnsha@arm.com \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).