public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: invalid 'asm': invalid operand for code 'H'
Date: Mon, 09 Jul 2018 11:53:00 -0000	[thread overview]
Message-ID: <CAH8yC8krGS=-GywF2k2PwFaXStYti=qH7Eku8ZV45ctB0wZZsA@mail.gmail.com> (raw)
In-Reply-To: <41986930-ecad-36eb-d633-a51446b511e1@arm.com>

On Mon, Jul 9, 2018 at 5:51 AM, Richard Earnshaw (lists)
<Richard.Earnshaw@arm.com> wrote:
> On 09/07/18 10:37, Richard Earnshaw (lists) wrote:
>> On 08/07/18 06:03, Jeffrey Walton wrote:
>>> ...
>>> The guide says this about the modifiers:
>>>
>>> L - The lowest-numbered register of a register pair, or the low 16
>>> bits of an immediate constant.
>>> H - The highest-numbered register of a register pair, or the high 16
>>> bits of an immediate constant
>>> ....
>>>
>>> Is this an ARM extension not present in GCC? Or am I doing something wrong?
>>>
>> The L and H modifiers are for dealing with 64-bit /register/ quantities
>> where you need two registers to hold the entire value.  Your example
>> only has a single 32-bit value.  You don't need qualifiers in this case.
>>  For an immediate like this, you'll have to hand-code the reduction into
>> the appropriate fields, either in the operands you pass to the ASM or
>> within the ASM expansion itself.  Something like:
>>
>> asm volatile ("movw %0, %1;movt %0, %2": "=r"(a) : "i"(imm & 0xffff),
>> "i" (imm & 0xffff0000));
>>
> Correction.  Looking at the source code, the L modifier only appears to
> apply to 32-bit integer immediate values, the H modifier only appears to
> apply  to 64-bit registers.
>
> So the guide is wrong for both cases, but in different ways.  At least
> when it comes to GCC.
>
> Which document are you referring to?

Thanks Richard.

The guide I was using is
http://www.iarsys.co.jp/download/LMS2/arm/7304/ewarm7304doc/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
(p.147).

Jeff

  reply	other threads:[~2018-07-09 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08  5:03 Jeffrey Walton
2018-07-09  9:46 ` Richard Earnshaw (lists)
2018-07-09  9:53   ` Richard Earnshaw (lists)
2018-07-09 11:53     ` Jeffrey Walton [this message]
2018-07-09 12:48       ` U.Mutlu
2018-07-09 12:53       ` Richard Earnshaw (lists)
2018-07-09 16:57       ` Richard Earnshaw (lists)

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='CAH8yC8krGS=-GywF2k2PwFaXStYti=qH7Eku8ZV45ctB0wZZsA@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-help@gcc.gnu.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).