xref: /minix3/lib/libc/arch/arm/softfloat/__aeabi_fcmpun.c (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /* $NetBSD: __aeabi_fcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $ */
2*84d9c625SLionel Sambuc 
3*84d9c625SLionel Sambuc /*
4*84d9c625SLionel Sambuc  * Written by Richard Earnshaw, 2003.  This file is in the Public Domain.
5*84d9c625SLionel Sambuc  */
6*84d9c625SLionel Sambuc 
7*84d9c625SLionel Sambuc #include "softfloat-for-gcc.h"
8*84d9c625SLionel Sambuc #include "milieu.h"
9*84d9c625SLionel Sambuc #include "softfloat.h"
10*84d9c625SLionel Sambuc 
11*84d9c625SLionel Sambuc #include <sys/cdefs.h>
12*84d9c625SLionel Sambuc #if defined(LIBC_SCCS) && !defined(lint)
13*84d9c625SLionel Sambuc __RCSID("$NetBSD: __aeabi_fcmpun.c,v 1.1 2013/04/16 10:37:39 matt Exp $");
14*84d9c625SLionel Sambuc #endif /* LIBC_SCCS and not lint */
15*84d9c625SLionel Sambuc 
16*84d9c625SLionel Sambuc int __aeabi_fcmpun(float32, float32);
17*84d9c625SLionel Sambuc 
18*84d9c625SLionel Sambuc int
__aeabi_fcmpun(float32 a,float32 b)19*84d9c625SLionel Sambuc __aeabi_fcmpun(float32 a, float32 b)
20*84d9c625SLionel Sambuc {
21*84d9c625SLionel Sambuc 	/*
22*84d9c625SLionel Sambuc 	 * The comparison is unordered if either input is a NaN.
23*84d9c625SLionel Sambuc 	 * Test for this by comparing each operand with itself.
24*84d9c625SLionel Sambuc 	 * We must perform both comparisons to correctly check for
25*84d9c625SLionel Sambuc 	 * signalling NaNs.
26*84d9c625SLionel Sambuc 	 */
27*84d9c625SLionel Sambuc 	return !float32_eq(a, a) || !float32_eq(b, b);
28*84d9c625SLionel Sambuc }
29