This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING] genattrab.c generate switch
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Bernd Schmidt <bschmidt at redhat dot com>, David Malcolm <dmalcolm at redhat dot com>, Jesper Broge JÃrgensen <jesperbroge at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 4 Mar 2016 12:14:02 -0500
- Subject: Re: [PING] genattrab.c generate switch
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc0AyYESM7R-HB8WALCKz5yZKsKLBBT1zP4kf8BP83He5w at mail dot gmail dot com> <569E2248 dot 9040605 at gmail dot com> <56C5B77A dot 3050900 at redhat dot com> <56D8ACAF dot 4060705 at gmail dot com> <CA+C-WL-K+KeqvKMrcULvfqrKEusC0PHtOAprR7p8mZgZGfW9KQ at mail dot gmail dot com> <1457098838 dot 1637 dot 30 dot camel at redhat dot com> <alpine dot DEB dot 2 dot 20 dot 9 dot 1603040927150 dot 1231 at idea> <56D9A625 dot 1040307 at redhat dot com> <20160304153405 dot GB3017 at tucnak dot redhat dot com> <alpine dot DEB dot 2 dot 20 dot 9 dot 1603041122341 dot 1231 at idea> <20160304164258 dot GD3017 at tucnak dot redhat dot com>
On Fri, Mar 4, 2016 at 11:42 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Mar 04, 2016 at 11:34:06AM -0500, Patrick Palka wrote:
>> * genattrtab.c (write_test_expr): New parameter EMIT_PARENS
>> which defaults to true. Emit an outer pair of parentheses only if
>> EMIT_PARENS. When continuing a chain of && or ||, don't emit
>> parentheses for the right-hand operand.
>
> Can you additionally to bootstrap/regtest on x86_64-linux compare
> insn-attrtab.s (compiled with -g0 and optimizations on) if it is bitwise
> identical without/with the patch (that should be the case, right),
> and also try say cross-compiler to armv7hl-linux-gnueabi (where I believe
> the nesting depth is significantly larger) and compare insn-attrtab.s
> there as well (no need to build arm binutils, just configure cross-compiler
> and let the build die after it builds cc1/cc1plus or even far before; all
> we care is that insn-attrtab.s is bitwise the same)?
I just quickly tested building the generated insn-attrtab.c with and
without the patch using my host gcc 5.3 compiler and the .s output is
not the same.
So the patch may be wrong, or the removal of parentheses is
functionally harmless but subtly affects code generation -- which is
plausible && and || naturally associate left-to-right but the explicit
parentheses emitted by write_test_expr effectively made chains of &&
or || to associate right-to-left. This change in associativity could
be affecting the behavior of optimization passes, in theory.
Or the change could just be wrong, although the earlier successful
bootstrap + regtest suggests not.