From 6c6720bb831b14c77d3eb8f5f7061e095df6ea47 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Wed, 15 Dec 2010 18:00:16 +0100 Subject: sh_fpu: Do not allow inclusion of fpu_control on not SH4 core Instead of emitting a warning even when compiling for SH4, stop compilation with an #error directive when not on SH4 core. Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/sh/fpu_control.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/sh/fpu_control.h b/libc/sysdeps/linux/sh/fpu_control.h index cbd889ece..da01725cb 100644 --- a/libc/sysdeps/linux/sh/fpu_control.h +++ b/libc/sysdeps/linux/sh/fpu_control.h @@ -20,7 +20,9 @@ #ifndef _FPU_CONTROL_H #define _FPU_CONTROL_H -#warning This file is only correct for sh4 +#ifndef __SH4__ +#error This file is only correct for sh4 +#endif /* masking of interrupts */ #define _FPU_MASK_VM 0x0800 /* Invalid operation */ -- cgit v1.2.3 From 6ac247452e646c2187f2f559143c8c087b0542e0 Mon Sep 17 00:00:00 2001 From: Christian Bruel Date: Fri, 17 Dec 2010 09:58:25 +0100 Subject: libm_sh: add optimised assembly implementation of lroundf and lrintf * libc/sysdeps/linux/sh/sysdep.h: Add LOCAL macro * libm/sh/sh4/Makefile.arch: Include asm source in the build * libm/sh/sh4/s_lrintf.S [NEW]: optimised asm lrintf * libm/sh/sh4/s_lroundf.S [NEW]: optimised asm lroundf Signed-off-by: Christian Bruel Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/sh/sysdep.h | 1 + libm/sh/sh4/Makefile.arch | 8 ++++--- libm/sh/sh4/s_lrintf.S | 52 ++++++++++++++++++++++++++++++++++++++++++ libm/sh/sh4/s_lroundf.S | 39 +++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 libm/sh/sh4/s_lrintf.S create mode 100644 libm/sh/sh4/s_lroundf.S (limited to 'libc') diff --git a/libc/sysdeps/linux/sh/sysdep.h b/libc/sysdeps/linux/sh/sysdep.h index 2ef0a3305..8b3c68220 100644 --- a/libc/sysdeps/linux/sh/sysdep.h +++ b/libc/sysdeps/linux/sh/sysdep.h @@ -26,6 +26,7 @@ /* Syntactic details of assembler. */ +#define LOCAL(X) .L_##X #define ALIGNARG(log2) log2 /* For ELF we need the `.type' directive to make shared libs work right. */ #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,@##typearg; diff --git a/libm/sh/sh4/Makefile.arch b/libm/sh/sh4/Makefile.arch index 122d84da2..e38e99c15 100644 --- a/libm/sh/sh4/Makefile.arch +++ b/libm/sh/sh4/Makefile.arch @@ -7,11 +7,13 @@ # ifeq ($(UCLIBC_HAS_FENV),y) -libm_ARCH_SRC:=$(wildcard $(libm_SUBARCH_DIR)/*.c) -libm_ARCH_OBJ:=$(patsubst $(libm_SUBARCH_DIR)/%.c,$(libm_SUBARCH_OUT)/%.o,$(libm_ARCH_SRC)) +libm_ARCH_CSRC:=$(wildcard $(libm_SUBARCH_DIR)/*.c) +libm_ARCH_COBJ:=$(patsubst $(libm_SUBARCH_DIR)/%.c,$(libm_SUBARCH_OUT)/%.o,$(libm_ARCH_SRC)) +libm_ARCH_SSRC:=$(wildcard $(libm_SUBARCH_DIR)/*.S) +libm_ARCH_SOBJ:=$(patsubst $(libm_SUBARCH_DIR)/%.S,$(libm_SUBARCH_OUT)/%.o,$(libm_ARCH_SSRC)) endif -libm_ARCH_OBJS:=$(libm_ARCH_OBJ) +libm_ARCH_OBJS:=$(libm_ARCH_COBJ) $(libm_ARCH_SOBJ) ifeq ($(DOPIC),y) libm-a-y+=$(libm_ARCH_OBJS:.o=.os) diff --git a/libm/sh/sh4/s_lrintf.S b/libm/sh/sh4/s_lrintf.S new file mode 100644 index 000000000..d8cec329c --- /dev/null +++ b/libm/sh/sh4/s_lrintf.S @@ -0,0 +1,52 @@ +/* Round argument to nearest integer value. SH4 version. + * According to ISO/IEC 9899:1999. This version doesn't handle range error. + * If arg is not finite or if the result cannot be represented into a long, + * return an unspecified value. No exception raised. + * + * Copyright (C) 2010 STMicroelectronics Ltd. + * + * Author: Christian Bruel + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +ENTRY(lrintf) + mov #0,r0 + sts fpscr,r3 + lds r0,fpscr + flds fr5,fpul + mov.l LOCAL(mask),r1 + sts fpul,r2 + and r2,r1 + mov.l LOCAL(midway),r2 + or r1,r2 + lds r2,fpul + fsts fpul,fr2 + fadd fr2,fr5 + ftrc fr5,fpul + sts fpul,r0 + float fpul,fr2 + fcmp/eq fr5,fr2 + bf/s 0f + mov #1,r2 + tst r1,r1 + and r0,r2 + movt r1 + shal r1 + tst r2,r2 + add #-1,r1 + bt 0f + sub r1,r0 +0: + rts + lds r3,fpscr + + .align 2 +LOCAL(mask): + .long 0x80000000 +LOCAL(midway): + .long 1056964608 + +END(lrintf) diff --git a/libm/sh/sh4/s_lroundf.S b/libm/sh/sh4/s_lroundf.S new file mode 100644 index 000000000..fda3a4b91 --- /dev/null +++ b/libm/sh/sh4/s_lroundf.S @@ -0,0 +1,39 @@ +/* Round argument toward 0. SH4 version. + * According to ISO/IEC 9899:1999. This version doesn't handle range error. + * If arg is not finite or if the result cannot be represented into a long, + * return an unspecified value. No exception raised. + * + * Copyright (C) 2010 STMicroelectronics Ltd. + * + * Author: Christian Bruel + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +ENTRY(lroundf) + mov #0,r0 + sts fpscr,r3 + lds r0,fpscr + flds fr5,fpul + mov.l LOCAL(mask),r1 + sts fpul,r2 + and r2,r1 + mov.l LOCAL(midway),r2 + or r1,r2 + lds r2,fpul + fsts fpul,fr2 + fadd fr2,fr5 + ftrc fr5,fpul + sts fpul,r0 + rts + lds r3,fpscr + + .align 2 +LOCAL(mask): + .long 0x80000000 +LOCAL(midway): + .long 1056964608 + +END(lroundf) -- cgit v1.2.3 From e6164d4b527865f4c81544ad18bfd634117d595b Mon Sep 17 00:00:00 2001 From: Konrad Eisele Date: Tue, 14 Dec 2010 13:49:17 +0100 Subject: sparc: check for log double support in gcc To compile the quad float emulation library gcc needs __LONG_DOUBLE_128__ macro defined. Check first, if not supported then revert to the qp_ops.c stubs Signed-off-by: Konrad Eisele Signed-off-by: Khem Raj --- libc/sysdeps/linux/sparc/Makefile.arch | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libc') diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch index 91c6e85e4..d0cae9ff8 100644 --- a/libc/sysdeps/linux/sparc/Makefile.arch +++ b/libc/sysdeps/linux/sparc/Makefile.arch @@ -16,9 +16,15 @@ CSRC += sigaction.c SSRC += fork.S vfork.S endif +# check weather __LONG_DOUBLE_128__ is defined (long double support) +UCLIBC_SPARC_HAS_LONG_DOUBLE=$(shell if [ "x`$(CC) -E -dM -xc /dev/null 2>&1 | grep __LONG_DOUBLE_128__`" != "x" ]; then echo "y"; fi) +ifeq ($(UCLIBC_SPARC_HAS_LONG_DOUBLE),y) CSRC += $(foreach f, \ q_div.c q_fle.c q_mul.c q_qtoll.c q_stoq.c \ mp_clz_tab.c q_dtoq.c q_flt.c q_neg.c q_qtos.c q_sub.c \ q_add.c q_feq.c q_fne.c q_qtod.c q_qtou.c q_ulltoq.c \ q_cmp.c q_fge.c q_itoq.c q_qtoull.c q_util.c \ q_cmpe.c q_fgt.c q_lltoq.c q_qtoi.c q_sqrt.c q_utoq.c, soft-fp/$(f)) +else +CSRC += qp_ops.c +endif -- cgit v1.2.3 From 4ac7ad3543dd6d7780e71af80fa5c45414451719 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 1 Jan 2011 22:59:00 -0800 Subject: libc/inet/netlinkaccess.h: Use the types from kernel Signed-off-by: Khem Raj --- libc/inet/netlinkaccess.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'libc') diff --git a/libc/inet/netlinkaccess.h b/libc/inet/netlinkaccess.h index 5111d3802..96ece392c 100644 --- a/libc/inet/netlinkaccess.h +++ b/libc/inet/netlinkaccess.h @@ -22,15 +22,8 @@ #include #include #include -#include - #if defined __ASSUME_NETLINK_SUPPORT || defined __UCLIBC_USE_NETLINK__ -#define _LINUX_TYPES_H -typedef uint8_t __u8; -typedef uint16_t __u16; -typedef uint32_t __u32; -typedef uint64_t __u64; -typedef int32_t __s32; +#include #include #include -- cgit v1.2.3