On Fri, Oct 8, 2021 at 4:21 PM Denys Vlasenko <[email protected]> wrote:
> Can you try this?
>
> #if defined(__clang_major__) && __clang_major__ >= 9
> /* Clang/llvm drops assignment to "constant" storage. Silently.
>  * Needs serious convincing to not eliminate the store.
>  */
> static ALWAYS_INLINE void register_barrier(void)
> {
>         int r0, r1, r2, r3, r4, r5;
>         asm volatile (
>                 "# clobber 6 registers"
>                 : "=r"(r0), "=r"(r1), "=r"(r2), "=r"(r3), "=r"(r4), "=r"(r5)
>                 : "0"(r1), "1"(r1), "2"(r2), "3"(r3), "4"(r4), "5"(r5)
>                 : "memory"
>
>         );
> }

should be "0"(r0), not r1; also, dummy-initialize them to avoid warnings:

static ALWAYS_INLINE void register_barrier(void)
{
        int r0 = r0, r1 = r1, r2 = r2, r3 = r3, r4 = r4, r5 = r5;
        asm volatile (
                "# clobber 6 registers"
                : "=r"(r0), "=r"(r1), "=r"(r2), "=r"(r3), "=r"(r4), "=r"(r5)
                : "0"(r0), "1"(r1), "2"(r2), "3"(r3), "4"(r4), "5"(r5)
                : "memory"
        );
}

6 registers is maximum what does not fail to compile for i386.
Size growth +1021 bytes.

5 registers: +564 bytes
4 registers: +424 bytes
3 registers: +303 bytes
2 registers: +205 bytes
1 register: +101 bytes
0 registers: 0 bytes (as expected)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to