linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/6] arm64: Add asm/ccset.h header
Date: Fri, 13 Mar 2020 10:54:44 +0000	[thread overview]
Message-ID: <20200313105443.GC42546@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <20200311180416.6509-2-richard.henderson@linaro.org>

Hi Richard,

On Wed, Mar 11, 2020 at 11:04:11AM -0700, Richard Henderson wrote:
> With gcc 10, arm64 includes support for flag outputs, much like
> x86 has done for years.  Mirror the macros that x86 places in
> asm/asm.h, with the necessary addition of CC_CLOBBER.

This sounds like a neat feature on the compiler side, and I can see that
this is potentially beneficial for hot paths.

I am concerned as Robin suggests for specific patches, that that macros
are going to be very easy to misuse, and make the assembly somewhat
opaque. So if there's a substantial benefit, it may be worth dealing
with that, but otherwise I'd prefer to keep things more legible so that
code is easier to maintain.

> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  arch/arm64/include/asm/ccset.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>  create mode 100644 arch/arm64/include/asm/ccset.h
> 
> diff --git a/arch/arm64/include/asm/ccset.h b/arch/arm64/include/asm/ccset.h
> new file mode 100644
> index 000000000000..e733d383f515
> --- /dev/null
> +++ b/arch/arm64/include/asm/ccset.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __ASM_CCSET_H
> +#define __ASM_CCSET_H
> +
> +/*
> + * Macros to generate condition code outputs from inline assembly.
> + * The output operand must be integral but type "bool" preferred.
> + */

Is there any documentation on this? What value does the output operand
nominally have when the flags are clear / set?

Thanks,
Mark.

> +#ifdef __GCC_ASM_FLAG_OUTPUTS__
> +# define CC_SET(c) "\n\t/* output condition code " #c "*/\n"
> +# define CC_OUT(c) "=@cc" #c
> +# define CC_CLOBBER
> +#else
> +# define CC_SET(c) "\n\tcset %[_cc_" #c "], " #c "\n"
> +# define CC_OUT(c) [_cc_ ## c] "=r"
> +# define CC_CLOBBER "cc"
> +#endif
> +
> +#endif /* __ASM_CCSET_H */
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-03-13 10:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 18:04 [PATCH 0/6] arm64: gcc asm flag outputs Richard Henderson
2020-03-11 18:04 ` [PATCH 1/6] arm64: Add asm/ccset.h header Richard Henderson
2020-03-13 10:54   ` Mark Rutland [this message]
2020-03-13 16:29     ` Richard Henderson
2020-03-11 18:04 ` [PATCH 2/6] arm64: uaccess: Use named asm operands for __in_range Richard Henderson
2020-03-11 19:08   ` Robin Murphy
2020-03-11 21:48     ` Richard Henderson
2020-03-13 16:14       ` Robin Murphy
2020-03-11 18:04 ` [PATCH 3/6] arm64: uaccess: Untie the input address in __range_ok Richard Henderson
2020-03-11 19:08   ` Robin Murphy
2020-03-11 18:04 ` [PATCH 4/6] arm64: uaccess: Use asm/ccset.h macros " Richard Henderson
2020-03-12 11:48   ` Robin Murphy
2020-03-13 11:04   ` Mark Rutland
2020-03-13 16:51     ` Robin Murphy
2020-03-13 17:14       ` Mark Rutland
2020-03-11 18:04 ` [PATCH 5/6] arm64: archrandom: Use asm/ccset.h macros in __arm64_rndr Richard Henderson
2020-03-11 18:04 ` [PATCH 6/6] arm64: Hoist CONFIG option out of ALTERNATIVE in uaccess.h Richard Henderson
2020-03-13 10:46   ` Mark Rutland

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=20200313105443.GC42546@lakrids.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=richard.henderson@linaro.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).