diff options
author | Haochen Gui <guihaoc@gcc.gnu.org> | 2024-05-14 16:37:06 +0800 |
---|---|---|
committer | Haochen Gui <guihaoc@gcc.gnu.org> | 2024-05-14 16:37:40 +0800 |
commit | fbd115fe83e96e0796cd8e262ed773b0ba07db81 (patch) | |
tree | 055bcc13af2a94be27c10948d3bdccd189a3610a /gcc | |
parent | 1a809280929fac9836ff31dcc0980ac8acee7631 (diff) | |
download | gcc-fbd115fe83e96e0796cd8e262ed773b0ba07db81.zip gcc-fbd115fe83e96e0796cd8e262ed773b0ba07db81.tar.gz gcc-fbd115fe83e96e0796cd8e262ed773b0ba07db81.tar.bz2 |
rs6000: Enable overlapped by-pieces operations
This patch enables overlapped by-piece operations by defining
TARGET_OVERLAP_OP_BY_PIECES_P to true. On rs6000, default move/set/clear
ratio is 2. So the overlap is only enabled with compare by-pieces.
gcc/
* config/rs6000/rs6000.cc (TARGET_OVERLAP_OP_BY_PIECES_P): Define.
gcc/testsuite/
* gcc.target/powerpc/block-cmp-9.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/block-cmp-9.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 1179996..e713a1e 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1776,6 +1776,9 @@ static const scoped_attribute_specs *const rs6000_attribute_table[] = #undef TARGET_CONST_ANCHOR #define TARGET_CONST_ANCHOR 0x8000 +#undef TARGET_OVERLAP_OP_BY_PIECES_P +#define TARGET_OVERLAP_OP_BY_PIECES_P hook_bool_void_true + /* Processor table. */ diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c new file mode 100644 index 0000000..f16429c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-9.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not {\ml[hb]z\M} } } */ + +/* Test if by-piece overlap compare is enabled and following case is + implemented by two overlap word loads and compares. */ + +int foo (const char* s1, const char* s2) +{ + return __builtin_memcmp (s1, s2, 7) == 0; +} |