public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: Jiong Wang <jiong.wang@foss.arm.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	Binutils <binutils@sourceware.org>
Subject: Re: How to save and restore a symbol value in Aarch64?
Date: Thu, 20 Apr 2017 13:57:00 -0000	[thread overview]
Message-ID: <CAH8yC8mhyjJ2-76A4Bz17F369wWXRQRhSEBrdkjiDY=XfpAt7w@mail.gmail.com> (raw)
In-Reply-To: <e77e6166-8281-ba9b-2451-724ec0d8aecc@foss.arm.com>

On Thu, Apr 20, 2017 at 8:35 AM, Jiong Wang <jiong.wang@foss.arm.com> wrote:
>
>
> On 20/04/17 11:54, Jeffrey Walton wrote:
>>
>> On Thu, Apr 20, 2017 at 6:02 AM, Andreas Schwab <schwab@linux-m68k.org>
>> wrote:
>>>
>>> On Apr 20 2017, Jeffrey Walton <noloader@gmail.com> wrote:
>>>
>>>> I need the method to get the previous .cpu value
>>>
>>> .cpu is not a symbol, it is a directive, so you cannot get its "value".
>>> The effect of the directive is to modify the internal state of the
>>> assembler, which is not directly accessible to the assembler input.
>>
>> Thanks Andreas.
>>
>> Does '.set push, .cpu' and '.set pop, .cpu' work as {expected|desired}
>> for Aarch32 and Aarch64?
>
> It will not work as you expected.
> They are simply treating "push/pop" as symbols, and their value will be the
> string ".cpu".

OK, thanks. My test case was bad. It needed to use a feature other
than NEON after the CRC. Trying to use AES caused the error I was
looking for.

> Below is a purely work around for your reference that you can escape
> assembler's architecture requirement check.
>
> __inline unsigned int GCC_INLINE_ATTRIB
> CRC32B(unsigned int crc, unsigned char v)
> {
>         unsigned int r;
>         asm (
>                         "\t.set raw_x0, 0\n"
>                         "\t.set raw_x1, 1\n"
>                         "\t.set raw_x2, 2\n"
>                         "\t.set raw_x3, 3\n"
>                         "\t.set raw_x4, 4\n"
>                         "\t.set raw_x5, 5\n"
>                         "\t.set raw_x6, 6\n"
>                         "\t.set raw_x7, 7\n"
>                         "\t#crc32w %w2, %w1, %w0\n"
>                         "\t.inst\t0x1ac04800 | (raw_%2) | (raw_%1 << 5) |
> (raw_%0 << 16)\n"
>                         : "=r"(r) : "r"(crc), "r"((unsigned int)v)
>             );
>         return r;
> }

Thanks Jiong. Wow, I'm fairly certain I would not have gotten that on my own.

If you get to the Baltimore MD or Washington DC area, then dinner and
cold beers are on me.

Jeff

  reply	other threads:[~2017-04-20 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  9:16 Jeffrey Walton
2017-04-20  9:27 ` Jeffrey Walton
2017-04-20 10:03 ` Andreas Schwab
2017-04-20 10:55   ` Jeffrey Walton
2017-04-20 12:35     ` Jiong Wang
2017-04-20 13:57       ` Jeffrey Walton [this message]
2017-04-20 19:01       ` Jeffrey Walton

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='CAH8yC8mhyjJ2-76A4Bz17F369wWXRQRhSEBrdkjiDY=XfpAt7w@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jiong.wang@foss.arm.com \
    --cc=schwab@linux-m68k.org \
    /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).