qemu-devel
[Top][All Lists]
Advanced

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

RE: [PATCH v8 10/12] target/hexagon: import parser for idef-parser


From: Taylor Simpson
Subject: RE: [PATCH v8 10/12] target/hexagon: import parser for idef-parser
Date: Mon, 11 Apr 2022 15:20:09 +0000


> -----Original Message-----
> From: Anton Johansson <anjo@rev.ng>
> Sent: Wednesday, February 9, 2022 11:03 AM
> To: qemu-devel@nongnu.org
> Cc: ale@rev.ng; Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>; Michael Lambert <mlambert@quicinc.com>;
> babush@rev.ng; nizzo@rev.ng; richard.henderson@linaro.org
> Subject: [PATCH v8 10/12] target/hexagon: import parser for idef-parser
> 
> Signed-off-by: Alessandro Di Federico <ale@rev.ng>
> Signed-off-by: Paolo Montesel <babush@rev.ng>
> Signed-off-by: Anton Johansson <anjo@rev.ng>


> diff --git a/target/hexagon/idef-parser/parser-helpers.c
> b/target/hexagon/idef-parser/parser-helpers.c
> new file mode 100644



> +void gen_set_overflow(Context *c, YYLTYPE *locp, HexValue *value)
> +{
> +    HexValue value_m = *value;
> +
> +    if (is_inside_ternary(c)) {
> +        /* Inside ternary operator, need to take care of the side-effect */
> +        HexValue cond = get_ternary_cond(c, locp);
> +        HexValue zero = gen_constant(c, locp, "0", cond.bit_width,
> UNSIGNED);
> +        bool is_64bit = cond.bit_width == 64;
> +        unsigned bit_width = cond.bit_width;
> +        value_m = rvalue_materialize(c, locp, &value_m);
> +        if (is_64bit) {
> +            value_m = gen_rvalue_extend(c, locp, &value_m);
> +        }
> +        OUT(c, locp, "tcg_gen_movcond_i", &bit_width,
> +                     "(TCG_COND_NE, ", &value_m, ", ", &cond);
> +        OUT(c, locp, ", ", &zero, ", ", &value_m, ", ", &zero, ");\n");

You shouldn't write zero when the condition is false - you should do nothing.  
Try a test where OVF is already set.  You can't overwrite the bit with zero 
when the current instruction doesn't overflow.



> +        if (is_64bit) {
> +            value_m = gen_rvalue_truncate(c, locp, &value_m);
> +        }
> +        gen_rvalue_free(c, locp, &cond);
> +    }
> +
> +    OUT(c, locp, "SET_USR_FIELD(USR_OVF, ", &value_m, ");\n");
> +    gen_rvalue_free(c, locp, &value_m);
> +}



reply via email to

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