diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 58126628ca0..37e427bd37b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10146,6 +10146,9 @@ (use (match_operand:SI 4))])] "TARGET_POPCNTD" { + if (optimize_insn_for_size_p ()) + FAIL; + if (expand_block_compare (operands)) DONE; else diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c new file mode 100644 index 00000000000..c7e853ad593 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-final { scan-assembler-times {\mb[l]? memcmp\M} 1 } } */ + +int foo (const char* s1, const char* s2) +{ + return __builtin_memcmp (s1, s2, 4); +}