diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 08:28:53 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-13 08:28:53 +0000 |
commit | c256ccd8f3dde8f3d0e6ffa642b2041361af8655 (patch) | |
tree | 2a0f39c3ccc766e422926dec0b7ffe621b076dc8 | |
parent | c562205f63ebab531efdc82c26a95566011f5dcd (diff) | |
download | gcc-c256ccd8f3dde8f3d0e6ffa642b2041361af8655.tar.gz |
PR target/61060
* config/i386/i386.c (ix86_expand_set_or_movmem): If count_exp
is const0_rtx, return immediately. Don't test count == 0 when
it is always true.
* gcc.dg/pr61060.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210352 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr61060.c | 19 |
4 files changed, 39 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be9e41138e3..a829af0f9af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-05-13 Jakub Jelinek <jakub@redhat.com> + + PR target/61060 + * config/i386/i386.c (ix86_expand_set_or_movmem): If count_exp + is const0_rtx, return immediately. Don't test count == 0 when + it is always true. + 2014-05-13 Zhenqiang Chen <zhenqiang.chen@linaro.org> * Makefile.in: add shrink-wrap.o. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b85015f04f7..7a7a3fcc5ea 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -24157,8 +24157,13 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp, align = MEM_ALIGN (dst) / BITS_PER_UNIT; if (CONST_INT_P (count_exp)) - min_size = max_size = probable_max_size = count = expected_size - = INTVAL (count_exp); + { + min_size = max_size = probable_max_size = count = expected_size + = INTVAL (count_exp); + /* When COUNT is 0, there is nothing to do. */ + if (!count) + return true; + } else { if (min_size_exp) @@ -24167,7 +24172,7 @@ ix86_expand_set_or_movmem (rtx dst, rtx src, rtx count_exp, rtx val_exp, max_size = INTVAL (max_size_exp); if (probable_max_size_exp) probable_max_size = INTVAL (probable_max_size_exp); - if (CONST_INT_P (expected_size_exp) && count == 0) + if (CONST_INT_P (expected_size_exp)) expected_size = INTVAL (expected_size_exp); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fdbed2fe020..b99777ebf41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-05-13 Jakub Jelinek <jakub@redhat.com> + + PR target/61060 + * gcc.dg/pr61060.c: New test. + 2014-05-12 DJ Delorie <dj@redhat.com> * gcc.dg/sibcall-3.c: MSP430 doesn't have sibcall. diff --git a/gcc/testsuite/gcc.dg/pr61060.c b/gcc/testsuite/gcc.dg/pr61060.c new file mode 100644 index 00000000000..d2a13650765 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr61060.c @@ -0,0 +1,19 @@ +/* PR target/61060 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -ftree-ter" } */ + +typedef __SIZE_TYPE__ size_t; + +extern inline __attribute__ ((gnu_inline, always_inline, artificial)) +void *memset (void *dest, int ch, size_t len) +{ + return __builtin_memset (dest, ch, len); +} + +char buf[10]; + +void +foo (void) +{ + memset (buf, sizeof (buf), 0); +} |