diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2020-01-08 09:31:07 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2020-01-08 09:31:07 +0000 |
commit | f30dd607669212de135dec1f1d8a93b8954c327c (patch) | |
tree | 497248e433c158b74b956765c29800219a4f94e2 /gcc/config | |
parent | d5bc18085c8b0344e7b53febc3cd3cc681a98ea3 (diff) | |
download | gcc-f30dd607669212de135dec1f1d8a93b8954c327c.zip gcc-f30dd607669212de135dec1f1d8a93b8954c327c.tar.gz gcc-f30dd607669212de135dec1f1d8a93b8954c327c.tar.bz2 |
Implement 64-bit double functions.
gcc/
PR target/92055
* config.gcc (tm_defines) [target=avr]: Support --with-libf7,
--with-double-comparison.
* doc/install.texi: Document them.
* config/avr/avr-c.c (avr_cpu_cpp_builtins)
<WITH_LIBF7_LIBGCC, WITH_LIBF7_MATH, WITH_LIBF7_MATH_SYMBOLS>
<WITH_DOUBLE_COMPARISON>: New built-in defines.
* doc/invoke.texi (AVR Built-in Macros): Document them.
* config/avr/avr-protos.h (avr_float_lib_compare_returns_bool): New.
* config/avr/avr.c (avr_float_lib_compare_returns_bool): New function.
* config/avr/avr.h (FLOAT_LIB_COMPARE_RETURNS_BOOL): New macro.
libgcc/
PR target/92055
* config.host (tmake_file) [target=avr]: Add t-libf7,
t-libf7-math, t-libf7-math-symbols as specified by --with-libf7=.
* config/avr/t-avrlibc: Don't copy libgcc.a if there are modules
depending on sizeof (double) or sizeof (long double).
* config/avr/libf7: New folder.
libgcc/config/avr/libf7/
PR target/92055
* t-libf7: New file.
* t-libf7-math: New file.
* t-libf7-math-symbols: New file.
* libf7-common.mk: New file.
* libf7-asm-object.mk: New file.
* libf7-c-object.mk: New file.
* asm-defs.h: New file.
* libf7.h: New file.
* libf7.c: New file.
* libf7-asm.sx: New file.
* libf7-array.def: New file.
* libf7-const.def: New file.
* libf7-constdef.h: New file.
* f7renames.sh: New script.
* f7wraps.sh: New script.
* f7-renames.h: New generated file.
* f7-wraps.h: New generated file.
From-SVN: r279994
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/avr/avr-c.c | 32 | ||||
-rw-r--r-- | gcc/config/avr/avr-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 17 | ||||
-rw-r--r-- | gcc/config/avr/avr.h | 3 |
4 files changed, 53 insertions, 1 deletions
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c index 1b75186..35f3e7e 100644 --- a/gcc/config/avr/avr-c.c +++ b/gcc/config/avr/avr-c.c @@ -390,6 +390,20 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) cpp_define (pfile, "__WITH_AVRLIBC__"); #endif /* WITH_AVRLIBC */ + // From configure --with-libf7={|libgcc|math|math-symbols|yes|no} + +#ifdef WITH_LIBF7_LIBGCC + cpp_define (pfile, "__WITH_LIBF7_LIBGCC__"); +#endif /* WITH_LIBF7_LIBGCC */ + +#ifdef WITH_LIBF7_MATH + cpp_define (pfile, "__WITH_LIBF7_MATH__"); +#endif /* WITH_LIBF7_MATH */ + +#ifdef WITH_LIBF7_MATH_SYMBOLS + cpp_define (pfile, "__WITH_LIBF7_MATH_SYMBOLS__"); +#endif /* WITH_LIBF7_MATH_SYMBOLS */ + // From configure --with-double={|32|32,64|64,32|64} #ifdef HAVE_DOUBLE_MULTILIB @@ -438,7 +452,23 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) #error "align this with config.gcc" #endif - + // From configure --with-double-comparison={2|3} --with-libf7. + +#if defined (WITH_DOUBLE_COMPARISON) +#if WITH_DOUBLE_COMPARISON == 2 || WITH_DOUBLE_COMPARISON == 3 + /* The number of states a DFmode comparison libcall might take and + reflects what avr.c:FLOAT_LIB_COMPARE_RETURNS_BOOL returns for + DFmode. GCC's default is 3-state, but some libraries like LibF7 + implement true / false (2-state). */ + cpp_define_formatted (pfile, "__WITH_DOUBLE_COMPARISON__=%d", + WITH_DOUBLE_COMPARISON); +#else +#error "align this with config.gcc" +#endif +#else +#error "align this with config.gcc" +#endif + /* Define builtin macros so that the user can easily query whether non-generic address spaces (and which) are supported or not. This is only supported for C. For C++, a language extension is needed diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index d1e4dc5..16c894c 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -128,6 +128,8 @@ extern bool avr_xload_libgcc_p (machine_mode); extern rtx avr_eval_addr_attrib (rtx x); extern bool avr_casei_sequence_check_operands (rtx *xop); +extern bool avr_float_lib_compare_returns_bool (machine_mode, enum rtx_code); + static inline unsigned regmask (machine_mode mode, unsigned regno) { diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 5ed5b9d..61168ed 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -14575,6 +14575,23 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, return NULL_TREE; } + +/* Worker function for `FLOAT_LIB_COMPARE_RETURNS_BOOL'. */ + +bool +avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code) +{ + if (mode == DFmode) + { +#if WITH_DOUBLE_COMPARISON == 2 + return true; +#endif + } + + // This is the GCC default and also what AVR-LibC implements. + return false; +} + /* Initialize the GCC target structure. */ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 0900272..c723b8a 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -107,6 +107,9 @@ FIXME: DRIVER_SELF_SPECS has changed. #define BYTES_BIG_ENDIAN 0 #define WORDS_BIG_ENDIAN 0 +#define FLOAT_LIB_COMPARE_RETURNS_BOOL(mode, comparison) \ + avr_float_lib_compare_returns_bool (mode, comparison) + #ifdef IN_LIBGCC2 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */ #define UNITS_PER_WORD 4 |