qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v5 38/60] target/riscv: vector floating-point compare instruc


From: Richard Henderson
Subject: Re: [PATCH v5 38/60] target/riscv: vector floating-point compare instructions
Date: Sat, 14 Mar 2020 02:08:32 -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 uint8_t float16_eq_quiet(uint16_t a, uint16_t b, float_status *s)
> +{
> +    int compare = float16_compare_quiet(a, b, s);
> +    if (compare == float_relation_equal) {
> +        return 1;
> +    } else {
> +        return 0;
> +    }
> +}

You really need remember that boolean results in C are 1 and 0.
You do not need to keep translating true to 1 and false to 0.

> +static uint8_t vmfne16(uint16_t a, uint16_t b, float_status *s)
> +{
> +    int compare = float16_compare_quiet(a, b, s);
> +    if (compare != float_relation_equal &&
> +            compare != float_relation_unordered) {

Indentation.

> +static uint8_t float16_le(uint16_t a, uint16_t b, float_status *s)
> +{
> +    int compare = float16_compare(a, b, s);
> +    if (compare == float_relation_less ||
> +            compare == float_relation_equal) {
> +        return 1;

Indentation.


r~



reply via email to

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