From 9cc37d8ee1c04f68b26aeeba978136d2487710f1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 20 Jan 2017 08:24:59 -0600 Subject: [PATCH] Math library optimatizations for FPU only apply to ARMv8 which is not yet supported. --- arch/arm/Kconfig | 8 +++ libc/machine/Kconfig | 50 ++++++--------- libc/machine/Make.defs | 6 +- libc/machine/armv8/Kconfig | 27 ++++++++ libc/machine/{arm => armv8}/Make.defs | 62 +++++++++++++++---- .../{arm/lib_ceil.c => armv8/arch_ceil.c} | 2 +- .../{arm/lib_ceilf.c => armv8/arch_ceilf.c} | 2 +- .../{arm/lib_floor.c => armv8/arch_floor.c} | 2 +- .../{arm/lib_floorf.c => armv8/arch_floorf.c} | 2 +- .../arch_nearbyint.c} | 2 +- .../arch_nearbyintf.c} | 2 +- .../{arm/lib_rint.c => armv8/arch_rint.c} | 2 +- .../{arm/lib_rintf.c => armv8/arch_rintf.c} | 2 +- .../{arm/lib_round.c => armv8/arch_round.c} | 2 +- .../{arm/lib_roundf.c => armv8/arch_roundf.c} | 2 +- .../{arm/lib_trunc.c => armv8/arch_trunc.c} | 2 +- .../{arm/lib_truncf.c => armv8/arch_truncf.c} | 2 +- 17 files changed, 117 insertions(+), 60 deletions(-) create mode 100644 libc/machine/armv8/Kconfig rename libc/machine/{arm => armv8}/Make.defs (67%) rename libc/machine/{arm/lib_ceil.c => armv8/arch_ceil.c} (98%) rename libc/machine/{arm/lib_ceilf.c => armv8/arch_ceilf.c} (98%) rename libc/machine/{arm/lib_floor.c => armv8/arch_floor.c} (98%) rename libc/machine/{arm/lib_floorf.c => armv8/arch_floorf.c} (98%) rename libc/machine/{arm/lib_nearbyint.c => armv8/arch_nearbyint.c} (98%) rename libc/machine/{arm/lib_nearbyintf.c => armv8/arch_nearbyintf.c} (98%) rename libc/machine/{arm/lib_rint.c => armv8/arch_rint.c} (98%) rename libc/machine/{arm/lib_rintf.c => armv8/arch_rintf.c} (98%) rename libc/machine/{arm/lib_round.c => armv8/arch_round.c} (98%) rename libc/machine/{arm/lib_roundf.c => armv8/arch_roundf.c} (98%) rename libc/machine/{arm/lib_trunc.c => armv8/arch_trunc.c} (98%) rename libc/machine/{arm/lib_truncf.c => armv8/arch_truncf.c} (98%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d56e0a861e1..d58118b0b34 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -302,6 +302,10 @@ config ARCH_CORTEXM0 select ARCH_HAVE_IRQPRIO select ARCH_HAVE_RESET +config ARCH_CORTEXM23 + bool + default n + config ARCH_CORTEXM3 bool default n @@ -310,6 +314,10 @@ config ARCH_CORTEXM3 select ARCH_HAVE_HIPRI_INTERRUPT select ARCH_HAVE_RESET +config ARCH_CORTEXM33 + bool + default n + config ARCH_CORTEXM4 bool default n diff --git a/libc/machine/Kconfig b/libc/machine/Kconfig index db468f6db16..147c336b18c 100644 --- a/libc/machine/Kconfig +++ b/libc/machine/Kconfig @@ -3,70 +3,58 @@ # see the file kconfig-language.txt in the NuttX tools repository. # +# These are library functions that may be overriden by architecture- +# specific implementations. Not all architectures support implementations +# for every library function. + config LIBM_ARCH_CEIL default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_FLOOR default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_NEARBYINT default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_RINT default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_ROUND default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_TRUNC default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_CEILF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_FLOORF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_NEARBYINTF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_RINTF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_ROUNDF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 config LIBM_ARCH_TRUNCF default n - depends on LIBC_ARCHOPT + depends on LIBM && ARCH_CORTEXM33 -config LIBC_ARCHOPT - bool "Architecture specific optimizations" - default n - select LIBM_ARCH_CEIL if CONFIG_ARCH_DPFPU - select LIBM_ARCH_FLOOR if CONFIG_ARCH_DPFPU - select LIBM_ARCH_NEARBYINT if CONFIG_ARCH_DPFPU - select LIBM_ARCH_RINT if CONFIG_ARCH_DPFPU - select LIBM_ARCH_ROUND if CONFIG_ARCH_DPFPU - select LIBM_ARCH_TRUNC if CONFIG_ARCH_DPFPU - select LIBM_ARCH_CEILF if CONFIG_ARCH_FPU - select LIBM_ARCH_FLOORF if CONFIG_ARCH_FPU - select LIBM_ARCH_NEARBYINTF if CONFIG_ARCH_FPU - select LIBM_ARCH_RINTF if CONFIG_ARCH_FPU - select LIBM_ARCH_ROUNDF if CONFIG_ARCH_FPU - select LIBM_ARCH_TRUNCF if CONFIG_ARCH_FPU - depends on ARCH_ARM && LIBM - ---help--- - Enable architecture specific optimizations. Currently only - available for use with ARM and only for the NuttX math library. +if ARCH_CORTEXM33 +source libc/machine/armv8/Kconfig +endif diff --git a/libc/machine/Make.defs b/libc/machine/Make.defs index 1149a8da3ae..1b78ca5d09f 100644 --- a/libc/machine/Make.defs +++ b/libc/machine/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_LIBC_ARCHOPT),y) -ifeq ($(CONFIG_ARCH_ARM),y) -include ${TOPDIR}/libc/machine/arm/Make.defs -endif +ifeq ($(CONFIG_ARCH_CORTEXM33),y) +include ${TOPDIR}/libc/machine/armv8/Make.defs endif diff --git a/libc/machine/armv8/Kconfig b/libc/machine/armv8/Kconfig new file mode 100644 index 00000000000..002c44d1f9f --- /dev/null +++ b/libc/machine/armv8/Kconfig @@ -0,0 +1,27 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_CORTEXM33 + +config ARMV8_LIBM + bool "Architecture specific optimizations" + default n + select LIBM_ARCH_CEIL if CONFIG_ARCH_DPFPU + select LIBM_ARCH_FLOOR if CONFIG_ARCH_DPFPU + select LIBM_ARCH_NEARBYINT if CONFIG_ARCH_DPFPU + select LIBM_ARCH_RINT if CONFIG_ARCH_DPFPU + select LIBM_ARCH_ROUND if CONFIG_ARCH_DPFPU + select LIBM_ARCH_TRUNC if CONFIG_ARCH_DPFPU + select LIBM_ARCH_CEILF if CONFIG_ARCH_FPU + select LIBM_ARCH_FLOORF if CONFIG_ARCH_FPU + select LIBM_ARCH_NEARBYINTF if CONFIG_ARCH_FPU + select LIBM_ARCH_RINTF if CONFIG_ARCH_FPU + select LIBM_ARCH_ROUNDF if CONFIG_ARCH_FPU + select LIBM_ARCH_TRUNCF if CONFIG_ARCH_FPU + depends on LIBM + ---help--- + Enable ARMv8 specific floating point optimizations. + +endif diff --git a/libc/machine/arm/Make.defs b/libc/machine/armv8/Make.defs similarity index 67% rename from libc/machine/arm/Make.defs rename to libc/machine/armv8/Make.defs index 127bfba153e..078d9b14608 100644 --- a/libc/machine/arm/Make.defs +++ b/libc/machine/armv8/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# libc/machine/arm/Make.defs +# libc/machine/armv8/Make.defs # # Copyright (C) 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -33,21 +33,57 @@ # ############################################################################ -ifeq ($(CONFIG_LIBM),y) -ifeq ($(CONFIG_ARCH_FPU),y) +ifeq ($(CONFIG_ARMV8_LIBM),y) -CSRCS += lib_ceilf.c lib_floorf.c lib_nearbyintf.c lib_rintf.c -CSRCS += lib_roundf.c lib_truncf.c +ifeq ($(LIBM_ARCH_CEIL),y) +CSRCS += arch_ceil.c +endif -ifeq ($(CONFIG_ARCH_DPFPU),y) +ifeq ($(LIBM_ARCH_CEILF),y) +CSRCS += arch_ceilf.c +endif -CSRCS += lib_ceil.c lib_floor.c lib_nearbyint.c lib_rint.c lib_round.c -CSRCS += lib_trunc.c +ifeq ($(LIBM_ARCH_FLOOR),y) +CSRCS += arch_floor.c +endif -endif # CONFIG_ARCH_DPFPU +ifeq ($(LIBM_ARCH_FLOORF),y) +CSRCS += arch_floorf.c +endif -DEPPATH += --dep-path machine/arm -VPATH += :machine/arm +ifeq ($(LIBM_ARCH_NEARBYINT),y) +CSRCS += arch_nearbyint.c +endif -endif # CONFIG_ARCH_FPU -endif # CONFIG_LIBM +ifeq ($(LIBM_ARCH_NEARBYINTF),y) +CSRCS += arch_nearbyintf.c +endif + +ifeq ($(LIBM_ARCH_RINTF),y) +CSRCS += arch_rintf.c +endif + +ifeq ($(LIBM_ARCH_ROUNDF),y) +CSRCS += arch_roundf.c +endif + +ifeq ($(LIBM_ARCH_TRUNCF),y) +CSRCS += arch_truncf.c +endif + +ifeq ($(LIBM_ARCH_RINT),y) +CSRCS += arch_rint.c +endif + +ifeq ($(LIBM_ARCH_ROUND),y) +CSRCS += arch_round.c +endif + +ifeq ($(LIBM_ARCH_TRUNC),y) +CSRCS += arch_trunc.c +endif + +DEPPATH += --dep-path machine/armv8 +VPATH += :machine/armv8 + +endif # CONFIG_ARMV8_LIBM diff --git a/libc/machine/arm/lib_ceil.c b/libc/machine/armv8/arch_ceil.c similarity index 98% rename from libc/machine/arm/lib_ceil.c rename to libc/machine/armv8/arch_ceil.c index f78df16494c..a4a584bdfd0 100644 --- a/libc/machine/arm/lib_ceil.c +++ b/libc/machine/armv8/arch_ceil.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_ceil.c + * libc/machine/armv8/arch_ceil.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_ceilf.c b/libc/machine/armv8/arch_ceilf.c similarity index 98% rename from libc/machine/arm/lib_ceilf.c rename to libc/machine/armv8/arch_ceilf.c index 6127b46547d..44d246354bb 100644 --- a/libc/machine/arm/lib_ceilf.c +++ b/libc/machine/armv8/arch_ceilf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_ceilf.c + * libc/machine/armv8/arch_ceilf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_floor.c b/libc/machine/armv8/arch_floor.c similarity index 98% rename from libc/machine/arm/lib_floor.c rename to libc/machine/armv8/arch_floor.c index 9d180d421a1..a1278dc98fa 100644 --- a/libc/machine/arm/lib_floor.c +++ b/libc/machine/armv8/arch_floor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_floor.c + * libc/machine/armv8/arch_floor.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_floorf.c b/libc/machine/armv8/arch_floorf.c similarity index 98% rename from libc/machine/arm/lib_floorf.c rename to libc/machine/armv8/arch_floorf.c index 30890232a92..1c76571042f 100644 --- a/libc/machine/arm/lib_floorf.c +++ b/libc/machine/armv8/arch_floorf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_floorf.c + * libc/machine/armv8/arch_floorf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_nearbyint.c b/libc/machine/armv8/arch_nearbyint.c similarity index 98% rename from libc/machine/arm/lib_nearbyint.c rename to libc/machine/armv8/arch_nearbyint.c index 16bf2ee3021..ca8df7fe4fa 100644 --- a/libc/machine/arm/lib_nearbyint.c +++ b/libc/machine/armv8/arch_nearbyint.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_nearbyint.c + * libc/machine/armv8/arch_nearbyint.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_nearbyintf.c b/libc/machine/armv8/arch_nearbyintf.c similarity index 98% rename from libc/machine/arm/lib_nearbyintf.c rename to libc/machine/armv8/arch_nearbyintf.c index d91340e5f45..3a2b2d1e07e 100644 --- a/libc/machine/arm/lib_nearbyintf.c +++ b/libc/machine/armv8/arch_nearbyintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_nearbyintf.c + * libc/machine/armv8/arch_nearbyintf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_rint.c b/libc/machine/armv8/arch_rint.c similarity index 98% rename from libc/machine/arm/lib_rint.c rename to libc/machine/armv8/arch_rint.c index 53c3d3d3fd5..27bebb60a58 100644 --- a/libc/machine/arm/lib_rint.c +++ b/libc/machine/armv8/arch_rint.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_rint.c + * libc/machine/armv8/arch_rint.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_rintf.c b/libc/machine/armv8/arch_rintf.c similarity index 98% rename from libc/machine/arm/lib_rintf.c rename to libc/machine/armv8/arch_rintf.c index 85b76066301..e17c1e8e585 100644 --- a/libc/machine/arm/lib_rintf.c +++ b/libc/machine/armv8/arch_rintf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_rintf.c + * libc/machine/armv8/arch_rintf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_round.c b/libc/machine/armv8/arch_round.c similarity index 98% rename from libc/machine/arm/lib_round.c rename to libc/machine/armv8/arch_round.c index b3926392a63..07bcd8e3332 100644 --- a/libc/machine/arm/lib_round.c +++ b/libc/machine/armv8/arch_round.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_round.c + * libc/machine/armv8/arch_round.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_roundf.c b/libc/machine/armv8/arch_roundf.c similarity index 98% rename from libc/machine/arm/lib_roundf.c rename to libc/machine/armv8/arch_roundf.c index ea5141935ba..382ffb1682d 100644 --- a/libc/machine/arm/lib_roundf.c +++ b/libc/machine/armv8/arch_roundf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_roundf.c + * libc/machine/armv8/arch_roundf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_trunc.c b/libc/machine/armv8/arch_trunc.c similarity index 98% rename from libc/machine/arm/lib_trunc.c rename to libc/machine/armv8/arch_trunc.c index 55d0d1e6595..b482c0a1a31 100644 --- a/libc/machine/arm/lib_trunc.c +++ b/libc/machine/armv8/arch_trunc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_trunc.c + * libc/machine/armv8/arch_trunc.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. * diff --git a/libc/machine/arm/lib_truncf.c b/libc/machine/armv8/arch_truncf.c similarity index 98% rename from libc/machine/arm/lib_truncf.c rename to libc/machine/armv8/arch_truncf.c index 1e3362dc281..4f5246ced38 100644 --- a/libc/machine/arm/lib_truncf.c +++ b/libc/machine/armv8/arch_truncf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/machine/arm/lib_truncf.c + * libc/machine/armv8/arch_truncf.c * * Copyright (C) 2017 Gregory Nutt. All rights reserved. *