Commit fdbfe4e5 by Richard Sandiford Committed by Richard Sandiford

poly_int: operand_subword

This patch makes operand_subword and operand_subword_force take
polynomial offsets.  This is a fairly old-school interface and
these days should only be used when splitting multiword operations
into word operations.  It still doesn't hurt to support polynomial
offsets and it helps make callers easier to write.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* rtl.h (operand_subword, operand_subword_force): Take the offset
	as a poly_uint64 an unsigned int.
	* emit-rtl.c (operand_subword, operand_subword_force): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r255883
parent 91914e56
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* rtl.h (operand_subword, operand_subword_force): Take the offset
as a poly_uint64 an unsigned int.
* emit-rtl.c (operand_subword, operand_subword_force): Likewise.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* doc/rtl.texi: Update documentation of SUBREG_BYTE. Document the * doc/rtl.texi: Update documentation of SUBREG_BYTE. Document the
'p' format code. Use INT_LIST rather than SUBREG as the example of 'p' format code. Use INT_LIST rather than SUBREG as the example of
a code with an XINT and an XEXP. Remove the implication that a code with an XINT and an XEXP. Remove the implication that
...@@ -1705,7 +1705,8 @@ subreg_lowpart_p (const_rtx x) ...@@ -1705,7 +1705,8 @@ subreg_lowpart_p (const_rtx x)
*/ */
rtx rtx
operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode mode) operand_subword (rtx op, poly_uint64 offset, int validate_address,
machine_mode mode)
{ {
if (mode == VOIDmode) if (mode == VOIDmode)
mode = GET_MODE (op); mode = GET_MODE (op);
...@@ -1714,12 +1715,12 @@ operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode ...@@ -1714,12 +1715,12 @@ operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode
/* If OP is narrower than a word, fail. */ /* If OP is narrower than a word, fail. */
if (mode != BLKmode if (mode != BLKmode
&& (GET_MODE_SIZE (mode) < UNITS_PER_WORD)) && maybe_lt (GET_MODE_SIZE (mode), UNITS_PER_WORD))
return 0; return 0;
/* If we want a word outside OP, return zero. */ /* If we want a word outside OP, return zero. */
if (mode != BLKmode if (mode != BLKmode
&& (offset + 1) * UNITS_PER_WORD > GET_MODE_SIZE (mode)) && maybe_gt ((offset + 1) * UNITS_PER_WORD, GET_MODE_SIZE (mode)))
return const0_rtx; return const0_rtx;
/* Form a new MEM at the requested address. */ /* Form a new MEM at the requested address. */
...@@ -1753,7 +1754,7 @@ operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode ...@@ -1753,7 +1754,7 @@ operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode
MODE is the mode of OP, in case it is CONST_INT. */ MODE is the mode of OP, in case it is CONST_INT. */
rtx rtx
operand_subword_force (rtx op, unsigned int offset, machine_mode mode) operand_subword_force (rtx op, poly_uint64 offset, machine_mode mode)
{ {
rtx result = operand_subword (op, offset, 1, mode); rtx result = operand_subword (op, offset, 1, mode);
......
...@@ -3043,10 +3043,10 @@ extern rtx gen_lowpart_if_possible (machine_mode, rtx); ...@@ -3043,10 +3043,10 @@ extern rtx gen_lowpart_if_possible (machine_mode, rtx);
/* In emit-rtl.c */ /* In emit-rtl.c */
extern rtx gen_highpart (machine_mode, rtx); extern rtx gen_highpart (machine_mode, rtx);
extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx); extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx);
extern rtx operand_subword (rtx, unsigned int, int, machine_mode); extern rtx operand_subword (rtx, poly_uint64, int, machine_mode);
/* In emit-rtl.c */ /* In emit-rtl.c */
extern rtx operand_subword_force (rtx, unsigned int, machine_mode); extern rtx operand_subword_force (rtx, poly_uint64, machine_mode);
extern int subreg_lowpart_p (const_rtx); extern int subreg_lowpart_p (const_rtx);
extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64); extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64);
......
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