[Bug middle-end/79238] New: Combine generates paradoxical subreg of memory
vogt at linux dot vnet.ibm.com
gcc-bugzilla@gcc.gnu.org
Thu Jan 26 10:12:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79238
Bug ID: 79238
Summary: Combine generates paradoxical subreg of memory
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: vogt at linux dot vnet.ibm.com
CC: krebbel at gcc dot gnu.org
Target Milestone: ---
Host: s390x
Target: s390x
Segher asked me to open a bug report for this:
https://gcc.gnu.org/ml/gcc/2017-01/msg00227.html
On Wed, Jan 25, 2017 at 06:36:04PM +0100, Dominik Vogt wrote:
> What's the matter with paradoxical subregs of memory? So, as far
> as I understand, Recog refuses to match them unless they are
> explicitly expressed as a pattern. On the other hand, Combine
> does not know that they are "outlawed" and happily generates
> them.
>
> This happens sometimes with some new patterns for s390x for the
> RISBG instruction, which does complex operations on registers. As
> it's beneficial to allow memory operands before reload,
> paradoxical subregs of memory are sometimes combined from such
> patterns, for example
>
> (set (reg:DI 68)
> (and:DI (subreg:DI (lshiftrt:SI (reg:SI 67 [ *f_5(D) ])
> (const_int 8 [0x8])) 0)
> (const_int 16777215 [0xffffff])))
>
> +
>
> (set (reg/i:DI 2 %r2)
> (and:DI (reg:DI 68)
> (const_int 1 [0x1])))
>
>
> =
>
> (set (reg/i:DI 2 %r2)
> (and:DI (subreg:DI (mem:QI (plus:DI (reg:DI 2 %r2 [ f ])
> ^^^^^^^^^^^^^^^^^
> (const_int 2 [0x2])) [1 *f_5(D)+2 S1 A16]) 0)
> (const_int 1 [0x1])))
>
> Which doesn't match because of the paradoxical subreg of memory (I
> think).
(No example code that generates this available, sorry. The expressions below
have been generated by patterns that are under development.)
--
On Wed, Jan 25, 2017 at 04:45:23PM -0600, Segher Boessenkool wrote:
> On Wed, Jan 25, 2017 at 06:36:04PM +0100, Dominik Vogt wrote:
> > What's the matter with paradoxical subregs of memory? So, as far
> > as I understand, Recog refuses to match them unless they are
> > explicitly expressed as a pattern.
>
> If INSN_SCHEDULING is defined recog does not allow paradoxical subregs
> of memory as a general_operand (memory_operand does not allow any
> subregs of memory).
>
> > On the other hand, Combine
> > does not know that they are "outlawed" and happily generates
> > them.
>
> combine should not generate things that can never match. Of course it
> sometimes does. This should be improved; please open a PR.
More information about the Gcc-bugs
mailing list