Commit 6e81b0cf by Aaron Sawdey

identify lfs prefixed case PR95347

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.

	Backport from master
	2020-06-03  Aaron Sawdey  <acsawdey@linux.ibm.com>

	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.
parent 541e8c4d
...@@ -24978,14 +24978,18 @@ address_to_insn_form (rtx addr, ...@@ -24978,14 +24978,18 @@ address_to_insn_form (rtx addr,
return INSN_FORM_BAD; 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 - PARALLEL containing a SET and a CLOBBER
- stfs:
- SET is from UNSPEC_SI_FROM_SF to MEM:SI - SET is from UNSPEC_SI_FROM_SF to MEM:SI
- CLOBBER is a V4SF - CLOBBER is a V4SF
- lfs:
- SET is from UNSPEC_SF_FROM_SI to REG:SF
- CLOBBER is a DI
*/ */
static bool static bool
is_stfs_insn (rtx_insn *insn) is_lfs_stfs_insn (rtx_insn *insn)
{ {
rtx pattern = PATTERN (insn); rtx pattern = PATTERN (insn);
if (GET_CODE (pattern) != PARALLEL) if (GET_CODE (pattern) != PARALLEL)
...@@ -25011,16 +25015,22 @@ is_stfs_insn (rtx_insn *insn) ...@@ -25011,16 +25015,22 @@ is_stfs_insn (rtx_insn *insn)
rtx src = SET_SRC (set); rtx src = SET_SRC (set);
rtx scratch = SET_DEST (clobber); rtx scratch = SET_DEST (clobber);
if (GET_CODE (src) != UNSPEC || XINT (src, 1) != UNSPEC_SI_FROM_SF) if (GET_CODE (src) != UNSPEC)
return false; return false;
if (GET_CODE (dest) != MEM || GET_MODE (dest) != SImode) /* stfs case. */
return false; if (XINT (src, 1) == UNSPEC_SI_FROM_SF
&& GET_CODE (dest) == MEM && GET_MODE (dest) == SImode
if (GET_CODE (scratch) != SCRATCH || GET_MODE (scratch) != V4SFmode) && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == V4SFmode)
return false; return true;
/* 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 /* Helper function to take a REG and a MODE and turn it into the non-prefixed
...@@ -25133,6 +25143,9 @@ prefixed_load_p (rtx_insn *insn) ...@@ -25133,6 +25143,9 @@ prefixed_load_p (rtx_insn *insn)
else else
non_prefixed = reg_to_non_prefixed (reg, mem_mode); non_prefixed = reg_to_non_prefixed (reg, mem_mode);
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); return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed);
} }
...@@ -25168,7 +25181,7 @@ prefixed_store_p (rtx_insn *insn) ...@@ -25168,7 +25181,7 @@ prefixed_store_p (rtx_insn *insn)
/* Need to make sure we aren't looking at a stfs which doesn't look /* 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 like the other things reg_to_non_prefixed/address_is_prefixed
looks for. */ 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); return address_is_prefixed (addr, mem_mode, NON_PREFIXED_DEFAULT);
else else
return address_is_prefixed (addr, mem_mode, non_prefixed); return address_is_prefixed (addr, mem_mode, non_prefixed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment