From: Chung-Ju Wu Date: Wed, 25 Apr 2018 12:08:14 +0000 (+0000) Subject: [NDS32] Fix incorrect settings in sfp-machine.h and t-nds32-newlib for hard fp. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba169b74244d4c485f53841733dd82e7e48dc9bd;p=gcc.git [NDS32] Fix incorrect settings in sfp-machine.h and t-nds32-newlib for hard fp. libgcc/ * config/nds32/sfp-machine.h: Fix settings for NDS32_ABI_2FP_PLUS. * config/nds32/t-nds32-newlib (HOST_LIBGCC2_CFLAGS): Use -fwrapv. From-SVN: r259645 --- diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 8d413b5efb6..e5f44b346aa 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-25 Chung-Ju Wu + + * config/nds32/sfp-machine.h: Fix settings for NDS32_ABI_2FP_PLUS. + * config/nds32/t-nds32-newlib (HOST_LIBGCC2_CFLAGS): Use -fwrapv. + 2018-04-24 H.J. Lu * config/i386/linux-unwind.h: Add (__CET__ & 2) != 0 check diff --git a/libgcc/config/nds32/sfp-machine.h b/libgcc/config/nds32/sfp-machine.h index 499bdad7423..bfbdaf9c3bf 100644 --- a/libgcc/config/nds32/sfp-machine.h +++ b/libgcc/config/nds32/sfp-machine.h @@ -76,6 +76,25 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); R##_c = FP_CLS_NAN; \ } while (0) +#ifdef NDS32_ABI_2FP_PLUS +#define FP_RND_NEAREST 0x0 +#define FP_RND_PINF 0x1 +#define FP_RND_MINF 0x2 +#define FP_RND_ZERO 0x3 +#define FP_RND_MASK 0x3 + +#define _FP_DECL_EX \ + unsigned long int _fcsr __attribute__ ((unused)) = FP_RND_NEAREST + +#define FP_INIT_ROUNDMODE \ + do { \ + _fcsr = __builtin_nds32_fmfcsr (); \ + } while (0) + +#define FP_ROUNDMODE (_fcsr & FP_RND_MASK) + +#endif + /* Not checked. */ #define _FP_TININESS_AFTER_ROUNDING 0 diff --git a/libgcc/config/nds32/t-nds32-newlib b/libgcc/config/nds32/t-nds32-newlib index 1ea2bc32163..a59646fcff5 100644 --- a/libgcc/config/nds32/t-nds32-newlib +++ b/libgcc/config/nds32/t-nds32-newlib @@ -19,7 +19,7 @@ # . # Compiler flags to use when compiling 'libgcc2.c' -HOST_LIBGCC2_CFLAGS = -O2 +HOST_LIBGCC2_CFLAGS = -O2 -fwrapv #LIB1ASMSRC = nds32/lib1asmsrc-newlib.S