This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve btc (PR target/57819)


> 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))
> into
> (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 
small tweak:

+      /* (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."

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]