mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: Charlie Jenkins <charlie@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] riscv: lib: Check if output in asm goto supported
Date: Fri, 19 Jan 2024 10:41:14 +0100	[thread overview]
Message-ID: <20240119-1bff4a21b3d2d5c500a14fcc@orel> (raw)
In-Reply-To: <20240118-csum_remove_output_operands_asm_goto-v2-1-5d1b73cf93d4@rivosinc.com>

On Thu, Jan 18, 2024 at 02:36:45PM -0800, Charlie Jenkins wrote:
> The output field of an asm goto statement is not supported by all
> compilers. If it is not supported, fallback to the non-optimized code.
> 
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: a04c192eabfb ("riscv: Add checksum library")
> ---
> The OutputOperands field for asm goto statements is only supported
> starting from GCC 11. Split the asm goto to remove the use of this
> feature.
> ---
> Changes in v2:
> - Use CC_HAS_ASM_GOTO_TIED_OUTPUT
> - Link to v1: https://lore.kernel.org/r/20240118-csum_remove_output_operands_asm_goto-v1-1-47c672bb9d4b@rivosinc.com
> ---
>  arch/riscv/lib/csum.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
> index 06ce8e7250d9..af3df5274ccb 100644
> --- a/arch/riscv/lib/csum.c
> +++ b/arch/riscv/lib/csum.c
> @@ -156,6 +156,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
>  	end = (const unsigned long *)(buff + len);
>  	csum = do_csum_common(ptr, end, data);
>  
> +#ifdef CC_HAS_ASM_GOTO_TIED_OUTPUT

Can't we just add another IS_ENABLED() to the if rather than this #ifdef?

>  	/*
>  	 * Zbb support saves 6 instructions, so not worth checking without
>  	 * alternatives if supported
> @@ -214,6 +215,7 @@ do_csum_with_alignment(const unsigned char *buff, int len)
>  		return csum >> 16;
>  	}
>  no_zbb:
> +#endif /* CC_HAS_ASM_GOTO_TIED_OUTPUT */
>  #ifndef CONFIG_32BIT
>  	csum += ror64(csum, 32);
>  	csum >>= 32;

BTW, I wonder how/if the check for CC_HAS_ASM_GOTO_TIED_OUTPUT in
init/Kconfig is working as expected. I see $CC, as opposed to $(CC),
being used there. I believe $CC is just the expansion of $C with a
'C' appended.

Thanks,
drew

> 
> ---
> base-commit: 080c4324fa5e81ff3780206a138223abfb57a68e
> change-id: 20240118-csum_remove_output_operands_asm_goto-49922c141ce7
> -- 
> - Charlie
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2024-01-19  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 22:36 Charlie Jenkins
2024-01-19  9:41 ` Andrew Jones [this message]
2024-01-19 15:23   ` Charlie Jenkins
2024-01-20 21:09 ` patchwork-bot+linux-riscv

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=20240119-1bff4a21b3d2d5c500a14fcc@orel \
    --to=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=charlie@rivosinc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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

all inboxes | Powered by JetHome®