When I configure gcc with --with-arch=rv64im I get following error when build benchmark/mm:
undefined reference to `__sync_fetch_and_add_4'
I see in atomic.c (riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv) there is a macro #ifdef __riscv_atomic to check and implement these functions.
Is it expected that these function to be undefined if A-extension not supported? Or do we need to implement them even __riscv_atomic undefined?
Thanks.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+unsubscribe@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/a5a75b1dc3dd4540a277e51fd7d35c2e%40HKMAIL101.nvidia.com.
Merge the thread.
Yes, to disable interrupt or sw-lock are nature solutions if without atomic instruction.
I was just hesitate whether I can simply tell MCU users (sw guys) that these builtin functions are not implemented in a toolchain.
“U mode to generate A instructions anyway, and have the supervisor emulate them” is an interesting idea. But looks a little bit heavy.
How about to implement a memory-mapped address to write/read as a locker (implemented by HW)?
From: bruce...@gmail.com [mailto:bruce...@gmail.com]
On Behalf Of Bruce Hoult
Sent: Thursday, September 21, 2017 2:05 PM
To: Sober Liu <sob...@nvidia.com>
Cc: RISC-V SW Dev <sw-...@groups.riscv.org>
Subject: Re: [sw-dev]gcc builtin functions like __sync_fetch_and_add if A-extension not supported
I you don't have the A-extension then hopefully you're on a uniprocessor system. You'll probably need to disable interrupts to implement the gcc built-ins. If the code will be running privileged then this can be done by writing to the mie CSR. If running in U mode then you'll need to call the supervisor.
It doesn't make a lot of sense to ask the supervisor to disable interrupts, run a couple of instructions in U mode, and then ask the supervisor to enable interrupts. For U mode software it would be better to tell the compiler to generate A instructions anyway, and have the supervisor emulate them.
From: Khem Raj [mailto:raj....@gmail.com]
Sent: Thursday, September 21, 2017 2:01 PM
To: Sober Liu <sob...@nvidia.com>; RISC-V SW Dev <sw-...@groups.riscv.org>
Subject: Re: [sw-dev]gcc builtin functions like __sync_fetch_and_add if A-extension not supported
The implementation in atomic.c assumes atomic memory instructions being available since its using sc.w.rl and lr.w.aq, therefore when using instruction set without atomic instruction like you said would probably require different fallback implementation may be by using spin lock.
On Thu, Sep 21, 2017 at 6:32 AM, Sober Liu <sob...@nvidia.com> wrote:
When I configure gcc with --with-arch=rv64im I get following error when build benchmark/mm:
undefined reference to `__sync_fetch_and_add_4'
I see in atomic.c (riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv) there is a macro #ifdef __riscv_atomic to check and implement these functions.
Is it expected that these function to be undefined if A-extension not supported? Or do we need to implement them even __riscv_atomic undefined?
Thanks.
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/a5a75b1dc3dd4540a277e51fd7d35c2e%40HKMAIL101.nvidia.com.
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at
https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAMU%2BEkwwup73pr0OXgmKa4ozYmRyeb1caHh4GWfro5Jk6HmX_w%40mail.gmail.com.