qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 08/60] target/riscv: add vector amo operations


From: Richard Henderson
Subject: Re: [PATCH v5 08/60] target/riscv: add vector amo operations
Date: Fri, 13 Mar 2020 21:28:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/12/20 7:58 AM, LIU Zhiwei wrote:
> +    static gen_helper_amo *const fnsw[9] = {
...
> +    static gen_helper_amo *const fnsd[18] = {
...
> +        fn = fnsw[seq];
> +#ifdef TARGET_RISCV64
> +        if (s->sew == 3) {
> +            fn = fnsd[seq];
> +        }
> +#endif

This indexing is wrong, since for seq == 11 you index past the end of fnsw[].

You need something like

    if (s->sew == 3) {
#ifdef TARGET_RISCV64
        fn = fnsd[seq];
#else
        /* Check done in amo_check(). */
        g_assert_not_reached();
#endif
    } else {
        fn = fnsw[seq];
    }

Otherwise it looks ok.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]