public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Enable overlap-by-pieces in case of fast unaliged access
@ 2021-07-22 12:52 Christoph Muellner
  2021-07-22 13:29 ` Kito Cheng
  0 siblings, 1 reply; 24+ messages in thread
From: Christoph Muellner @ 2021-07-22 12:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jim Wilson, Kito Cheng, Christoph Muellner

This patch enables the overlap-by-pieces feature of the by-pieces
infrastructure for inlining builtins in case the target has set
riscv_slow_unaligned_access_p to false.

To demonstrate the effect for targets with fast unaligned access,
the following code sequences are generated for a 15-byte memset-zero.

Without overlap_op_by_pieces we get:
  8e:   00053023                sd      zero,0(a0)
  92:   00052423                sw      zero,8(a0)
  96:   00051623                sh      zero,12(a0)
  9a:   00050723                sb      zero,14(a0)

With overlap_op_by_pieces we get:
  7e:   00053023                sd      zero,0(a0)
  82:   000533a3                sd      zero,7(a0)

gcc/ChangeLog:

	* config/riscv/riscv.c (riscv_overlap_op_by_pieces): New function.
	(TARGET_OVERLAP_OP_BY_PIECES_P): Connect to
	riscv_overlap_op_by_pieces.

Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
---
 gcc/config/riscv/riscv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 576960bb37c..98c76ba657a 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -5201,6 +5201,14 @@ riscv_slow_unaligned_access (machine_mode, unsigned int)
   return riscv_slow_unaligned_access_p;
 }
 
+/* Implement TARGET_OVERLAP_OP_BY_PIECES_P.  */
+
+static bool
+riscv_overlap_op_by_pieces (void)
+{
+  return !riscv_slow_unaligned_access_p;
+}
+
 /* Implement TARGET_CAN_CHANGE_MODE_CLASS.  */
 
 static bool
@@ -5525,6 +5533,9 @@ riscv_asan_shadow_offset (void)
 #undef TARGET_SLOW_UNALIGNED_ACCESS
 #define TARGET_SLOW_UNALIGNED_ACCESS riscv_slow_unaligned_access
 
+#undef TARGET_OVERLAP_OP_BY_PIECES_P
+#define TARGET_OVERLAP_OP_BY_PIECES_P riscv_overlap_op_by_pieces
+
 #undef TARGET_SECONDARY_MEMORY_NEEDED
 #define TARGET_SECONDARY_MEMORY_NEEDED riscv_secondary_memory_needed
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-11-02 22:04 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 12:52 [PATCH] RISC-V: Enable overlap-by-pieces in case of fast unaliged access Christoph Muellner
2021-07-22 13:29 ` Kito Cheng
2021-07-22 17:27   ` Palmer Dabbelt
2021-07-22 18:23     ` Christoph Müllner
2021-07-22 22:54       ` Christoph Müllner
2021-07-26  9:48         ` Kito Cheng
2021-07-26 10:05     ` Andrew Waterman
2021-07-27  1:47       ` Palmer Dabbelt
2021-07-27  9:32         ` Christoph Müllner
2021-07-29 18:53           ` Palmer Dabbelt
2021-07-29 19:36             ` Christoph Müllner
2021-08-05  9:11               ` Christoph Müllner
2021-08-13 17:52                 ` Christoph Müllner
2021-08-16 10:02                   ` Kito Cheng
2021-08-16 16:15                     ` Palmer Dabbelt
2021-08-16 16:29                       ` Kito Cheng
2021-08-16 17:09                         ` Palmer Dabbelt
2021-08-16 18:56                           ` Andrew Pinski
2021-08-16 20:01                             ` Palmer Dabbelt
2021-11-02 19:27   ` Vineet Gupta
2021-11-02 20:09     ` Christoph Müllner
2021-11-02 20:15       ` Vineet Gupta
2021-11-02 21:18         ` Christoph Müllner
2021-11-02 22:04           ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).