This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Improve btc (PR target/57819)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 08 Jul 2013 10:24:16 +0200
- Subject: Re: [PATCH] Improve btc (PR target/57819)
- References: <20130705151551 dot GX2336 at tucnak dot redhat dot com>
> So, my first approach was trying to simplify that, because nonzero_bits
> on the subreg operand say that no bits outside of QImode may be non-zero,
> both the zero_extend and subreg can be dropped. That is the simplify-rtx.c
> change. Then I've figured out that combine.c doesn't actually attempt to
> simplify this anyway, so that is the combine.c change. And lastly an i386
> pattern was needed anyway. I've also attempted to simplify:
> (zero_extend:SI (subreg:QI (and:DI <something> (const_int 63)) 0))
> (subreg:SI (and:DI <something> (const_int 63)) 0) (very small change in
> simplify-rtx.c, just drop the requirement that zero_extend mode is as wide
> or wider than SUBREG_REG's mode, and when it is <= use gen_lowpart_no_emit
> instead of just returning the SUBREG_REG, but that unfortunately regressed
> the test1 case, we'd need some further i386.md tweaks.
> While in theory this folding looks like a useful simplification, because
> of this I'm wondering if other backends don't rely on those actually not
> being simplified.
> So, I've as an alternative implemented also an i386.md only fix.
> Thus, do we want the first patch, or first patch + also the
> above described further simplify-rtx.c change + some further i386.md tweaks,
> or just the second patch instead?
Given the look of the pattern in the second patch, I think we definitely want
to simplify upstream. The first simplification looks very natural to me, the
further tweaked one less so, so let's go for the first patch alone, with a
+ /* (zero_extend:M (subreg:N <X:O>)) is <X:O> (for M == O) or
+ (zero_extend:M <X:O>), if X doesn't have any bits outside of N mode
+ non-zero. E.g.
"if X doesn't have any non-zero bits outside of mode N."