This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Support __FLT_EVAL_METHOD__ == 16 in math.h
- From: Kito Cheng <kito dot cheng at sifive dot com>
- To: newlib at sourceware dot org, kito dot cheng at gmail dot com
- Cc: Kito Cheng <kito dot cheng at sifive dot com>
- Date: Thu, 3 Oct 2019 14:22:38 +0800
- Subject: [PATCH] Support __FLT_EVAL_METHOD__ == 16 in math.h
- GCC will set __FLT_EVAL_METHOD__ to 16 if __fp16 supported, e.g.
cortex-a55/aarch64.
- $ aarch64-unknown-elf-gcc -v 2>&1 |grep version
gcc version 9.2.0 (GCC)
- $ aarch64-unknown-elf-gcc -E -dM -mcpu=cortex-a55 - < /dev/null |grep FLT_EVAL_METHOD
#define __FLT_EVAL_METHOD__ 16
#define __FLT_EVAL_METHOD_TS_18661_3__ 16
#define __FLT_EVAL_METHOD_C99__ 16
- The behavior of __FLT_EVAL_METHOD__ == 16 is same as
__FLT_EVAL_METHOD__ == 0 except for float16_t, but newlib didn't
support float16_t.
---
newlib/libc/include/math.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index 1efc5b92c..412ae318a 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -146,7 +146,7 @@ extern int isnan (double);
#define __TMP_FLT_EVAL_METHOD
#endif /* FLT_EVAL_METHOD */
#if defined FLT_EVAL_METHOD
- #if FLT_EVAL_METHOD == 0
+ #if (FLT_EVAL_METHOD == 0) || (FLT_EVAL_METHOD == 16)
typedef float float_t;
typedef double double_t;
#elif FLT_EVAL_METHOD == 1
--
2.17.1