Message ID | 569E2248.9040605@gmail.com |
---|---|
State | New |
Headers | show |
On 01/19/2016 12:47 PM, Jesper Broge Jørgensen wrote: > Here is the reformatted patch: This will probably have to wait until stage1. > + const int code = GET_CODE (op2); > + if (code != IOR) > + { > + if (code == EQ_ATTR) All the formatting still looks completely mangled. This was probably done by your mailer. Please try attaching the diff as text/plain. Bernd
On 18/02/16 13:22, Bernd Schmidt wrote: > On 01/19/2016 12:47 PM, Jesper Broge Jørgensen wrote: >> Here is the reformatted patch: > > This will probably have to wait until stage1. > >> + const int code = GET_CODE (op2); >> + if (code != IOR) >> + { >> + if (code == EQ_ATTR) > > All the formatting still looks completely mangled. This was probably > done by your mailer. Please try attaching the diff as text/plain. > > > Bernd > Hi i send the patch back as an attatchment as requested about two weeks ago (https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01256.html) but i have not received any response. If it has to wait for stage 1 are there anything else i can do for the patch untill then?
On Thu, Mar 3, 2016 at 4:29 PM, Jesper Broge Jørgensen <jesperbroge@gmail.com> wrote: > > On 18/02/16 13:22, Bernd Schmidt wrote: >> >> On 01/19/2016 12:47 PM, Jesper Broge Jørgensen wrote: >>> >>> Here is the reformatted patch: >> >> >> This will probably have to wait until stage1. >> >>> + const int code = GET_CODE (op2); >>> + if (code != IOR) >>> + { >>> + if (code == EQ_ATTR) >> >> >> All the formatting still looks completely mangled. This was probably done >> by your mailer. Please try attaching the diff as text/plain. >> >> >> Bernd >> > Hi i send the patch back as an attatchment as requested about two weeks ago > (https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01256.html) but i have not > received any response. > > If it has to wait for stage 1 are there anything else i can do for the patch > untill then? I still suggest to try making write_test_expr() avoid emitting redundant parentheses for chains of || or &&, which would fix the original issue all the same. Previously you claimed that such a change would not be simpler than your current patch, but I gave it a quick try and ended up with a much smaller patch: gcc/genattrtab.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
On Thu, 2016-03-03 at 17:36 -0500, Patrick Palka wrote: > On Thu, Mar 3, 2016 at 4:29 PM, Jesper Broge Jørgensen > <jesperbroge@gmail.com> wrote: > > > > On 18/02/16 13:22, Bernd Schmidt wrote: > > > > > > On 01/19/2016 12:47 PM, Jesper Broge Jørgensen wrote: > > > > > > > > Here is the reformatted patch: > > > > > > > > > This will probably have to wait until stage1. > > > > > > > + const int code = GET_CODE (op2); > > > > + if (code != IOR) > > > > + { > > > > + if (code == EQ_ATTR) > > > > > > > > > All the formatting still looks completely mangled. This was > > > probably done > > > by your mailer. Please try attaching the diff as text/plain. > > > > > > > > > Bernd > > > > > Hi i send the patch back as an attatchment as requested about two > > weeks ago > > (https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01256.html) but i > > have not > > received any response. > > > > If it has to wait for stage 1 are there anything else i can do for > > the patch > > untill then? > > I still suggest to try making write_test_expr() avoid emitting > redundant parentheses for chains of || or &&, which would fix the > original issue all the same. Previously you claimed that such a > change would not be simpler than your current patch, but I gave it a > quick try and ended up with a much smaller patch: > > gcc/genattrtab.c | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) Patrick, did you forget to attach the patch? I see the diffstat, but no patch.
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 2caf8f6..8e7f9e6 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -4113,6 +4113,103 @@ eliminate_known_true (rtx known_true, rtx exp, int insn_code, int insn_index) return exp; } +/* Check if exp contains a series of IOR conditions on the same attr_name. + If it does it can be turned into a switch statement and returns true. + If write_cases is true it will write the cases of the switch to outf. */ + +static int +check_attr_set_switch (FILE *outf, rtx exp, unsigned int attrs_cached, + int write_cases, int indent) +{ + if (GET_CODE (exp) != IOR) + return 0; + if (GET_CODE (XEXP (exp, 0)) != EQ_ATTR) + return 0; + + rtx next = exp; + int ior_depth = 0; + int is_first = 1; + + const char *attr_name_cmp = XSTR (XEXP (exp, 0), 0); + + while (1) + { + rtx op1 = XEXP (next, 0); + rtx op2 = XEXP (next, 1); + + if (GET_CODE (op1) != EQ_ATTR) + return 0; + + const char *attr_name = XSTR (op1, 0); + const char *cmp_val = XSTR (op1, 1); + + /* pointer compare is enough. */ + if (attr_name_cmp != attr_name) + return 0; + + if (write_cases) + { + struct attr_desc *attr = find_attr (&attr_name, 0); + gcc_assert (attr); + if (is_first) + { + fprintf (outf, "("); + is_first = 0; + int i; + for (i = 0; i < cached_attr_count; i++) + if (attr->name == cached_attrs[i]) + break; + + if (i < cached_attr_count && (attrs_cached & (1U << i)) != 0) + fprintf (outf, "cached_%s", attr->name); + else if (i < cached_attr_count && + (attrs_to_cache & (1U << i)) != 0) + fprintf (outf, "(cached_%s = get_attr_%s (insn))", attr->name, + attr->name); + else + fprintf (outf, "get_attr_%s (insn)", attr->name); + fprintf (outf, ")\n"); + write_indent (outf, indent); + fprintf (outf, "{\n"); + } + write_indent (outf, indent); + fprintf (outf, "case "); + write_attr_valueq (outf, attr, cmp_val); + fprintf (outf, ":\n"); + } + + const int code = GET_CODE (op2); + if (code != IOR) + { + if (code == EQ_ATTR) + { + const char *attr_name = XSTR (op2, 0); + const char *cmp_val = XSTR (op2, 1); + + if (attr_name == alternative_name) + return 0; + + struct attr_desc *attr = find_attr (&attr_name, 0); + gcc_assert (attr); + + if (attr->is_const) + return 0; + else if (write_cases) + { + write_indent (outf, indent); + fprintf (outf, "case "); + write_attr_valueq (outf, attr, cmp_val); + fprintf (outf, ":\n"); + } + } + break; + } + next = op2; + ior_depth++; + } + return ior_depth > 2; +} + /* Write out a series of tests and assignment statements to perform