]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: add tests for overlapping mem ops
authorChristoph Müllner <christoph.muellner@vrull.eu>
Mon, 29 Apr 2024 01:06:52 +0000 (03:06 +0200)
committerChristoph Müllner <christoph.muellner@vrull.eu>
Wed, 15 May 2024 11:01:45 +0000 (13:01 +0200)
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>
gcc/testsuite/gcc.target/riscv/cpymem-32-ooo.c
gcc/testsuite/gcc.target/riscv/cpymem-64-ooo.c

index 946a773f77a0af47c477af730235d1887973777c..947d58c30fa3bca537e6a1966868db4c3f1ed668 100644 (file)
@@ -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)
index 08a927b948358c08bffddf6f4365bc7bcce22473..108748690cd3398adbbed8e1a2f639e2cedef22a 100644 (file)
@@ -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)