linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: avoid enabling vectorized code generation
@ 2022-12-16 18:50 Saleem Abdulrasool
  2022-12-16 19:05 ` Conor Dooley
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Saleem Abdulrasool @ 2022-12-16 18:50 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: linux-riscv, linux-kernel, Saleem Abdulrasool

The compiler is free to generate vectorized operations for zero'ing
memory.  The kernel does not use the vector unit on RISCV, similar to
architectures such as x86 where we use `-mno-mmx` et al to prevent the
implicit vectorization.  Perform a similar check for
`-mno-implicit-float` to avoid this on RISC-V targets.

Signed-off-by: Saleem Abdulrasool <abdulras@google.com>
---
 arch/riscv/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0d13b597cb55..68433476a96e 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -89,6 +89,10 @@ KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax)
 # architectures.  It's faster to have GCC emit only aligned accesses.
 KBUILD_CFLAGS += $(call cc-option,-mstrict-align)
 
+# Ensure that we do not vectorize the kernel code when the `v` extension is
+# enabled.  This mirrors the `-mno-mmx` et al on x86.
+KBUILD_CFLAGS += $(call cc-option,-mno-implicit-float)
+
 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y)
 prepare: stack_protector_prepare
 stack_protector_prepare: prepare0
-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2023-02-08 17:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 18:50 [PATCH] riscv: avoid enabling vectorized code generation Saleem Abdulrasool
2022-12-16 19:05 ` Conor Dooley
2022-12-16 19:45 ` Ben Dooks
2022-12-16 19:54   ` Palmer Dabbelt
2022-12-16 20:56     ` Saleem Abdulrasool
2022-12-17  2:02       ` Conor Dooley
2022-12-19 15:21         ` Saleem Abdulrasool
2022-12-19 16:51           ` Conor Dooley
2022-12-21 16:17 ` Bin Meng
2022-12-21 17:39   ` Saleem Abdulrasool
2022-12-22  9:40     ` Bin Meng
2022-12-22 15:23       ` Saleem Abdulrasool
2022-12-23  6:57         ` Bin Meng
2022-12-27 15:24           ` Saleem Abdulrasool
2023-02-08 17:56 ` Palmer Dabbelt

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 NNTP newsgroup(s).