On Mon, Aug 08, 2016 at 05:03:46PM +0930, Alan Modra wrote:
> Segher, is this rs6000 patch OK? Bootstrapped as above.
>
> PR target/72771
> * config/rs6000/rs6000.c (toc_relative_expr_p): Allow lo_sum/high
> toc refs created during reload.
> /* Return true if OP is a toc pointer relative address (the output
> - of create_TOC_reference). If STRICT, do not match high part or
> - non-split -mcmodel=large/medium toc pointer relative addresses. */
> + of create_TOC_reference). If STRICT, do not match non-split
> + -mcmodel=large/medium toc pointer relative addresses. */
Why this comment change? The code still does not allow high part if
strict? The changelog says it does now, is the code correct?
Segher
> bool
> toc_relative_expr_p (const_rtx op, bool strict)
> @@ -7949,13 +7949,17 @@ toc_relative_expr_p (const_rtx op, bool strict)
>
> if (TARGET_CMODEL != CMODEL_SMALL)
> {
> - /* Only match the low part. */
> - if (GET_CODE (op) == LO_SUM
> - && REG_P (XEXP (op, 0))
> - && INT_REG_OK_FOR_BASE_P (XEXP (op, 0), strict))
> - op = XEXP (op, 1);
> - else if (strict)
> + /* When strict ensure we have everything tidy. */
> + if (strict
> + && !(GET_CODE (op) == LO_SUM
> + && REG_P (XEXP (op, 0))
> + && INT_REG_OK_FOR_BASE_P (XEXP (op, 0), strict)))
> return false;
> +
> + /* When not strict, allow non-split toc addresses and also allow
> + lo_sum/high addresses created during reload. */
> + if (GET_CODE (op) == LO_SUM)
> + op = XEXP (op, 1);
> }