From 3352b62bebfd1e5c2e9961f481df968ab317d78d Mon Sep 17 00:00:00 2001 From: NetBSD project Date: Thu, 30 Jul 2015 09:50:51 +0000 Subject: StdLib/LibC: Add software floating point library from NetBSD Floating point processing is not supported on ARM for UEFI. In order to support UEFI applications in AppPkg we use this library to provide the required functionality. Changes as compared to the NetBSD version: - Formatting changes (tabs to spaces, DOS line endings etc). - Disable exceptions as described in the float_raise() function. - Disable definition of 'Symbolic Boolean literals' in milieu.h. Source originally from: NetBSD project - Source: http://cvsweb.netbsd.org/bsdweb.cgi/?only_with_tag=MAIN - Licensing and Copyright: http://www.netbsd.org/about/redistribution.html Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel Reviewed-by: Olivier Martin Reviewed-by: Daryl McDaniel git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18116 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c | 35 +++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c | 42 ++++++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c | 37 ++++++++++++++++++++++++++ StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c | 42 ++++++++++++++++++++++++++++++ 12 files changed, 452 insertions(+) create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c (limited to 'StdLib/LibC/Softfloat/Arm') diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c new file mode 100644 index 0000000000..8bde7a5489 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_dcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +int __aeabi_dcmpeq(float64, float64); + +int +__aeabi_dcmpeq(float64 a, float64 b) +{ + + return float64_eq(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c new file mode 100644 index 0000000000..c153feb6a8 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c @@ -0,0 +1,35 @@ +/* $NetBSD: __aeabi_dcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $ */ +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_dcmpge(float64, float64); + +int +__aeabi_dcmpge(float64 a, float64 b) +{ + + return !float64_lt(a, b) && float64_eq(a, a) && float64_eq(b, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c new file mode 100644 index 0000000000..5fb1606697 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_dcmpgt.c,v 1.2 2013/04/16 13:38:34 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmpgt.c,v 1.2 2013/04/16 13:38:34 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_dcmpgt(float64, float64); + +int +__aeabi_dcmpgt(float64 a, float64 b) +{ + + return !float64_le(a, b) && float64_eq(a, a) && float64_eq(b, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c new file mode 100644 index 0000000000..a8327c5e5b --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_dcmple.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmple.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_dcmple(float64, float64); + +int +__aeabi_dcmple(float64 a, float64 b) +{ + + return float64_le(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c new file mode 100644 index 0000000000..8d0e143cb4 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_dcmplt.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmplt.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_dcmplt(float64, float64); + +int +__aeabi_dcmplt(float64 a, float64 b) +{ + + return float64_lt(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c new file mode 100644 index 0000000000..fa91120a6c --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c @@ -0,0 +1,42 @@ +/* $NetBSD: __aeabi_dcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Richard Earnshaw, 2003. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_dcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_dcmpun(float64, float64); + +int +__aeabi_dcmpun(float64 a, float64 b) +{ + /* + * The comparison is unordered if either input is a NaN. + * Test for this by comparing each operand with itself. + * We must perform both comparisons to correctly check for + * signalling NaNs. + */ + return !float64_eq(a, a) || !float64_eq(b, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c new file mode 100644 index 0000000000..83db09e6a4 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_fcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmpeq.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +int __aeabi_fcmpeq(float32, float32); + +int +__aeabi_fcmpeq(float32 a, float32 b) +{ + + return float32_eq(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c new file mode 100644 index 0000000000..db59a98822 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_fcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmpge.c,v 1.2 2013/04/16 13:38:34 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_fcmpge(float32, float32); + +int +__aeabi_fcmpge(float32 a, float32 b) +{ + + return !float32_lt(a, b) && float32_eq(a, a) && float32_eq(b, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c new file mode 100644 index 0000000000..6d6dea6088 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_fcmpgt.c,v 1.2 2013/04/16 13:38:34 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmpgt.c,v 1.2 2013/04/16 13:38:34 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_fcmpgt(float32, float32); + +int +__aeabi_fcmpgt(float32 a, float32 b) +{ + + return !float32_le(a, b) && float32_eq(a, a) && float32_eq(b, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c new file mode 100644 index 0000000000..84c0355e2e --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_fcmple.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmple.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_fcmple(float32, float32); + +int +__aeabi_fcmple(float32 a, float32 b) +{ + + return float32_le(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c new file mode 100644 index 0000000000..a421e8ce21 --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c @@ -0,0 +1,37 @@ +/* $NetBSD: __aeabi_fcmplt.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Ben Harris, 2000. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmplt.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_fcmplt(float32, float32); + +int +__aeabi_fcmplt(float32 a, float32 b) +{ + + return float32_lt(a, b); +} diff --git a/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c new file mode 100644 index 0000000000..403afba17e --- /dev/null +++ b/StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c @@ -0,0 +1,42 @@ +/* $NetBSD: __aeabi_fcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */ + +/** @file +* +* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +/* + * Written by Richard Earnshaw, 2003. This file is in the Public Domain. + */ + +#include "softfloat-for-gcc.h" +#include "milieu.h" +#include "softfloat.h" + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __aeabi_fcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __aeabi_fcmpun(float32, float32); + +int +__aeabi_fcmpun(float32 a, float32 b) +{ + /* + * The comparison is unordered if either input is a NaN. + * Test for this by comparing each operand with itself. + * We must perform both comparisons to correctly check for + * signalling NaNs. + */ + return !float32_eq(a, a) || !float32_eq(b, b); +} -- cgit v1.2.3