public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tamar Christina <Tamar.Christina@arm.com>
To: Jochen Barth <jpunktbarth@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: RE: arm_neon.h / vext_u64 (uint64x1_t __a, uint64x1_t __b, __const int __c)
Date: Thu, 10 Sep 2020 08:34:19 +0000	[thread overview]
Message-ID: <VI1PR08MB5325E434921B75F6CB7321E8FF270@VI1PR08MB5325.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <5bd09e76-1c19-c6d1-34f8-2e51a7b17828@gmail.com>

Hi Jochen,

> -----Original Message-----
> From: Jochen Barth <jpunktbarth@gmail.com>
> Sent: Thursday, September 10, 2020 9:14 AM
> To: Tamar Christina <Tamar.Christina@arm.com>
> Cc: gcc-help <gcc-help@gcc.gnu.org>
> Subject: Re: arm_neon.h / vext_u64 (uint64x1_t __a, uint64x1_t __b,
> __const int __c)
> 
> Dear Tamar,
> 
> Sorry, I do no get the point:
> 
> >>> EXT is a byte level extract, if you have a 64 bit vector and a
> >>> 64-bit type like uint64x1_t then the only possible index for n is 0.
> 

Because those intrinsics are not doing byte level extraction. They are convenience functions that
do not allow partial extraction of a type. For instance vext_s16 which takes an int16x4_t as input
restricts the values of n to 0 to 3 because when used with the EXT instruction it always
makes sure they're a multiple of 2 bytes since a int16 is two bytes.

A uint64x1_t is a vector of 8 bytes which the intrinsic does as a group of 8 bytes since it
Always wants to extract whole numbers. As such the only possible index is 0.

To get the behavior you have in your example you need to do the extraction on bytes using
vext_u8 which will allow you to corrupt the number. i.e.

what you want is

 vreinterpret_u64_u8 (vext_u8 (vreinterpret_u8_u64 (a), vreinterpret_u8_u64 (b), <number>))

where your extraction happens on bytes. In this case n has the range 0-7.

Instead of looking at the Arm ARM you should look at the definition of the intrinsics
https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics

Regards,
Tamar

> But my previous examples with n=c=1..7 showed that different (n=c)'s are
> possible,
> 
> why is "the only possible index for n=0" ?
> 
> Kind regards, Jochen

  reply	other threads:[~2020-09-10  8:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 21:10 Jochen Barth
2020-09-02 21:11 ` Jochen Barth
     [not found] ` <VI1PR08MB53253664D3E7644526965E27FF260@VI1PR08MB5325.eurprd08.prod.outlook.com>
     [not found]   ` <e06ec9ce-78ec-8eb2-83c4-4d3eda9e18f4@gmail.com>
2020-09-10  7:54     ` Tamar Christina
2020-09-10  8:14       ` Jochen Barth
2020-09-10  8:34         ` Tamar Christina [this message]
2020-09-10 10:35           ` Jochen Barth

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=VI1PR08MB5325E434921B75F6CB7321E8FF270@VI1PR08MB5325.eurprd08.prod.outlook.com \
    --to=tamar.christina@arm.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jpunktbarth@gmail.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).