Skip to contentSkip to conversation

riscv: Enable compiler optimizations

PATCH In review Chenxi Mao 3 participants 3 messages Jul 8, 2020 – Jul 20, 2020 RISC-V

lore
Share & tools
lore

Chenxi Mao

author
#0 lore raw

PATCH 1/1 riscv: Enable compiler optimizations

Enable ARCH_HAS_FAST_MULTIPLIER and ARCH_SUPPORTS_INT128 for better code generation.
These 2 configurations works fine on GCC-9.3 and GCC-10.1

---
 arch/riscv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/Kconfig +2 -0
index 128192e14ff2..f21b7e5188ca 100644
@@ -26,6 +26,8 @@ config RISCV
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+	select ARCH_HAS_FAST_MULTIPLIER
+	select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG
 	select CLONE_BACKWARDS
 	select COMMON_CLK
 	select EDAC_SUPPORT
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 14 lines · On Tue, 07 Jul 2020 22:43:54 PDT (-0700), [email protected] wrote:

Enable ARCH_HAS_FAST_MULTIPLIER and ARCH_SUPPORTS_INT128 for better code generation.
These 2 configurations works fine on GCC-9.3 and GCC-10.1

---
 arch/riscv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/Kconfig +0 -0
index 128192e14ff2..f21b7e5188ca 100644

arch/riscv/Kconfig config RISCV · line 30

Quoted 5 lines
arch/riscv/Kconfig +2 -0
@@ -26,6 +26,8 @@ config RISCV
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+	select ARCH_HAS_FAST_MULTIPLIER
+	select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG

IIRC int128 is only supported on 64-bit targets, and we already have this under RV64I but with a different set of requirements. It looks like everyone has a different set of requirements, but I feel like CC_HAS_INT128 is the right way to go. I'm not sure why we have the version check there. Ard: do you know why we would need both?

The fast multiplier one looks fine to me. They're supposed to stay alphabetical, though.

Quoted 3 lines
arch/riscv/Kconfig +0 -0
 	select CLONE_BACKWARDS
 	select COMMON_CLK
 	select EDAC_SUPPORT
#2 lore raw
Quoted 11 lines · Palmer Dabbelt
Quoted 9 lines · On Tue, 07 Jul 2020 22:43:54 PDT (-0700), [email protected] wrote:

Enable ARCH_HAS_FAST_MULTIPLIER and ARCH_SUPPORTS_INT128 for better code generation.
These 2 configurations works fine on GCC-9.3 and GCC-10.1

---
 arch/riscv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
Quoted 17 lines

arch/riscv/Kconfig config RISCV · line 30

Quoted 10 lines
arch/riscv/Kconfig +2 -0
index 128192e14ff2..f21b7e5188ca 100644
@@ -26,6 +26,8 @@ config RISCV
      select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
      select ARCH_WANT_FRAME_POINTERS
      select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+     select ARCH_HAS_FAST_MULTIPLIER
+     select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG

IIRC int128 is only supported on 64-bit targets, and we already have this under RV64I but with a different set of requirements. It looks like everyone has a different set of requirements, but I feel like CC_HAS_INT128 is the right way to go. I'm not sure why we have the version check there. Ard: do you know why we would need both?

That looks like copy/paste from the arm64 tree to me, where the names of the libgcc routines were changed at some point, and we only support the newer ones in the kernel.

Quoted 6 lines

The fast multiplier one looks fine to me. They're supposed to stay alphabetical, though.

Quoted 3 lines
arch/riscv/Kconfig +0 -0
      select CLONE_BACKWARDS
      select COMMON_CLK
      select EDAC_SUPPORT