From: Conor Dooley <conor@kernel.org>
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] riscv: lib: Support csum on GCC <11
Date: Thu, 18 Jan 2024 22:05:44 +0000 [thread overview]
Message-ID: <20240118-museum-ample-11d649f95de8@spud> (raw)
In-Reply-To: <20240118-csum_remove_output_operands_asm_goto-v1-1-47c672bb9d4b@rivosinc.com>
[-- Attachment #1.1: Type: text/plain, Size: 3166 bytes --]
On Thu, Jan 18, 2024 at 01:53:59PM -0800, Charlie Jenkins wrote:
> 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.
>
> 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.
Maybe this is a super naive question, but is it possible to just not
use the custom csum code for gcc older than 11?
> ---
> arch/riscv/lib/csum.c | 42 ++++++++++++++++++++++++++++++------------
> 1 file changed, 30 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
> index 06ce8e7250d9..23be289f52b6 100644
> --- a/arch/riscv/lib/csum.c
> +++ b/arch/riscv/lib/csum.c
> @@ -177,22 +177,35 @@ do_csum_with_alignment(const unsigned char *buff, int len)
> : no_zbb);
>
> #ifdef CONFIG_32BIT
> - asm_volatile_goto(".option push \n\
> + /*
> + * OutputOperands in asm goto is not supported until GCC 11, so
> + * this asm has to be split to be compatible.
> + */
> + asm (".option push \n\
> .option arch,+zbb \n\
> rori %[fold_temp], %[csum], 16 \n\
> andi %[offset], %[offset], 1 \n\
> add %[csum], %[fold_temp], %[csum] \n\
> - beq %[offset], zero, %l[end] \n\
> - rev8 %[csum], %[csum] \n\
> .option pop"
> : [csum] "+r" (csum), [fold_temp] "=&r" (fold_temp)
> - : [offset] "r" (offset)
> - :
> - : end);
> + : [offset] "r" (offset));
> +
> + if (offset == 0)
> + goto end;
> +
> + asm (".option push \n\
> + .option arch, +zbb \n\
> + rev8 %[csum], %[csum] \n\
> + .option pop"
> + : [csum] "+r" (csum));
>
> return (unsigned short)csum;
> #else /* !CONFIG_32BIT */
> - asm_volatile_goto(".option push \n\
> + /*
> + * OutputOperands in asm goto is not supported until GCC 11, so
> + * this asm has to be split to be compatible.
> + */
> + asm (".option push \n\
> .option arch,+zbb \n\
> rori %[fold_temp], %[csum], 32 \n\
> add %[csum], %[fold_temp], %[csum] \n\
> @@ -200,13 +213,18 @@ do_csum_with_alignment(const unsigned char *buff, int len)
> roriw %[fold_temp], %[csum], 16 \n\
> addw %[csum], %[fold_temp], %[csum] \n\
> andi %[offset], %[offset], 1 \n\
> - beq %[offset], zero, %l[end] \n\
> - rev8 %[csum], %[csum] \n\
> .option pop"
> : [csum] "+r" (csum), [fold_temp] "=&r" (fold_temp)
> - : [offset] "r" (offset)
> - :
> - : end);
> + : [offset] "r" (offset));
> +
> + if (offset == 0)
> + goto end;
> +
> + asm (".option push \n\
> + .option arch, +zbb \n\
> + rev8 %[csum], %[csum] \n\
> + .option pop"
> + : [csum] "+r" (csum));
>
> return (csum << 16) >> 48;
> #endif /* !CONFIG_32BIT */
>
> ---
> base-commit: 080c4324fa5e81ff3780206a138223abfb57a68e
> change-id: 20240118-csum_remove_output_operands_asm_goto-49922c141ce7
> --
> - Charlie
>
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor@kernel.org>
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] riscv: lib: Support csum on GCC <11
Date: Thu, 18 Jan 2024 22:05:44 +0000 [thread overview]
Message-ID: <20240118-museum-ample-11d649f95de8@spud> (raw)
In-Reply-To: <20240118-csum_remove_output_operands_asm_goto-v1-1-47c672bb9d4b@rivosinc.com>
[-- Attachment #1: Type: text/plain, Size: 3166 bytes --]
On Thu, Jan 18, 2024 at 01:53:59PM -0800, Charlie Jenkins wrote:
> 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.
>
> 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.
Maybe this is a super naive question, but is it possible to just not
use the custom csum code for gcc older than 11?
> ---
> arch/riscv/lib/csum.c | 42 ++++++++++++++++++++++++++++++------------
> 1 file changed, 30 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c
> index 06ce8e7250d9..23be289f52b6 100644
> --- a/arch/riscv/lib/csum.c
> +++ b/arch/riscv/lib/csum.c
> @@ -177,22 +177,35 @@ do_csum_with_alignment(const unsigned char *buff, int len)
> : no_zbb);
>
> #ifdef CONFIG_32BIT
> - asm_volatile_goto(".option push \n\
> + /*
> + * OutputOperands in asm goto is not supported until GCC 11, so
> + * this asm has to be split to be compatible.
> + */
> + asm (".option push \n\
> .option arch,+zbb \n\
> rori %[fold_temp], %[csum], 16 \n\
> andi %[offset], %[offset], 1 \n\
> add %[csum], %[fold_temp], %[csum] \n\
> - beq %[offset], zero, %l[end] \n\
> - rev8 %[csum], %[csum] \n\
> .option pop"
> : [csum] "+r" (csum), [fold_temp] "=&r" (fold_temp)
> - : [offset] "r" (offset)
> - :
> - : end);
> + : [offset] "r" (offset));
> +
> + if (offset == 0)
> + goto end;
> +
> + asm (".option push \n\
> + .option arch, +zbb \n\
> + rev8 %[csum], %[csum] \n\
> + .option pop"
> + : [csum] "+r" (csum));
>
> return (unsigned short)csum;
> #else /* !CONFIG_32BIT */
> - asm_volatile_goto(".option push \n\
> + /*
> + * OutputOperands in asm goto is not supported until GCC 11, so
> + * this asm has to be split to be compatible.
> + */
> + asm (".option push \n\
> .option arch,+zbb \n\
> rori %[fold_temp], %[csum], 32 \n\
> add %[csum], %[fold_temp], %[csum] \n\
> @@ -200,13 +213,18 @@ do_csum_with_alignment(const unsigned char *buff, int len)
> roriw %[fold_temp], %[csum], 16 \n\
> addw %[csum], %[fold_temp], %[csum] \n\
> andi %[offset], %[offset], 1 \n\
> - beq %[offset], zero, %l[end] \n\
> - rev8 %[csum], %[csum] \n\
> .option pop"
> : [csum] "+r" (csum), [fold_temp] "=&r" (fold_temp)
> - : [offset] "r" (offset)
> - :
> - : end);
> + : [offset] "r" (offset));
> +
> + if (offset == 0)
> + goto end;
> +
> + asm (".option push \n\
> + .option arch, +zbb \n\
> + rev8 %[csum], %[csum] \n\
> + .option pop"
> + : [csum] "+r" (csum));
>
> return (csum << 16) >> 48;
> #endif /* !CONFIG_32BIT */
>
> ---
> base-commit: 080c4324fa5e81ff3780206a138223abfb57a68e
> change-id: 20240118-csum_remove_output_operands_asm_goto-49922c141ce7
> --
> - Charlie
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-01-18 22:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 21:53 [PATCH] riscv: lib: Support csum on GCC <11 Charlie Jenkins
2024-01-18 21:53 ` Charlie Jenkins
2024-01-18 22:05 ` Conor Dooley [this message]
2024-01-18 22:05 ` Conor Dooley
2024-01-18 22:20 ` Palmer Dabbelt
2024-01-18 22:20 ` Palmer Dabbelt
2024-01-18 22:38 ` Charlie Jenkins
2024-01-18 22:38 ` Charlie Jenkins
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=20240118-museum-ample-11d649f95de8@spud \
--to=conor@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.