diff options
author | Christoph Müllner <christoph.muellner@vrull.eu> | 2024-04-29 03:06:52 +0200 |
---|---|---|
committer | Christoph Müllner <christoph.muellner@vrull.eu> | 2024-05-15 13:01:45 +0200 |
commit | 5814437b4fcc550697d6e286f49a2f8b108815bf (patch) | |
tree | 8c383d9bb395b614104576977049aabe357fa0b2 /gcc | |
parent | 04cd8ccaec90405ccf7471252c0e06ba7f5437dc (diff) | |
download | gcc-5814437b4fcc550697d6e286f49a2f8b108815bf.zip gcc-5814437b4fcc550697d6e286f49a2f8b108815bf.tar.gz gcc-5814437b4fcc550697d6e286f49a2f8b108815bf.tar.bz2 |
RISC-V: add tests for overlapping mem ops
A recent patch added the field overlap_op_by_pieces to the struct
riscv_tune_param, which is used by the TARGET_OVERLAP_OP_BY_PIECES_P()
hook. This hook is used by the by-pieces infrastructure to decide
if overlapping memory accesses should be emitted.
The changes in the expansion can be seen in the adjustments of the
cpymem test cases. These tests also reveal a limitation in the
RISC-V cpymem expansion that prevents this optimization as only
by-pieces cpymem expansions emit overlapping memory accesses.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/cpymem-32-ooo.c: Adjust for overlapping
access.
* gcc.target/riscv/cpymem-64-ooo.c: Likewise.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c | 33 |
2 files changed, 20 insertions, 33 deletions
diff --git a/gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c b/gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c index 946a773..947d58c 100644 --- a/gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c +++ b/gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c @@ -24,9 +24,8 @@ void copy_aligned_##N (void *to, void *from) \ ** ... ** lw\t[at][0-9],0\([at][0-9]\) ** sw\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],6\([at][0-9]\) -** sb\t[at][0-9],6\([at][0-9]\) +** lw\t[at][0-9],3\([at][0-9]\) +** sw\t[at][0-9],3\([at][0-9]\) ** ... */ COPY_N(7) @@ -36,9 +35,8 @@ COPY_N(7) ** ... ** lw\t[at][0-9],0\([at][0-9]\) ** sw\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],6\([at][0-9]\) -** sb\t[at][0-9],6\([at][0-9]\) +** lw\t[at][0-9],3\([at][0-9]\) +** sw\t[at][0-9],3\([at][0-9]\) ** ... */ COPY_ALIGNED_N(7) @@ -66,11 +64,10 @@ COPY_ALIGNED_N(8) ** ... ** ... ** lw\t[at][0-9],0\([at][0-9]\) -** ... ** sw\t[at][0-9],0\([at][0-9]\) ** ... -** lbu\t[at][0-9],10\([at][0-9]\) -** sb\t[at][0-9],10\([at][0-9]\) +** lw\t[at][0-9],7\([at][0-9]\) +** sw\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_N(11) @@ -79,11 +76,10 @@ COPY_N(11) **copy_aligned_11: ** ... ** lw\t[at][0-9],0\([at][0-9]\) -** ... ** sw\t[at][0-9],0\([at][0-9]\) ** ... -** lbu\t[at][0-9],10\([at][0-9]\) -** sb\t[at][0-9],10\([at][0-9]\) +** lw\t[at][0-9],7\([at][0-9]\) +** sw\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_ALIGNED_N(11) diff --git a/gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c b/gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c index 08a927b..1087486 100644 --- a/gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c +++ b/gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c @@ -24,9 +24,8 @@ void copy_aligned_##N (void *to, void *from) \ ** ... ** lw\t[at][0-9],0\([at][0-9]\) ** sw\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],6\([at][0-9]\) -** sb\t[at][0-9],6\([at][0-9]\) +** lw\t[at][0-9],3\([at][0-9]\) +** sw\t[at][0-9],3\([at][0-9]\) ** ... */ COPY_N(7) @@ -36,9 +35,8 @@ COPY_N(7) ** ... ** lw\t[at][0-9],0\([at][0-9]\) ** sw\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],6\([at][0-9]\) -** sb\t[at][0-9],6\([at][0-9]\) +** lw\t[at][0-9],3\([at][0-9]\) +** sw\t[at][0-9],3\([at][0-9]\) ** ... */ COPY_ALIGNED_N(7) @@ -66,9 +64,8 @@ COPY_ALIGNED_N(8) ** ... ** ld\t[at][0-9],0\([at][0-9]\) ** sd\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],10\([at][0-9]\) -** sb\t[at][0-9],10\([at][0-9]\) +** lw\t[at][0-9],7\([at][0-9]\) +** sw\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_N(11) @@ -77,11 +74,9 @@ COPY_N(11) **copy_aligned_11: ** ... ** ld\t[at][0-9],0\([at][0-9]\) -** ... ** sd\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],10\([at][0-9]\) -** sb\t[at][0-9],10\([at][0-9]\) +** lw\t[at][0-9],7\([at][0-9]\) +** sw\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_ALIGNED_N(11) @@ -90,11 +85,9 @@ COPY_ALIGNED_N(11) **copy_15: ** ... ** ld\t[at][0-9],0\([at][0-9]\) -** ... ** sd\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],14\([at][0-9]\) -** sb\t[at][0-9],14\([at][0-9]\) +** ld\t[at][0-9],7\([at][0-9]\) +** sd\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_N(15) @@ -103,11 +96,9 @@ COPY_N(15) **copy_aligned_15: ** ... ** ld\t[at][0-9],0\([at][0-9]\) -** ... ** sd\t[at][0-9],0\([at][0-9]\) -** ... -** lbu\t[at][0-9],14\([at][0-9]\) -** sb\t[at][0-9],14\([at][0-9]\) +** ld\t[at][0-9],7\([at][0-9]\) +** sd\t[at][0-9],7\([at][0-9]\) ** ... */ COPY_ALIGNED_N(15) |