This is the mail archive of the gcc-bugs@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]

[Bug target/69577] [5/6 Regression] wrong code with -fno-forward-propagate -mavx and 128bit arithmetics since r215450


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69577

--- Comment #11 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Author: rsandifo
Date: Thu Feb  4 15:01:15 2016
New Revision: 233143

URL: https://gcc.gnu.org/viewcvs?rev=233143&root=gcc&view=rev
Log:
PR 69577: Invalid RA of destination subregs

In PR 69577 we have:

      A: (set (reg:V2TI X) ...)
      B: (set (subreg:TI (reg:V2TI X) 0) ...)

X gets allocated to an AVX register, as usual for V2TI.  The problem is
that the movti for B doesn't then preserve the other half of X, even
though the subreg semantics are supposed to guarantee that.

If instead the same value had been set by:

      A': (set (subreg:TI (reg:V2TI X) 16) ...)
      B: (set (subreg:TI (reg:V2TI X) 0) ...)

the subreg in A' would have prevented the use of AVX registers for X,
since you can't directly access the high part.

IMO these are really the same thing.  An alternative way to view it
is that the original sequence is equivalent to:

      A: (set (reg:V2TI X) ...)
      B1: (set (subreg:TI (reg:V2TI X) 0) ...)
      B2: (set (subreg:TI (reg:V2TI X) 16) (subreg:TI (reg:V2TI X) 16))

in which B2 is a no-op and therefore implicit.  The handling ought
to be the same regardless of whether there is an rtl insn that
explicitly assigns to (subreg:TI (reg:V2TI X) 16).

This patch implements that idea.  Hopefully the comments explain
what's going on.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabihf.

gcc/
        PR rtl-optimization/69577
        * reginfo.c (record_subregs_of_mode): Add a partial_def parameter.
        (find_subregs_of_mode): Update accordingly.  Iterate over partial
        definitions.

gcc/testsuite/
        PR rtl-optimization/69577
        * gcc.target/i386/pr69577.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr69577.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reginfo.c
    trunk/gcc/testsuite/ChangeLog

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