From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: How to use "y" constraint in GCC inline powerpc assembly ?
Date: Sat, 18 Apr 2020 08:28:53 +0000 [thread overview]
Message-ID: <9fd93f18-652e-c301-f110-d9f07201330d@c-s.fr> (raw)
Hi Segher,
I'd like to use cr instead of gpr to return error condition from
__get_user().
I saw in GCC doc
(https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html) that it is
possible to use "y" as constraint to refer to "Any condition register
field, cr0…cr7".
I tried the test below, but it fails with "error: impossible register
constraint in 'asm'"
How does "y" has to be used ?
int test(char *p)
{
struct {
int r:1;
} res = {0};
asm("crnot %0 * 4 + eq, %0 * 4 + eq": "=&y"(res.r));
if (res.r)
return -14;
return 0;
}
Christophe
next reply other threads:[~2020-04-18 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 8:28 Christophe Leroy [this message]
2020-04-18 21:39 ` How to use "y" constraint in GCC inline powerpc assembly ? Segher Boessenkool
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=9fd93f18-652e-c301-f110-d9f07201330d@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=segher@kernel.crashing.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 NNTP newsgroup(s).