aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2013-11-05 14:17:33 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2013-11-05 06:17:33 -0800
commit5689294cd95ee6209a55359b710ca9bce81d98d8 (patch)
treeff433ccdf462aa7465faa04380de59abd9507cd5 /gcc/expr.c
parentc8d97db2cc5f8c8b603196e1f3704b4a2c3caf37 (diff)
downloadgcc-5689294cd95ee6209a55359b710ca9bce81d98d8.zip
gcc-5689294cd95ee6209a55359b710ca9bce81d98d8.tar.gz
gcc-5689294cd95ee6209a55359b710ca9bce81d98d8.tar.bz2
Don't use mode wider than Pmode for size in movmem/setmem
gcc/ PR middle-end/58981 * doc/md.texi (@code{movmem@var{m}}): Specify Pmode as mode of pattern, instead of word_mode. * expr.c (emit_block_move_via_movmem): Don't use mode wider than Pmode for size. (set_storage_via_setmem): Likewise. gcc/testsuite/ PR middle-end/58981 * gcc.dg/pr58981.c: New test. From-SVN: r204394
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 551a660..8ef2870 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1297,11 +1297,12 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align,
/* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
here because if SIZE is less than the mode mask, as it is
returned by the macro, it will definitely be less than the
- actual mode mask. */
+ actual mode mask. Since SIZE is within the Pmode address
+ space, we limit MODE to Pmode. */
&& ((CONST_INT_P (size)
&& ((unsigned HOST_WIDE_INT) INTVAL (size)
<= (GET_MODE_MASK (mode) >> 1)))
- || GET_MODE_BITSIZE (mode) >= BITS_PER_WORD))
+ || GET_MODE_BITSIZE (mode) >= GET_MODE_BITSIZE (Pmode)))
{
struct expand_operand ops[6];
unsigned int nops;
@@ -2879,14 +2880,15 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align,
enum insn_code code = direct_optab_handler (setmem_optab, mode);
if (code != CODE_FOR_nothing
- /* We don't need MODE to be narrower than
- BITS_PER_HOST_WIDE_INT here because if SIZE is less than
- the mode mask, as it is returned by the macro, it will
- definitely be less than the actual mode mask. */
+ /* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
+ here because if SIZE is less than the mode mask, as it is
+ returned by the macro, it will definitely be less than the
+ actual mode mask. Since SIZE is within the Pmode address
+ space, we limit MODE to Pmode. */
&& ((CONST_INT_P (size)
&& ((unsigned HOST_WIDE_INT) INTVAL (size)
<= (GET_MODE_MASK (mode) >> 1)))
- || GET_MODE_BITSIZE (mode) >= BITS_PER_WORD))
+ || GET_MODE_BITSIZE (mode) >= GET_MODE_BITSIZE (Pmode)))
{
struct expand_operand ops[6];
unsigned int nops;