Message ID | 20200603211033.126329-1-acsawdey@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [pushed] identify lfs prefixed case PR95347 | expand |
Now that this has been in trunk for a bit with no issues, ok to back port to 10? Aaron Sawdey, Ph.D. sawdey@linux.ibm.com IBM Linux on POWER Toolchain > On Jun 3, 2020, at 4:10 PM, Aaron Sawdey <acsawdey@linux.ibm.com> wrote: > > This passed regstrap and was approved offline by Segher, posting > the final form (minus my debug code, oops). > > The same problem also arises for plfs where prefixed_load_p() > doesn't recognize it so we get just lfs in the asm output > with an @pcrel address. > > PR target/95347 > * config/rs6000/rs6000.c (is_stfs_insn): Rename to > is_lfs_stfs_insn and make it recognize lfs as well. > (prefixed_store_p): Use is_lfs_stfs_insn(). > (prefixed_load_p): Use is_lfs_stfs_insn() to recognize lfs. > --- > gcc/config/rs6000/rs6000.c | 37 +++++++++++++++++++++++++------------ > 1 file changed, 25 insertions(+), 12 deletions(-) > > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c > index ba9069ecc3b..42d517c1f65 100644 > --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > @@ -24980,14 +24980,18 @@ address_to_insn_form (rtx addr, > return INSN_FORM_BAD; > } > > -/* Helper function to see if we're potentially looking at stfs. > +/* Helper function to see if we're potentially looking at lfs/stfs. > - PARALLEL containing a SET and a CLOBBER > - - SET is from UNSPEC_SI_FROM_SF to MEM:SI > - - CLOBBER is a V4SF > + - stfs: > + - SET is from UNSPEC_SI_FROM_SF to MEM:SI > + - CLOBBER is a V4SF > + - lfs: > + - SET is from UNSPEC_SF_FROM_SI to REG:SF > + - CLOBBER is a DI > */ > > static bool > -is_stfs_insn (rtx_insn *insn) > +is_lfs_stfs_insn (rtx_insn *insn) > { > rtx pattern = PATTERN (insn); > if (GET_CODE (pattern) != PARALLEL) > @@ -25013,16 +25017,22 @@ is_stfs_insn (rtx_insn *insn) > rtx src = SET_SRC (set); > rtx scratch = SET_DEST (clobber); > > - if (GET_CODE (src) != UNSPEC || XINT (src, 1) != UNSPEC_SI_FROM_SF) > + if (GET_CODE (src) != UNSPEC) > return false; > > - if (GET_CODE (dest) != MEM || GET_MODE (dest) != SImode) > - return false; > + /* stfs case. */ > + if (XINT (src, 1) == UNSPEC_SI_FROM_SF > + && GET_CODE (dest) == MEM && GET_MODE (dest) == SImode > + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == V4SFmode) > + return true; > > - if (GET_CODE (scratch) != SCRATCH || GET_MODE (scratch) != V4SFmode) > - return false; > + /* lfs case. */ > + if (XINT (src, 1) == UNSPEC_SF_FROM_SI > + && GET_CODE (dest) == REG && GET_MODE (dest) == SFmode > + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == DImode) > + return true; > > - return true; > + return false; > } > > /* Helper function to take a REG and a MODE and turn it into the non-prefixed > @@ -25135,7 +25145,10 @@ prefixed_load_p (rtx_insn *insn) > else > non_prefixed = reg_to_non_prefixed (reg, mem_mode); > > - return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); > + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) > + return address_is_prefixed (XEXP (mem, 0), mem_mode, NON_PREFIXED_DEFAULT); > + else > + return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); > } > > /* Whether a store instruction is a prefixed instruction. This is called from > @@ -25170,7 +25183,7 @@ prefixed_store_p (rtx_insn *insn) > /* Need to make sure we aren't looking at a stfs which doesn't look > like the other things reg_to_non_prefixed/address_is_prefixed > looks for. */ > - if (non_prefixed == NON_PREFIXED_X && is_stfs_insn (insn)) > + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) > return address_is_prefixed (addr, mem_mode, NON_PREFIXED_DEFAULT); > else > return address_is_prefixed (addr, mem_mode, non_prefixed); > -- > 2.17.1 >
On Mon, Jun 15, 2020 at 09:25:40AM -0500, Aaron Sawdey wrote: > Now that this has been in trunk for a bit with no issues, ok to back port to 10? Yes please. Thanks! Segher > > The same problem also arises for plfs where prefixed_load_p() > > doesn't recognize it so we get just lfs in the asm output > > with an @pcrel address. > > > > PR target/95347 > > * config/rs6000/rs6000.c (is_stfs_insn): Rename to > > is_lfs_stfs_insn and make it recognize lfs as well. > > (prefixed_store_p): Use is_lfs_stfs_insn(). > > (prefixed_load_p): Use is_lfs_stfs_insn() to recognize lfs.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index ba9069ecc3b..42d517c1f65 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24980,14 +24980,18 @@ address_to_insn_form (rtx addr, return INSN_FORM_BAD; } -/* Helper function to see if we're potentially looking at stfs. +/* Helper function to see if we're potentially looking at lfs/stfs. - PARALLEL containing a SET and a CLOBBER - - SET is from UNSPEC_SI_FROM_SF to MEM:SI - - CLOBBER is a V4SF + - stfs: + - SET is from UNSPEC_SI_FROM_SF to MEM:SI + - CLOBBER is a V4SF + - lfs: + - SET is from UNSPEC_SF_FROM_SI to REG:SF + - CLOBBER is a DI */ static bool -is_stfs_insn (rtx_insn *insn) +is_lfs_stfs_insn (rtx_insn *insn) { rtx pattern = PATTERN (insn); if (GET_CODE (pattern) != PARALLEL) @@ -25013,16 +25017,22 @@ is_stfs_insn (rtx_insn *insn) rtx src = SET_SRC (set); rtx scratch = SET_DEST (clobber); - if (GET_CODE (src) != UNSPEC || XINT (src, 1) != UNSPEC_SI_FROM_SF) + if (GET_CODE (src) != UNSPEC) return false; - if (GET_CODE (dest) != MEM || GET_MODE (dest) != SImode) - return false; + /* stfs case. */ + if (XINT (src, 1) == UNSPEC_SI_FROM_SF + && GET_CODE (dest) == MEM && GET_MODE (dest) == SImode + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == V4SFmode) + return true; - if (GET_CODE (scratch) != SCRATCH || GET_MODE (scratch) != V4SFmode) - return false; + /* lfs case. */ + if (XINT (src, 1) == UNSPEC_SF_FROM_SI + && GET_CODE (dest) == REG && GET_MODE (dest) == SFmode + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == DImode) + return true; - return true; + return false; } /* Helper function to take a REG and a MODE and turn it into the non-prefixed @@ -25135,7 +25145,10 @@ prefixed_load_p (rtx_insn *insn) else non_prefixed = reg_to_non_prefixed (reg, mem_mode); - return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) + return address_is_prefixed (XEXP (mem, 0), mem_mode, NON_PREFIXED_DEFAULT); + else + return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); } /* Whether a store instruction is a prefixed instruction. This is called from @@ -25170,7 +25183,7 @@ prefixed_store_p (rtx_insn *insn) /* Need to make sure we aren't looking at a stfs which doesn't look like the other things reg_to_non_prefixed/address_is_prefixed looks for. */ - if (non_prefixed == NON_PREFIXED_X && is_stfs_insn (insn)) + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) return address_is_prefixed (addr, mem_mode, NON_PREFIXED_DEFAULT); else return address_is_prefixed (addr, mem_mode, non_prefixed);