From: Anton Johansson via <qemu-devel@nongnu.org>
To: Taylor Simpson <tsimpson@quicinc.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "ale@rev.ng" <ale@rev.ng>, Brian Cain <bcain@quicinc.com>,
Michael Lambert <mlambert@quicinc.com>,
"babush@rev.ng" <babush@rev.ng>, "nizzo@rev.ng" <nizzo@rev.ng>,
"richard.henderson@linaro.org" <richard.henderson@linaro.org>
Subject: Re: [PATCH v8 10/12] target/hexagon: import parser for idef-parser
Date: Tue, 12 Apr 2022 17:10:44 +0200 [thread overview]
Message-ID: <3553bdb8-021c-3105-f8d3-4d65fd2bc0b8@rev.ng> (raw)
In-Reply-To: <SN4PR0201MB8808765107E51ACC51D89DECDEEA9@SN4PR0201MB8808.namprd02.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2896 bytes --]
Very nice catch, this is the bug that plagued us a few weeks ago when
rebasing,
it has since been fixed. Actually the `gen_set_overflow` fucntion has
been removed
completely as it was only called when we handled `asl/asr_r_r_sat`.
Current way we handle overflow:
Overflow is now only set by saturates, this assumption holds for the
instructions
we parse in phase 1. In the parser, all saturates call `gen_rvalue_sat`
which emits
a call to `gen_set_usr_field_if` in `genptr.c` to set USR_OVF only if
the value is
non-zero. It does this via OR'ing with the previous value.
See here
<https://gitlab.com/AntonJohansson/qemu/-/blob/feature/idef-parser/target/hexagon/idef-parser/parser-helpers.c#L2109>
for `gen_rvalue_sat`
and here
<https://gitlab.com/AntonJohansson/qemu/-/blob/feature/idef-parser/target/hexagon/genptr.c#L669>
for `gen_set_usr_field_if`
>
>> -----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);
>> +}
[-- Attachment #2: Type: text/html, Size: 4983 bytes --]
next prev parent reply other threads:[~2022-04-12 15:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 17:03 [PATCH v8 00/12] target/hexagon: introduce idef-parser Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 01/12] target/hexagon: update MAINTAINERS for idef-parser Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 02/12] target/hexagon: import README " Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 03/12] target/hexagon: make slot number an unsigned Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 04/12] target/hexagon: make helper functions non-static Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 05/12] target/hexagon: introduce new helper functions Anton Johansson via
2022-03-21 18:28 ` Taylor Simpson
2022-02-09 17:03 ` [PATCH v8 06/12] target/hexagon: expose next PC in DisasContext Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 07/12] target/hexagon: prepare input for the idef-parser Anton Johansson via
2022-03-21 18:33 ` Taylor Simpson
2022-02-09 17:03 ` [PATCH v8 08/12] target/hexagon: import flex/bison to docker files Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 09/12] target/hexagon: import lexer for idef-parser Anton Johansson via
2022-03-21 18:40 ` Taylor Simpson
2022-02-09 17:03 ` [PATCH v8 10/12] target/hexagon: import parser " Anton Johansson via
2022-04-11 15:20 ` Taylor Simpson
2022-04-12 15:10 ` Anton Johansson via [this message]
2022-04-12 18:41 ` Taylor Simpson
2022-04-21 11:50 ` Anton Johansson via
2022-04-21 14:22 ` Taylor Simpson
2022-04-21 16:38 ` Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 11/12] target/hexagon: call idef-parser functions Anton Johansson via
2022-02-09 17:03 ` [PATCH v8 12/12] target/hexagon: import additional tests Anton Johansson via
2022-03-21 18:58 ` Taylor Simpson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3553bdb8-021c-3105-f8d3-4d65fd2bc0b8@rev.ng \
--to=qemu-devel@nongnu.org \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=babush@rev.ng \
--cc=bcain@quicinc.com \
--cc=mlambert@quicinc.com \
--cc=nizzo@rev.ng \
--cc=richard.henderson@linaro.org \
--cc=tsimpson@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).